Repository navigation
fix(opencode): keep doom-loop guard to real failures across steps (Refs #725) - #746
Closed
agenteinstinct1-max wants to merge 2 commits into
Closed
agenteinstinct1-max wants to merge 2 commits into
agenteinstinct1-max wants to merge 2 commits into
Conversation
#725) Co-authored-by: arena-agent <[email protected]>
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
…ac-silvercode Co-authored-by: arena-agent <[email protected]>
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.
Issue for this PR
Refs #725 (draft — intentionally using
Refsrather than a closing keyword so #725 is not auto-closed)Type of change
What does this PR do?
Refs #725. Replaces the closed #728 draft on a fresh branch and incorporates the review fixes on top of the doom-loop guard rework in
packages/opencode/src/session/processor.ts.Previously,
processor.tscheckedparts.slice(-DOOM_LOOP_THRESHOLD)forstatus !== "pending"tool parts, which false-triggereddoom_loopon parallel sibling calls within one generation step, successful calls, andexperimental_repairToolCall's"invalid"deferred-tool placeholder.Changes in
packages/opencode/src/session/processor.ts:completed/error) tool executions and exclude the reserved literal"invalid"repair placeholder (llm.tsstrips"invalid"fromactiveToolsand uses it only forexperimental_repairToolCall).DOOM_LOOP_THRESHOLD - 1evidence window from distinct generation steps (step-startboundaries), newest-first, rather than raw execution slots: sibling calls fanned out in one step do not self-trigger within that batch, while a failing batch repeated across three steps still trips the guard instead of displacing cross-step evidence.ctx.assistantMessageand memoize the prior-turn execution steps once perprocess()attempt, avoiding current-message duplication, repeated DB reads per step, and fixed history-count truncation across tool-less turns.FINISH_NUDGE,REVIEW_STAGNATION_NUDGE, auto-compaction/subtask continuations) while stopping at real user messages, and remove the fail-opencatchCauseandindex < 0early-return paths.How did you verify your code works?
Added deterministic Effect tests in
packages/opencode/test/session/processor-effect.test.ts(stubbingPermission.ServiceandLLM.Service) covering:0asks.1doom_loopask on step 3.0asks on steps 1–2,1doom_loopask on step 3.completed) calls repeated across 3 steps ->0asks."invalid"repair placeholders (within one step and across steps) followed by the instructed retry ->0asks."invalid"placeholder between real failures neither counts as a failure nor breaks a genuine 3-step failure streak.completedcall breaks the failure streak until two new consecutive failing steps precede the next retry.Validation
bun test test/session/processor-effect.test.ts -t "doom loop"(packages/opencode): 8 pass, 0 fail (30expect()calls)bun test --timeout 30000 test/session/processor-effect.test.ts(packages/opencode): 38 pass, 0 fail (191expect()calls)bun test --timeout 30000 test/session(packages/opencode): 838 pass, 8 skip, 1 todo, 0 fail (2635expect()calls across 36 files)NODE_OPTIONS="--max-old-space-size=3000" bun turbo typecheck --concurrency=1: 17/17 packages pass (0errors, including fulltsc --noEmitinpackages/opencode)./node_modules/.bin/oxlint packages/opencode/src/session/processor.ts packages/opencode/test/session/processor-effect.test.ts: 0 errors, no new warnings (11 pre-existing warnings)Screenshots / recordings
N/A — backend session processor logic only (no UI changes).
Checklist