Repository navigation
fix(builtins): usage errors fail the command, not the script - #2560
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 15afca9 | Commit Preview URL Branch Preview URL |
Oct 07 2026, 01:07 PM |
chaliy
force-pushed
the
claude/builtin-errors-nonfatal
branch
from
October 7, 2026 12:49
27bca4b to
a81ac68
Compare
grep -E '(' or an awk syntax error returned Err from the builtin, which
aborted the whole exec. Bundled builtins' Execution/Regex errors now
become exit 2 with the message on stderr, as in bash. Err from custom
builtins (builder, registry, resolver) still aborts.
Claude-Session: https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
chaliy
force-pushed
the
claude/builtin-errors-nonfatal
branch
from
October 7, 2026 13:06
e3b9f0d to
15afca9
Compare
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.
Requested by Михайло · project thread
What changed
A usage error in one of bashkit's own builtins now fails only that command. It exits 2 with the message on stderr, and the script keeps going, as in bash. Affected cases:
grep -E '('andgrep -Pwith a bad patternrgwith a bad regexgrepwith no pattern, orgrep -f missingset -estill stops on them.Errreturned by a custom builtin (BashBuilder::builtin,BuiltinRegistry,CommandResolver) still abortsexec(), which is the existing public contract. Limits, cancellation and I/O errors still abort for every builtin.Why
Before, a single bad regex in an agent's script killed the whole run and dropped the output of every command after it. This was found while probing awk for the gap report.
Before
After
The new
builtin-usage-errors.test.sh(6 cases) matches bash 5.2 with GNU grep and mawk; the rg case is bashkit-only.Risk
Medium-low. The rule lives in the builtin dispatcher and applies only when the builtin being run is the bundled one, checked by pointer identity and not overridden by name. The trace-isolation test now uses a custom fatal builtin for its failure path, since grep no longer aborts. Error text is capped at 1 KB (TM-INF-022).
Checklist
cargo test -p bashkit --lib --tests, clippy, fmthttps://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
Generated by Claude Code