-
Couldn't load subscription status.
- Fork 3.7k
refactor(cli): throw tool error instead of returning and matching error strings #8432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
- added ToolResultWithStatus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 issues found across 9 files
Prompt for AI agents (all 3 issues)
Understand the root cause of the following 3 issues and fix them.
<file name="extensions/cli/src/tools/searchCode.ts">
<violation number="1" location="extensions/cli/src/tools/searchCode.ts:104">
Treating ripgrep exit code 1 as a thrown error regresses the tool: it now fails whenever a search has no matches, whereas ripgrep uses that code to signal an empty result set. Please continue returning the "No matches found" message so successful searches without hits don’t show up as tool errors.</violation>
</file>
<file name="extensions/cli/src/tools/writeFile.ts">
<violation number="1" location="extensions/cli/src/tools/writeFile.ts:165">
Wrapping the caught error in a new Error discards ContinueError reasons and errno metadata, so upstream tool handling always sees an unknown failure reason.</violation>
</file>
<file name="extensions/cli/src/tools/readFile.ts">
<violation number="1" location="extensions/cli/src/tools/readFile.ts:55">
Use ContinueErrorReason.FileNotFound when the target file is missing so downstream tooling can recognize the specific "file not found" condition instead of an unspecified error.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
sestinj
approved these changes
Oct 27, 2025
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
Earlier, the cli used to match for tool errors and cancellations by searching those words in the tool call result. This approach produced errors when the tool call was successful but contained the "error" and "cancelled" words. This PR fixes it.
resolves CON-3796
AI Code Review
@continue-reviewChecklist
Screen recording or screenshot
before
after
Tests
[ What tests were added or updated to ensure the changes work as expected? ]
Summary by cubic
Refactored CLI tool error handling to throw structured errors and propagate execution status, replacing fragile string matching. This prevents false cancellations/errored states and ensures accurate tool result statuses in the UI.
Bug Fixes
Refactors