Repository navigation
feat(agent): unify Code Mode output budgeting, tail previews, and in-cell Read paging - #7125
Merged
Merged
Conversation
…cell Read paging Implements the Code Mode output budgeting, tail preview, in-cell workspace Read paging, and wait tuning design discussed in #7108: - Collapse inner Cell clip() into a single outer archive budget frozen per return (default 10,000 tokens / 40,000 UTF-16 chars, max 20,000 tokens / 80,000 chars, honoring small/zero budgets via PageBudget::DisplayBody and top-level cellStatus without leaking optional body text). - Add single-pass O(1) TailRing trailing preview with exact JSON-escaped UTF-16 accounting across pure-text, mixed text+media (preserving media order with one shared event locator), and asynchronous Cell notifications / RecoveredCell reports (shared 40,000-char JSON-cost budget). - Preserve incremental prior_output on synchronous exec/wait interruptions without duplicating previously yielded output. - Enforce a whole-Cell-lifetime 16 MiB Host output cap (accounting for per-item slot overhead without double-charging transferred external notifications). - Expand ordinary in-Cell workspace text Read pages (including continuations) to 65,536 UTF-16 units while keeping direct Read and archive/attachment/ session reads at 7,500. - Raise wait default yield_time_ms from 10s to 30s and clarify exec pragma guidance. Refs #7108 Generated-by: Google Antigravity
8 tasks done
M4n5ter
added a commit
that referenced
this pull request
Nov 21, 2026
…re (#7135) #7125 unified Code Mode output budgeting so external exec calls honor display_budget_chars (default 10,000 tokens / 40,000 UTF-16 chars) instead of always archiving at 7,500 chars. Because readArchivedResult() in external_codex_cli.mjs emitted 30,000 chars without setting max_output_tokens, exec returned inline output, JSON.parse threw a SyntaxError, and the worker exited without replying to session/prompt, causing antigravity_can_continue_after_host_restarts_during_a_prompt to hang until the 45s follow-up deadline. Set max_output_tokens: 1000 with a 12,000-char payload so archive continuation is exercised deterministically regardless of default budget changes, surface non-JSON archive replies clearly, and fail pending ACP session/prompt requests immediately when the fixture aborts. Refs #7125 Generated-by: Maka (Gemini)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the unified Code Mode output budgeting, trailing preview, in-Cell workspace
Readpaging, andwaitdefault timeout design finalized in #7108:clip()inplugins/agent/tools/src/cell/session.rsand froze the per-call display budget (effective_cell_display_chars: default 10,000 tokens / 40,000 UTF-16 chars, capped at 20,000 tokens / 80,000 chars, no lower clamp) ontoToolSuccess,ReturnedToolResult, andExternalReturn::Output.ArchivedPlaceholder) and mixed text+media (DurableToolProjection::Content) archiving across native replay, external-effect first delivery and redelivery, and imported replay under onedisplay_budget_chars: usizemodel (MAX_PAGE_CHARS= 7,500 for ordinary tools; frozen Cell budget forexec/wait).PageBudget::DisplayBodyand single-passcellStatusprefix capture so small or zero budgets (max_output_tokens: 0/max_tokens: 0) never leak optional body text or fall back to full text, while still delivering mandatorycellStatus,resourceRef, andpage.next(at=0).TailRingtrailing preview & unified 40K async/recovery budget:tailPreview(up tomin(2,000, budget / 4)UTF-16 JSON-escaped units whenbudget >= 1,600) across pure-text and mixed text+media archives, preserving media order with one sharedarchive:<event-id>notice.prior_outputon synchronousexec/waitinterruptions without duplicating already-yielded output.RecoveredCellreports under a single shared 40,000-char JSON-escaped display budget (CellReportBody+bound_json_field_text) while preserving media parts in order.CellContext(MAX_CELL_OUTPUT_BYTES = 16 MiB) to accumulate across the full Cell lifetime rather than resetting ontake_output()/take_notifications(), accounting for per-item slot overhead and avoiding double-charging transferred external notifications.Readpaging &waitdefaults:Readpages (including continuation pages) to65,536UTF-16 units (CELL_READ_PAGE_CHARS), keeping direct modelReadandarchive:/attachment:/sessionreads at7,500.waitdefaultyield_time_msfrom10_000to30_000and placedyield_time_msguidance on the line following the// @exec:/# @exec:pragma example so copied pragma lines parse cleanly.Storage / Migration note
No database migration script is required: newly added fields (
display_budget_chars,cell_status,tail_preview) use#[serde(default, skip_serializing_if = "Option::is_none")], andStoredToolResult::Inline(Box<ReturnedToolResult>)is#[serde(untagged)](wire-identical). Existing SQLite rows deserialize cleanly and apply the unified default budget (7,500chars).Refs #7108
Verification
cargo fmt --check— passgit diff origin/rust-preview --check— passcargo clippy --tests -p maka-code-runtime -p maka-js-runtime -p maka-python-runtime -p maka-agent-facts -p maka-agent-state -p maka-tools -p maka-agent-engine -p maka-session-import -p maka-files-native -p maka-agent-native -- -D warnings— pass (0 warnings)cargo test -p maka-code-runtime -p maka-agent-facts -p maka-agent-state -p maka-tools -p maka-agent-engine -p maka-session-import -p maka-files-native— passcargo test -p maka-agent-native --lib code_mode_budget— pass (real V8 Host end-to-end acceptance covering budget tiers,tailPreview, mixed text+media order, zero-budget strict bounding, synchronous interruption incremental archive, in-Cell 65,536 workspaceRead+ continuations, native/external/imported parity, and async/recovery 40K JSON-escaped bounding)cargo test -p maka-agent-native --lib compaction_cancels_background_request_when_main_finishes— passcargo test -p maka-schema— passmaka-cli/ desktop UI builds (nonode_modulesinstalled in the isolated worktree; verified via GitHub Actions CI).AI use
Select exactly one:
Tool(s) and scope: Google Antigravity authored the implementation, tests, and PR; Maka (
codex/gpt-6.2-astra) performed multi-round design and code review.Checklist
Does this PR entail a change in behavior?