Repository navigation
feat(criteria): opt-in match_on: simple_commands for command_executed - #270
CarlesUIPath wants to merge 3 commits into
Conversation
A pattern can now match each simple command the shell runs instead of the raw Bash text, so a heredoc body, echo string or comment no longer counts as running a command. Heredoc bodies dropped (unquoted: substitutions kept; fed to a shell: parsed), $(...)/backticks/sh -c recursed, leading timeout/sudo/nohup/nice/exec/command/xargs/find -exec/stdbuf/time wrappers stripped; assignments and env stay visible. PowerShell/cmd calls and text that cannot be split fall back to raw matching, noted in the details. Matches count per simple command. Default behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…c, keeps quoted < > as words, treats unwrapped PowerShell as non-POSIX Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… error falls back to raw - The heredoc mark is a private-use code point, not `__HEREDOC_<n>__`: a literal `__HEREDOC_0__` word in agent text raised IndexError (score 0.0, early stop disarmed) or fed a real heredoc body to the wrong command. A text that holds one of the splitter's own marks (U+E000-U+E007, U+E0FF) is not split; other private-use code points (Codex citation marks) are words. - Any exception from the splitter falls back to raw matching, logged and named in the details (`splitter error <type>`), instead of failing the check. - A heredoc fed to a shell behind assignments or `env` (`X=1 bash <<EOF`, `env -u Y sh -s <<EOF`) is parsed as a script. - Wrapper and keyword stripping walks an index: it was quadratic in the run length. - One `-c` detector: command_text normalization uses shell_commands.command_flag_index and looks_like_shell (same open `*sh` test as before); simple_commands' allowlist gains yash and fish. The non-POSIX name regex is built from NON_POSIX_SHELLS. - command_pattern / exclude_pattern / match_on descriptions cover simple_commands; piped stdin into a shell is documented as not parsed. CE036 cases for simple_commands. Replay of 16,936 stored evaluations: default match_on unchanged (0 diffs); opt-in set 0 P->F, 21 F->P (as before); crash scan of 146,745 calls: 0 exceptions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude finished @CarlesUIPath's task in 1m 14s —— View job Code Review in Progress
|
uipreliga
left a comment
There was a problem hiding this comment.
Review: coder_eval — pr:270 (8 files) axis:1-8
Scope: pr:270 (8 files) axis:1-8 · branch feat/match-on-simple-commands (pr-270) · 3df13d2 · 2026-11-25T20:34Z · workflow variant
Change class: complex — adds a new shell tokenizer/parser (heredocs, substitutions, wrappers) and a new opt-in criterion matching mode that changes grading semantics
PR #270 is a well-contained opt-in feature (it is additive, the default command_text mode does not change, and type safety, architecture and security are strong), but match_on: simple_commands can still pass a max_count: 0 guard for a forbidden command when it falls back to raw text with an anchored pattern, or when it reads 1<<3 arithmetic as a heredoc, and the schema description and guide teach patterns that miss common forms, so fix these score-changing gaps before you merge.
Summary
| Axis | Score | 🔴 | 🟠 | 🟡 | 🔵 | Top Issue |
|---|---|---|---|---|---|---|
| 1. Code Quality & Style | 9.2 / 10 | 0 | 0 | 1 | 3 | High cyclomatic complexity in _matching_commands and new shell lexer functions |
| 2. Type Safety | 9.9 / 10 | 0 | 0 | 0 | 1 | Tri-state return (tuple |
| 3. Test Health | 9.4 / 10 | 0 | 0 | 1 | 1 | The shell splitter's fail-safe and quoting branches have no tests: depth limit, unterminated heredoc and backtick, single-quoted ')' in $(...), stray backtick in a heredoc body, shlex error, bare bash -c |
| 4. Security | 9.8 / 10 | 0 | 0 | 0 | 2 | Common shell forms (bash -euo pipefail -c, here-string to a shell, sh -c --, exec -a) are not unwrapped, and the guide does not list them |
| 5. Architecture & Design | 9.9 / 10 | 0 | 0 | 0 | 1 | Public guide names internal systems (studio-web, internal tickets) and leaves out the built-in agents |
| 6. Error Handling & Resilience | 8.4 / 10 | 0 | 1 | 1 | 1 | Raw-text fallback in match_on: simple_commands applies an anchored per-command pattern to the whole call, so max_count: 0 guards fail open |
| 7. API Surface & Maintainability | 9.5 / 10 | 0 | 0 | 1 | 0 | match_on field description says echo strings are not commands, but an unanchored pattern still matches an echo or printf string, so a max_count: 0 guard fails on a mention |
| 8. Evaluation Harness Quality | 9 / 10 | 0 | 0 | 2 | 0 | Unquoted arithmetic shift ((( x = 1<<3 ))) is read as a heredoc and swallows the rest of the script silently, with no fallback note |
Overall Score: 9.4 / 10 · Weakest Axis: Error Handling & Resilience at 8.4 / 10
Totals: 🔴 0 · 🟠 1 · 🟡 6 · 🔵 9 across 8 axes.
Blockers
- [Axis 6] Raw-text fallback in match_on: simple_commands applies an anchored per-command pattern to the whole call, so max_count: 0 guards fail open (
src/coder_eval/criteria/command_executed.py:171) —_simple_command_textssends every call it cannot classify or split to rawcommand_textmatching:if _NON_POSIX_PREFIX.match(cmd_text) or _POWERSHELL_ENV.search(cmd_text): return _NOT_POSIX(line 167) andexcept ShellSplitError: return _UNPARSEABLE(lines 171-172). The patterns written for simple_commands are anchored. The guide's own example (docs/TASK_DEFINITION_GUIDE.md:1075) iscommand_pattern: "^(\\S*/)?uip (maestro )?flow debug\\b"withmax_count: 0. The pattern is compiled with re.DOTALL and without MULTILINE, so on the raw text^matches only at the start of the whole call. A forbidden command later in the call does not match, and the guard passes. I ran the real checker with that criterion on three inputs. All three gave score 1.0, and live_verdict gave 'undecided', so early stop did not fire. The inputs were: (1)echo 'On Windows run: $env:UIPATH_URL=x'; uip flow debug x, (2)cat <<'EOF' > README.md\nSet $env:UIPATH_URL first\nEOF\nuip flow debug x, (3)echo $'it\\'s' && uip flow debug x. Bash accepts the ANSI-C quote in (3), but the single-quote branch at shell_commands.py:140 raises 'unterminated quote'. The only notice is one line in the details of a passing criterion (1 call(s) matched on raw text (1 not POSIX shell)). This contradicts contracts.md:150, which says a parse failure "never turns a match into a miss without notice". Fix: when a call falls back, match the pattern per logical line or per;/&&/|segment of the raw text (or with re.MULTILINE), so an anchored pattern still finds a command later in the call. Alternatively, have a call that falls back count as unresolved for amax_countguard. Add a fallback test that uses the documented anchored guard; the current fallback tests (tests/test_command_executed_simple_commands.py:308-356) use only unanchored patterns.
Non-blocking, but please consider before merge
- [Axis 1] High cyclomatic complexity in _matching_commands and new shell lexer functions (
src/coder_eval/criteria/command_executed.py:310) — radon givesCommandExecutedChecker._matching_commandsD(26) at line 280. On origin/main it is C(16), so this PR adds 10 branches. Most of them come from the inlinedif criterion.match_on == "simple_commands":block (lines 310-322). That block repeats the pattern/exclude test that the command_text path does at lines 328-333:if pattern is not None and not any(pattern.search(w) for w in windows): continue/if exclude_re is not None and any(exclude_re.search(w) for w in windows): continue. The logic now exists in 2 places in one function, with different labeling and fallthrough rules (acontinuethat skips the raw path for a tuple, and a fallthrough with a raw_fallbacks increment for a str). Fix: factor out a per-call generator_match_units(cmd, criterion) -> Iterable[(label, haystacks)]. It yields one unit per simple command in simple_commands mode, and one unit (raw + normalized haystacks) otherwise. Then one loop applies pattern/exclude and appends the label. This removes the duplicate loop and brings CC back to about 16. - [Axis 3] The shell splitter's fail-safe and quoting branches have no tests: depth limit, unterminated heredoc and backtick, single-quoted ')' in $(...), stray backtick in a heredoc body, shlex error, bare
bash -c(src/coder_eval/shell_commands.py:84) — The routed coverage report lists these lines of the new module as missing: 84 (raise ShellSplitError("nested deeper than the limit")), 213->220 (heredoc with no closing delimiter), 228-229 and 233 (backslash inside backticks,raise ShellSplitError("unterminated backtick")), 244-249 (single-quote tracking in_closing_paren), 270-271 and 283-284 (except ShellSplitError: pass # prose with a stray backtick or $(), 296-297 (shlex ValueError wrapped), and 386->388 (bash -cwith no script). Most of these decide whether a call is split or falls back to raw text, so they change the score. Example:echo $($($($($($($($(uip x))))))))raises the depth error, and the whole call, heredoc mentions included, is matched raw (verified: details say '1 not splittable into simple commands'). No test trips that gate. Add direct_texts/ShellSplitErrorassertions for each branch. Verified outputs to pin:x=$(echo ')' ; uip a)gives {'x=SUBST','echo )','uip a'};cat <<EOF\nuip flow debug\n(no terminator) gives {'cat'};echooopsraises ShellSplitError;cat > r.md <<EOF\nrunuip a and $(\nEOFgives {'cat'}; 7 nested$(raises ShellSplitError;bash -cgives []. Also add one checker test where the depth limit forces a raw fallback. - [Axis 6] Whole-text
$env:/ non-POSIX heuristic disables splitting for a whole POSIX call that only mentions PowerShell in a heredoc or quoted string (src/coder_eval/criteria/command_executed.py:167) —if _NON_POSIX_PREFIX.match(cmd_text) or _POWERSHELL_ENV.search(cmd_text): return _NOT_POSIXruns_POWERSHELL_ENV = re.compile(r"\$env:\w")(line 47) on the text before it is split. The check therefore also hits heredoc bodies, single-quoted echo strings and comments, which are the mentions this feature exists to ignore. A README heredoc with Windows setup steps ($env:UIPATH_URL) is a plausible case for this Windows-centric product. I confirmed that the bash callcat <<'EOF' > README.md\nSet $env:UIPATH_URL first\nEOF\nuip flow debug xreturns 'not POSIX shell', and the whole call is matched as raw text. The cmdlet check is already narrow: it runs after the split and only onargv[0](line 176:_POWERSHELL_CMDLET.fullmatch(argv[0])). Fix: apply the$env:check the same way, after the split, on command words only (for example, any argv[0] that starts with$env:). Then a mention inside a string or heredoc no longer sends the call to the fallback. Add a test with a quoted or heredoc$env:mention next to a real command. - [Axis 7]
match_onfield description says echo strings are not commands, but an unanchored pattern still matches an echo or printf string, so amax_count: 0guard fails on a mention (src/coder_eval/models/criteria.py:950) — Thematch_onField description is the source for the generated plugin reference (plugins/coder-eval/reference/criteria.md:114), which/coder-eval:taskreads when it writes guards. Lines 950-951 say: "heredoc bodies, comments and " / "echo strings are not commands". This is not true without a qualifier. The splitter keepsechoas the program and the string as its argument, so only an ANCHORED pattern skips it. I ran this on PR head 3df13d2:_check(_turn('echo "never run uip flow debug here"'), command_pattern="uip flow debug", match_on="simple_commands", min_count=0, max_count=0)gives score 0.0 withExamples: ['echo never run uip flow debug here']. With^uip flow debugit gives 1.0. The guide is correct at docs/TASK_DEFINITION_GUIDE.md:1083: "Anecho/printfstring is an argument ofecho, so an anchored pattern (^uip ...) does not match it". The schema description is the copy that is wrong. A task author who trusts it writes an unanchored guard and gets a false fail on any echo, printf orgit commit -mthat names the command. Fix: change the clause to say that a simple command is matched as<program> <args>, so anchor the pattern (^prog ...) to skip echo strings and other arguments. Also state that a substitution shows as__SUBST__. The guide says this but the description does not. Then runmake plugin-reference. Also remove the history wording at line 957, "Other tools' JSON params are matched as before." (CLAUDE.md: a docstring states the contract, not the history). Write "...are matched as withcommand_text" instead. - [Axis 8] Unquoted arithmetic shift (
(( x = 1<<3 ))) is read as a heredoc and swallows the rest of the script silently, with no fallback note (src/coder_eval/shell_commands.py:168) —elif text.startswith("<<", i) and not text.startswith("<<<", i) and (m := _HEREDOC.match(text, i)):together with_HEREDOC = re.compile(r"<<(-?)[ \t]*(?:...|(\\?)([A-Za-z0-9_.\-]+))")(line 41) accepts a digit delimiter. In(( mask = 1<<3 ))\nuip flow debug f.flowthe<<3opens a 'heredoc', and every following line is eaten as its body until a line that is exactly3. Repro: simple_commands gives only('mask = 1',), and a max_count: 0 guard onuip flow debugscored 1.0 with no 'matched on raw text' note.let y=1<<2behaves the same way. This is the one silent-miss shape I found, because every other parse problem is either noted in the details or falls back. Fix: track((...))/letarithmetic context in_scan(skip it as one word, as$((already is at line 197), or reject a delimiter that is all digits. A safer option is to raise ShellSplitError when a heredoc is still open at end of text in a call that has later lines, so the call falls back loudly. Add a regression test. - [Axis 8] The guide's
^(env \\S+ )*prefix does not match its ownenv -u UIPATH_STUDIO_PID uip rpa buildexample, so a guard written from the guide misses it (docs/TASK_DEFINITION_GUIDE.md:1086) — Line 1086 says: '(env -u UIPATH_STUDIO_PID uip rpa build, ...). Wrapper stripping stops at the first assignment orenv, so write^(env \\S+ )*or^(\\w+=\\S* )*before the program if those forms must also match.' I loaded^(env \\S+ )*uip rpa buildthrough yaml.safe_load and tested it with re.search: it gives False for 'env -u UIPATH_STUDIO_PID uip rpa build' and True for 'env X=1 uip rpa build' and 'env -i uip rpa build'. Each repeat of the group needs the wordenvagain, so an option that takes an argument (-u NAME) breaks the chain. The notes cite 43 evaluations of exactly theseenv -u UIPATH_STUDIO_PIDguards. An author who copies this advice into a max_count: 0 guard gets a false pass on the most common env form. Fix: give a prefix that is correct, for example^(env( -u \\S+| -\\S+| \\w+=\\S*)* )?(\\w+=\\S* )*, and verify it with a test in tests/test_command_executed_simple_commands.py that compiles the documented string. The same text is in the model description, so no regeneration of plugins/coder-eval/reference/criteria.md is needed for this line.
Nits
- [Axis 1] Shell identification duplicated in shell_commands.py: two predicates with different basename rules, repeated POSIX-shell -c check, fish in _POSIX_SHELLS (
src/coder_eval/shell_commands.py:336) —looks_like_shell(line 336:return arg0.rsplit("/", 1)[-1].endswith("sh")) splits only on/and does not lowercase or remove.exe._is_posix_shellgoes throughprogram_name(line 68:re.split(r"[\\/]", arg0)[-1].lower()plus.removesuffix(".exe")). SoC:\...\bash.exe -cunwraps in simple_commands mode but not in command_text mode. Makelooks_like_shelluseprogram_name(arg0).endswith("sh"). Also,_POSIX_SHELLSat line 47 lists"fish", but fish is not POSIX (it has no heredocs, and$(...)/&&work only in newer versions). Rename the set to_SH_COMPATIBLE_SHELLS, or remove fish. - [Axis 1] match_on Literal re-spelled in several places without a named alias (
tests/lint/live_verdict_contract.py:78) —match_on: Literal["command_text", "simple_commands"] = "command_text",copies the field type fromCommandExecutedCriterion.match_on(models/criteria.py). Define aMatchOn = Literal[...]alias in models and import it here, so a third mode cannot be added in one place only. - [Axis 1] New test file hand-rolls TurnRecord/CommandTelemetry builders and imports models from submodules (
tests/test_command_executed_simple_commands.py:12) — Lines 12-13from coder_eval.models.results import TurnRecord/from coder_eval.models.telemetry import CommandTelemetrygo against the CLAUDE.md rule "All core models import from coder_eval.models" (both are re-exported there, and 38 test files already import them that way)._turn(line 21) andtest_non_shell_tool_json_is_matched_as_before(line 365) each hand-buildTurnRecord(...CommandTelemetry(... timestamp=datetime.now() ...)), althoughtests/_fixtures/live_criteria.pyalready hasmake_command/make_turnwith a frozen timestamp. The contract cases in the same PR use those helpers. Also, line 396 has a function-localfrom coder_eval.models import SandboxConfig, TaskDefinition; move it to the top-level import. - [Axis 2] Tri-state return (tuple | reason-str | None) dispatched by isinstance (
src/coder_eval/criteria/command_executed.py:155) —def _simple_command_texts(cmd_text: str) -> tuple[str, ...] | str:(line 155) and_simple_commands_of(...) -> tuple[str, ...] | str | None(line 181) return a sentinel reason string (_NOT_POSIX = "not POSIX shell",_UNPARSEABLE = ...,f"splitter error {type(e).__name__}"at line 175) in the same union as the tuple of simple-command texts. Astris also anIterable[str]. If a future caller writesfor unit in units:without theisinstance(units, tuple)check at line 312, the code type-checks and loops over the characters of the reason: each character becomes a 'simple command' and can match a pattern. Today the only caller does the check, so the cost is only future risk. Fix: return a small typed result, for exampleclass _RawFallback(NamedTuple): reason: strwith return typetuple[str, ...] | _RawFallback | None, or a dataclass withcommands: tuple[str, ...] | Noneandfallback_reason: str | None. Pyright then makes a caller narrow the result before it iterates, and the open-ended reason vocabulary (also thedict[str, int]key of_Matches.raw_fallbacks, line 265) is named in one place. Optional: the positional 3-tuples_scan -> tuple[str, list[str], list[tuple[bool, str]]]and_unwrap -> tuple[list[str], list[str], list[list[str]]]in shell_commands.py return twolist[str]items (argv and scripts) that can be swapped with no type error. A NamedTuple would remove that risk too. - [Axis 3] Checker branches added for simple_commands mode have no tests: per-unit counting without a command_pattern, windowing of long simple commands, and the empty or non-string command fallthrough (
src/coder_eval/criteria/command_executed.py:315) — Line 315 isif pattern is not None and not any(pattern.search(w) for w in windows):. Itspattern is Noneside changes how pattern-less caps count. Verified:tool_name='Bash', max_count=1oncd x && ls && pwdgives 0.0 withmatch_on=simple_commands(3 matches) and 1.0 with the default mode (1 match). No test pins this. Line 314,windows = _search_windows(unit), has no test with a simple command longer than_MAX_PATTERN_SEARCH_LEN. Line 193,return None(empty or non-stringcommandin_simple_commands_of), is in the routed coverage-missing list. Add one test for each: a pattern-lessmax_countcap counted per simple command, a pattern found only past 2000 chars of one simple command, and a Bash call withcommand: ""or a non-string command in simple_commands mode. - [Axis 4] Common shell forms (bash -euo pipefail -c, here-string to a shell, sh -c --, exec -a) are not unwrapped, and the guide does not list them (
src/coder_eval/shell_commands.py:345) — The guide tells authors to anchor patterns in this mode. Several common forms leave the program out of first position, or drop the script entirely, so the evaluated agent can run a forbidden command without a match. Results from running_simple_command_texts:bash -euo pipefail -c 'uip flow debug x'-> ('bash -euo pipefail -c uip flow debug x',). The cause is command_flag_index at lines 345-349:if not tok.startswith("-"): return Nonetreats the argument of-o(pipefail) as the first positional word.bash <<< 'uip flow debug x'-> ('bash',):_REDIRECT_OPat line 45 removes<<<and its target, and_feeds_a_script(line 119) handles only heredocs. The guide does not list this case; it lists only stdin piped from another command.sh -c -- 'uip flow debug x'-> ('-- uip flow debug x',).exec -a n uip flow debug x-> ('-a n uip flow debug x',). In each case^(\S*/)?uip ... flow debug\bdoes not match. The equivalentbash -s <<'EOF'form is parsed correctly. Fix: in command_flag_index, skip the argument of-o/+o/-Oand accept--after-c. Treat a<<<target fed to a shell like a heredoc fed to a shell. Giveexecits options in_FLAG_WRAPPERS(-a). Add these cases to the test file. Cross-axis: Axis 8. CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N - [Axis 4] simple_commands runs shlex on the whole command without a size limit, against the HAZARD invariant at line 29; one long quoted word is quadratic (1 MB takes about 9 s) (
src/coder_eval/criteria/command_executed.py:170) — Lines 29-30 say# HAZARD: bounds ReDoS on a large command string. Every search window is at most this long and normalization runs per window, so shlex needs no separate size guard.The new path callsargvs = simple_commands(cmd_text)(line 170) on the full text, which has no limit. It reacheslexer = shlex.shlex(top, posix=True, punctuation_chars=_SEP_CHARS)(shell_commands.py:290). shlex builds each token one character at a time, so cost is quadratic in the length of one word. Measured_splittimes forecho "<n chars>": 125k 0.29 s, 250k 0.84 s, 500k 2.43 s, 1M 9.10 s. Apython3 -c '<512 KB script>'takes 4.8 s. The module docstring (shell_commands.py:10, "Linear in the length of the text") and contracts.md:162 ("The splitter is linear") are wrong for this input. TestLinearTime tests only units with many short words.live_verdictcalls this path synchronously from the early-stop event callback (orchestration/early_stop.py:419), so a large call blocks the event loop once per distinct text.@lru_cache(maxsize=1024)on_simple_command_texts(line 153) also keeps up to 1024 full-size texts for the whole process. Model output limits keep the practical impact low. Fix: above a length limit (for example 64 KB), return a"too long to split"raw-text fallback reason. Or remove the long quoted spans before shlex sees them. Add a long single-word case to TestLinearTime, and correct the two "linear" statements. CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L - [Axis 5] Public guide names internal systems (studio-web, internal tickets) and leaves out the built-in agents (
docs/TASK_DEFINITION_GUIDE.md:1097) — Line 1097,- It reads the recorded command text only, so it works the same on every agent and driver (Claude Code, Codexbash -lcrecords, studio-web)., namesstudio-webas an agent/driver. No such agent or driver exists insrc/coder_eval/(the in-tree agents are Claude Code, Codex, Antigravity, OpenCode, Pi)..claude/notes/contracts.md:132-137cites(UiPath/skills #5069)andlab ticket 526, which are internal trackers. Replacestudio-webwith the in-tree agents, or say "every agent and driver". Remove the internal ticket references from the notes, or make them generic ("a downstream suite"). - [Axis 6] Shell call with a non-string/malformed command element is matched on raw JSON with no fallback note in details (
src/coder_eval/criteria/command_executed.py:192) —_simple_commands_ofre-quotes only an all-string list (if isinstance(raw_command, list) and raw_command and all(isinstance(a, str) for a in raw_command):, line 190). Any other non-string value getsif not isinstance(raw_command, str) or not raw_command: return None(lines 192-193). None is the value for a non-shell call, so_matching_commandsfalls through to JSON matching and does not add the call toraw_fallbacks. I confirmed that a Bash call withcommand: ["bash", "-lc", "uip flow debug", 1]matches asBash({"command": [...]}). The details saymatch_on=simple_commandsbut have nomatched on raw textline, so this fallback is the one case that_raw_fallback_notedoes not report. Fix: return a reason string (for example 'command is not a string or string list') for a shell call with a non-empty, non-string command, so every fallback path is reported the same way.
What's Missing
Parallel paths:
- 🟡 The Codex adapter loses the shell kind before the new matcher sees it, and the PR does not change the adapter.
_record_command_textin src/coder_eval/agents/codex_agent.py:282-295, used by rollout recovery at :2474, removes apowershell -Command/cmd /cwrapper (detected by its own_SHELL_PROGRAMregex at :189) and records only the script, with tool_name "Bash". The live path at :2636 records the full wrapper text. So the same Windows call reaches_simple_commands_ofin two shapes, and simple_commands mode has to guess from the text (_POWERSHELL_ENVover the whole text,Verb-Nounon argv[0]). That guess is the source of the false raw-text fallback. Codex's_SHELL_PROGRAMis also a fourth shell-identification predicate, next tolooks_like_shell,_POSIX_SHELLSandNON_POSIX_SHELLS. Fix at record time: keep the wrapper for non-POSIX shells, or record a shell-kind param that_simple_commands_ofreads, the same way it reads a tool_name that containspowershell. Add one test that sends a rollout-shaped Codex PowerShell record throughmatch_on: simple_commands. (trigger: src/coder_eval/criteria/command_executed.py) (restates: Axis 6: Whole-text$env:/ non-POSIX heuristic disables splitting for a whole POSIX call) - 🔵 Only the generated plugins/coder-eval/reference/criteria.md was updated for the new mode, and it has the echo claim that Axis 7 found to be wrong. The other guard-authoring surfaces were not updated. plugins/coder-eval/reference/task-rubric.md row 1 still says
echo cmdcan pass, and row 3 coversmax_count: 0negatives, but neither givesmatch_on: simple_commandsplus an anchored pattern as the fix. The/coder-eval:taskand/coder-eval:lint-tasksskills (plugins/coder-eval/skills/*/SKILL.md) do not suggest it for must-not-run guards and do not flag amax_count: 0guard that trips on heredoc mentions. The/coder-eval:analyzeskill cannot explain the newmatched on raw text (...)details line. As a result, new guards written with the plugin keep the heredoc false-fail that this PR exists to remove. (trigger: src/coder_eval/models/criteria.py)
Tests:
- 🔵 No test covers
require_success: truetogether withmatch_on: simple_commands.result_statusis set per call, so every simple command in a successful call counts as having succeeded. For example,uip flow pack x; trueanduip flow pack x || echo skipboth credituip flow packeven when that command failed. The guide's simple-commands section does not say that the success status comes from the whole call. Add a test that pins this, and add one line to docs/TASK_DEFINITION_GUIDE.md § Matching simple commands. (trigger: src/coder_eval/criteria/command_executed.py) - 🔵 No test loads the guide's own simple-commands YAML example and prefix advice and runs them against the cases the guide names. A test that loads
^(\\S*/)?uip (maestro )?flow debug\\bfrom YAML, adds the^(env \\S+ )*prefix, and runs them againstenv -u UIPATH_STUDIO_PID uip rpa build, a heredoc mention and a raw-text fallback call would have caught both the broken env prefix and the anchored-guard fail-open on fallback. Add a doc-example test in tests/test_command_executed_simple_commands.py. (trigger: docs/TASK_DEFINITION_GUIDE.md) (restates: Axis 8: The guide's^(env \\S+ )*prefix does not match its ownenv -uexample) - 🔵 The checker tests for simple_commands mode use only tool_name "Bash" and "ExecutePowershellCommand".
_is_shell_calltreats ANY call with acommandparam as shell, and the PR splits those calls as POSIX. That includes OpenCode, Antigravity and Pi shell tools after theircommand_line->commandnormalization, and also an MCP or other tool that has an unrelatedcommandparam. No test runs a non-Bash shell tool name or a non-shell tool with acommandkey through the splitter. Add tests for one in-tree non-Claude shell tool record and for one non-shell tool that has acommandkey. (trigger: src/coder_eval/criteria/command_executed.py)
Nightly pipeline:
- 🟡 The PR does not give the rollout order for the downstream nightly suites. Criterion models use
extra="forbid"(models/criteria.py:103). So a task YAML that addsmatch_on: simple_commandsfails validation with "Extra inputs are not permitted" on every coder-eval release before this one.evaluate <run_dir>from an older install also fails on such a run's recorded config. The PR body shows default-mode parity (16,936/16,936) and opt-in evidence (21 fail->pass, 20 row verdicts). It does not say that the nightly's coder-eval pin must be bumped before any suite opts in, or that the opt-in flips those rows. The flip shows as a step in the evalboard pass-rate trend, which nobody has been told to expect. State the pin-then-opt-in order and the expected trend shift in the PR, or in the contracts.md note. (trigger: src/coder_eval/models/criteria.py)
Harness & Lint Improvements
Static checks (lint / type):
- [ce-lint] CE069 no-str-or-str-sequence-union (new BaseRule
tests/lint/rules/ce069_no_str_or_str_sequence_union.py; add toALL_RULESintests/lint/runner.pyand to[tool.ruff.lint] externalin pyproject.toml). The rule forbids a return or parameter annotation insrc/coder_eval/that puts barestrin one union withtuple[str, ...],list[str],Sequence[str]orIterable[str]. Astris itself anIterable[str], so pyright does not make a caller narrow the value before aforloop. To check it on the AST, flatten theBitOrchain ofFunctionDef.returnsandarg.annotation. A grep of src/ finds exactly two hits, and both are in this PR:_simple_command_texts -> tuple[str, ...] | str(command_executed.py:155) and_simple_commands_of -> tuple[str, ...] | str | None(:181). So the rule starts with zero violations after the fix. The fix it forces: a typed_RawFallback(reason: FallbackReason)NamedTuple whose reasons are a closedLiteral/enum. The fix also removes the| Nonearm. Each non-tuple path must then name a reason, so the silent JSON fallthrough for a malformedcommandelement (command_executed.py:192) becomes a type error and cannot go unreported. Prevents: Tri-statetuple | reason-str | Nonereturn dispatched by isinstance (command_executed.py:155/181, A1/A2/A5/A7). Indirectly also the malformed-command-element fallback with no note in details (command_executed.py:192, A2/A6), because removingNonefrom the union forces a reason on that path. - [ce-lint] CE070 literal-member-set-spelled-once (a whole-tree
@pytest.mark.lintclass intests/test_custom_lint.py, because it reasons over the whole tree). Oversrc/coder_eval/andtests/lint/, the sameLiteral[...]with 2 or more string members may appear in only one place. Every other site imports a named alias (for exampleMatchOn = Literal["command_text", "simple_commands"]incoder_eval.models). I ran an AST scan on the PR head and found 5 duplicated member sets: match_on (models/criteria.py:945 and tests/lint/live_verdict_contract.py:78),error/success/unknown(5 sites in agents/*, models/telemetry.py:398 and live_verdict_contract.py:96),argmax/expected(2), theerror/failed/succeeded/ungradedset (4), anddocker/tempdir(3). All are small enough to fix in the same change, so the rule can start at zero violations. Prevents:match_onLiteral written again in tests/lint/live_verdict_contract.py:78 and models/criteria.py:945 with no shared alias (A1/A7). A third mode cannot then be added in one place only. - [ce-lint] CE072 cyclomatic-complexity ratchet (a whole-tree
@pytest.mark.lintclass that usesradon.complexity.cc_visit; radon is already a runtime dependency). Keep a checked-in baseline (tests/lint/cc_baseline.json) of every function insrc/coder_eval/with radon CC > 20, recorded at its current value. Fail when a function that is not in the baseline goes above 20, or when a baselined function's CC increases. A flat cap is not possible, because about 53 D-or-worse blocks exist today. Ruff's C901 is the wrong tool here: mccabe does not count boolean operators, so it scores_matching_commandsat 14 and_scanat 13 (radon scores them 26 and 31). At any usefulmax-complexityit misses both functions and reports 20 old offenders.PLR0912(max-branches=25) also passes both. The fix is a refactor (the_match_unitsgenerator, splitting_scan), not a# noqa. Per CLAUDE.md, a cap rule sets its limit below the current value, so the baseline only goes down. Prevents:CommandExecutedChecker._matching_commandsgoing from C(16) to D(26) because of the inlined, duplicated simple_commands pattern/exclude loop, and the new_scanat E(31) in shell_commands.py:125 (A1 theme group). - [ce-lint] Widen CE001 (
tests/lint/rules/no_submodule_model_imports.py) fromsrc/totests/. Exempttests/lint/**fixtures that build violating source on purpose, and keep the existingTYPE_CHECKINGskip. Today 34 test files usefrom coder_eval.models.<sub> import. That is a mechanical fix, and this project has no backward-compatibility burden. Do not propose a rule against the hand-builtTurnRecord/CommandTelemetrywithdatetime.now(): 34 test files buildCommandTelemetry(directly, so a rule would be mostly noise. Leave the move to the sharedtests/_fixtures/live_criteria.pybuilders to review. Prevents: tests/test_command_executed_simple_commands.py:12-13 importingTurnRecord/CommandTelemetryfromcoder_eval.models.results/.telemetryagainst the CLAUDE.md rule (A1). - [ce-lint] CE073 executable pattern examples in docs (extend
tests/lint/doc_examples.py, the CE029 extractor). Add a fenced block type, for example```pattern-example, with apattern:line, amatch_on:line, andmatch:/no-match:command lines. CE073 runs each block through the realCommandExecutedCheckerand asserts the result, and it fails when thematch_onsection of docs/TASK_DEFINITION_GUIDE.md has an inline regex that is not in such a block. Use it for the wrapper-prefix advice (^(env \S+ )*must matchenv -u UIPATH_STUDIO_PID uip rpa build; today it does not) and for the echo-string claim (an unanchoreduip flow debugDOES matchecho "... uip flow debug ..."). Thematch_onField description in models/criteria.py:950 is the source of plugins/coder-eval/reference/criteria.md, so make it point at the same verified examples instead of making its own unverified claim. Prevents: Guide prefix^(env \S+ )*that does not match the guide's ownenv -u NAMEexample (TASK_DEFINITION_GUIDE.md:1086, A8). Field description saying echo strings are not commands although an unanchored guard matches them (models/criteria.py:950, A7). - [ce-lint] CE074 no internal tracker references on public surfaces (a doc-surface
@pytest.mark.lintclass). Overdocs/**,plugins/**,.claude/notes/**andsrc/**, forbid cross-repo issue references of the form<Org>/<repo> #<n>for any repo other than this one, and\b(lab )?ticket \d+\b. Both are mechanical. Product names such asstudio-webin an agent list are NOT generically detectable; leave those to the Axis 5 review litmus (grep -ri <internal-system>). Prevents:(UiPath/skills #5069)andlab ticket 526in .claude/notes/contracts.md:132-137 (A5/A7). It does not catchstudio-webat TASK_DEFINITION_GUIDE.md:1097. - [ci-gate] Changed-line branch-coverage gate in
make verifyand CI:pytest --cov-branchand thendiff-cover coverage.xml --compare-branch origin/main --fail-under 95(diff-cover is a new dev dependency, so run the license check first). The repo-wide 80% threshold passed while the new shell_commands.py had 11 uncovered branches. These include the depth-limitShellSplitError(line 84), the unterminated-heredoc and backtick paths, the_closing_parensingle-quote tracking, theexcept ShellSplitError: passat 283-284, and thepattern is Noneper-unit counting side of command_executed.py:315. Most of these branches decide between split and raw fallback, so they change the score. Prevents: Untested splitter fail-safe and quoting branches (shell_commands.py:84 and others, A3). Untested checker branches in simple_commands mode: pattern-less per-unitmax_count, windowing of long units, empty or non-stringcommand(command_executed.py:315/314/193, A3).
Harness improvements (not statically reachable):
- Bash-oracle differential test for
shell_commands.simple_commands. Run each command of a corpus (authored, plus Hypothesis-generated from a small shell grammar) under a realbashin a tmp dir. Use a PATH of stub executables that only log their argv, or atrap DEBUGthat logsBASH_COMMAND. Assert that every program bash runs is the first word of some unit that the splitter returns, or that the splitter raisesShellSplitError. A silent miss must fail the test. Seed the corpus with(( m = 1<<3 ))\nuip ...,let y=1<<2,bash -euo pipefail -c '...',sh -c -- '...',bash <<< '...',exec -a n uip ...,echo $'it\'s' && uip ..., 7-deep$(, and quoted)in$(...). Why not static: The ground truth is what bash actually runs. Only a bash process can supply it, and a lint rule over the splitter source cannot predict how it parses a given input. Prevents: Arithmetic<<3read as a heredoc that silently swallows later lines (shell_commands.py:168, A8). Wrapper forms not unwrapped (shell_commands.py:345, A4/A8). ANSI-C quote mis-split that forces a raw fallback (part of command_executed.py:171, A6). - A 'fallback fails closed' requirement in the CE036 live-verdict contract (tests/lint/live_verdict_contract.py). After the CE069 fix makes the fallback reasons a closed type, add a
fallback_gapscheck. For each reason (not POSIX, unparseable, splitter error, malformed command), it requires aContractCasewith the guide's anchoredmax_count: 0guard (^(\S*/)?uip (maestro )?flow debug\b) and a forbidden command placed after the fallback trigger, withreaches: "fail". Today the fallback cases use only unanchored patterns, so they cannot expose an anchored pattern that is tested against the whole raw text. Seed it with the three reproduced inputs:$env:in an echo string,$env:in a heredoc body, and the ANSI-C quote. Why not static: Fail-open is a semantic property of how the checker applies an anchored regex to text that fell back. Only a replay through the real checker shows it; the AST shows nothing. Prevents: An anchoredmax_count: 0guard that passes on a forbidden command after a raw-text fallback (command_executed.py:171, A6 high). The whole-text$env:heuristic that sends POSIX calls to the fallback (command_executed.py:167, A6). - Adversarial-shape performance budget in
TestLinearTime. Add cases with one long word or one quoted span (echo "<256 KB>",python3 -c '<256 KB script>') and assert a wall-clock or op-count budget. Pair it with an explicit max input length that returns atoo long to splitfallback reason. Also correct the 'linear' claims in the shell_commands.py docstring and in contracts.md:162. Why not static: shlex is quadratic only for certain input shapes, and a cost that depends on input shape shows only at runtime. No lint rule can prove that a call site is bounded. Prevents: Unbounded shlex run on the whole command, which goes against the HAZARD invariant at command_executed.py:29 (about 9 s per 1 MB word and blocks the early-stop event loop) (command_executed.py:170, A4). - Delete before you guard, for shell identification. Collapse
looks_like_shelland_is_posix_shellinto one predicate built onprogram_name(lowercase, split on\and/, remove.exe), and rename or trim_POSIX_SHELLSso it does not listfish. Add one Windows-path case (C:\...\bash.exe -c) that runs in both match modes. No lint rule is proposed: CLAUDE.md prefers removing the sharp edge to guarding it, and after the merge there is no second predicate left to guard. Why not static: This is a deliberate choice not to add a rule. A rule that forbidsrsplit("/", 1)[-1]would guard a pattern the fix deletes, and deciding whether fish counts as POSIX is a semantic call. Prevents: Two shell predicates with different basename rules, and fish listed in_POSIX_SHELLS(shell_commands.py:336/47, A1/A5/A7).
Top 5 Priority Actions
- Stop anchored guards from failing open on fallback (src/coder_eval/criteria/command_executed.py:167-172): match the pattern on each line or each
;/&&/|segment of the raw text, or make a fallback call count as unresolved for amax_countguard; move the$env:check after the split so it runs only on argv[0]; and add a fallback test that uses the guide's anchored^(\S*/)?uip (maestro )?flow debug\bguard on the three verified inputs ($env:in a quoted string,$env:in a heredoc, ANSI-C$'it\'s'). - Stop the silent heredoc swallow in src/coder_eval/shell_commands.py:168 (with
_HEREDOCat line 41): skip((...))andletarithmetic as$((already is at line 197, reject an all-digit delimiter, or raise ShellSplitError when a heredoc is still open at the end of the text; then add a regression test for(( mask = 1<<3 ))\nuip flow debug f.flow, which now passes amax_count: 0guard with no fallback note. - Correct the
match_onField description at src/coder_eval/models/criteria.py:950-957: say that a simple command is matched as<program> <args>, so only an anchored pattern skips echo/printf strings; state that a substitution shows as__SUBST__; replace the history wording 'matched as before'; then runmake plugin-referenceso plugins/coder-eval/reference/criteria.md:114 stops telling/coder-eval:taskto write unanchored guards that fail on a mention. - Replace the broken
^(env \S+ )*prefix advice at docs/TASK_DEFINITION_GUIDE.md:1086 with a prefix that matches the guide's ownenv -u UIPATH_STUDIO_PID uip rpa buildexample, and add a test in tests/test_command_executed_simple_commands.py that compiles the documented string and runs it on that example. - Close the unwrapping and test gaps in src/coder_eval/shell_commands.py: in command_flag_index (line 345), skip the argument of
-o/+o/-Oand accept--after-c; treat a<<<here-string fed to a shell like a heredoc; giveexec -aits option; add tests for the fail-safe branches that have no tests (depth limit at line 84, unterminated heredoc/backtick, single-quoted)in$(...), shlex error, barebash -c), including one checker test where the depth limit forces a raw fallback.
Stats: 0 🔴 · 1 🟠 · 6 🟡 · 9 🔵 across 8 axes reviewed.

command_executed/command_not_executedsearch the raw Bash text, so a grader cannot tell a command that ran from a mention of it (a heredoc body, anechostring, a comment). Suites compensate with long prefix lists and heredoc-skipping regexes (UiPath/skills #5069). This adds an opt-in per-criterion mode that matches each simple command the shell runs.What it does (
src/coder_eval/shell_commands.py, stdlib only, linear time)$(...)/backtick contents; a heredoc fed tosh/bashis parsed as a script.;&&|||&()and newlines withshlex(posix, punctuation_chars). It recurses into$(...), backticks,<(...),sh -c/bash -lcstrings,evalandfind -exec.envoptions stay visible.exclude_patternapplies per simple command.match_on: command_textis unchanged.Evidence (replay of 16,936 stored criterion evaluations, 18 nightlies 2026-11-18..25)
^(\S*/)?uip (maestro )?flow debug\b) and 7 othermax_count: 0guards: 0 pass→fail, 21 fail→pass (20 row verdicts).uip-timings.logconfirms that no forbidden uip call ran in the flipped voice and insights rows.Docs: TASK_DEFINITION_GUIDE § command_executed (quotes are resolved, no spanning, python heredocs dropped, loop variables not expanded, counting). Rationale:
.claude/notes/contracts.md§ Matching on simple commands.Reviewed with
/coder-eval-code-review-wf(8 axes, verify on); its 🟠 and 🟡 findings are fixed in 3df13d2 (heredoc mark out of band, any splitter error falls back to raw, prefixed heredoc-to-shell parsed, one-cdetector, linear wrapper stripping). Quality Gate green: 7149 passed, coverage 93.46%.🤖 Generated with Claude Code