personal memory agent
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: persist stream name in sync history to prevent verification mismatches

The upload path saved files under a stream-derived directory but did not
record the stream name in the sync history. The query path re-derived
the stream independently, which could produce a different result when
_strip_hostname() behaved differently or the client sent a different
stream query param. This caused the April 9 circuit breaker outage.

Now the stream is persisted in the sync history record at upload time.
The query handler reads it from the record, falling back to derivation
for legacy records that lack the field.

Files changed:
- apps/observer/routes.py
- apps/observer/tests/test_routes.py

+5 -2
+4 -2
apps/observer/routes.py
··· 535 535 sync_record = { 536 536 "ts": now_ms(), 537 537 "segment": segment, 538 + "stream": stream, 538 539 "files": file_records, 539 540 } 540 541 if segment != original_segment: ··· 702 703 client_stream = request.args.get("stream", "").strip() 703 704 observer_name = observer.get("name", "unknown") 704 705 if client_stream and re.match(r"^[a-z0-9][a-z0-9._-]*$", client_stream): 705 - stream = client_stream 706 + fallback_stream = client_stream 706 707 else: 707 - stream = stream_name(observer=observer_name) 708 + fallback_stream = stream_name(observer=observer_name) 708 709 709 710 # Build response grouped by segment, deduplicating by sha256 710 711 # Later records overwrite earlier ones (most recent upload wins) ··· 719 720 continue 720 721 721 722 segment = record.get("segment", "") 723 + stream = record.get("stream", fallback_stream) 722 724 segment_original = record.get("segment_original") 723 725 724 726 if segment not in segments:
+1
apps/observer/tests/test_routes.py
··· 758 758 record = json.loads(f.readline()) 759 759 760 760 assert record["segment"] == "120000_300" 761 + assert record["stream"] == "history-test" 761 762 assert "segment_original" not in record # No collision 762 763 assert len(record["files"]) == 1 763 764