Skip to content

fix(runner): cold-replay stopgaps — result caps, resume frame, arg parsing#5152

Merged
mmabrouk merged 1 commit into
big-agentsfrom
fix/cold-replay-stopgaps
Jul 9, 2026
Merged

fix(runner): cold-replay stopgaps — result caps, resume frame, arg parsing#5152
mmabrouk merged 1 commit into
big-agentsfrom
fix/cold-replay-stopgaps

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Jul 7, 2026

Copy link
Copy Markdown
Member

Two production turns failed on 2026-07-07 because the runner cold-replays the conversation as flattened text every turn. Turn c6de1865 needed three approval rounds for one curl: each fresh model rebuilt the arguments from the text replay and drifted the approval key. Turn 6d34b1ea ran five rounds and executed zero commits: the resume prompt re-presented the stale user command as if just spoken, so each fresh model restarted the whole task, and one 30-60 KB tool dump filled the 24K window and evicted the original goal.

Full analysis: docs/design/agent-workflows/projects/approval-boundary/cold-replay-failure-report.md. Session-based continuation is the real fix and lands next; these are the cheap repairs to the text-replay path, which stays as the fallback after sessions.

Replay framing, before/after

Before (approval resume, no new user text):

Conversation so far:
...
[user APPROVED commit_revision; the call has NOT run yet. ...]

Continue the conversation. The user now says:
search for tools and add them if needed use the skill   <- stale, restarts the task

After:

Conversation so far:
user: search for tools and add them if needed use the skill   <- stays in history position
...
[user APPROVED commit_revision; the call has NOT run yet. ...]

The user has responded to the pending approval above. If a call is marked APPROVED and not yet run, execute exactly that call now with the same arguments; do not restart the task. If it was DENIED, continue without it.

The four changes (all services/runner)

  1. Per-result cap + bigger window (transcript.ts): each rendered tool RESULT body caps at 4,000 chars with an explicit [... N chars omitted] marker. Tool CALL args are never capped (the resume nudge says "with the same arguments"). Default AGENTA_AGENT_HISTORY_MAX_CHARS raised 24,000 -> 100,000, still env-overridable.
  2. Resume closing frame (transcript.ts): when an unresolved approved call is newer than the last user text, the closing frame becomes the execute-the-approved-call instruction above instead of the stale command. Normal new-user-message turns are unchanged.
  3. normalizeJsonish hardening (responder.ts): tolerates up to three stray trailing }/] on stringified JSON args (the round-5 shape), so the honest re-issue matches the stored approval key. Non-JSON strings keep their literal value.
  4. Replay observability (transcript.ts + run-plan.ts): one [HITL] cold replay: log line per replay with transcript length before/after the tail slice, fully evicted message count, pending-nudge presence, resume-frame flag, and turnText length.

Deferred to the session work

  • Runner-side execution of approved calls (keep-alive slice 2 answers the parked permission RPC directly).
  • Name-level approval-key fallback matching (same).
  • Session/keep-alive machinery (its own project).
  • get_revision platform op (build-kit backlog).
  • Frontend changes.

Tests: pnpm test 620/620 green, pnpm run typecheck green. Design doc: docs/design/agent-workflows/projects/cold-replay-stopgaps/.

https://claude.ai/code/session_01AumZJ9xRd4XYNHThqy4rTv

@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jul 7, 2026 8:59pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dbfac3c4-2b73-45f9-8944-57e59298ad92

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cold-replay-stopgaps

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mmabrouk mmabrouk marked this pull request as ready for review July 9, 2026 14:23
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Jul 9, 2026
@mmabrouk mmabrouk merged commit 72b3f9a into big-agents Jul 9, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant