feat(interp): improve error messages for blocked and unknown commands#182
Open
julesmcrt wants to merge 1 commit intojules.macret/Q/help-add-allowed_commandsfrom
Open
Conversation
Prefix all error messages with "rshell:" to clearly identify the shell,
use distinct wording ("command not allowed" vs "unknown command") so
LLMs and users can tell policy blocks from missing commands, and
add a contextual hint pointing to 'help' when it is available.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
thieman
approved these changes
Apr 14, 2026
4ee0b74 to
cdc07cf
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.
Summary
rshell:to clearly identify the source shell (follows thebash: cmd: errorconvention)Run 'help' to see allowed/available commands.hint is appended only whenhelpis in the allowed commands list — avoids suggesting a command that would itself be blockedBefore / After
1. Command not allowed —
helpIS in allowed listBefore:
After:
2. Command not allowed —
helpNOT in allowed listBefore:
After:
No hint is shown because
helpitself is not allowed — suggesting it would produce a confusing follow-up error.3. Unknown command —
helpIS in allowed listBefore:
After:
Note:
foois not in the allowed list, so the allow check fires before the builtin lookup. The "unknown command" path is only reached when a command passes the allow check but isn't a known builtin (e.g., with--allow-all-commands).4. Unknown command —
helpNOT in allowed listBefore:
After:
5. Unknown command with
--allow-all-commands(the "unknown command" path)Before:
After:
Design decisions
rshell:prefix — Follows theshell: cmd: errorconvention used by bash/zsh. Helps LLMs and log parsers identify which shell produced the error.Run 'help' ...hint only appears whenhelpis in the allowed commands set. This avoids a frustrating UX where following the hint produces another error (rshell: help: command not allowed). The check usesr.allowedCommands["help"]for the "not allowed" path, and a pre-computedhelpAvailablebool captured at runner creation for the exec handler path.helpoutput already shows the rshell version (via feat(help): show version, command counts, and allowed/not-allowed builtins #181), keeping errors concise.Depends on
feat(help): show version, command counts, and allowed/not-allowed builtins) — TheRun 'help' ...hint is most useful whenhelpshows the version header, allowed/not-allowed builtin lists, and the--allflag.Test plan
go test ./...— 0 failures)helpis allowedmake fmtclean🤖 Generated with Claude Code