Skip to content

fix(antigravity): serve the transcript trace when a session has no .db - #236

Draft
VasiHemanth wants to merge 1 commit into
mainfrom
fix/antigravity-trace-guard
Draft

fix(antigravity): serve the transcript trace when a session has no .db#236
VasiHemanth wants to merge 1 commit into
mainfrom
fix/antigravity-trace-guard

Conversation

@VasiHemanth

Copy link
Copy Markdown
Owner

Follow-up to #229.

The problem

#229 taught _antigravity_cli_trace to fall back to brain/<sid>/.system_generated/logs/transcript*.jsonl when a session has no conversations/<sid>.db — newer agy builds no longer write one. That half works.

But get_session_detail only called it when the .db existed:

cli_db = ANTIGRAVITY_CLI_DIR / "conversations" / f"{session_id}.db"
if cli_db.exists():                       # <- fallback never runs without a .db
    cli_msgs = _antigravity_cli_trace(cli_db, session_id)

So the fallback never ran for exactly the sessions it was written for. All 29 sessions #229 restores have no .db; they dropped through to the brain-markdown branch, and 26 of them rendered nothing at all. The bug hwantage reported was still on screen after the merge.

This was my miss reviewing #229 — I validated _antigravity_cli_trace(db, sid) directly, which exercises a fallback the endpoint never reached.

The fix

_antigravity_cli_trace already does if db_path and db_path.exists() internally, so the outer guard was redundant as well as harmful. Drop it and let the function decide.

Measured

Over the 167 Antigravity brain sessions on this machine, through the running API:

sessions returning zero messages : 59   -> 35
total messages served            : 6724 -> 7814   (+1090)
kind=antigravity_cli             : 62   -> 91

Spot-check on two sessions that previously rendered nothing:

615e6853  kind=antigravity_brain  messages=1    ->  kind=antigravity_cli  messages=168
97fe56ed  kind=antigravity_brain  messages=2    ->  kind=antigravity_cli  messages=164

No session loses events. The guard only ever affected sessions without a .db, and those previously always fell through to brain markdown; the arithmetic closes exactly (6724 + 1090 = 7814).

The 35 still returning zero have neither a usable transcript nor a .db — pre-existing and out of scope here.

Test

test_session_detail_uses_transcript_trace_when_there_is_no_sqlite_db drives get_session_detail, not the parser, since the parser was never the broken half. It also plants a task.md so it pins the precedence (real trajectory beats synthesized markdown).

Against the prior code it fails with AssertionError: fell through to 'antigravity_brain'. With the fix, test_antigravity_cli.py is 13 passed. Full backend suite: 382 passed, same 23 pre-existing environment failures as main.

🤖 Generated with Claude Code

PR #229 taught _antigravity_cli_trace to fall back to
brain/<sid>/.system_generated/logs/transcript*.jsonl when a session has
no conversations/<sid>.db, which newer agy builds no longer write. The
parser half works, but get_session_detail only called it when the .db
existed, so the fallback never ran for the sessions it was written for.
Those sessions dropped through to the brain markdown branch instead.

_antigravity_cli_trace already does `if db_path and db_path.exists()`
internally, so the outer guard was redundant as well as harmful. Drop it
and let the function decide.

Measured over the 167 Antigravity brain sessions on this machine:

  sessions returning zero messages : 59 -> 35
  total messages served            : 6724 -> 7814  (+1090)
  kind=antigravity_cli             : 62 -> 91

No session loses events: the guard only ever affected sessions without a
.db, and those previously always fell through to brain markdown.

The regression test drives get_session_detail rather than the parser,
since the parser was never the broken half — it fails on the prior code
with "fell through to 'antigravity_brain'".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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