Skip to content

L82 patch-target classifier: close the fail-open cases found reviewing #92 - #101

Open
githubscum wants to merge 1 commit into
mainfrom
lotor-lane/l82-fail-open-fixes
Open

githubscum wants to merge 1 commit into
mainfrom
lotor-lane/l82-fail-open-fixes

Conversation

@githubscum

Copy link
Copy Markdown
Owner

WO: WO-L82-03 + WO-L82-04 (both in proposals/l82-patch-targets/). Not core: the classifier lives under proposals/, so this is a normal lane PR; it feeds the half of #92 that still goes to a signing sitting.

Addresses: the LIMIT recorded 2026-11-14 in the #92 review: patchApplyTargets fails open. Returning null means "not a patch-apply command, nothing to gate", so every case below was a patch write the self-mod gate could not see.

Fixed (each with a test):

  • shell keywords before the verb: if ...; then git apply x; fi, ! git apply x, { git apply x; }, coproc git apply x, case a in a) git apply x;; esac
  • & as a separator (true & git apply x), without splitting &&, 2>&1, >&, &>
  • |& treated as a pipe, so the verb reading stdin fails closed
  • env -u FOO, env -C dir, and env -S "git apply x" (the split string is scanned like a sh -c body)
  • git global options: --git-dir x, --work-tree x, --namespace x take a value; any other leading flag (-P, --paginate, --bare, --no-optional-locks, --exec-path) is self-contained
  • stdin spellings (-, /dev/stdin, /dev/fd/0, /proc/self/fd/0) fail closed without calling the reader, so readFileSync can't hang
  • a lone ) no longer counts as a patch source (it used to over-gate ( git apply x ))

Tested: node --test test/l82-patch-targets.test.js: 35/35 (was 21). npm test: 1472 tests, 1466 pass, 0 fail, 6 skipped (main 9785d40: 1458). Plus an orchestrator probe of 31 variants the executor never saw. Only the four meant to stay null (echo a & echo b, ls >&2, git status &>/dev/null, git apply --check x) still return null.

Eval: none named. This is R1-style completeness for the gate (a write it can't see), not a v3 granularity change.

What a reviewer should doubt:

  • It's still a regex-and-whitespace tokenizer. Escaped spaces, nested quotes and $'...' aren't parsed. Anything new it misses is still fail-open, and this PR only closes the cases on the list.
  • case WORD in skips exactly one word after case. A pattern-looking token (foo)) before the verb is dropped anywhere in the pre-verb run, not only first. The executor argued this is conservative. I probed it and found nothing that fails open, but I didn't prove it.
  • in and esac are now skipped as keywords at the head of a segment.
  • No KNOWN-LIMITS entry: this closes a defect in a proposal, it isn't a new limit in the product. Say so if you want it numbered anyway.

🤖 Generated with Claude Code

…#92

patchApplyTargets returned null (nothing to gate) for commands that do apply
a patch: shell keywords (if/then, !, {, coproc, case arms), a single `&`,
`|&`, `env -u X`, `env -S "..."`, git global flags (-P, --paginate, --bare,
--git-dir x), and it would read /dev/stdin (can hang). Each now matches with
its targets or fails closed. 14 new tests; full suite 1472/1466 pass/0 fail.

Executor: glm-5.3-flash:cloud (WO-L82-03, WO-L82-04). Orchestrator probe and
review by ike.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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