Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 39 additions & 12 deletions scripts/post-review-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1829,13 +1829,20 @@ LOSSY_FAILURE_PROJECTION_INPUT='{"action":"request-changes","pr_number":99,"repo
run_no_projection_test "projection-omits-mixed-sub-agent-failure" \
"${LOSSY_FAILURE_PROJECTION_INPUT}"

# A dimension failure recorded at low is still a dimension failure: severity
# must not make it look like a challenger skip.
LOW_LOSSY_FAILURE_PROJECTION_INPUT='{"action":"request-changes","pr_number":99,"repo":"test-org/test-repo","head_sha":"abcdef0123456789abcdef0123456789abcdef01","body":"Issue","findings":[{"severity":"low","category":"logic-error","file":"internal/foo.go","description":"kept before this fix"},{"severity":"low","category":"sub-agent-failure","file":"N/A","description":"The style-conventions sub-agent did not return findings: timeout"}]}'
run_no_projection_test "projection-omits-mixed-low-sub-agent-failure" \
"${LOW_LOSSY_FAILURE_PROJECTION_INPUT}"

# A skipped/failed challenger retains the dimensional findings; a failed
# safety-critical dimension must still suppress the entire projection.
CHALLENGER_FAILURE_INPUT="$(jq '.findings += [{severity:"low", category:"sub-agent-failure", file:"N/A", description:"challenger time budget", actionable:false}]' <<< "${PROJECTION_INPUT}")"
# dimension, or a failure that names no sub-agent, must still suppress the
# entire projection at any severity.
CHALLENGER_FAILURE_INPUT="$(jq '.findings += [{severity:"low", category:"sub-agent-failure", file:"N/A", description:"The challenger sub-agent did not return findings: time budget: 500s remaining. Using pre-challenger finding set.", actionable:false}]' <<< "${PROJECTION_INPUT}")"
for projection_forge in github gitlab; do
run_projection_test "projection-keeps-findings-with-challenger-failure-${projection_forge}" \
"${CHALLENGER_FAILURE_INPUT}" "${PROJECTION_EXPECTED}" "${projection_forge}"
for failure_severity in info medium high critical; do
for failure_severity in info low medium high critical; do
DIMENSION_FAILURE_INPUT="$(jq --arg severity "${failure_severity}" '.findings += [{severity:$severity, category:"sub-agent-failure", file:"N/A", description:"dimension failed", actionable:false}]' <<< "${CHALLENGER_FAILURE_INPUT}")"
run_no_projection_test "projection-blocks-${failure_severity}-failure-with-challenger-${projection_forge}" \
"${DIMENSION_FAILURE_INPUT}" "${projection_forge}"
Expand Down Expand Up @@ -1903,6 +1910,20 @@ run_disposition_case() {
encoded="${encoded% -->}"
actual="$(printf '%s' "${encoded}" | base64 --decode 2>/dev/null || true)"

# Empty check_jq means expect no projection (used when a finding must
# suppress the ledger, e.g. a non-challenger sub-agent-failure).
if [[ -z "${check_jq}" ]]; then
if [[ ${exit_code} -ne 0 || -n "${marker}" ]]; then
echo "FAIL: ${test_name} — expected no disposition projection"
echo "Actual: ${actual}"
cat "${TMPDIR}/stdout-${test_name}.log"
FAILURES=$((FAILURES + 1))
return
fi
echo "PASS: ${test_name}"
return
fi

if [[ ${exit_code} -ne 0 ]] || ! jq -e "${check_jq}" <<< "${actual}" >/dev/null 2>&1; then
echo "FAIL: ${test_name} — disposition projection mismatch"
echo "Actual: ${actual}"
Expand Down Expand Up @@ -2842,15 +2863,21 @@ run_disposition_case "projection-dismissal-covers-less-severe-row" \
assert_last_result "projection-dismissal-covers-less-severe-row" \
'.findings == null and .action == "comment"'

# Runner safety signals are never covered by a dismissal: they mint, stay in
# the posted result, and the dismissed id stays closed.
for safety_category in protected-path sub-agent-failure; do
run_disposition_case "projection-dismissal-does-not-cover-${safety_category}-row" \
"$(jq -c --arg c "${safety_category}" '.findings[0].category = $c' <<< "$(redismiss_review a.go low)")" \
"${REDISMISS_PRIOR}" "${REDISMISS_KEPT}"
assert_last_result "projection-dismissal-does-not-cover-${safety_category}-row" \
"$(printf '(.findings | length) == 1 and .findings[0].category == "%s" and .findings[0].id != "f_old"' "${safety_category}")"
done
# Runner safety signals are never covered by a dismissal: they mint and stay
# in the posted result. protected-path still writes a projection (dismissed
# id stays closed). A non-challenger sub-agent-failure suppresses the
# projection entirely (#1567).
run_disposition_case "projection-dismissal-does-not-cover-protected-path-row" \
"$(jq -c '.findings[0].category = "protected-path"' <<< "$(redismiss_review a.go low)")" \
"${REDISMISS_PRIOR}" "${REDISMISS_KEPT}"
assert_last_result "projection-dismissal-does-not-cover-protected-path-row" \
'(.findings | length) == 1 and .findings[0].category == "protected-path" and .findings[0].id != "f_old"'

run_disposition_case "projection-dismissal-does-not-cover-sub-agent-failure-row" \
"$(jq -c '.findings[0].category = "sub-agent-failure"' <<< "$(redismiss_review a.go low)")" \
"${REDISMISS_PRIOR}" ""
assert_last_result "projection-dismissal-does-not-cover-sub-agent-failure-row" \
'(.findings | length) == 1 and .findings[0].category == "sub-agent-failure" and .findings[0].id != "f_old"'

# Suppression that empties the findings must not leave a blocking verdict:
# reject and request-changes are downgraded to comment, never posted as-is.
Expand Down
18 changes: 12 additions & 6 deletions scripts/post-review.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2268,10 +2268,14 @@ fi

# Append a machine-readable projection only when every schema-validated finding
# can be represented safely. A lossy projection could turn a failed sub-agent
# into an apparently clean dimension on the next re-review. Low-severity
# challenger failures are non-dimensional and retain the pre-challenger findings.
# A dimension failure the severity filter removed (Sonnet-tier failures are
# recorded at info) must still suppress the projection.
# into an apparently clean dimension on the next re-review. Challenger failures
# are non-dimensional and retain the pre-challenger findings. They are told
# apart by the failed sub-agent's name, which the pr-review skill puts at the
# start of the description ("The challenger sub-agent did not return
# findings: ..."), never by severity. Every other sub-agent-failure, at any
# severity and including one that names no sub-agent, suppresses the
# projection, even when the severity filter removed it (Sonnet-tier failures
# are recorded at info).
#
# The projection is the ledger: every current finding plus every prior
# finding not re-emitted, each with its id, and one {id, status} per prior
Expand Down Expand Up @@ -2310,9 +2314,11 @@ PRIOR_FINDINGS_PROJECTION="$(jq -c --slurpfile unfiltered "${UNFILTERED_RESULT_F
type == "string" and IN(
"protected-path", "provenance-warning", "scope-authorization-implicit"
);
def challenger_failure:
.category == "sub-agent-failure" and
(.description | type == "string" and startswith("The challenger sub-agent did not return findings:"));
def non_dimensional_finding:
(.category | non_dimensional_category) or
(.category == "sub-agent-failure" and .severity == "low");
(.category | non_dimensional_category) or challenger_failure;
def projectable:
(.category | type == "string" and allowed_category) and (.file == "N/A" or (.file | safe_path));
def closed_status: IN("resolved_by_change", "dismissed_by_human");
Expand Down
18 changes: 12 additions & 6 deletions scripts/post-review.src.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1430,10 +1430,14 @@ fi

# Append a machine-readable projection only when every schema-validated finding
# can be represented safely. A lossy projection could turn a failed sub-agent
# into an apparently clean dimension on the next re-review. Low-severity
# challenger failures are non-dimensional and retain the pre-challenger findings.
# A dimension failure the severity filter removed (Sonnet-tier failures are
# recorded at info) must still suppress the projection.
# into an apparently clean dimension on the next re-review. Challenger failures
# are non-dimensional and retain the pre-challenger findings. They are told
# apart by the failed sub-agent's name, which the pr-review skill puts at the
# start of the description ("The challenger sub-agent did not return
# findings: ..."), never by severity. Every other sub-agent-failure, at any
# severity and including one that names no sub-agent, suppresses the
# projection, even when the severity filter removed it (Sonnet-tier failures
# are recorded at info).
#
# The projection is the ledger: every current finding plus every prior
# finding not re-emitted, each with its id, and one {id, status} per prior
Expand Down Expand Up @@ -1472,9 +1476,11 @@ PRIOR_FINDINGS_PROJECTION="$(jq -c --slurpfile unfiltered "${UNFILTERED_RESULT_F
type == "string" and IN(
"protected-path", "provenance-warning", "scope-authorization-implicit"
);
def challenger_failure:
.category == "sub-agent-failure" and
(.description | type == "string" and startswith("The challenger sub-agent did not return findings:"));
def non_dimensional_finding:
(.category | non_dimensional_category) or
(.category == "sub-agent-failure" and .severity == "low");
(.category | non_dimensional_category) or challenger_failure;
def projectable:
(.category | type == "string" and allowed_category) and (.file == "N/A" or (.file | safe_path));
def closed_status: IN("resolved_by_change", "dismissed_by_human");
Expand Down
Loading