Skip to content

agy-cli 0.1.114: raise replay prompt budget on agy >= 1.5.14 and add opt-in history seeding - #1463

Open
deephbz wants to merge 1 commit into
magpie-community:mainfrom
deephbz:feat/agy-replay-budget-and-seed
Open

deephbz wants to merge 1 commit into
magpie-community:mainfrom
deephbz:feat/agy-replay-budget-and-seed

Conversation

@deephbz

@deephbz deephbz commented Nov 22, 2026

Copy link
Copy Markdown

Problem

maxInitialPromptBytes() caps every cold-start replay at 112 KiB (114,688 bytes) to stay under older agy's 128 KiB tail truncation on session/prompt.

When a client compacts its context into a 120–160 KiB opening prompt, or replays a long history after a prefix fork or pool eviction, the bridge silently middle-truncates the prompt or omits earlier turns even on agy 1.5.14, which accepts larger prompts without clipping.

Evidence

Direct ACP probes against agy 1.5.14 showed two behaviors:

  1. session/prompt delivers a 192,000-byte payload verbatim to the model (head, middle, and tail markers intact; zero bytes omitted).
  2. session/resume without _meta.antigravity.systemPrompt.append keeps the systemPrompt.append attached at session/new.

Live end-to-end checks with gemini-3.8-flash on agy 1.5.14:

Case Payload bytes Mode Turn 1 input tokens Turn 2 cache-read tokens Markers intact
Compaction opening prompt 149,481 Default (184000 B) 37,023 — All 3 (0 bytes omitted)
Overflowing opening prompt 228,830 AGY_BRIDGE_HISTORY_SEED=1 41,962 39,940 Both head and tail

Change

  1. Version-gated default prompt budget. maxInitialPromptBytes(agentVersion) keeps 114688 bytes for agy < 1.5.14 (and unknown versions) and raises the default to 184000 bytes for agy >= 1.5.14 (LARGE_PROMPT_AGY_VERSION). AGY_BRIDGE_MAX_PROMPT_BYTES still overrides the default. When the budget exceeds 112 KiB, the omission notice uses a generic message instead of citing 112 KiB.
  2. Opt-in history seeding (AGY_BRIDGE_HISTORY_SEED=1, default off). When a cold replay still overflows maxInitialPromptBytes, planHistorySeed moves overflowing earlier history turns (or leading user messages in a multi-user opening turn) into a cloaked (outgoing()) _meta.antigravity.systemPrompt.append block on session/new, capped by AGY_BRIDGE_HISTORY_SEED_MAX_BYTES (default 512 KiB). Proc and parked session records persist hasHistorySeed, and session/resume omits _meta when hasHistorySeed is set so agy keeps the seeded context. The option defaults to off because Antigravity can return 429 for some systemPrompt.append payloads.
  3. Observability and docs. Replay events add seed_messages and seed_bytes. README.md and README.en.md document the version-gated default and the new env vars. package.json bumps 0.1.113 to 0.1.114.

Tests

  • New suite packages/agy-cli/test/replay-budget.mjs (registered in packages/agy-cli/agy-cli.test.mjs) checks:
    • agy 1.5.0 keeps the 112 KiB budget and clips a 150 KiB prompt;
    • agy 1.5.14 raises the default budget to 184000 bytes and sends a 150 KiB prompt verbatim;
    • AGY_BRIDGE_HISTORY_SEED=1 seeds overflowing history and overflowing multi-user opening turns into cloaked session/new _meta.antigravity.systemPrompt.append, enforces AGY_BRIDGE_HISTORY_SEED_MAX_BYTES, reports seed_messages/seed_bytes, and omits _meta on session/resume so the seeded context survives resume.
  • bun scripts/check.mjs agy-cli passes (registry.json and agy-cli).
  • bun scripts/bumped.mjs upstream/main passes.
  • bun test packages/agy-cli/agy-cli.test.mjs passes (26 pass, 0 fail).
  • Live checks against agy 1.5.14 (gemini-3.8-flash) passed for both the 149 KiB default-budget prompt and the 229 KiB seeded replay with turn-2 cache hits.

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