Skip to content

fix(evals): set aside a denied compound call whose plugin part was then allowed alone - #12373

Merged
kyle-sexton merged 6 commits into
mainfrom
fix/12256-run-validity-recovered-compound
Nov 2, 2026
Merged

kyle-sexton merged 6 commits into
mainfrom
fix/12256-run-validity-recovered-compound

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #12256

Summary

run-validity now sets aside a with-arm denied compound Bash call whose plugin part a later call in the same run ran alone and was allowed, and reports it as a warning (option 2, recorded on the issue). A denial whose plugin part never ran alone still counts.

Fix

  • run-validity.py: split the denied command at ;, &&, || and newlines; drop assignment-only commands, cd, and trailing ls/echo/cat (piped only into head/tail). Exactly one command must remain, naming a path at or under the plugin directory, and a later non-denied call must equal it word for word after quote removal and same-command variable resolution. Commands holding &, ( or ) never qualify.
  • Reported like the plugin-data and tool-results warnings: a "not counted" clause in the summary and the warnings sentence.
  • reading-results.md#denials records the rule as the fourth set-aside kind; evals changelog fragment (patch).

Judgment call: the refinement asked for whitespace-normalized string equality; word matching with variables resolved is used instead, because dropping assignments only means something when the $S/$PD they set are substituted, and the issue's own paths example is recovered only that way. It is no looser: a quoted "/a b" stays one word.

Verification

  • python3 plugins/evals/skills/plugin-eval/scripts/test_run_validity.py: 131 tests OK. The recovered-compound test fails on main's script and passes with the fix; the never-recovered cases (no retry, other arguments, retry before the denial, retry denied, retry still wrapped, two commands left, echo before the plugin part, ls | sh, nothing under the plugin, unresolved $(...), & and (...)) still FAIL.
  • scripts/run-ruff.sh check on both .py files: all checks passed.
  • Saved harness-config: concise rewrite of audit, audit-pass, audit-instructions (rollout slice A) #11564 traces re-scored: after pass 8 -> 6 counted denials, before pass 5 -> 4; both stay INVALID (the remaining denials are reads and $(date)-built calls this rule does not cover).
  • Left out: nothing.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 4 commits November 2, 2026 09:00
…en allowed alone

run-validity counted a denied compound Bash call as a with-arm plugin
denial even when a later call in the same run was its plugin-path part
alone and was allowed, so a state-saving skill whose model wraps the
prescribed script call in assignments, cd or a trailing ls could not
score VALID.

Per the recorded decision (option 2), such a denial is now set aside as
a warning, like the plugin-data and own tool-results denials. The
denied command is split at ;, &&, || and newlines; assignment-only and
cd commands, and trailing ls/echo/cat (piped only into head or tail),
are dropped. Exactly one command must remain, naming a path under the
plugin directory, and a later undenied Bash call must equal it word for
word (quotes removed, same-command variables resolved). A denial never
recovered that way still fails.

Closes #12256

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 2, 2026 14:04
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 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 ✅ Completed 2026-11-02T14:07:57.871066Z 3d5b0dc Draft marked ready
ℹ️ 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.

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 36d460a5e337133c7b1a68a5f6a7f8f2c96467bd: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #12373 (incremental, 089ade4..36d460a)

I found no security issues in this round.

What changed since the last review. This round fixes the two remaining owner-accepted threads. Both fixes only tighten the rule for setting a denial aside.

  • Command substitution. command_segments now refuses the whole command when any word holds $( or a backtick outside single quotes (SUBSTITUTION, run-validity.py#L1624-L1630).
  • Redirects. writes_file now treats a < or > anywhere in a word as a possible write. The only exemptions are 2>&1, >&2, 2>&- and /dev/null.
  • Where the redirect check runs. It now also covers dropped cd and assignment-only commands (#L1680).
  • Docs. The docstring and reading-results.md now state the rule as the code applies it.

What I checked.

  • Command substitution check, traced against shell_tokens.
    • An escaped \$ or \` (outside quotes or inside double quotes) is stored with the ' quote, so it is correctly not treated as a substitution.
    • A $( split by a backslash-newline inside double quotes merges into one double-quoted part, so it is still caught.
    • $"(...)" keeps its $ and its ( in separate parts, so it is correctly not a substitution.
    • An unquoted (, which includes <(, $(( and X=$(…) written outside quotes, is still rejected by NOT_SPLIT.
    • The same refusal applies to the later "alone" call. That can only stop a match; it can never create one.
  • Redirect check, input by input.
    • The no-file exemptions match REDIRECT as a whole word.
    • Each of these is treated as a write and keeps the denial counted: x>/dev/null, >&/path, <, <<<, <<EOF, and an assignment glued to a redirect (X=1>…).
    • A quoted ">" is also treated as a write. That loses a set-aside but never excuses a denial.
  • Fail-closed behaviour. Every new branch can only stop a denial from being set aside.
  • Data flow. Trace text is only tokenized and compared. Nothing passes it to a shell, a subprocess or a file path. The output is an eval validity verdict with no credentials, merge decision or install path behind it, so none of the leak, compromise or charge impacts can be reached.
  • Settled threads. The redirect and substitution threads are resolved by the owner at this head with their lines unchanged. The fixes match the replies, so I am not raising either again.
  • Prior findings. My one earlier post was a clean summary with no findings, so there is nothing to repeat.
  • Trusted paths, trust controls and manifests. No changed file in scope matches a trusted-path glob. No trust control or plugin manifest is touched.
  • Standing instructions. The doc edit narrows a scoring exception and removes no guardrail. I did not consult the instruction exception register.
  • Embedded text. I found no directive aimed at this lane in the PR context or the settled threads.

Round cap: not reached (0 of 3 rounds with findings).

critical-findings: 0

@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: 3d5b0dcb3b

ℹ️ 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".

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-review: 1 inline finding(s) on 3d5b0dcb3baaf5db4394073cf3c1c0a9f5b8a1ce; the summary is in this lane's pull request comment.

claude-lane: claude-review

…nd rule

A recovered compound denial matched words with quotes removed, so an
unquoted glob in the denied part could match a quoted literal in the
later call, and a trailing ls/echo/cat that redirected into a file was
dropped as a wrapper, excusing a denied write into the plugin.

A plugin part left holding an unquoted glob, brace or tilde, or an
unresolved $, no longer qualifies, and a word holding any of those is
compared with its quoting. A trailing command is dropped only when its
redirects name no file (2>&1, /dev/null), as bash_paths treats them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-review: 2 inline finding(s) on 089ade403b5e7cfca4a30319c5b7a33da4c4129a; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 36d460a5e337133c7b1a68a5f6a7f8f2c96467bd: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

claude-review (code-review lane) on 36d460a5e337133c7b1a68a5f6a7f8f2c96467bd, incremental review since 089ade40: no findings.

What I read: every hunk of the incremental diff in all three in-scope files: reading-results.md, run-validity.py and test_run_validity.py. For context I also read the surrounding code in run-validity.py: shell_tokens, shell_words, command_segments, writes_file, plugin_part and recovered_denial. I also read the PR context, the settled threads and my own prior findings. This is round 3 of a cap of 3, and it is not past the cap.

My two earlier findings are fixed, and their threads are settled with no lines changed since.

  • A redirect glued to the word before it (echo x>/p/f). It is fixed in writes_file: a < or > anywhere in a word now counts as a write. The only words exempted are those that fully match REDIRECT with an fd-dup, fd-close or /dev/null target.
    • The cd and assignment-only drop at L1680 now goes through the same check.
    • I traced these forms; each is still treated as a write: &>/p, >|/p, >& /p, X=1>/p, and {}>/p (a tuple word, which the function joins first).
  • A command substitution in a trailing wrapper. It is fixed in command_segments: a $( or backtick in any word part outside single quotes now rejects the whole candidate.
    • Backslash escapes are tokenized with quote ', so \$( and \` are correctly not counted.
    • An unquoted ( is still caught by NOT_SPLIT.
    • The check also covers the later allowed call that recovered_denial compares against.
    • Some inputs are rejected when they need not be, for example "$""(id)". That only loses a set-aside, so it is acceptable.

Tests: the new cases match the code paths they target:

  • the glued redirects, plus the cd and assignment redirects
  • 2>&- staying a warning
  • $(, backticks, $?, $VAR and a single-quoted $(...)

Docs: reading-results.md and the docstring now describe the rule as the code implements it. The doc names 2>&1, >&2 and 2>&-; the code also exempts other fd duplications such as 3>&1. None of those writes a file, so this is not a correctness gap.

Closing issue #12256: both "Done when" criteria are still met, as at the last review. The rule is recorded at reading-results.md#denials. The recovered and never-recovered cases are each covered by a test.

Other checks:

  • No plugin manifest changed in this increment.
  • No .claude/rules/ criteria apply.
  • No embedded instructions were found in the PR context, settled threads or prior findings.

Verification: this lane has no shell, so I ran neither the tests nor ruff. The PR's "134 tests OK" result comes from the owner's thread reply; it is the author's claim and is not verified here.

…pound rule

A redirect glued to the word before it (echo '{}'>/p/state.json) was
not seen, and cd and assignment-only commands were dropped with no
redirect check, so a denied write into the plugin could be excused. A
dropped command now keeps the candidate whenever any word holds a < or
>, other than an fd duplication or close or a /dev/null target.

A $( inside double quotes, or a backtick, in any command of the denied
call, now refuses the candidate; $? and $VAR still pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 923b929 Nov 2, 2026
47 checks passed
@kyle-sexton
kyle-sexton deleted the fix/12256-run-validity-recovered-compound branch November 2, 2026 14:41
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.

fix(evals): decide whether run-validity counts a denied compound call whose plugin part was then allowed alone

1 participant