Skip to content

feat(core): replace the shell classifier with fixed stops - #483

Merged
lg2m merged 2 commits into
feat/v0110-snapshotsfrom
feat/v0110-shell-triage
Oct 27, 2026
Merged

lg2m merged 2 commits into
feat/v0110-snapshotsfrom
feat/v0110-shell-triage

Conversation

@lg2m

@lg2m lg2m commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Replaces the shell classifier's allow/prompt/forbidden tiers with a short list of fixed stops. Stacked on #482.

What changes for users

Mode Behavior
read_only Reads run; everything else is denied. Unchanged.
ask Read tools run; every other call waits for you. Fixed stops are now denied without asking.
auto Every call runs except a fixed stop. Unknown programs, rm, git push, curl, and dynamic commands no longer need a grant.
full Everything runs. Unchanged.

The fixed stops are: force-push or deleting remote refs; rm -r, mv, or chmod/chown -R of /, home, or a directory directly under either; sudo/doas/su/pkexec; disk formatting and device writes; shutdown and reboot; and any command naming ~/.ssh, ~/.aws, ~/.gnupg, ~/.netrc, gh/docker/kube config, ~/.git-credentials, or QQ's credential files. A stop is a tool error: permission_denied: fixed_stop: <reason>; <what to do instead>. Do not retry it in another form. No grant lifts one.

The stops reuse the existing tree-sitter-bash parse and wrapper peeling, so cd x && …, env A=b …, timeout, pipes, subshells and sh -c '…' are all caught. The docs call it an accident net, not a security boundary.

The approval prompt no longer shows "asks because: …", since there are no prompt rules to report. ShellCommandPreview.verdict/reasons stay on the wire but are not set; removing them is left for the protocol bump in B.

The plan (docs/plans/README.md) drops the per-action reviewer and the routine list in favor of this design (see the fx/pi comparison in Direction). A user-level deny_shell_prefixes is marked TODO.

Verification

  • approval/stops.rs tests cover every stop bare and in 5 wrapped forms, plus false positives (rm -rf target, mv target/qq ~/bin, git push -u origin x, dd of=disk.img, cat .ssh/config).
  • approval.rs tests cover the mode table, including Auto running unknown and dynamic commands and Full running stops.
  • Session tests: a stop in Auto is denied before any hold and never reaches a configured reviewer, and an exact human grant does not lift it. Headless tests: Auto denies a sudo command without approvals.
  • cargo xtask check passed (583 s).

Notes

  • About −900 lines net; approval/rules.rs (2.3k lines) is gone.
  • Auto in an unscoped embedding (no native task scope) now runs unknown commands instead of denying them. The binary's native Auto already did.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-27T16:35:57.107273Z
We couldn’t complete this review. Comment @codex review to try again.
2067bcb New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d7b5bd14aa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-core/src/approval/stops.rs Resolved
Comment thread crates/qq-core/src/approval/stops.rs Resolved
Comment thread crates/qq-core/src/approval/stops.rs Resolved
@lg2m
lg2m added this pull request to stack #484 October 27, 2026 16:06
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@lg2m

lg2m commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 5e283bfcf5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

lg2m added 2 commits October 27, 2026 09:35
Auto now runs every call except a short list of fixed stops: force-push and
remote ref deletion, rm/mv/chmod -R of / or home, sudo and friends, disk and
power commands, and commands naming credential files. Ask holds every non-read
call and denies stops without asking; Full runs everything. The stops keep the
tree-sitter parse and wrapper peeling, so cd/env/timeout/sh -c forms are
caught. The allow/prompt/forbidden rule table is deleted, and the plan drops
the per-action reviewer.
@lg2m
lg2m force-pushed the feat/v0110-shell-triage branch from 5e283bf to 2067bcb Compare October 27, 2026 16:35
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@lg2m
lg2m merged commit f13e2a2 into main Oct 27, 2026
8 checks passed
@lg2m
lg2m deleted the feat/v0110-shell-triage branch October 27, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant