Skip to content

feat(antigravity): populate checkpoint prompt field via condensation-time transcript decoding#1381

Open
peyton-alt wants to merge 8 commits into
feat/antigravity-agentfrom
feat/antigravity-transcript-decode
Open

feat(antigravity): populate checkpoint prompt field via condensation-time transcript decoding#1381
peyton-alt wants to merge 8 commits into
feat/antigravity-agentfrom
feat/antigravity-transcript-decode

Conversation

@peyton-alt
Copy link
Copy Markdown
Contributor

@peyton-alt peyton-alt commented Jun 5, 2026

https://entire.io/gh/entireio/cli/trails/531

Summary

Fills the previously-empty committed checkpoint "prompt" field for the Antigravity (agy) agent.

Root cause: agy writes its transcript file after its Stop hook returns, so the framework's TurnEnd prompt backfill (lifecycle.go) sees an empty transcript and prompt.txt stays empty. Condensation (git commit) re-reads the now-populated live transcript but only read prompts from prompt.txt — it never re-extracted from the transcript. So agy checkpoints landed with an empty prompt.

What changed

  • agent/antigravity/transcript.go — implement PromptExtractor.ExtractPrompts (parse USER_INPUT steps, strip the <USER_REQUEST> wrapper) and TranscriptAnalyzer (GetTranscriptPosition + ExtractModifiedFilesFromOffset, reusing the existing decodeAgyString/resolveAgySymlinks helpers). Mirrors the codex template; one shared agyStep schema, one offset convention.
  • strategy/manual_commit_condensation.go — a general resolvePromptsFromLateFlushedTranscript fallback called from both prompt-resolution sites (extractSessionData, extractSessionDataFromLiveTranscript) when prompts are empty, re-extracting from the populated live transcript at condensation. General to any PromptExtractor; a safe no-op for agents that already capture prompts at TurnStart (guarded by len(data.Prompts) == 0).

Notable

  • Behavior note: implementing TranscriptAnalyzer also opts agy into transcript-based modified-file extraction + mid-turn detection (hasNewTranscriptWork), which previously short-circuited. It degrades gracefully (empty transcript → position 0 → no spurious work), and transcript-derived paths match parsePreToolUse (absolute, symlink-resolved) so they dedupe cleanly with the hook-derived set.
  • Out of scope: token counting (handled by the OutOfBandTokenSource title-tee, feat(antigravity): native token counts via title-slot tee #1356). No UI changes — the merged entire.io AntigravityParser already renders prompts from the transcript.
  • Attribution was investigated and is already correctinitial_attribution.agent_lines reflects agent work (verified 3 lines / 100% on a real agy checkpoint). The prompt_attributions[].agent_lines_added diagnostic is 0 at checkpoint 1 by design (a base→last-checkpoint snapshot with no prior checkpoint); it is not the result field. No attribution code changed.
  • Minor follow-up: the mutating-tool-name list (write_to_file/replace_file_content/multi_replace_file_content) is duplicated between transcript.go and lifecycle.go:parsePreToolUse — could be unified into one shared set.

Test plan

  • mise run check green — gofmt, golangci-lint (0 issues), test:ci (unit + integration + Vogon canary, -race)
  • Verified end-to-end against real agy 1.0.5: the committed prompt.txt on entire/checkpoints/v1 equals the user's prompt (empty before this fix)
  • Integration test TestAntigravity_PromptInCheckpointMetadata with a verified negative control (empty-transcript-through-commit → test fails), proving the condensation-time path is load-bearing
  • Offset off-by-one and absolute-path convention each pinned by a focused test

🤖 Generated with Claude Code


Note

Medium Risk
Touches commit-time condensation and checkpoint metadata for all agents that use the empty-prompt fallback, but the path is guarded and only runs when prompts are missing; Antigravity also gains transcript-based file tracking, which could affect mid-turn detection.

Overview
Antigravity checkpoints no longer ship with an empty prompt when the agent flushes its JSONL transcript after Stop (TurnEnd backfill saw an empty file). The Antigravity agent now implements PromptExtractor and TranscriptAnalyzer: user text from USER_INPUT steps (stripping <USER_REQUEST>), non-blank line offsets, and deduped paths from mutating tool calls via existing decodeAgyString / resolveAgySymlinks.

Manual-commit condensation adds resolvePromptsFromLateFlushedTranscript, invoked from both shadow-branch and live-transcript extraction when prompt.txt is still empty—only for agents that implement PromptExtractor, so other agents are unchanged.

Coverage includes unit tests for extraction/offsets/paths, a strategy test for the fallback helper, and integration TestAntigravity_PromptInCheckpointMetadata (empty transcript through Stop, late populate, then commit asserts prompt.txt).

Reviewed by Cursor Bugbot for commit a530791. Configure here.

peyton-alt and others added 8 commits June 4, 2026 19:49
…T steps

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… fixture

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tion is implemented

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…on for late-flush agents

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…file extraction)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@peyton-alt peyton-alt requested a review from a team as a code owner June 5, 2026 20:18
Copilot AI review requested due to automatic review settings June 5, 2026 20:18
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a530791. Configure here.

count++
}
}
return count, nil
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transcript offset counting mismatch

Medium Severity

Antigravity’s GetTranscriptPosition, ExtractPrompts, and ExtractModifiedFilesFromOffset advance offsets using non-blank JSONL lines, but after condensation CheckpointTranscriptStart is set from countTranscriptItems, which counts physical newline-separated lines (only trailing empties trimmed). Comparing those values in hasNewTranscriptWork and passing checkpointTranscriptStart into the new late-flush prompt path can miss new transcript work or scope prompts/files incorrectly when blank lines appear.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a530791. Configure here.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Antigravity (agy) checkpoints being committed with an empty prompt by re-extracting prompts from the live transcript at condensation time (for agents that implement PromptExtractor). It also implements Antigravity’s prompt extraction and transcript analysis so agy can participate in transcript-based prompt recovery and modified-file extraction.

Changes:

  • Add a condensation-time fallback to re-extract prompts from a late-flushed live transcript when prompt.txt is still empty.
  • Implement PromptExtractor + TranscriptAnalyzer for Antigravity JSONL transcripts (USER_INPUT prompt parsing and mutating tool file detection).
  • Add unit + integration coverage proving the late-flush prompt recovery end-to-end.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cmd/entire/cli/strategy/manual_commit_condensation.go Adds a guarded condensation-time fallback to recover prompts from a populated live transcript when existing prompt sources are empty.
cmd/entire/cli/strategy/late_flush_prompt_test.go Unit tests for the new condensation-time prompt recovery helper and its guard behavior.
cmd/entire/cli/integration_test/antigravity_test.go End-to-end integration test reproducing agy’s late transcript flush and asserting committed prompt.txt is recovered at commit time.
cmd/entire/cli/agent/antigravity/transcript.go Implements Antigravity PromptExtractor and TranscriptAnalyzer (offsets, prompt extraction, modified-file extraction).
cmd/entire/cli/agent/antigravity/transcript_test.go Adds focused tests for prompt extraction, offset semantics, transcript position counting, and modified-file path conventions/deduping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants