diff --git a/.changes/pr-pipeline/fix-workflow-staged-route-fail-1161edd2.md b/.changes/pr-pipeline/fix-workflow-staged-route-fail-1161edd2.md new file mode 100644 index 00000000000..5c051456eef --- /dev/null +++ b/.changes/pr-pipeline/fix-workflow-staged-route-fail-1161edd2.md @@ -0,0 +1,9 @@ +--- +bump: patch +--- + +### Fixed + +- route workflow-staged to a failing status, not needs-human + + A resolve-conflicts stop on workflow-staged now ends in a failing pr-unblock/conflict status and the lane-stopped comment instead of needs-human. The merge carries the pull request's own .github/workflows/ changes together with the base's, which the lane token cannot push, and nothing in it is a person's decision, so a session merges main by hand. escalation-routes.json routes it fail, and the stopping check skips lane-stopped. clear-escalations.mjs still lifts a workflow-staged label an older lane run set, on the same evidence as before. diff --git a/.github/scripts/pr-merge/clear-escalations.mjs b/.github/scripts/pr-merge/clear-escalations.mjs index 302a9882875..978dda84b01 100755 --- a/.github/scripts/pr-merge/clear-escalations.mjs +++ b/.github/scripts/pr-merge/clear-escalations.mjs @@ -29,11 +29,13 @@ // review, other lanes) are not someone speaking; an App marker is judged // by the rule above instead. // - Every recorded reason no longer holds at the current head: -// workflow-staged main changed nothing under .github/workflows/ -// since its merge base with the head, so merging -// main into the head stages no workflow change; -// or a trusted move (below) and the head -// contains main as it was at the escalation +// workflow-staged (a label set before escalation-routes.json +// routed it `fail`) main changed nothing under +// .github/workflows/ since its merge base with +// the head, so merging main into the head stages +// no workflow change; or a trusted move (below) +// and the head contains main as it was at the +// escalation // unresolved-conflict, GitHub reports the PR mergeable: no conflict // protected-path-conflict is left to resolve // feedback-protected-path the PR changes nothing under .github/workflows/ diff --git a/.github/scripts/pr-merge/clear-escalations.test.mjs b/.github/scripts/pr-merge/clear-escalations.test.mjs index b3580232f23..58c3537a70b 100644 --- a/.github/scripts/pr-merge/clear-escalations.test.mjs +++ b/.github/scripts/pr-merge/clear-escalations.test.mjs @@ -261,6 +261,7 @@ test("a reason a person decides is never cleared", async () => { // stopped on and on a new one alike: a lane posts a pr-unblock/* status on a // head only when it stops there or clears its own failure, so a new head // carries nothing that proves the cause gone or fails it in the label's place. +// unresolved-conflict and workflow-staged keep their own repository-state check. test("a label for a reason now routed to a failing status: fix-ci comes off on a red head, others stay after the head moves", async () => { for (const reason of ["ci-fix-escalated", "ci-fix-round-cap"]) { const atHead = commented(BOT, escalationBody(reason).replaceAll(KEY, HEAD), "2026-10-18T10:00:05Z"); @@ -269,7 +270,7 @@ test("a label for a reason now routed to a failing status: fix-ci comes off on a assert.equal(w.writes().at(-1)?.method, "DELETE", reason); assert.match(w.writes()[0].body.body, new RegExp(`\`${reason}\``)); } - const others = Object.keys(ROUTES).filter((reason) => escalationRoute(reason) === "fail" && escalationActivity(reason) !== "fix-ci" && reason !== "unresolved-conflict"); + const others = Object.keys(ROUTES).filter((reason) => escalationRoute(reason) === "fail" && escalationActivity(reason) !== "fix-ci" && !["unresolved-conflict", "workflow-staged"].includes(reason)); assert.ok(others.includes("feedback-not-landed") && others.includes("unexpected-path-staged")); assert.ok(!others.some((reason) => escalationActivity(reason) === "review-dependency"), "every review-dependency stop holds for a person"); for (const reason of others) { diff --git a/.github/scripts/pr-unblock/escalation-routes.json b/.github/scripts/pr-unblock/escalation-routes.json index 657b2f5f399..29b43601d3c 100644 --- a/.github/scripts/pr-unblock/escalation-routes.json +++ b/.github/scripts/pr-unblock/escalation-routes.json @@ -1,6 +1,6 @@ { "protected-path-conflict": { "activity": "resolve-conflicts", "route": "hold", "why": "a conflicted path is a workflow, submodule config or a settings file, which the lane does not resolve" }, - "workflow-staged": { "activity": "resolve-conflicts", "route": "hold", "why": "the merge stages a change under .github/workflows/, which the lane does not push" }, + "workflow-staged": { "activity": "resolve-conflicts", "route": "fail", "why": "the merge stages the pull request's own .github/workflows/ changes together with the base's, which the lane token cannot push, so a session merges main by hand" }, "unexpected-path-staged": { "activity": "resolve-conflicts", "route": "fail", "why": "the conflict resolution changes a path outside the conflicted ones, which the lane does not push" }, "repeat-cap": { "activity": "resolve-conflicts", "route": "fail", "why": "the lane has resolved conflicts on this branch as many times in a row as its cap allows" }, "unresolved-conflict": { "activity": "resolve-conflicts", "route": "fail", "why": "the lane could not resolve every conflict" }, diff --git a/.github/scripts/pr-unblock/report-escalation.test.sh b/.github/scripts/pr-unblock/report-escalation.test.sh index d380eb39be2..c887a7516b7 100755 --- a/.github/scripts/pr-unblock/report-escalation.test.sh +++ b/.github/scripts/pr-unblock/report-escalation.test.sh @@ -132,19 +132,21 @@ context_of() { if [[ $activity == resolve-conflicts ]]; then echo pr-unblock/conflict; else echo "pr-unblock/$activity"; fi } -# The routes: a person only for SAFETY (a path the lane token may not push, -# supply-chain trust) or a question only a person answers (intent, design, +# The routes: a person only for SAFETY (a path the lane would have to resolve +# or push, supply-chain trust) or a question only a person answers (intent, design, # security, a person's own thread or hold), and every review-dependency stop, # whose failing status would be per head while the merge marker comes from the -# lane's own re-run; every other stop is a failing status and no label. -HOLD_REASONS=(protected-path-conflict workflow-staged conflict-patch-protected-path +# lane's own re-run; every other stop is a failing status and no label, +# workflow-staged included: the merge is not the lane's to push, but nothing +# in it is a person's decision, so a session merges main by hand. +HOLD_REASONS=(protected-path-conflict conflict-patch-protected-path feedback-protected-path feedback-round-cap feedback-uncertain feedback-disputed feedback-question-intent feedback-question-design feedback-question-security dependency-round-cap dependency-invalid dependency-fix-not-landed dependency-config-unreadable dependency-files-truncated dependency-control-uncited dependency-security-close dependency-escalate dependency-fix-refused dependency-workflow-unpinned ci-fix-protected-path ci-fix-weaken-required) -FAIL_REASONS=(unexpected-path-staged repeat-cap unresolved-conflict conflict-patch-invalid conflict-patch-not-applied +FAIL_REASONS=(workflow-staged unexpected-path-staged repeat-cap unresolved-conflict conflict-patch-invalid conflict-patch-not-applied feedback-not-converging feedback-verifier-open feedback-not-landed feedback-invalid feedback-partial feedback-incomplete feedback-stood-open feedback-unadjudicated feedback-untaken-threads feedback-publish-failed ci-fix-round-cap ci-fix-empty ci-fix-invalid ci-fix-not-applied ci-fix-escalated) @@ -291,24 +293,24 @@ check "unknown mode: no gh call" '' "$(cat "$STUB/calls")" # The role label resolves from the base tracker config, not from the workspace root. setup '[]' '[]' '{"config":{"role_labels":{"human-gated":"status: blocked-human"}}}' printf '{"config":{"role_labels":{"human-gated":"from-head"}}}' >"$STUB/ws/.work-item-tracker.json" -run workflow-staged +run protected-path-conflict check "role label: exit 0" 0 "$RC" has "role label: label from config" 'labels[]=status: blocked-human' "$STUB/calls" has "role label: comment names it" 'remove the `status: blocked-human` label' "$STUB/bodies" check "role label: workspace-root config ignored" 0 "$(grep -c from-head "$STUB/calls" || true)" setup '[]' '[]' '{"config":{"role_labels":{"autonomous-eligible":"go"}}}' -run workflow-staged +run protected-path-conflict has "role label: absent role defaults to needs-human" 'labels[]=needs-human' "$STUB/calls" setup '[]' '[]' '{not json' -run workflow-staged +run protected-path-conflict check "role label: unparsable config fails" 1 "$([[ $RC -ne 0 ]] && echo 1 || echo 0)" check "role label: unparsable config writes nothing" 0 "$(writes)" for entry in false null 7 '""' '["needs-human"]'; do setup '[]' '[]' "{\"config\":{\"role_labels\":{\"human-gated\":$entry}}}" - run workflow-staged + run protected-path-conflict check "role label: present entry $entry fails" 1 "$([[ $RC -ne 0 ]] && echo 1 || echo 0)" check "role label: present entry $entry makes no gh call" '' "$(cat "$STUB/calls")" done @@ -539,7 +541,7 @@ check "clear: an activity the table does not route fails" 1 "$([[ $RC -ne 0 ]] & check "clear: an unknown activity makes no gh call" '' "$(cat "$STUB/calls")" # Never touches the branch: no git, no contents API, no write outside the PR's issue. -for reason in workflow-staged ci-fix-escalated; do +for reason in protected-path-conflict workflow-staged; do setup '[]' "$(comment ''$'\nold' 'melodic-automation-lanes[bot]' Bot 9)" run "$reason" check "$reason: never runs git" 0 "$(grep -c '^git' "$STUB/calls" || true)" diff --git a/docs/conventions/pr-pipeline/README.md b/docs/conventions/pr-pipeline/README.md index 630070fb8b5..15086552520 100644 --- a/docs/conventions/pr-pipeline/README.md +++ b/docs/conventions/pr-pipeline/README.md @@ -582,7 +582,8 @@ activity in a trailer. A verdict is bound to the commit it judged and is not reu A `pr-unblock` run that stops ends on the route [`escalation-routes.json`](../../../.github/scripts/pr-unblock/escalation-routes.json), the one routing table, gives its reason; `report-escalation.sh` reads it. Route `hold` is for a reason only -a person settles: a path the lane token may not push or a supply-chain refusal (SAFETY), an intent, +a person settles: a path the lane would itself have to resolve or write that its token may not +push, or a supply-chain refusal (SAFETY), an intent, design or security question, a person's own thread or hold, a finding no adjudicator may judge (a security-review or CRITICAL one), or any `review-dependency` stop: its failing status would be per head, and the merge gate's head-bound `verdict=merge` marker comes from the lane's own re-run, so only the label @@ -592,6 +593,9 @@ no label, a failing commit status on the head the activity gated (`pr-unblock/co `resolve-conflicts`, `pr-unblock/` otherwise; `report-stop-status` posts it), and one lanes App comment per activity (marked ``, naming the run) that the next stop edits in place. The stopping job's check skips `lane-stopped`. +`workflow-staged` routes `fail` as a capability limit: the merge carries the PR's own +`.github/workflows/` changes together with the base's, which the lane token cannot push, and +nothing in it is a person's decision, so a session merges main by hand. A select job's stop (a cap, or a conflict no model can resolve) is final for its head. A stop after a model turn (the push, reply or verdict job's) is retried on the same head by the activity's dispatcher, under the cap it already keeps: `limit-stops-per-head` for @@ -628,7 +632,7 @@ head: | Reason | Cleared when | |---|---| -| `workflow-staged` | main changes nothing under `.github/workflows/` since its merge base with the head; or a trusted move (below) took the head off the resume key and the head contains main as it was when the lane escalated | +| `workflow-staged` (a label set before it routed `fail`) | main changes nothing under `.github/workflows/` since its merge base with the head; or a trusted move (below) took the head off the resume key and the head contains main as it was when the lane escalated | | `unresolved-conflict`, `protected-path-conflict` | GitHub reports the PR mergeable | | `ci-fix-round-cap`, `ci-fix-empty`, `ci-fix-invalid`, `ci-fix-not-applied`, `ci-fix-escalated` | a trusted move took the head off the resume key, and at the new head no check other than `ci-status` (which the label itself fails) fails, runs or was cancelled, the latest run of each ended `success`, `neutral` or `skipped`, and one passed | | `feedback-protected-path` | the PR changes nothing under `.github/workflows/` | diff --git a/docs/conventions/pr-pipeline/pr-run-activity.md b/docs/conventions/pr-pipeline/pr-run-activity.md index 6938294b860..0b56c8d5bc6 100644 --- a/docs/conventions/pr-pipeline/pr-run-activity.md +++ b/docs/conventions/pr-pipeline/pr-run-activity.md @@ -866,11 +866,11 @@ stops for a hold only at the push job's label and draft re-read. Every path and | Clean merge, committed and pushed | push | `clean-merge` on `resolve-conflicts` | empty | success `apply-conflict-patch` | | A later merge reaches another tree | model call or push | none | empty | failure | | Head moved since the select job | push | `superseded-sha` | empty | neutral `apply-conflict-patch` | -| Empty patch, or a conflicted path left with markers | push | `awaiting-human` | `unresolved-conflict` | neutral `apply-conflict-patch` | +| Empty patch, or a conflicted path left with markers | push | `lane-stopped` | `unresolved-conflict` | neutral `apply-conflict-patch` | | The scan refused the model's output (leak-scan block, oversize patch) | conflict-scan-refusal | none | `unresolved-conflict` | failure `resolve-conflicts` | -| A model edit outside the conflicted set | push | `awaiting-human` | `unexpected-path-staged` | neutral `apply-conflict-patch` | +| A model edit outside the conflicted set | push | `lane-stopped` | `unexpected-path-staged` | neutral `apply-conflict-patch` | | A model edit a refusal names | push | `awaiting-human` | `conflict-patch-protected-path` / `conflict-patch-invalid` | neutral `apply-conflict-patch` | -| A `.github/workflows/` change that is not the base's own | push | `awaiting-human` | `workflow-staged` | neutral `apply-conflict-patch` | +| A `.github/workflows/` change that is not the base's own | push | `lane-stopped` | `workflow-staged` | neutral `apply-conflict-patch` | | Hold label or draft set during the run | push | `awaiting-human` | empty | neutral `apply-conflict-patch` | | Resolved, committed and pushed | push | none | empty | success `apply-conflict-patch` |