fix(core): cap done repair loop#292
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Review mode: initial
Findings
- [Minor] The
errorRoundscounter resets to 0 on a successfuldone()call (status"ok"). This means after a successful verification, the agent gets a fresh three-error budget for subsequentdone()calls. While not a bug, this may allow the agent to cycle through error rounds and fixes indefinitely if it introduces errors after each fix. Consider whether a per-session (non-resetting) budget is desired, or at least document the design choice in the constant comment. (packages/core/src/agent.ts:389) - [Nit]
formatDoneRepairLimitTextincludes'has_errors'as the first line of the text content returned to the model. The previousdone()result's details already indicatestatus: 'has_errors', so repeating it in the text is redundant. Consider removing that line. (packages/core/src/agent.ts:407)
Summary
This PR caps the done() repair loop at three error rounds, preserving the latest artifact and surfacing warnings when the limit is reached. The changes are clean, well-tested, and align the tool prompt copy with the new limit. The two new tests cover both the direct tool behavior and the full agent termination path. Overall, the implementation direction is sound.
Testing
Good coverage: unit tests for the wrap logic and integration-style test using the executeTool mock. Consider adding a test that verifies errorRounds resets after a successful done() call, to document the expected reset behavior.
Open-CoDesign Bot
This was referenced May 3, 2026
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
Fixes #251
Testing