Skip to content

fix(antigravity): a long shell command keeps its start, not its last 8,000 characters - #40702

Merged
juliusmarminge merged 2 commits into
mainfrom
factory/issue-40695
Nov 22, 2026
Merged

juliusmarminge merged 2 commits into
mainfrom
factory/issue-40695

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

In an Antigravity thread, a shell command over 8,000 characters was saved and shown as its last 8,000 characters under "[Earlier output truncated]". That lost the program, flags and target (e.g. cat > notes.md <<'EOF') and called the command 'output'. Command lines are now cut from the end instead: they keep their start and end with a [Command truncated] marker. Command output still keeps its tail as before.

Fixes #40695

Reproduction on main

Commit c1fbdf6 (origin/main). Linux VM, T3CODE_DEV_SEED=0 vp run dev (fresh database), Antigravity provider set to sign-in method 'Gemini API key', runtime 1.5.14 (agy on PATH). Every hub model (gemini-3.8-flash, gemini-4-neon, gemini-4-hydrogen) failed with a 429 'Individual quota reached, resets in ~116h'. So GOOGLE_GEMINI_BASE_URL was pointed at a local stand-in for the Gemini streamGenerateContent API that answers with agy's own run_command function call (CommandLine = a 9,686-character cat > notes.md <<'EOF' + 140 lines + EOF). Real agy and the real T3 server handled everything else. Ran t3 thread start --provider antigravity --model gemini-4-neon --option runtimeMode=full-access <project> "Write a ~10 KB notes.md with one shell heredoc.". The turn completed, and agy wrote notes.md complete (140 lines, 9,660 bytes). T3's saved tool item holds the command as [Earlier output truncated]\n\n24: the quick brown fox… (8,028 chars), and cat > notes.md appears nowhere in the stored event. In the web client, the thread's work log row reads [Earlier output truncated] 24: the quick brown fox jumps over the lazy dog, notes entry. .... The failing test on factory/repro-40695 (AntigravityProtocol.test.ts, 'keeps the start of a long command line, where the program and target are') sends a heredoc CommandLine through parseSessionUpdateEvent + normalizeAntigravityToolCall. It fails on main (command does not start with the heredoc head); the other 44 tests pass.

Evidence

Real web clients on Linux, Chromium, light theme, 1280×800; fresh isolated databases. Real agy 1.5.14 used Gemini API-key mode with a local Gemini streaming API fixture returning the same 10,278-character heredoc command on both commits. Start the thread, wait for completion, then expand its work log and command. Both executions wrote identical complete files (140 lines, 10,252 bytes).

Before After
c1fbdf6cdb fa1c0659c2
Before: work-log row loses the program and target After: work-log row retains cat and notes.md
Before: expanded command starts with Earlier output truncated After: expanded command starts with the heredoc
Before: retained command tail reaches EOF After: shortened command ends with Command truncated

Gemini API fixture · Seed and CLI reproduction script · Runtime observations

Tests

  • vp test run src/provider/acp/AntigravityProtocol.test.ts (apps/server): 45 passed. With the fix reverted, the repro test and the updated Unicode test fail.
  • vp test run apps/server/src/provider/acp/: 8 files, 183 passed
  • vp run check:changed: format, lint, knip, typecheck (3 packages) and tests (2 files, 47) all pass
  • CI on fa1c065: all 8 required checks pass

Not in this change

  • packages/provider-acp (runtimeModel.ts) and packages/provider-core (McpProviderSessions.ts) have their own '[Earlier output truncated]' cuts for generic tool content; this change does not touch them.

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
  • Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5

Run by the t3code factory in T3 Code.

juliusmarminge and others added 2 commits November 22, 2026 06:02
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…8,000 characters

Command lines were bounded like output, keeping the tail under
'[Earlier output truncated]'. A command line's program and target are at
its start, so bound it from the head with a '[Command truncated]' marker.

Fixes #40695

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 21.5 KiB 21.5 KiB 0 B (0.0%) 24.4 KiB ✅
Codex Live turn messages 1 1 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅
Claude Live turn messages 1 1 0 (0.0%) 8 ✅

Other scenarios

All 64 scenario measurements match main.

All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling
Codex short turn resume WebSocket decoded 10.5 KiB 10.5 KiB 0 B (0.0%) 12.7 KiB ✅
Codex short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn running, cold open HTTP decoded 281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅
Codex long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Codex long turn running, history page HTTP decoded 92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB ✅
Codex long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Codex long turn finished, cold open HTTP decoded 381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, socket cold open WebSocket decoded 381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, work page HTTP decoded 186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB ✅
Codex long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Codex idle thread resume WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell snapshot HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Codex fleet shell subscribe WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Codex fleet shell resume check rows 0 0 0 0 ✅
Codex stale shell reload HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex stale shell reload rows 27 27 0 (0.0%) 27 ✅
Codex stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Codex stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex stale todo list cold open HTTP decoded 72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅
Codex stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Codex stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅
Claude short turn resume WebSocket decoded 10.6 KiB 10.6 KiB 0 B (0.0%) 12.7 KiB ✅
Claude short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn running, cold open HTTP decoded 283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅
Claude long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Claude long turn running, history page HTTP decoded 93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅
Claude long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Claude long turn finished, cold open HTTP decoded 384.2 KiB 384.2 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, socket cold open WebSocket decoded 384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, work page HTTP decoded 188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB ✅
Claude long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Claude idle thread resume WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell snapshot HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Claude fleet shell subscribe WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Claude fleet shell resume check rows 0 0 0 0 ✅
Claude stale shell reload HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude stale shell reload rows 27 27 0 (0.0%) 27 ✅
Claude stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Claude stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude stale todo list cold open HTTP decoded 73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅
Claude stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Claude stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅

Baseline: 122d3bf · PR result: fa1c065 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Antigravity command lines now retain their beginning when they exceed the text limit. The truncation uses a command-specific marker and avoids ending on an unmatched high surrogate. Other command-text fields keep their existing tail-truncation behavior.

Changes: Antigravity command-line truncation

Layer / File(s) Summary
Command-line truncation and validation
apps/server/src/provider/acp/AntigravityProtocol.ts, apps/server/src/provider/acp/AntigravityProtocol.test.ts
Command-line fields and normalized commands now retain their prefix and use [Command truncated] when shortened. Tests cover raw input, normalized commands, and Unicode boundaries. Other command-text fields retain tail truncation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: lucenx9

Merge Risk: Minimal · up to fa1c0

Long Antigravity shell commands now keep their beginning and program in the work log, with a command-specific truncation marker. Output truncation is unchanged. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a long Antigravity shell command now keeps its start instead of its last 8,000 characters. It follows the conventional commit format and matches the raw summary, objec…
Linked Issues check Passed [#40695] Requirement 1: a long Antigravity command keeps its start (program, flags, target). The diff adds boundCommandLine, which keeps the first TOOL_TEXT_LIMIT (8,000) characters. `normalizeAnt…
Out of Scope Changes check Passed The whole-PR diff against the merge base touches only apps/server/src/provider/acp/AntigravityProtocol.ts and its test file AntigravityProtocol.test.ts. All hunks serve #40695: the new command-lin…
Description check Passed The description covers the problem, the change, the linked issue, and detailed verification. It states the reproduction steps, the test commands with results, and before/after evidence. It also names …
Full details: Title check

Explanation

The title names the main change: a long Antigravity shell command now keeps its start instead of its last 8,000 characters. It follows the conventional commit format and matches the raw summary, objectives, and linked issue #40695. The title is 85 characters, slightly long but still readable.

Full details: Linked Issues check

Explanation

[#40695] Requirement 1: a long Antigravity command keeps its start (program, flags, target). The diff adds boundCommandLine, which keeps the first TOOL_TEXT_LIMIT (8,000) characters. normalizeAntigravityToolCall now uses it for command, so the command no longer starts with [Earlier output truncated]. Requirement 2: a cut command uses a command-specific marker. COMMAND_LINE_TRUNCATED = "\n\n[Command truncated]" is appended. Input fields CommandLine, command_line, commandLine and command route through boundCommandLine via COMMAND_LINE_FIELDS in sanitizeToolValue, so the raw input is head-cut with the same marker. Output fields keep tail truncation with [Earlier output truncated]. The new test 'keeps the start of a long command line' asserts the head is kept, the output marker is absent, and the raw CommandLine starts with the head. The updated Unicode test asserts the head-cut and that no unmatched high surrogate remains. The real-app before-and-after evidence in the PR description is not yet captured. It is not a coding requirement, so it does not affect this verdict.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base touches only apps/server/src/provider/acp/AntigravityProtocol.ts and its test file AntigravityProtocol.test.ts. All hunks serve #40695: the new command-line bounding helper, the field routing in sanitizeToolValue, the change to normalizeAntigravityToolCall, and the tests that cover them. The PR description states that packages/provider-acp and packages/provider-core are not changed, and the diff confirms this. No unrelated change was found.

Full details: Description check

Explanation

The description covers the problem, the change, the linked issue, and detailed verification. It states the reproduction steps, the test commands with results, and before/after evidence. It also names the excluded scope and the authors. The Problem, Change, and Scope sections follow the template. Verification includes focused test runs and states what was checked. Gaps are minor: the description does not explicitly say why a bug-fix-only scope applies beyond linking issue #40695, and the screenshot links are external and not verified here. These do not make the description incomplete.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 122d3bf and fa1c065.

Files selected for processing: 2

  • apps/server/src/provider/acp/AntigravityProtocol.test.ts
  • apps/server/src/provider/acp/AntigravityProtocol.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@juliusmarminge
juliusmarminge merged commit df67c4f into main Nov 22, 2026
39 checks passed
@juliusmarminge
juliusmarminge deleted the factory/issue-40695 branch November 22, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Antigravity: a shell command over 8,000 characters shows only its last 8,000, under "[Earlier output truncated]"

1 participant