fix(stella-tools): name real forge inputs in gh redirects - #6551
Conversation
The refusal for gh pr ready named the action "update with draft", which is not an enum value and reads as draft true. Ready is update with draft set to false. Merge names confirm as its own field, and gh pr checks points at watch_ci's branch, which has no action. A wrapper flag that takes a value was treated as a command word, so sudo -u user, nice -n 10, and env -u FOO let gh through unsigned. Refs #6545 Co-authored-by: Mac Anderson <mac@oxagen.sh>
Reviewer's GuideUpdates Flow diagram for schema-valid gh redirect generationflowchart LR
Command["gh subcommand"] --> Match["forge_redirect matches verb"]
Match --> Refusal["refusal uses Redirect.call"]
Refusal --> Schema["Schema-valid tool input"]
Schema --> PullRequest["pull_request: action plus draft or confirm"]
Schema --> WatchCI["watch_ci: branch, no action"]
Flow diagram for wrapper-aware gh command detectionflowchart TD
Input["Shell command prefix"] --> Separator["Scan after last separator"]
Separator --> Assignment["Consume assignments"]
Assignment --> Wrapper["Recognize wrapper"]
Wrapper --> Flags["Consume wrapper flags"]
Flags --> Value{"Flag takes a separate value?"}
Value -->|Yes| Consume["Consume value"]
Value -->|No| Next["Continue parsing"]
Consume --> Next
Next --> Gh["gh is command position"]
Next --> NonExec["Non-executing form stays open"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
The prose gate rejects "used to". The comments now say what the refusal names: ready is update with draft set to false, merge's confirm is its own field, and watch_ci takes branch. Refs #6545 Co-authored-by: Mac Anderson <mac@oxagen.sh>
…-ci-and-review-issues-f906
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_7e697e1c-8954-4a7c-a148-0c991ea4b5a5) |
macanderson
left a comment
There was a problem hiding this comment.
Adversarial review round 1: env -S regresses a refused spelling, and bundled sudo flags still hide the command.
env -S and --split-string run the split string, so treating them as values let gh pr create through. A single-dash cluster is read letter by letter, so sudo -Eu root and env -iu FOO still name the command. Refs #6545 Co-authored-by: Mac Anderson <mac@oxagen.sh>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Sorry @macanderson, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 4 days and 20 hours by commenting @sourcery-ai review. Upgrade to get a review now.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_bd972ff3-218b-4491-ad92-210596880546) |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
What & why
Bugbot reviewed #6545 once and left two medium findings in
forge_redirect. Both are fixed here.gh pr readywas refused with actionupdate with draft, which is not an enum value onpull_requestand reads asdraft: true. Ready is actionupdatewithdraft: false.gh pr mergenow names actionmergeandconfirm: trueas its own field.gh pr checkspoints atwatch_ciwithbranchset to the pull request's head. That tool has noaction.A wrapper flag that takes a value (
sudo -u user,nice -n 10,env -u FOO) was treated as a command word, so theghafter it was not redirected. The parse now consumes that value for the wrapper flags that take one.sudo -n echo ghstays open, because-non sudo takes no value andechois the command.The low finding, an empty body signed twice, is residue in #6553.
Refs #6545
Refs #6553
The witness
main, passes here), orevery_redirect_names_a_real_tool_inputreads the action between backticks and requires it to be in the tool schema's enum. On main the ready refusal putsupdate with draftin those backticks, which is not an enum value.a_wrapper_flag_value_does_not_hide_the_commandrequiressudo -u user gh pr create,nice -n 10 gh pr merge, andenv -u FOO gh issue commentto redirect. On mainis_command_positionstops on the flag's value and returnsNone.cargo test -p stella-tools --lib forge::redirect— 12 passed.The gate
cargo fmt --check(formatted withcargo fmt -p stella-tools)cargo clippy -p stella-tools --lib -- -D warningspassedcargo test -p stella-tools --lib forge::redirectpassedRefs #6545appears above and as a commit trailer. This PR does not close that issue; it is already merged.Fix over file
331543eis the samessm:SendCommandAccessDeniedExceptionforgha-deploy-stellathat failed the previous main push (run 35527940671). The role policy is outside this repository, so this PR does not change.github/workflows/docs.yml.Ground-rule check
stella-core; no new deps without justification belowAnything reviewers should know?
Bugbot and Sourcery each reviewed #6545 once, so the medium findings are fixed here rather than filed.
command -v ghis now left open:-vtakes the name and does not run it.docs guardsandmain is not known-brokenfail on main's account (#6548). #6550 registers SCR-006 in the document manifest and #6552 rewrites its prose. This branch merges main again once they land.Summary by Sourcery
Ensure forge redirects both detect wrapped
ghinvocations reliably and provide schema-accurate retry instructions.Bug Fixes:
ghcommands from redirect enforcement.Enhancements:
command -v gh.Documentation:
Tests:
Note
Medium Risk
Changes bash-layer enforcement of which
ghinvocations are blocked and the guidance agents get on retry; incorrect parsing could either block benign commands or miss wrappedghwrites.Overview
Fixes forge
ghredirects so refusal text matches real tool schemas and wrapped shell spellings cannot skip signing.Refusal copy now goes through a
refusal()helper: each redirect uses acallsnippet (e.g. actionupdateplusdraft: falseforgh pr ready,confirm: truefor merge,branchforgh pr checks→watch_ci) and only mentions signing for write tools.Command-position detection is rewritten to parse forward from the last separator, consuming wrapper flags and their values per wrapper (
sudo -u,nice -n,env -u, clusters like-Eu, GNUenv -S). That closes the hole wheresudo -u user gh …was treated likeecho gh …and allowed unsigned forge writes;command -v ghandsudo -n echo ghstay allowed.Tests add witness coverage that every redirect names a schema-valid action/input and that value-taking wrapper flags still trigger redirects.
Reviewed by Cursor Bugbot for commit 5c5fc38. Configure here.