Skip to content

fix(agent): stop managed snapshot failure retry looping - #4581

Closed
Yeachan-Heo wants to merge 2 commits into
devfrom
fix/managed-snapshot-looping
Closed

fix(agent): stop managed snapshot failure retry looping#4581
Yeachan-Heo wants to merge 2 commits into
devfrom
fix/managed-snapshot-looping

Conversation

@Yeachan-Heo

Copy link
Copy Markdown
Owner

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() while structuredClone strips 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 deterministic ManagedAttemptSnapshotError — surfacing in the TUI as the repeated
Managed fallback attempt could not produce a serializable event snapshot errors ending in Retry failed after 3 attempts.

Changes

  • managedAttemptSnapshotDetailed now 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.
  • Session policy: local_snapshot_failure surfaces its one producer-boundary diagnostic immediately instead of re-issuing the identical request retry.maxRetries times (matching local_buffer_overflow). Still never charges the fallback chain, advances models, or rotates credentials.
  • docs/non-compaction-retry-policy.md synced 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 fail
  • bun --cwd=packages/agent run check — clean
  • bun --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.

Yeachan Heo and others added 2 commits August 15, 2026 17:36
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
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

Canonicalization receipt for issue #4578

The required docs/non-compaction-retry-policy.md correction from this duplicate's commit 04be9224886a8cdcdba123cd8643cc1354e8a6f4 has been integrated unchanged into canonical PR #4580.

Canonical exact head: a03dde8d675de017781a547c876c26a022a1d105
Canonical PR: #4580

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
Supersedes-PR: #4581
Canonical-PR: #4580

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