Skip to content

fix(sources): acquire Antigravity's real .pb conversations in the live daemon - #3638

Merged
Sinity merged 3 commits into
masterfrom
feature/sources/antigravity-daemon-conversation-acquisition
Aug 3, 2026
Merged

Sinity merged 3 commits into
masterfrom
feature/sources/antigravity-daemon-conversation-acquisition

Conversation

@Sinity

@Sinity Sinity commented Aug 3, 2026

Copy link
Copy Markdown
Owner

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

Sinity added 3 commits August 3, 2026 13:24
Problem
-------
polylogue-3m3de: the live daemon never acquires Antigravity's real
conversations/*.pb trajectories -- only a one-shot `polylogue import` run
does. A periodic daemon reconciliation loop needs to convert only cascades
not yet in raw_sessions on each tick, instead of paying the language-server
subprocess + markdown-conversion cost for the whole corpus every time.

Solution
--------
Add an `only_cascade_ids` filter to `antigravity.iter_language_server_exports`
and thread it through `source_parsing.iter_antigravity_language_server_sessions`.
`None` (default) preserves existing behavior (export everything); an empty
frozenset is a real no-op (no cascades exported, no fallback triggered since
the conversations/ directory still exists).

Verification
------------
devtools test tests/unit/sources/test_antigravity_language_server.py -- 21 passed
…t path

Problem
-------
polylogue-3m3de: `parse_sources_archive`'s multi-worker branch called
`iter_antigravity_language_server_sessions(source)` without `capture_raw=True`.
Every exported session's raw_data was therefore None, so
`_archive_raw_payload`/`_archive_raw_source_path` fell back to a JSON dump of
the parsed session and the shared source root path -- collapsing every
conversation's raw provenance onto one non-unique source_path instead of its
real `.pb` file and bytes. The sequential (workers<=1) path already passed
capture_raw=True via `iter_source_sessions_with_raw`; only the parallel
optimization added for Antigravity's sequential-subprocess carve-out missed it.

Solution
--------
Pass capture_raw=True, blob_root, and blob_store through on the parallel path
too, matching the sequential path's behavior.

Verification
------------
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
Problem
-------
polylogue-3m3de: verified live 2026-08-03, raw_sessions origin='antigravity-
session' held 232 rows (grown from 116 before PR #3441 merged), every one a
brain/*.md.metadata.json sidecar, and zero rows for conversations/*.pb -- the
44 real conversations (314MB) were still never acquired despite #3441 fixing
the batch importer's directory-gate bug.

Root cause: the live daemon's acquisition model is entirely the WatchSource
file-watcher (sources/live/watcher.py), which for antigravity only matches
`*.metadata.json` (`WatchSource(name="antigravity", ..., 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 by the daemon.

Solution
--------
New `polylogue/daemon/antigravity_conversation_acquisition.py`, following the
existing periodic-daemon-check shape (`embedding_backlog.py`,
`blob_gc_periodic.py`): `periodic_antigravity_conversation_acquisition_check`
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 per tick) via
`iter_antigravity_language_server_sessions(..., only_cascade_ids=...)`
(polylogue-3m3de.1, this PR's other commit). Wired into `daemon/cli.py`'s
periodic_loops alongside the other maintenance checks.

`polylogue/daemon` importing storage/pipeline/sources substrate directly is
an existing, accepted pattern for this class of periodic maintenance module
(`embedding_backlog.py`, `blob_gc_periodic.py`, `secret_scan_sweep.py` are
all already baselined the same way); added 7 new entries to
`docs/plans/layering-surface-baseline.json` for the new file rather than
routing through `insights`/`operations` -- 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
(`devtools render topology-projection`).

Verification
------------
devtools test tests/unit/daemon/test_antigravity_conversation_acquisition.py -- 4 passed
devtools verify --quick -- exit_code 0 (format/lint/mypy/render-all/layering all ok)
Ref polylogue-3m3de
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a0f89bc9-e12f-4767-a84c-d9dd68fbdb5a

📥 Commits

Reviewing files that changed from the base of the PR and between 859e36d and fee9487.

📒 Files selected for processing (9)
  • docs/plans/layering-surface-baseline.json
  • docs/plans/topology-target.yaml
  • polylogue/daemon/antigravity_conversation_acquisition.py
  • polylogue/daemon/cli.py
  • polylogue/pipeline/services/archive_ingest.py
  • polylogue/sources/parsers/antigravity.py
  • polylogue/sources/source_parsing.py
  • tests/unit/daemon/test_antigravity_conversation_acquisition.py
  • tests/unit/sources/test_antigravity_language_server.py

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity
Sinity merged commit 4612665 into master Aug 3, 2026
3 checks passed
@Sinity
Sinity deleted the feature/sources/antigravity-daemon-conversation-acquisition branch August 3, 2026 11:45
Sinity added a commit that referenced this pull request Aug 3, 2026
…ition PR

Synthetic antigravity fixtures wrote a flat root/*.md.metadata.json
layout and used Source(name='antigravity-test', ...) -- PR #3638's
iter_antigravity_language_server_sessions requires source.name to
resolve via Provider.from_string (must be exactly 'antigravity') and
its brain-metadata fallback requires root/brain/<subdir>/*.metadata.json,
matching the real ~/.gemini/antigravity layout. Neither matched, so
every synthetic antigravity fixture silently parsed to zero sessions.
Also updated a stale test double missing the new only_cascade_ids kwarg.

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant