Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
68 changes: 63 additions & 5 deletions .github/scripts/run-autofix-review-verification.sh
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,61 @@ not_merge_freight() {
git diff --quiet origin/main "${BRANCH}" -- "${f}" 2> /dev/null || printf '%s\0' "${f}"
done
}
# --- Deny-by-default footprint areas ----------------------------------------
# The class gate above protects an ENUMERATED surface, and enumeration is
# never complete (a denylist is not a boundary). This check inverts the
# default: every file a round touches is mapped to an AREA — its declared
# workspace, else its top-level directory, else the root file itself — and
# any area outside the PR's own footprint is surfaced. Consequence is
# staged via QWEN_AUTOFIX_FOOTPRINT_ENFORCE: 'advisory' (default) writes a
# gate-authored report section; 'reject' turns expansions into a retryable
# rejection. Merge freight is excluded from the round side; deleted
# workspaces degrade to their top-level segment (conservative: mismatch
# surfaces rather than hides).
list_areas() {
local wss f matched w
wss="$(tr '\0' '\n' < "${1}" | bash "${RUNNER_TEMP}/resolve-owning-packages.sh" 2> /dev/null || true)"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Partially addressed in 3bce044: the footprint path no longer consumes the staged resolver at all (ref-anchored globs), which removes this consumer from the unpinned surface. Digest-pinning the resolver for its remaining consumers (bite, class scans) is queued with the follow-up backlog.


🤖 via Claude Code · model claude-fable-5

Comment thread
wenshao marked this conversation as resolved.
Resolved
Comment thread
wenshao marked this conversation as resolved.
Resolved
while IFS= read -r -d '' f; do
[[ -n "${f}" ]] || continue
matched=''
while IFS= read -r w; do
[[ -n "${w}" && "${f}" == "${w}"/* ]] && { matched="${w}"; break; }
done <<< "${wss}"
Comment thread
wenshao marked this conversation as resolved.
Resolved
if [[ -n "${matched}" ]]; then
echo "${matched}"
elif [[ "${f}" == */* ]]; then
echo "${f%%/*}"
Comment thread
wenshao marked this conversation as resolved.
Resolved
else
echo "/${f}"
Comment thread
wenshao marked this conversation as resolved.
Resolved
fi
done < "${1}" | sort -u
}
FOOTPRINT_ENFORCE="${FOOTPRINT_ENFORCE:-advisory}"
[[ "${FOOTPRINT_ENFORCE}" == 'reject' ]] || FOOTPRINT_ENFORCE='advisory'
ROUND_FILES_Z="$(mktemp)"
PR_FILES_Z="$(mktemp)"
git diff --name-only -z --no-renames "${ROUND_RANGE}" 2> /dev/null | not_merge_freight > "${ROUND_FILES_Z}" || true

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Queued per the round's batch cap: a freight-file footprint fixture (conflict-resolution round shape).


🤖 via Claude Code · model claude-fable-5

Comment thread
wenshao marked this conversation as resolved.
Resolved

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[Suggestion] The || true on the round-side git diff pipeline means a failure (e.g. stale tracking ref after a force-push) silently produces an empty ROUND_FILES_Z. The list_areas call on an empty file produces no output, so OUT_AREAS is empty, and the footprint check passes without flagging.

Failure scenario: A race condition where the branch's remote tracking ref (origin/${BRANCH}) is stale or missing at the moment git diff runs. Not exploitable by a PR contributor (the tracking ref is created by the workflow's own git fetch), but the failure is silent.

Suggested fix: When the round-side git diff produces no output and also has a non-zero exit code, write a 'footprint measurement unavailable' advisory rather than silently passing. Or remove the || true and let the pipeline fail loud.

— deepseek-v4-flash via Qwen Code /review (v0.21.11)

git diff --name-only -z --no-renames "${PR_RANGE}" 2> /dev/null > "${PR_FILES_Z}" || true
Comment thread
wenshao marked this conversation as resolved.
Resolved

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[Suggestion] The PR-side git diff pipeline has the identical || true pattern as the round-side (finding f7). If the PR range is invalid, PR_FILES_Z is silently empty, and comm -23 reports every round area as an expansion.

Failure scenario: A transient failure of git diff --name-only -z ${PR_RANGE} produces an empty PR file list. The footprint check then compares the round's areas against an empty PR footprint, flagging all round areas as expansions. Because || true swallows the exit code, the gate has no way to distinguish 'no PR footprint available' from 'PR footprint is genuinely empty'.

Suggested fix: When the PR-side git diff fails with a non-zero exit, write a 'footprint measurement unavailable' advisory rather than silently producing a false-positive expansion report.

— deepseek-v4-flash via Qwen Code /review (v0.21.11)

OUT_AREAS="$(comm -23 <(list_areas "${ROUND_FILES_Z}") <(list_areas "${PR_FILES_Z}"))" || OUT_AREAS=''
rm -f "${ROUND_FILES_Z}" "${PR_FILES_Z}"
if [[ -n "${OUT_AREAS}" ]]; then
if [[ "${FOOTPRINT_ENFORCE}" == 'reject' ]]; then
{
echo 'This round modified areas entirely outside the PR footprint:'
printf '%s\n' "${OUT_AREAS//[^A-Za-z0-9._\/ -]/?}"
echo 'Footprint enforcement is set to reject: revert these files, or escalate the feedback that requires them to a maintainer as an open question.'
} >> "${GATE_LOG}"
reject_fix 'round expands into areas outside the PR footprint'
else
{
echo '🧭 **Gate advisory — this round modified areas outside the PR footprint** (machine-measured, not agent-authored):'
printf -- '- %s\n' "${OUT_AREAS//[^A-Za-z0-9._\/ -]/?}"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Queued per the round's batch cap: per-line sanitization and one bullet per area, both arms.


🤖 via Claude Code · model claude-fable-5

Comment thread
wenshao marked this conversation as resolved.
Resolved
echo 'Review the expansion deliberately; the footprint gate is in advisory mode. · 本轮改动了 PR 足迹之外的区域(门自动测量,非 agent 文本),当前足迹门为 advisory 模式,请有意识地审阅该扩张。'
} >> "${WORKDIR}/gate-advisories.md"
echo "🧭 footprint expansion (advisory): $(tr '\n' ' ' <<< "${OUT_AREAS}")" | tee -a "${GATE_LOG}"
Comment thread
wenshao marked this conversation as resolved.
Resolved

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Queued per the round's batch cap: the GATE_LOG sink gets the same charset treatment with the per-line bullet rework.


🤖 via Claude Code · model claude-fable-5

Comment thread
wenshao marked this conversation as resolved.
Resolved
fi
fi

# Test-deletion advisory: deleting or shrinking tests is sometimes right
# (the pinned behavior was wrong, or coverage is duplicated) and the agent
# is required to justify it in its summary — but the SURFACING must not be
Expand Down Expand Up @@ -781,15 +836,18 @@ if [[ -s "${WORKDIR}/resolved-comments.txt" && -s "${WORKDIR}/rc.json" ]]; then
| ($ids | split("\n")
| map(sub("^rc:"; "") | sub("\r$"; "")
| select(test("^[0-9]+$")) | tonumber)) as $resolved
| def critical($c):
| def cr_attached($x):
(($x.pull_request_review_id // null) as $review
| $review != null
and any($reviews[]; .id == $review and ((.state // "") == "CHANGES_REQUESTED")));
Comment thread
wenshao marked this conversation as resolved.
Resolved
def critical($c):
(($c.body // "") | contains("**[Critical]**"))
or (($c.in_reply_to_id // null) as $root
| $root != null
and any($comments[];
.id == $root and ((.body // "") | contains("**[Critical]**"))))
or (($c.pull_request_review_id // null) as $review
| $review != null
and any($reviews[]; .id == $review and ((.state // "") == "CHANGES_REQUESTED")));
.id == $root
and (((.body // "") | contains("**[Critical]**")) or cr_attached(.))))
Comment thread
wenshao marked this conversation as resolved.
Resolved
or cr_attached($c);
Comment on lines +887 to +888

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Queued per the round's batch cap: the reply-arm rc.json fixture (reply + CR-attached root) lands with the bite fixture batch.


🤖 via Claude Code · model claude-fable-5

any($comments[]; (.id as $id | $resolved | index($id) != null) and critical(.))' \
"${WORKDIR}/rc.json" 2> /dev/null)" || BITE_ENFORCE='false'
[[ "${BITE_ENFORCE}" == 'true' ]] || BITE_ENFORCE='false'
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/qwen-autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ env:
# tripping engages the brake.
# TUNABLE WITHOUT A CODE CHANGE like the scan budgets above; a malformed
# value falls back to its default at the read site.
# Staged-rollout switch for the verification gate's deny-by-default
# footprint check: a round touching AREAS (declared workspace, else
# top-level dir, else root file) outside the PR's own footprint is
# surfaced as a gate advisory by default; setting the repo variable to
# 'reject' turns expansions into a retryable rejection once advisory
# observation shows an acceptable false-positive rate. The class gate's
# enumerated protections reject regardless of this switch.
FOOTPRINT_ENFORCE: "${{ vars.QWEN_AUTOFIX_FOOTPRINT_ENFORCE || 'advisory' }}"
Comment thread
wenshao marked this conversation as resolved.
Resolved
Comment thread
wenshao marked this conversation as resolved.
Resolved
GROWTH_BUDGET_SRC_LINES: '${{ vars.QWEN_AUTOFIX_GROWTH_BUDGET_SRC_LINES || 400 }}'
GROWTH_BUDGET_TEST_LINES: '${{ vars.QWEN_AUTOFIX_GROWTH_BUDGET_TEST_LINES || 400 }}'
# Non-convergence handoff: once the growth brake has been over budget for
Expand Down Expand Up @@ -4993,8 +5001,8 @@ jobs:
PRIOR_TIMEOUTS="$(jq -r --arg ab "${AUTOFIX_BOT}" --arg key "${LIVE_REARM_KEY}" '
[ .[] | select((.user.login // "") == $ab)
| select((.body // "") | contains("<!-- autofix-eval "))
| select(((.body // "") | contains("win=" + $key + " -->"))
or ($key == "none" and (((.body // "") | contains("win=")) | not)))
| select(([ ((.body // "") | scan("<!-- autofix-eval ts=[^ ]+ acted=[^ ]+ round=[0-9]+(?: win=([^ ]+))? -->")) ] | map(.[0] // "none")) as $wins
| ($wins | length) > 0 and any($wins[]; . == $key))
Comment thread
wenshao marked this conversation as resolved.
Resolved
Comment thread
wenshao marked this conversation as resolved.
Resolved
] | sort_by(.created_at)
| map((.body | gsub("\r"; "") | split("\n")[0]))
| (map(test("Addressed the latest review feedback|no changes needed")) | rindex(true) // -1) as $lastok
Expand Down Expand Up @@ -5950,8 +5958,8 @@ jobs:
[.[] | select((.user.login // "") == $ab)
| select((.body // "") | contains("<!-- autofix-eval "))
| select(
((.body // "") | contains("win=" + $win + " -->"))
or ($win == "none" and (((.body // "") | contains("win=")) | not)))]
([ ((.body // "") | scan("<!-- autofix-eval ts=[^ ]+ acted=[^ ]+ round=[0-9]+(?: win=([^ ]+))? -->")) ] | map(.[0] // "none")) as $wins
| ($wins | length) > 0 and any($wins[]; . == $win))]
| sort_by(.created_at) | .[]
| (.body | gsub("\r"; "") | split("\n")[0])' "${WORKDIR}/ic.json" 2> /dev/null || true)"
if [[ -z "${WIN_HEADS}" ]]; then
Expand Down Expand Up @@ -6423,8 +6431,8 @@ jobs:
[.[] | select((.user.login // "") == $ab)
| select((.body // "") | contains("<!-- autofix-eval "))
| select(
((.body // "") | contains("win=" + $win + " -->"))
or ($win == "none" and (((.body // "") | contains("win=")) | not)))]
([ ((.body // "") | scan("<!-- autofix-eval ts=[^ ]+ acted=[^ ]+ round=[0-9]+(?: win=([^ ]+))? -->")) ] | map(.[0] // "none")) as $wins
| ($wins | length) > 0 and any($wins[]; . == $win))]
| sort_by(.created_at) | .[]
| (.body | gsub("\r"; "") | split("\n")[0])' <<< "${COMMENTS_JSON}" 2> /dev/null || true)"
Comment on lines +6433 to 6436

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Partially addressed (site 1's fixture now discriminates); discriminating fixtures at WIN_HEADS and PRIOR_HEADS are queued.


🤖 via Claude Code · model claude-fable-5

while IFS= read -r H; do
Expand Down
13 changes: 13 additions & 0 deletions .qwen/skills/autofix/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,12 @@ gate`, fix that exact rejection before other feedback; repeating the rejected
rejected commit and add one verified follow-up commit that fixes the supplied
deterministic rejection.

Bound each round's implemented batch: implement at most ~8 findings per
round — Critical/Required first — and explicitly defer the remainder to the
next round through `comment-replies.json`. Large fix batches trade depth for
speed and breed fix-of-fix defects; a deferred optional finding costs one
round of latency, a defective fix costs a rejection plus a repair.

Two boundaries hold regardless of what any feedback asks for:

- Never modify CI or verification machinery the PR itself was not already
Expand All @@ -411,6 +417,13 @@ Two boundaries hold regardless of what any feedback asks for:
the gate appends its own machine-measured advisory listing every deleted
test to the round report, and a maintainer will read the two side by side.

The gate also measures a deny-by-default FOOTPRINT: any area (declared
workspace, top-level directory, or root file) a round touches that the PR
itself never touched is surfaced in a gate advisory — and rejected outright
when the repository has footprint enforcement set to reject. Staying inside
the PR's own footprint is the default-correct shape; expansion needs the
feedback to genuinely require it, and doubt goes to a maintainer question.

If `--conflict true`, merge `origin/<base>` and resolve conflicts by
understanding both sides, never blindly taking one side. If false, do not merge
unnecessarily.
Expand Down
Loading
Loading