Repository navigation
fix(sources): acquire real Antigravity conversations, fix directory gate - #3441
Conversation
Problem: forensic audit (polylogue-eo81) found the Antigravity origin inverted -- all 116 antigravity-session rows were 1-message metadata sidecar fragments, while the 44 real conversation trajectories (314MB of .pb protobuf files under conversations/) had zero raw rows. Root cause was two-fold: 1. The language-server export path (already built to convert .pb trajectories to markdown via the local Antigravity language server's ConvertTrajectoryToMarkdown RPC -- avoiding the need to reverse-engineer the protobuf schema) was gated on a `source.path / "sessions"` directory that has never existed on this machine; the real directory is `conversations/`, so the gate always short-circuited to a no-op. 2. Cascade discovery used SearchConversations, which only surfaces a small recently-tracked subset (10 of 44 real conversations, verified empirically) rather than every cascade with a .pb file still on disk. GetCascadeTrajectory/ConvertTrajectoryToMarkdown happily serve any cascade id whose .pb file exists regardless of whether the live index tracks it. Solution: - polylogue/sources/parsers/antigravity.py: ground cascade discovery in `conversations/*.pb` file listing (disk truth), enriching title/workspace/snippet metadata from search results when available. - polylogue/sources/source_parsing.py: fix the directory gate to `conversations/`; snapshot the raw .pb bytes into the blob store per exported session (mirrors hermes_state's sqlite snapshot pattern) so source.db holds real acquired bytes with a stable content hash for idempotent re-ingest. Add an explicit brain-metadata fallback walk for when the language server truly cannot be reached (no conversations/ dir, no binary, or a benign connection failure before any session was obtained) -- but NOT for a mid-export abort, which must surface loudly rather than being silently backfilled. - polylogue/archive/artifact_taxonomy/runtime.py: reclassify `*.md.metadata.json` as a non-session sidecar (AGENT_SIDECAR_META) in the generic per-file walk, so per-artifact brain metadata is no longer fragmented into noise sessions by default now that real conversations are acquired directly. `parse_brain_metadata` remains used explicitly by the new fallback walk. This fix is acquisition-side: the .pb bytes were never captured at all, so the operator's planned index rebuild (which only replays source.db) would not have recovered them without this change landing first. Also adds a regression fixture (tests/unit/sources/test_silent_ingest_loss.py) for the separately-audited Codex silent-parse-loss finding (polylogue-i415): verified against the live archive's actual raw bytes that the CURRENT Codex parser already produces the expected message counts for all 11 affected 2025-era rollouts (e.g. 1023 messages for the 3.3MB sample that showed message_count=0) -- that loss was a stale materialization from an older parser version, not a defect in the current parser, so no codex.py change is needed; the fixture guards the shape from silently regressing. Verification: - devtools test tests/unit/sources/test_antigravity_language_server.py tests/unit/sources/test_silent_ingest_loss.py tests/unit/sources/test_parsers_local_agent.py tests/unit/sources/parsers/test_antigravity.py tests/unit/sources/test_dispatch_payloads.py tests/unit/sources/parsers/test_origin_regression_pack.py -> 107 passed - devtools verify --quick -> exit 0 (format, lint, mypy --strict, render all --check) - Manually verified against the live archive at /realm/db/polylogue: language-server export produces real markdown (116530 chars) for a cascade id absent from SearchConversations' 10-item result but present as conversations/a6db7297-....pb; re-parsed all 17 message_count=0 codex-session rows against their exact archived raw bytes (verified by blob_size match), confirming 11 now parse correctly and 6 are genuinely near-empty stubs (<=5KB, <=4 records). Ref polylogue-eo81, polylogue-i415 Co-Authored-By: Claude <[email protected]>
|
Warning Review limit reached
Next review available in: 40 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Ref polylogue-eo81, polylogue-i415 Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c7a940348
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| resolved_blob_root = blob_store_root() | ||
| resolved_store = blob_store or BlobStore(resolved_blob_root) | ||
| blob_hash, blob_size = resolved_store.write_from_path(pb_path) |
There was a problem hiding this comment.
Preserve a replayable Antigravity raw payload
When raw capture is enabled, this stores the binary protobuf itself as the session's durable raw payload, but reset/reprocess later sends that blob through ingest_worker.build_raw_payload_envelope, which only has a binary special case for Hermes and otherwise decodes JSON/JSONL. A real Antigravity .pb therefore fails decoding, so rebuilding the rebuildable index from source.db cannot recreate these sessions. Persist a replayable language-server export envelope alongside the original artifact, or add a protobuf-aware Antigravity replay path.
AGENTS.md reference: AGENTS.md:L89-L94
Useful? React with 👍 / 👎.
…vity (#3479) ## Summary 44 real Antigravity conversations have never been acquired. The discovery logic to acquire them landed in #3441 and could never fire, because `Source.runtime_root` points at a directory that does not contain the data. ## Problem The archive holds **116 `antigravity-session` rows, all of them `*.md.metadata.json` sidecars** materialising as one-message sessions. Meanwhile `~/.gemini/antigravity/conversations/` holds **44 `.pb` files** — the actual conversations — totalling 345 MB, none of it acquired. The origin is inverted: metadata archived, conversations dropped. PR #3441 fixed the discovery path to ground on `conversations/*.pb` (`sources/source_parsing.py:73`). That fix is correct and has never executed, because: ``` Source.runtime_root = "~/.antigravity" ← 4 KB, one `extensions` dir, 0 .pb files actual data ~/.gemini/antigravity ← 345 MB, conversations/ with 44 .pb ``` Every acquired sidecar row's `source_path` already points under `~/.gemini/antigravity/brain/…`, so the correct root was observable in the archive's own data the whole time. ## Solution Corrects `runtime_root`, with the evidence recorded inline at the declaration. Also updates `tests/unit/core/test_sources.py`, which asserted the literal `"~/.antigravity"`. That test pinned the bug rather than a contract — the enclosing test is `test_runtime_root_present_for_local_session_sources`, whose intent is that local session sources *have* a root, not that antigravity's is any particular string. ## Verification ``` provider_to_source(ANTIGRAVITY).runtime_root → ~/.gemini/antigravity exists: True conversations/: True, 44 .pb files ``` `devtools test tests/unit/core/test_sources.py` → 28 passed. `devtools verify --quick` → exit 0. ## Note This unblocks acquisition but does not perform it — the 44 conversations remain unacquired until an import runs against the corrected root. A rebuild does not recover them; they were never in `source.db`. Ref polylogue-eo81. Co-authored-by: Claude Opus 5 <[email protected]>
…sions Problem Every antigravity-session row in the live archive (116/116, measured 2026-07-31) is a 1-message fragment materialized from a per-artifact ~/.gemini/antigravity/brain/<uuid>/*.md.metadata.json sidecar -- metadata, not conversation content. Real conversation content lives in conversations/*.pb trajectories; acquiring those was already fixed by PR #3441 (merged), which also stopped classifying future metadata sidecars as sessions. That fix is forward-only: the 116 already-materialized phantom sessions and their unclassified raw rows are untouched by it. This closes the retroactive half of polylogue-eo81/polylogue-msia (the two beads describe the same finding). Solution - polylogue/storage/antigravity_phantom_sweep.py: read-only scan_antigravity_phantom_sessions() joins sessions to session_tags on the existing degraded:brain-metadata-fragment auto-tag (written at ingest time by PR #1856) -- precise, already-present evidence, no new content classification needed. Cross-checks each candidate's raw_id against source.db's raw_sessions row when a source connection is given, and reports (rather than assumes) when that raw row is already missing. - polylogue/storage/artifacts/persistence.py: adds materialize_artifact_observations_for_raw_ids(), a scoped sibling of the existing materialize_artifact_observations() full census, so an actuator that already knows exactly which raw ids it touched doesn't have to pay for a 43k-row census just to classify a handful of rows. - devtools/antigravity_phantom_sweep_report.py: read-only report CLI. - devtools/antigravity_phantom_purge_apply.py: --apply-gated actuator. Dry-run by default; --apply calls ArchiveStore.delete_sessions() on the flagged session ids (the same primitive CLI delete / MCP write(operation='delete_session') already reach -- rebuild-safe, since PR #3441's ingest-side classifier already refuses *.md.metadata.json as session content) and materialize_artifact_observations_for_raw_ids() on their raw ids (persists an explicit AGENT_SIDECAR_META classification). - Registered both as `devtools workspace antigravity-phantom-sweep` / `antigravity-phantom-purge-apply`, mirroring the binary-artifact-sweep pattern from polylogue-hbtj2 (PR #3576). Real .pb conversation acquisition: out of scope here, already done. PR #3441 (merged 2026-07-31) already built acquisition for conversations/*.pb -- not a raw protobuf parser, but calling Antigravity's own local language-server RPC (ConvertTrajectoryToMarkdown) to export each cascade to markdown, verified against 44 real files on the live machine (2,162 real messages, blob sizes matching on-disk .pb sizes). No new protobuf-format work was needed or attempted in this change; the only remaining step is operational (sinnix redeploy + reingest), not code. Verification devtools test tests/unit/storage/test_antigravity_phantom_sweep.py -> 5 passed (real parse_brain_metadata/parse_markdown_export fixtures, real ArchiveStore.write_raw_and_parsed writer; dry-run leaves the session untouched; --apply deletes only the tagged phantom and leaves a co-located real antigravity session and its raw row alone) devtools test tests/unit/devtools/test_command_catalog.py \ tests/unit/devtools/test_render_devtools_reference.py \ tests/unit/devtools/test_devtools_main.py -> 17 passed devtools verify --quick -> exit_code 0 (ruff format/check, mypy --strict, render all --check, topology, layering, closure-matrix, schema/manifest/policy lab checks) Not run: devtools verify --all (no seeded testmon db in this worktree; --quick plus the two focused pytest runs above are the verification evidence for this PR, per repo convention for a worktree without a pre-seeded testmon cache). Ref polylogue-eo81, polylogue-msia Co-Authored-By: Claude <[email protected]>
…sions (#3581) ## Summary Retroactive half of the antigravity-inversion finding (polylogue-eo81 / polylogue-msia, the same finding described in two beads): adds a read-only sweep and an `--apply`-gated actuator that delete the 116 already-materialized brain-metadata phantom sessions in the live archive and persist an explicit non-session classification for their raw rows. ## Problem Every `antigravity-session` row in the live archive (116/116, measured 2026-07-31) is a 1-message fragment materialized from a per-artifact `~/.gemini/antigravity/brain/<uuid>/*.md.metadata.json` sidecar -- metadata, not conversation content. Real conversation content lives in `conversations/*.pb` trajectories. Acquiring those `.pb` conversations was already fixed by PR #3441 (merged 2026-07-31): it calls Antigravity's own local language-server RPC (`ConvertTrajectoryToMarkdown`) to export each cascade to markdown -- not a raw protobuf parser, since the language server already exposes trajectory content over RPC -- and verified against all 44 real files on this machine (2,162 real messages, blob sizes matching on-disk `.pb` sizes). That PR also stopped classifying *future* metadata sidecars as sessions (`AGENT_SIDECAR_META`). That fix is forward-only. The 116 already-materialized phantom sessions, and their still-unclassified raw rows in `source.db`, are untouched by it -- PR #3441's own notes call this out explicitly as deliberately out of scope, deferred to a follow-up. This PR is that follow-up. ## Solution - `polylogue/storage/antigravity_phantom_sweep.py`: read-only `scan_antigravity_phantom_sessions()`. Joins `sessions` to `session_tags` on the existing `degraded:brain-metadata-fragment` auto-tag (written at ingest time by PR #1856) -- precise, already-present evidence, no new content classification needed. Cross-checks each candidate's `raw_id` against `source.db`'s `raw_sessions` row when a source connection is given, and reports (rather than assumes) when that raw row is already missing. - `polylogue/storage/artifacts/persistence.py`: adds `materialize_artifact_observations_for_raw_ids()`, a scoped sibling of the existing `materialize_artifact_observations()` full census (from polylogue-hbtj2 / PR #3576), so an actuator that already knows exactly which raw ids it touched doesn't pay for a 43k-row census just to classify a handful of rows. (Also fixes a latent bug in the new function: the connection needs `row_factory = sqlite3.Row` set before `_row_to_raw_session` can read columns by name -- caught by this PR's own test.) - `devtools/antigravity_phantom_sweep_report.py`: read-only report CLI (text or `--json`). - `devtools/antigravity_phantom_purge_apply.py`: `--apply`-gated actuator. Dry-run by default; `--apply` calls `ArchiveStore.delete_sessions()` on the flagged session ids (the same primitive CLI `delete` / MCP `write(operation='delete_session')` already reach -- rebuild-safe, since PR #3441's ingest-side classifier already refuses `*.md.metadata.json` as session content and won't resurrect them on re-ingest) and `materialize_artifact_observations_for_raw_ids()` on their raw ids (persists an explicit `AGENT_SIDECAR_META` classification). - Registered both as `devtools workspace antigravity-phantom-sweep` / `antigravity-phantom-purge-apply`, mirroring the binary-artifact-sweep pattern from polylogue-hbtj2. ## Real `.pb` conversation acquisition: already done, not attempted here Item 2 of both beads' AC ("decide and, if tractable, implement real `.pb` conversation acquisition") was already resolved by PR #3441 before this session started. No protobuf reverse-engineering was needed: the fix routes through Antigravity's own local language-server export RPC rather than parsing the wire format directly. The only remaining step is operational (Sinnix redeploy of the daemon + a reingest pass to acquire the 44 real conversations), not code -- confirmed still pending as of this PR (`raw_sessions` has zero rows referencing `antigravity/conversations` in the live archive checked during this session). ## Verification ``` devtools test tests/unit/storage/test_antigravity_phantom_sweep.py -> 5 passed ``` Builds the phantom shape through the real production parser (`parse_brain_metadata`) and the real archive writer (`ArchiveStore.write_raw_and_parsed`), plus a co-located real antigravity session (`parse_markdown_export`, no degraded flag) to prove the sweep and purge never touch it. Confirms: dry-run mutates nothing; `--apply` deletes only the tagged phantom, leaves the real session and its raw row alone, and writes exactly one `raw_artifacts` row with `artifact_kind = AGENT_SIDECAR_META` for the purged raw id. ``` devtools test tests/unit/devtools/test_command_catalog.py tests/unit/devtools/test_render_devtools_reference.py tests/unit/devtools/test_devtools_main.py -> 17 passed ``` ``` devtools verify --quick -> exit_code 0 (ruff format/check, mypy --strict, render all --check, topology, layering, closure-matrix, schema/manifest/policy lab checks) ``` Not run: `devtools verify --all` (no seeded testmon db in this worktree). `--quick` plus the two focused pytest runs above are the verification evidence for this PR. Manual, read-only cross-check against the live archive (`/realm/db/polylogue`, no writes): confirmed the exact shape both beads describe -- 116 `antigravity-session` rows, all `message_count=1`, all tagged `degraded:brain-metadata-fragment`, all `raw_sessions.source_path` ending `.md.metadata.json`, zero existing `raw_artifacts` rows for any of them, and zero `raw_sessions` rows referencing `antigravity/conversations` (the redeploy+reingest for PR #3441's fix has not happened yet). This PR's actuator was not run against the live archive -- per instruction, only built and tested against fixtures. Ref polylogue-eo81, polylogue-msia
…ity brain metadata (#3614) ## Summary Closes the source-admission/classification cluster spanning three beads: Claude Code tool-result sidecar admission (polylogue-omsw), Antigravity brain-metadata sidecar admission (polylogue-3m3de), and dead-code removal of `parse_drive_payload` (polylogue-194qk). ## Problem **polylogue-omsw**: `sources/live/tool_result_sidecars.py` joins Claude Code `tool-results/<tool_use_id>.<ext>` overflow content back to its owning `tool_result` block by `tool_use_id` -- these files are never independent conversation content. Content-shape classification alone cannot refuse them: a tool call's own output can coincidentally reproduce a genuine session-document shape byte-for-byte. Verified live against this machine's real `~/.claude/projects` corpus (12,821 non-hook tool-results files, 411 valid-JSON among them): one `tool-results/*.txt` sidecar whose content was a real claude.ai export document (an earlier turn's tool call had fetched and dumped one) classified as `SESSION_DOCUMENT`/`parse_as_session=True` under the prior content-only rules. **polylogue-3m3de**: reported 232 growing `raw_sessions` rows for `origin=antigravity-session`, all `brain/<uuid>/*.md.metadata.json` sidecars, zero real `.pb` conversations acquired. Investigation (scanned `classify_artifact`/`classify_artifact_path` against this machine's real `~/.gemini/antigravity/brain` corpus, 940 files): 0 leaks. The existing `AGENT_SIDECAR_META` path rule (polylogue-eo81, #1024/#3441) and `schemas/sampling_db.py`'s `schema_eligible` exclusion already close both downstream harms the bead names (session materialization, schema-inference contamination). The growing raw-row count is `source.db`'s durable raw-tier retention by design, not an admission-scope bug. The real unaddressed gap -- `sources/live/watcher.py`'s antigravity `WatchSource` only watches `.metadata.json`, never `.pb` -- is acquisition/daemon wiring work, explicitly left open per this fix's scope. **polylogue-194qk**: `sources/dispatch.py:1777-1828`'s `parse_drive_payload` re-implements chunk detection/list recursion the lowering pipeline (`_lower_drive_like_payload` -> `_parse_lowered_spec`) already owns, with zero production callers -- only self-recursion, `__all__`, and a self-validating test pair that exercises the dead function against itself. ## Solution - Added `tool_result_sidecar` `OriginArtifactRule` (`parse_policy="raw-only"`) to the Claude Code `OriginSpec`, matching `tool-results/<name>` paths (excluding `hook-*`, which keeps its own correct `HOOK_EVENT` content classification) so `classify_artifact`/`classify_artifact_path` refuse session admission by path, before any content heuristic runs -- same shape as the existing `AGENT_SIDECAR_META`/`WORKFLOW_JOURNAL` rules. Added `ArtifactKind.TOOL_RESULT_SIDECAR`. `path_suffixes` scoped to `.json` only (not the `.txt`/`.html` also found live) because `artifact_suffixes_for_provider` feeds `live/watcher.py`'s acquisition suffix filter directly -- widening it would expand what gets *acquired* archive-wide, out of scope. - Acknowledged the classifier-fingerprint drift gate (`docs/plans/classifier-fingerprints.json`) as `acknowledged_safe`: tightens acceptance only, no reparse needed (existing contaminated rows are the already-planned polylogue-x1gd index rebuild's job). - Added regression test pinning antigravity brain-metadata classification (no code change needed there -- already correct). - Deleted `parse_drive_payload` and its self-validating tests/imports. ## Verification - `devtools test tests/unit/sources/test_artifact_taxonomy.py tests/unit/sources/test_origin_specs.py tests/unit/sources/test_source_laws.py tests/unit/sources/test_dispatch_payloads.py` -> 181 passed, 2 pre-existing failures unrelated to this change (confirmed via isolated diff-based comparison to origin/master: both fail identically before this branch's commits -- a `_detect_provider_from_raw_bytes` monkeypatch-target rename and an unrelated claude-ai zip-entry detection assertion). - `devtools lab policy classifier-fingerprints` -> "Classifier fingerprint policy intact." - `devtools render all --check` -> no "out of sync" surfaces. - `devtools verify --quick` -> exit 0 (format, lint, mypy --strict, render-all-check, schema-versioning, classifier-fingerprints, and other lab policy gates all green). - Ad hoc live-corpus scans (not committed) against this machine's real `~/.claude/projects` tool-results files (12,821) and `~/.gemini/antigravity/brain` files (940): 0 classification leaks post-fix. Cleanup of existing contaminated `raw_sessions` rows is explicitly out of scope for both beads (raw-authority path owns it, per this repo's durable-tier policy). Ref polylogue-omsw, polylogue-3m3de, polylogue-194qk
…ion (#3638) ## Summary The live daemon never acquired Antigravity's real conversation trajectories (`conversations/*.pb`) despite PR #3441 fixing the batch-importer's directory-gate bug. This closes the daemon-side acquisition gap with a new periodic reconciliation loop, plus two related bugs found while tracing the root cause. ## Problem Verified live 2026-08-03 (polylogue-3m3de): `raw_sessions` origin='antigravity-session' held 232 rows (grown from 116 before PR #3441 merged three days earlier), every one a `brain/*.md.metadata.json` sidecar fragment, and zero rows for `conversations/*.pb` -- the 44 real conversations (314MB) sitting permanently un-acquired by the running daemon. Root cause traced to `sources/live/watcher.py`: the live daemon's only acquisition model for local sources is the `WatchSource` file-watcher, and for antigravity it only matches `*.metadata.json` (`WatchSource(name="antigravity", root=antigravity_path(), suffixes=(".metadata.json",))`). `.pb` files are structurally invisible to it, and even if watched, the watcher's per-file streaming-JSON model has no hook to drive the local Antigravity language-server subprocess the `.pb` -> markdown conversion requires. #3441's fix only reached the batch importer (`pipeline/services/archive_ingest.py`), which the running daemon never calls -- only a one-shot `polylogue import` does. So the watcher kept admitting metadata-only fragments forever while the real conversations sat permanently un-acquired. Reproduced directly: running `antigravity.iter_language_server_exports` against the real `~/.gemini/antigravity` archive (44 real `.pb` files, 314MB) works correctly and yields real conversation content -- the acquisition *code* is sound, it is simply never invoked by the live daemon. Two more bugs surfaced while tracing this: 1. `pipeline/services/archive_ingest.py`'s multi-worker parse branch called `iter_antigravity_language_server_sessions(source)` without `capture_raw=True` (unlike the sequential branch), so every exported session's `raw_data` was `None` and raw provenance collapsed onto one non-unique source_path instead of each conversation's actual `.pb` file/bytes. 2. No way to export a bounded subset of cascades -- `iter_language_server_exports` always converted the whole corpus, which would make a periodic reconciliation loop re-run the language-server subprocess for already-acquired conversations on every tick. ## Solution - `sources/parsers/antigravity.py`: added `only_cascade_ids` filter to `iter_language_server_exports`, threaded through `source_parsing.iter_antigravity_language_server_sessions`. `None` (default) preserves existing behavior. - `pipeline/services/archive_ingest.py`: fixed the parallel-path `capture_raw` omission. - New `polylogue/daemon/antigravity_conversation_acquisition.py`: `periodic_antigravity_conversation_acquisition_check`, following the existing periodic-daemon-check shape (`embedding_backlog.py`, `blob_gc_periodic.py`). Runs on a 30-minute cadence via `daemon_write_coordinator`, diffs `conversations/*.pb` cascade ids against `raw_sessions` to find not-yet-acquired ones, and converts only those (bounded to 25/tick) via the new `only_cascade_ids` filter. Wired into `daemon/cli.py`'s `periodic_loops`. - `docs/plans/layering-surface-baseline.json`: added 7 entries for the new daemon module's direct substrate imports, matching the existing pattern for sibling periodic-check modules (`embedding_backlog.py`, `blob_gc_periodic.py`, `secret_scan_sweep.py` are baselined the same way -- there is no existing product-layer seam for "acquire raw provider bytes" and every sibling periodic check takes the same direct-substrate path). - `docs/plans/topology-target.yaml` regenerated for the new module. **Not in scope / deferred:** actually re-triggering full acquisition against the live production archive (this PR ships the mechanism; the daemon will pick up the 44 real conversations on its next reconciliation tick after deploy). Did not add a `.pb` suffix to the `WatchSource` itself -- the per-file streaming-JSON watcher model cannot drive a subprocess conversion, so a dedicated periodic loop is the correct shape, not a watcher suffix change. ## Verification - `devtools test tests/unit/sources/test_antigravity_language_server.py` -- 21 passed (includes 2 new tests for `only_cascade_ids`) - `devtools test tests/unit/pipeline/test_archive_ingest_shared_raw.py tests/unit/pipeline/test_archive_ingest_commit_batching.py tests/unit/sources/parsers/test_antigravity.py` -- 21 passed - `devtools test tests/unit/daemon/test_antigravity_conversation_acquisition.py` -- 4 passed (new file: acquisition, idempotent re-run, bounded batching) - `devtools verify --quick` -- `exit_code: 0` (format/lint/mypy/render-all/layering all ok) Ref polylogue-3m3de
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Fixes the acquisition half of the "Antigravity inversion" forensic finding
(polylogue-eo81): 314MB / 44 real Antigravity conversation trajectories
(
conversations/*.pb) were never acquired at all, while 116 per-artifactmetadata sidecars were ingested as noise sessions. Also adds a regression
fixture for the separately-audited Codex silent-parse-loss finding
(polylogue-i415), which investigation showed needs no parser fix.
Problem
A forensic audit of the live archive found every
antigravity-sessionrow(116/116) was a 1-message fragment from
brain/<uuid>/*.md.metadata.json—artifact metadata, not conversations — while
raw_sessions/raw_artifactsheld zero rows for
conversations/*.pb, the actual 314MB of realconversation content. Root cause, traced in
polylogue/sources/parsers/antigravity.pyand
polylogue/sources/source_parsing.py:.pbtrajectories to markdown via the local Antigravity language server's
ConvertTrajectoryToMarkdownRPC, so this code never has toreverse-engineer the protobuf schema) was gated on
source.path / "sessions"— a directory that has never existed on thismachine. The real directory is
conversations/, so the gate alwaysshort-circuited to a no-op and the export path never ran.
SearchConversations, which only surfaces a smallrecently-tracked subset — verified empirically at 10 of 44 real
conversations — rather than every cascade with a
.pbfile still ondisk.
GetCascadeTrajectory/ConvertTrajectoryToMarkdownhappily serveany cascade id whose
.pbfile exists, regardless of whether thelanguage server's live index currently tracks it.
This is an acquisition-side loss: the
.pbbytes were never captured atall, so the operator's planned index rebuild (which only replays
source.db) would not have recovered them without this fix landing first.Separately, the audit's Codex finding (polylogue-i415: 11 rollouts up to
3.3MB parsed to
message_count=0despite real content) turned out to bealready fixed in the current parser — see Verification below — so this PR
adds a regression fixture rather than a
codex.pychange.Solution
polylogue/sources/parsers/antigravity.py: ground cascade discovery inthe
conversations/*.pbfile listing (disk truth) instead of the searchRPC; enrich title/workspace/snippet metadata from search results when
available for a given cascade.
polylogue/sources/source_parsing.py: fix the directory gate toconversations/. Snapshot the raw.pbbytes into the blob store perexported session (mirrors
hermes_state's sqlite snapshot pattern) sosource.dbholds real acquired bytes with a stable content hash foridempotent re-ingest, not an ephemeral export that re-runs unconditionally
every pass. Add an explicit brain-metadata fallback walk
(
_iter_antigravity_brain_metadata_fallback) for when the language servertruly cannot be reached — no
conversations/dir, no binary, or a benignconnection failure before any session was obtained — but deliberately
not for a mid-export abort, which must surface loudly (existing
AntigravityPartialExportErrorsemantics) rather than being silentlybackfilled with degraded fragments.
polylogue/archive/artifact_taxonomy/runtime.py: reclassify*.md.metadata.jsonas a non-session sidecar (AGENT_SIDECAR_META) inthe generic per-file walk, so per-artifact brain metadata is no longer
fragmented into noise sessions by default now that real conversations are
acquired directly.
parse_brain_metadataremains directly usable and iswhat the new fallback walk calls.
tests/unit/sources/test_silent_ingest_loss.py: new regression fixture(
test_codex_dense_reasoning_and_tool_call_rollout_yields_messages) builtfrom real record shapes copied out of the affected rollout (prose
replaced with placeholders), locking in that a dense
response_item/reasoning/function_call/custom_tool_callstreamcontaining real
messagerecords must not silently parse to zero.Existing tests updated to match the corrected behavior:
test_antigravity_brain_artifact_metadata_parses_sibling_markdown(nowasserts the path-only classification is a non-session sidecar, while
parse_brain_metadataitself remains directly usable),test_antigravity_source_walk_prefers_language_server_exports(mkdirtarget renamed
sessions→conversations), plus the driver-level testsin
test_antigravity_language_server.py/test_silent_ingest_loss.pyupdated to provide the now-required
conversations/*.pbdisk-truth filesfor their fake-client scenarios.
Acquisition vs. parse classification
.pbconversations (this PR): acquisition loss. Byteswere never captured; a rebuild alone would not have helped. Fixed here.
The 11 affected rollouts' raw bytes already exist in
source.db(verifiedby
blob_size/live-file-size match). Re-parsing those exact archived rawbytes with the current
codex.py(unmodified by this PR) produces theexpected non-zero message counts — e.g. 1023 messages for the 3.3MB
sample that materialized as
message_count=0. The loss was a stalematerialization from an older parser version; the operator's planned
index rebuild will resolve it with no code change. This PR only adds the
regression fixture so that shape cannot silently regress again.
Verification
Manual verification directly against the live machine's real Antigravity
data and archived Codex raw bytes (read-only; no live-archive writes):
AntigravityLanguageServerClient.export_markdown()for cascadea6db7297-78ae-46d5-9956-d4c5a1fc0917— a.pbfile present on disk butabsent from
SearchConversations' 10-item result — and got back82,274 characters of real conversation markdown, confirming the
disk-truth discovery strategy recovers cascades the search index misses.
iter_source_sessions_with_raw, against thereal
Source(name="antigravity", path=~/.gemini/antigravity)withcapture_raw=Trueand a scratch blob store (not the live archive):produced all 44 sessions, all 44 with a raw blob snapshot (blob sizes
matching the real
.pbfile sizes on disk, e.g. 26,888,066 bytes for thelargest), 2,162 total real messages, zero brain-metadata fallback
fragments (correct — the language server served all 44).
codex-sessionrows withmessage_count=0in the livearchive (
/realm/db/polylogue) against their exact archived raw bytes(verified identical via
blob_size== live on-disk file size): 11 nowproduce real, non-trivial message counts (3 to 1073) with the current
parser; the remaining 6 are genuinely near-empty stubs (≤5KB, 1-4
records) — confirming the bead's own classification.
Not done in this PR (needs operator action)
The live
polylogued.serviceruns from a Nix-built package(
/nix/store/.../python3.14t-polylogue-0.3.0/), a separate deploymentartifact from this checkout — it does not pick up this fix until the
PR merges and Sinnix rebuilds/redeploys the service. I deliberately did
not attempt to acquire into the live archive: doing so today would
either (a) run against the old, still-buggy deployed code (no-op) or (b)
require writing to the archive outside the daemon's write path while the
daemon is live, which the mission explicitly said to avoid without
certainty of safety. Operator action needed: merge this PR, redeploy
polylogued(Sinnix rebuild), then either wait for the next scheduledAntigravity source catch-up or run
polylogue import ~/.gemini/antigravityagainst the redeployed daemon to acquire the 44 real conversations. I did
not run
polylogue check --cleanupor any destructive/reset command.Existing degraded fragment sessions (the 116
brain-metadata-fragmentrows) are left untouched by this PR — no deletion or reclassification of
already-materialized rows, only of future ingest behavior. A retroactive
cleanup/reclassification pass for those existing rows is separate,
deliberate, deletion-adjacent work and is intentionally out of scope here;
recommend tracking it as a follow-up against polylogue-eo81 if the operator
wants it done.
Ref polylogue-eo81, polylogue-i415
Co-Authored-By: Claude [email protected]