Repository navigation
feat(storage): sweep and purge antigravity brain-metadata phantom sessions - #3581
Conversation
|
Warning Review limit reached
Next review available in: 29 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 (8)
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 |
…ge PR polylogue-eo81 and polylogue-msia described the same finding (antigravity origin holding only brain-metadata phantom sessions). msia carries the more precise measurements and the consolidated resolution notes for PR #3581, which builds the retroactive purge/reclassify tooling both beads' AC asked for. eo81 closed as duplicate; msia stays open pending operator redeploy + reingest + --apply. Co-Authored-By: Claude <[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]>
28f0184 to
8ea0fa5
Compare
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-sessionrow 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.jsonsidecar -- metadata, not conversation content. Real conversation content lives inconversations/*.pbtrajectories.Acquiring those
.pbconversations 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.pbsizes). 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-onlyscan_antigravity_phantom_sessions(). Joinssessionstosession_tagson the existingdegraded:brain-metadata-fragmentauto-tag (written at ingest time by PR fix(antigravity): flag fragmented brain-metadata sessions degraded #1856) -- precise, already-present evidence, no new content classification needed. Cross-checks each candidate'sraw_idagainstsource.db'sraw_sessionsrow when a source connection is given, and reports (rather than assumes) when that raw row is already missing.polylogue/storage/artifacts/persistence.py: addsmaterialize_artifact_observations_for_raw_ids(), a scoped sibling of the existingmaterialize_artifact_observations()full census (from polylogue-hbtj2 / PR fix(sources): refuse to session-parse unrecognized SQLite databases #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 needsrow_factory = sqlite3.Rowset before_row_to_raw_sessioncan 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;--applycallsArchiveStore.delete_sessions()on the flagged session ids (the same primitive CLIdelete/ MCPwrite(operation='delete_session')already reach -- rebuild-safe, since PR fix(sources): acquire real Antigravity conversations, fix directory gate #3441's ingest-side classifier already refuses*.md.metadata.jsonas session content and won't resurrect them on re-ingest) andmaterialize_artifact_observations_for_raw_ids()on their raw ids (persists an explicitAGENT_SIDECAR_METAclassification).devtools workspace antigravity-phantom-sweep/antigravity-phantom-purge-apply, mirroring the binary-artifact-sweep pattern from polylogue-hbtj2.Real
.pbconversation acquisition: already done, not attempted hereItem 2 of both beads' AC ("decide and, if tractable, implement real
.pbconversation 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_sessionshas zero rows referencingantigravity/conversationsin the live archive checked during this session).Verification
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;--applydeletes only the tagged phantom, leaves the real session and its raw row alone, and writes exactly oneraw_artifactsrow withartifact_kind = AGENT_SIDECAR_METAfor the purged raw id.Not run:
devtools verify --all(no seeded testmon db in this worktree).--quickplus 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 -- 116antigravity-sessionrows, allmessage_count=1, all taggeddegraded:brain-metadata-fragment, allraw_sessions.source_pathending.md.metadata.json, zero existingraw_artifactsrows for any of them, and zeroraw_sessionsrows referencingantigravity/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