fix(opencode): clear writer-failure counter in resetThresholds#913
Open
hzhongzhong wants to merge 1 commit into
Open
fix(opencode): clear writer-failure counter in resetThresholds#913hzhongzhong wants to merge 1 commit into
hzhongzhong wants to merge 1 commit into
Conversation
SessionPrune.resetThresholds cleared `crossed` and `maxCrossed` but left `writerFailures` (keyed by the same sessionID) untouched. A session that started a fresh checkpoint threshold cycle therefore inherited the previous consecutive writer-failure count, so a later failure could hit the retry cap earlier than expected and leave a stale in-memory entry. Drop the writer-failure count alongside the other per-session threshold state. Fixes XiaomiMiMo#734 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Fixes #734
Problem
SessionPrune.resetThresholdsclearscrossedandmaxCrossedbut leaveswriterFailures(keyed by the samesessionID) untouched. A session that starts a fresh checkpoint threshold cycle therefore inherits the previous consecutive writer-failure count, so a later failure can reach the retry cap earlier than expected and a stale in-memory entry lingers until a success clears it or the process restarts.Fix
Drop the writer-failure count alongside the other per-session threshold state:
writerFailures.delete(sessionID).Verification
Added a
SessionPrune.fireCheckpointstest that records two writer failures, callsresetThresholds, then drives three more failures — expecting the fresh cycle to enqueue all three before the cap (enqueueCount 5). It failed before the fix (counter carried over → stalled at 3) and passes after.bun test test/session/prune.test.ts→ 10 pass. Related checkpoint/rebuild suites green (52 pass across 7 files).