Skip to content

the protected-path classifier reads a jq failure as "not protected", so a malformed merge_autonomy_protected_paths would fail open on the deadliest landing class

Id: TD-PPagop-26082320 · Status: resolved · Filed: 2026-08-23 · Resolved: 2026-08-23 · Ref: #733

_landing_is_protected (lib/landing.sh) and its deliberate twin _escape_audit_is_protected (scripts/detect-classifier-escapes.sh) both decide a path with

Terminal window
jq -e --arg p "$path" '
any(.[]; . as $entry | if $entry | endswith("/*") then ($p | startswith($entry[:-1])) else $entry == $p end)
' <<<"$protected_json" >/dev/null 2>&1

That has three outcomes and two return values. jq -e exits 0 on a match, 1 on no match, and 5 when the program raises — which it does for any entry that is not a string, since endswith on a number is a runtime error. The caller cannot tell 5 from 1, so a list like [123, "lib/*"] reads as no path is protected, for every path in the diff.

landing_protected_paths_hit then reports exit 1, “no protected path touched”, and landing_eligible clears gate 4. A pull request editing lib/landing.sh itself would be eligible for an unattended routine landing — risk register item 1 in docs/reviews/2026-08-14-autonomy-investigation.md §7, “a pull request editing the classifier riding the routine tier through the gate it just weakened”, and precisely the fail-open class §7 risk 4 says is converted to fail-closed on the arming path.

The function already has the right vocabulary for this: landing_protected_paths_hit’s own exit 2 means “the answer could not be established”, and landing_eligible turns that into unknown rather than eligible. Only the boolean helper below it cannot express it. Note the contrast with the sibling key: the routine-sources membership test in landing_eligible is spelled ! jq -e … 'index($s) != null', so a jq error there refuses instead.

Not reachable today. agent-cycle.sh’s schema gate (requirement 1b) validates config.json against config.schema.json before any key is read, and the schema declares items: {type: string, minLength: 1} for both the top-level merge_autonomy_protected_paths and its repos[] override — a non-string element is refused with config.merge_autonomy_protected_paths[0]: expected string, got number and the cycle exits 1. scripts/detect-classifier-escapes.sh reads its --config file with no schema gate at all, but it only ever audits landings that a schema-validated config produced. So this is a latent contract defect, not a live hole: the guard that saves it is two files away and nothing states the dependency.

Suggested fix. Give the helper a third answer — distinguish jq’s exit 5 from its exit 1 and let landing_protected_paths_hit return 2 on it, the same “could not be established” it already returns for an unreadable or page-capped changed-file listing. Both implementations must move together, and test/detect-classifier-escapes.test.sh should pin the new verdict the way it already pins the other two. This is a change to the gate’s own error contract, so requirement 8d and acceptance check 8t (docs/IMPLEMENTATION-PIPELINE-SPEC.md) move with it.

Noticed while reviewing PR #727 (agent-ops#724), which made the list configurable and so introduced the first way for its contents to be anything other than the nine literals the old case statement hard-coded.