Repository navigation
Refuse all Beside Other Names and Drop Empty Names in the Linux Agents Loader - #3066
Conversation
…nts Loader bootstrap.sh passed `--agents all,herdr` through as `--install all herdr` and an empty name through as an empty argument, so install-agents.sh died late with an unknown-tool error after the loader had accepted the list. The Windows loader already refused "all" beside other names and dropped empty names, so the Linux loader now does the same before any action runs. Tests pin both loaders. Fixes #3043 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… Agents Loader A name holding a space and the word all, such as "herdr all", matched the joined-string check and installed every tool. The loader now compares each name exactly, as the Windows loader does. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🟢 Approval recommended
The loader change matches the stated scope, and the remaining test concern does not identify a defect.
0 open findings
What changed in this PR
This PR aligns the Linux agents loader with the existing PowerShell behavior for mixed all lists and empty names.
Changes:
- Reject
allbeside another name and drop empty comma-separated names before running an action. - Add Linux and PowerShell handoff tests. Case handling for
allremains out of scope.
| File | Description |
|---|---|
host-setup/bootstrap.sh |
Validates and normalizes the agents list before handoff. |
tests/test_bootstrap.py |
Tests list parsing and installer handoff behavior. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3066 +/- ##
========================================
Coverage 61.21% 61.21%
========================================
Files 17 17
Lines 9062 9062
========================================
Hits 5547 5547
Misses 3515 3515
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Bring #3077 current with the promotion fixes #3082 and #3087 and with #3066. The one conflict, the Claude agent-safety README's guard bullet, keeps develop's alias and shell-environment sentences and this branch's negation, run-time word, and cut-short --no-verify sentences. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…3077) ## Summary Closes five option-reading gaps in the write guard. Each one was confirmed on develop with `classify` on a constructed command before it was fixed, and each reading was checked against git 2.47 or gh's flag table. - **#2978, `--no-verify` cut short.** `_names_no_verify` reads a commit or push word that is a prefix of `--no-verify`, as in `--no-veri`, as the flag. Git 2.47 runs `--no-veri` and refuses `--no-v`, `--no-ve`, and `--no-ver` as ambiguous with `--no-verbose`, so reading those too only over-reads. - **#3015, a commit's `-n` in a cluster.** `_commit_cluster_skips_hooks` reads a cluster such as `-an` or `-nm` letter by letter. A value letter (`m F C c t`) takes the rest of its word, or the next word where it ends its word, so `-mn` and `-m -an` are messages. `-S` and `-u` take only the rest of their word, so `-Sn` is a key id. A long value option such as `--mess` takes the next word, and a word after `--` is a pathspec. - **#3006, a run-time word among a merge's words.** `_gh_merge_run_time_word` fails closed on a `$`, backtick, or brace word among a `gh pr merge`'s words, since it may expand to `--admin`. An option value that word splitting cannot split is the exception, as in `--body "$BODY"`, though not a `--repo` or `-R` value, which the target check cannot read. A word in a heredoc body that is data is left alone too. Only a gh word in a command's position whose subcommand under `pr` is `merge` counts (`_runs_gh_pr_merge`), so `echo gh pr merge $N` and `gh pr edit "$PR" --add-label merge` are not read as merges. A quoted positional such as `gh pr merge "$PR"` fails closed, as `git push origin "$BR"` already does, and the deny says only a quoted option value is accepted. - **#3004, merge's boolean `-m`.** `_gh_target_readings` reads a merge argv (`_runs_gh_pr_merge`) a second time by `_GH_MERGE_TEXT_FLAGS`, merge's value options less the repo flags, where `-m` is `--merge`. A target either reading finds counts, so `gh pr merge 5 -m -R stranger/example` is denied. This only adds targets. - **#3025, a later negated push option.** Of `--force`, `--delete`, `--all`/`--branches`, `--mirror`, and `--tags` and each one's `--no-` form, the later one wins, whole or cut short to the shortest prefix git 2.47 reads as that option alone (`_PUSH_NEGATIONS`). A shorter one, such as `--no-forc`, `--no-d`, or `--no-a`, is ambiguous and refused by git, so it cancels nothing. A negation after `--` or `--end-of-options`, or one that is another option's value, cancels nothing. `--force-with-lease` is now tracked apart from `--force`, since git leaves a lease in place after `--no-force`. A short cluster such as `-f` has no negated form, so `-f` after `--no-force` forces. Both READMEs describe the new readings. ## Verification - **Git and gh semantics, run directly.** In a throwaway repository with logging hooks: `--no-veri` and `-an` skip the hook, `-mn`, `-m -an`, `-Sn`, and `-uno` do not, and `-xn` is an unknown switch. `--force --no-force` and `-f --no-force` are rejected as non-fast-forward, `--force-with-lease --no-force` still leases, `--delete --no-delete` does not delete, and `--tags --no-tags` pushes the branch. `--no-de`, `--no-al`, `--no-b`, `--no-m`, `--no-ta`, and `--no-veri` are unique, while `--no-forc`, `--no-d`, `--no-a`, `--no-t`, and `--no-v` are ambiguous. A read-only `gh pr list` confirmed gh reads a short cluster ending in `-R` (#3067). - **Self-test.** Every new row was proven by reverting its fix and watching it fail: the cut-short reading, the cluster reader, the run-time check, the merge table reading, the negation block, the lease split, the prefix floor, the `--no-tags` reading, the command-position test, the narrow merge test, the long-value and `--` handling, and the `-S`/`-u` rule. `gh-write-guard.py --selftest` passes, and so do `test_install.py` (161 tests), ruff format and check, mypy, `prose_lint.py --diff origin/develop`, and `spec/validate.py`. ## Differential Develop's guard and this branch's `classify` ran over 129,336 constructed commands: commit, push, and `gh pr merge` (and `pr create`, `view`, `comment`, `edit`) with every one- and two-word option list from each pool, two options before three fixed push tails, and 150,000 random lists of one to seven words, some wrapped in `bash -c`, `eval`, or after `A=--admin;`. Origin, rules, current branch, aliases, and config reads were pinned. | develop | branch | count | | --- | --- | --- | | allow | allow | 53,021 | | deny | deny | 40,269 | | allow | deny | 35,321 | | deny | allow | 725 | Every flip is sorted into the issue that explains it, with none left over. A separate model of git's own option parse sorted the commit and push flips into a real bypass, a command git refuses, or an over-read. - **allow to deny, #2978 (19,550).** 4,230 run a real bypass, as `git push --no-veri` does. 13,833 are commands git refuses, as `git commit --no-ver` or `git push --no-v` is. 1,487 read a cut-short word that is another option's value, as in `git commit -c --no-veri`, the same over-read the exact `--no-verify` already gets. - **allow to deny, #3015 (9,109).** 7,725 run a real bypass, as `git commit -m x -an` does. 1,384 are commands git refuses, as in `git commit -an -x`. None reads a value as a cluster. - **allow to deny, #3006 (6,635).** 2,561 quoted positionals such as `gh pr merge "$PR"`, 1,628 unquoted words or values such as `$A` or `--body $BODY`, 1,401 unquoted attached values such as `--body=$B`, 750 brace expansions such as `--{admin,squash}`, and 295 run-time repo values such as `-R $A`. - **allow to deny, #3004 (23).** Each is a merge whose `-m` came before a `-R` or `--repo` naming another owner, as in `gh pr merge 5 -m -Rstranger/example`. - **allow to deny, `--no-tags` (4).** A push whose `--tags` a later `--no-tags` cancels, or one with an ambiguous `--no-t` git refuses, which is now read as a branch push. - **deny to allow, #3025 (725).** 724 hold a negation of an earlier `--mirror`, `--all`, `--branches`, `--delete`, or `--force`, as in `git push --all --no-all origin`. For each, develop's guard gives the same allow on the push with the cancelled option and its negation removed. The remaining one, `git push -uo --all --no-a -uo --no-all`, carries `--no-a`, which git refuses as ambiguous, so it runs nothing. ## Local Review Three frontier `local-strict-review` passes ran, the third over the pushed head. Fixed from them: - `--tags --no-tags` was a false allow on develop. It is in the class this change fixes, and it is now read. - The run-time check first used the loose merge test and ignored command position, which denied `gh pr comment "$PR" --body merge` and `echo gh pr merge $PR`. - The cluster reader ignored long value options and `--`, which denied `git commit --mess -an` and `git commit -m x -- -an`. - Rows for `-mm -an`, `-S -an`, `-u -an`, and `--force-wi --no-force`, and the README sentence naming which options a later negation cancels. Declined, with evidence: - Consolidating `_gh_merge_run_time_word` with the commit arm of `_rewritten_git_words`, `_runs_gh_pr_merge` with `_is_gh_pr_merge`, `_commit_cluster_skips_hooks` with `_is_commit_value_option`, and `_gh_merge_attached_value` with `_holds_attached_value` is helper consolidation, left to the lane for #3008. - `_PUSH_NEGATIONS` keeps its prefix floor rather than `_spells_long_option`. Without it, an ambiguous `--no-f`, `--n`, or a non-option word would cancel, and every deny-to-allow flip here is held to exactly what git does. `--no-prune` stays on its existing reading, which differs only for prefixes git refuses. - The exact-word `-n` test stays, though it denies `git commit -m -n`. Dropping it is a deny-to-allow change outside #3025, filed as #3070. Remaining from the third pass, after the two-round edit budget: - `introduced`, filed as #3075: in a double-quoted wrapper body, the outer shell expands a quoted value before the inner shell reads its quotes, so `B="x' --admin '"; sh -c "gh pr merge 5 --squash --body '$B'"` is allowed. Develop allows it too, since it has no run-time check at all, and the existing commit check has the same hole. - `introduced`, filed as #3076: a comment's `$X` after a merge is read as a merge word, a false deny. ## Review Loop Copilot's first round raised three findings, each fixed in 37e6f1e: a merge's run-time `--repo` value was exempt as a quoted value (now denied, the other gh writes filed as #3079), the merge target reading used the loose merge test (now `_runs_gh_pr_merge`), and the `_push_targets` docstring left out `--tags`. Two local passes on that push fixed the README sentence order around the `eval` sentence and the deny message, which now names the repository case. A further local pass found #3080, a flag between `pr` and the write subcommand hiding it, pre-existing and filed. Remaining after that push's two-round edit budget, filed as #3084: the merge deny message and both READMEs give `--body "$BODY"` as the accepted form without the condition that the guard can read the command's quoting. Where `_quote_kept_tokens` cannot align, as beside `echo a"b c"`, that form is denied too, and a `;` the tokenizer fused can let the walk read a later command's word, as in `gh pr merge 1; echo $'a\'b'`, which the existing commit check shares. A push stating the condition (37f8bc9) named the wrong cause in its example, so b357198 reverts it, returning the content to the reviewed and attested f338947 tree. That is the third round on that sentence, so it stops there. ## Merge of Develop de87b0d merges `origin/develop` at f654eb6, which carries #3082, #3087, and #3066, as a merge commit. The one conflict, the Claude README's guard bullet, keeps develop's alias and shell-environment sentences and this branch's sentences. The differential above was re-run with develop's new guard as the base and gives the same counts, every flip in the same class. The gates pass on the merged head, `test_install.py` with 162 tests. A fresh frontier local pass over the merged branch diff found no false allow this branch introduces. It found false allows develop shares, filed or noted below, and a process substitution over-deny already filed as #3073. Its point that the README's run-time `--repo` sentence could read as general is declined: it follows the merge sentences and says "too", other gh writes are #3079, and that sentence has had its three rounds. ## Filed Rather Than Widened Here - #3067: a gh short-option cluster ending in `-R`, such as `-dR stranger/example`, is not read as a target. `gh pr merge 5 -sb "$X"` is over-denied by the same missing cluster reading. - #3068: `_is_commit_value_option` reads `-mm` and `-Sm` as taking the next word, so `git commit -mm "$X"` is allowed. - #3069: a run-time word where gh, `pr`, or `merge` goes hides a merge, with or without a literal `--admin`. - #3070: the exact `-n` over-deny above. - #3073: a process substitution such as `--body-file <(cat body.md)` is read as the command's own words, on the merge and the commit checks. - #3074: words `xargs` appends at run time, as in `printf -- --admin | xargs gh pr merge 5`. - #3080: a flag between `pr` and the write subcommand hides the write from the cross-owner check, as in `gh pr -R stranger/example merge 5`. - #3084: the quoting condition and the fused-separator walk above. - #3089: `GH_REPO` is no target the cross-owner check reads. - #3090: a command string `env -S` runs is not read. - #3091: run-time words of `cmd` (`%F%`) and PowerShell (`@a`) are not read as run-time words. - #2177 (comment): a commit run through an alias, as in `git -c alias.ci=commit ci -n -m x`, is not read for the bypass flags. - #3079: a run-time `--repo` value on a gh write other than a merge, as in `gh issue comment 5 --repo "$T" --body hi`, from Copilot's finding on this pull request. Closes on promotion: #2978, #3015, #3006, #3004, #3025 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
…heck to Main (#3092) - #3077 makes `gh-write-guard` read options it read too narrowly before: a `--no-verify` cut short to a prefix git runs, such as `--no-veri`, a commit's `-n` inside a short-option cluster such as `-an`, read letter by letter so a value letter such as `-m` takes the rest of its word, a run-time word (`$`, backtick, or brace) among a `gh pr merge`'s words, which fails closed since it may expand to `--admin`, except an option value word splitting cannot split such as `--body "$BODY"`, and a merge whose boolean `-m` comes before a `-R` or `--repo`, now read for its target. Those verdicts each go from allow to deny. It also lets a later negated push option cancel an earlier one, as git does, for `--force`, `--delete`, `--all`/`--branches`, `--mirror`, and `--tags`, so a push such as `git push --all --no-all origin` gets the verdict the push without either option gets, and it tracks `--force-with-lease` apart from `--force`, since git keeps a lease after `--no-force`. A differential against the previous guard over constructed commands found every deny-to-allow flip in that negation class, and the agent-safety READMEs describe each new reading - #3066 makes the Linux bootstrap loader split `--agents` on commas, drop empty names, refuse an empty result, and refuse `all` beside other names before any action runs, as the Windows loader already does After this merges, the host-safety installer payload changes, so the maintainer runs the installer after promotion. Fixes #2978 Fixes #3015 Fixes #3006 Fixes #3004 Fixes #3025 Fixes #3043 🤖 Generated with [Claude Code](https://claude.com/claude-code)
bootstrap.shpassed--agents all,herdrthrough as--install all herdrand an empty name through as an empty argument, soinstall-agents.shdied late with an unknown-tool error (it treatsalland an empty name as tool names).bootstrap.ps1already refusesallbeside other names and drops empty names, so the Linux loader now does the same, before any action runs.allcompared as a whole name, refused beside other names.Where-Objectfilter reverted.alldiffers between the loaders, tracked in Align the Case of all in the Linux and Windows Agents List Parsing #3065.Fixes #3043
🤖 Generated with Claude Code