fix(agent): stop managed snapshot failure retry looping - #4581
fix(agent): stop managed snapshot failure retry looping#4581Yeachan-Heo wants to merge 2 commits into
Conversation
A payload class can serialize live through prototype toJSON while structuredClone removes that serializer and retains bigint state. Validate and measure the detached value, sanitize that exact clone when needed, and surface residual local failures once instead of replaying the same deterministic defect. Lore-id: 4578d5a1 Constraint: preserve managed transaction isolation, provider classification, hostile payload safety, and staged byte caps Rejected: bounded same-model retries | deterministically amplifies the same local producer defect Confidence: high Scope-risk: medium Reversibility: clean Tested: managed transaction and session cohorts; issue #2408 transport cohort; agent and coding-agent checks; workspace build; affected CI planner
The #4578 fix removed the bounded same-model retry for local_snapshot_failure because the retained producer shape is deterministic and retries only replayed the same defect three times. Sync the retry-policy doc with the shipped behavior. Lore-id: 61d94fea Confidence: high Scope-risk: narrow Reversibility: clean Tested: doc-only; behavior covered by managed-attempt and session fallback suites
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Canonicalization receipt for issue #4578 The required Canonical exact head: The six implementation files were already byte-identical; #4580 now owns the complete seven-file change, fresh verification, review contract, and CI. Closing #4581 as a superseded duplicate so issue #4578 has one authority lane. Signed-by: Yeachan-Heo |
Lands the #4578 fix on top of dev plus the retry-policy doc sync.
Root cause
A payload class can serialize live through prototype
toJSON()whilestructuredClonestrips that serializer and keeps bigint state. The staging pre-measure trusted the live JSON result, so the detached snapshot was accepted unserializable and every re-issue reproduced the same deterministicManagedAttemptSnapshotError— surfacing in the TUI as the repeatedManaged fallback attempt could not produce a serializable event snapshoterrors ending inRetry failed after 3 attempts.Changes
managedAttemptSnapshotDetailednow validates and byte-measures the DETACHED clone with the exact serialization staging uses, sanitizing the detached value when validation fails, so every accepted snapshot is isolated, JSON-serializable, and bounded.local_snapshot_failuresurfaces its one producer-boundary diagnostic immediately instead of re-issuing the identical requestretry.maxRetriestimes (matchinglocal_buffer_overflow). Still never charges the fallback chain, advances models, or rotates credentials.docs/non-compaction-retry-policy.mdsynced to the shipped behavior.Verification
bun test packages/agent/test/managed-attempt-transaction.test.ts packages/coding-agent/test/agent-session-fallback-attempt-transaction.test.ts— 70 pass / 0 failbun --cwd=packages/agent run check— cleanbun --cwd=packages/coding-agent run check:types— same two pre-existing failures as the base commit (cross-worktree node_modules contamination, verified identical at HEAD~1); no new errors introduced.