fix(circuit-breaker): make repetitive detection target-aware and add enabled escape hatch#2655
Merged
code-yeongyu merged 4 commits intocode-yeongyu:devfrom Mar 18, 2026
Merged
Conversation
Contributor
|
All contributors have signed the CLA. Thank you! ✅ |
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
No issues found across 8 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: The PR correctly implements target-aware circuit breaking by using tool signatures, reducing false positives while maintaining safety via the absolute tool call limit and comprehensive tests.
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
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.
Summary
circuitBreaker.enabled(defaulttrue) as an escape hatch for repetitive-pattern cancellation.maxToolCallssafety backstop and keep cancellation messages human-readable.Changes
src/config/schema/background-task.ts:circuitBreaker.enabled?: booleansrc/features/background-agent/constants.ts:DEFAULT_CIRCUIT_BREAKER_ENABLED = trueassets/oh-my-opencode.schema.jsonregeneratedToolCallWindow.toolNames->toolSignaturestoolName::sortedJson(input)recordToolCall(...)now accepts optionaltoolInputtoolNameremains bare (no signature payload leakage)MessagePartInfo.statenow includes optionalinputpartInfo.state?.inputtorecordToolCall(...)if (circuitBreaker.enabled)maxToolCallscancellation remains unconditionalloop-detector.test.ts: enabled flag resolution, signature normalization/order stability, different-target no-trigger, same-target trigger, no-input fallbackmanager-circuit-breaker.test.ts: integration coverage for different-target run-through, same-target cancellation with bare tool name,enabled=falsebehavior, and absolute-cap backstopTesting
bun run typecheck bun run build bun test src/features/background-agent/loop-detector.test.ts src/features/background-agent/manager-circuit-breaker.test.ts src/config/schema/background-task-circuit-breaker.test.tsAdditional verification:
XDG_CONFIG_HOME=/tmp/omo-smoke-xdg) and local plugin path (file:///.../dist/index.js) so user config was not modified.Known upstream baseline (not introduced by this PR):
bun test src/features/background-agent/has one pre-existing failure insrc/features/background-agent/manager.test.ts:BackgroundManager process cleanup > should remove listeners after last shutdowndevin a temporary worktreeRelated Issues
Closes #2652
Summary by cubic
Make the circuit breaker target-aware to stop false-positive cancellations, and add an escape hatch to disable repetitive-pattern checks. Keeps the absolute
maxToolCallsbackstop unchanged. Closes #2652.Bug Fixes
toolName::sortedJson(input)) instead of tool name.state.inputto loop detection; cancellation message shows only the bare tool name.New Features
circuitBreaker.enabled(defaulttrue) to disable repetitive-pattern cancellation.maxToolCalls.Written for commit 224ecea. Summary will update on new commits.