GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge pull request #7806 from developing-today/queue/13485-2176-ci-cl… · developing-today/code@e5a4fdc

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github/workflows
    • main-broken.yml
    • scripts-test.yml
  • scripts
    • classify_failure.py
    • tests
      • test_classify_failure.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/main-broken.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/main-broken.yml
+176-10Lines changed: 176 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ name: main broken watcher
3434
# fleet monitor enqueues the priority packet; no queue write
3535
# happens from this workflow's release job.
3636
#
37+
# Scout leg (#2176, failure-triage design): between filing and any
38+
# remediation spend, a scout step reads the failing jobs' log tails
39+
# (scripts/classify_failure.py) and classifies the breakage --
40+
# quota-or-secret / infra-runner / infra-network / flake-suspect /
41+
# real-regression / unknown -- posting an agent-note:v1 with 3-5
42+
# evidence lines on the breakage issue BEFORE the jules label or a
43+
# fresh fix task is applied. Routing: quota/secret escalates (zero
44+
# fix attempts); infra and flake get one automatic re-run of the
45+
# failed jobs (a repeat escalates as infrastructure; a third flake
46+
# strike files a flake-fix issue); real-regression and unknown take
47+
# the existing Jules/queue routing with the diagnosis attached.
48+
# Authority limits preserved: the scout may re-run once, comment,
49+
# label, and file within the chain's labels; it never edits code,
50+
# merges, touches secrets, or disables workflows.
51+
#
3752
# Dry-run: workflow_dispatch with dry_run=true and a run_id prints
3853
# what WOULD be filed and files nothing.
3954

@@ -84,7 +99,7 @@ jobs:
8499
permissions:
85100
contents: read
86101
issues: write
87-
actions: read
102+
actions: write
88103
pull-requests: read
89104
id-token: write
90105
env:
@@ -149,7 +164,7 @@ jobs:
149164
if [ -n "$existing" ]; then
150165
echo "DRY-RUN: would append a comment with run $run_url to issue #$existing and queue a fresh fix task on it via the pm-dispatch queuer."
151166
else
152-
echo "DRY-RUN: would queue '$title' via the pm-dispatch queuer (which creates the issue) with Breakage-ID: $bid, then apply labels kind/ci, priority/critical, main-broken, queue/queued, status/needs-triage; agent-note holder: chain (filing); then jules label if <3 open main-broken issues carry it."
167+
echo "DRY-RUN: would run the scout classifier first; on a fix route it would queue '$title' via the pm-dispatch queuer (which creates the issue) with Breakage-ID: $bid, on a rerun/escalate route it would file the issue directly with NO fix task queued; then apply labels kind/ci, priority/critical, main-broken, status/needs-triage (queue/queued only when a fix task was queued); agent-note holder: chain (filing); then jules label if <3 open main-broken issues carry it and the scout route is fix."
153168
fi
154169
echo "action=dry" >> "$GITHUB_OUTPUT"
155170
exit 0
@@ -186,6 +201,41 @@ jobs:
186201
} >> "$GITHUB_OUTPUT"
187202
echo "Identified breakage: action=${action} existing=${existing:-none} Breakage-ID=${bid}"
188203
204+
# Scout leg (#2176): classify from the failing jobs' log tails
205+
# BEFORE any remediation spend. This step runs ahead of the
206+
# create-path dispatch on purpose (Codex finding, PR #7806):
207+
# pm-dispatch always enqueues a fix task, so the create dispatch,
208+
# the jules label step, and the append dispatch all gate on the
209+
# scout route; non-fix routes file the issue without a fix task
210+
# (see the file-issue-only step below). Fail-open by design: if
211+
# the classifier errors, route stays empty and the chain behaves
212+
# as before.
213+
- name: Scout - classify the failure from job log tails (#2176)
214+
id: scout
215+
if: steps.identify.outputs.action == 'create' || steps.identify.outputs.action == 'append' || steps.identify.outputs.action == 'dry'
216+
continue-on-error: true
217+
run: |
218+
set -euo pipefail
219+
mkdir -p scout-logs
220+
gh api "repos/$GH_REPO/actions/runs/$RUN_ID/jobs?per_page=100" \
221+
--jq '.jobs[] | select(.conclusion == "failure") | [.id, .name] | @tsv' \
222+
> scout-logs/jobs.tsv || true
223+
while IFS=$'\t' read -r jid jname; do
224+
[ -n "$jid" ] || continue
225+
gh api "repos/$GH_REPO/actions/jobs/$jid/logs" > "scout-logs/$jid.log" 2>/dev/null \
226+
|| echo "log download failed for job $jid ($jname)" > "scout-logs/$jid.log"
227+
done < scout-logs/jobs.tsv
228+
python3 scripts/classify_failure.py --logs-dir scout-logs \
229+
--jobs-manifest scout-logs/jobs.tsv > scout.json \
230+
|| echo '{"classification":"unknown","route":"fix","detail":"classifier error","evidence":[],"jobs":[]}' > scout.json
231+
cat scout.json
232+
{
233+
echo "classification=$(jq -r .classification scout.json)"
234+
echo "route=$(jq -r .route scout.json)"
235+
echo "detail=$(jq -r '.detail // ""' scout.json)"
236+
} >> "$GITHUB_OUTPUT"
237+
jq -r '.evidence[]?' scout.json > scout-evidence.txt || true
238+
189239
# Coin labels if missing (main-broken + jules included: the
190240
# plain `jules` label did not exist before this workflow). Only
191241
# needed on the create path, before the label-apply step.
@@ -199,7 +249,8 @@ jobs:
199249
"main-broken|B60205|main branch full-suite (main tier) is red; remediation chain owns this" \
200250
"queue/queued|7057ff|Has a queued task in the fleet agent queue" \
201251
"status/needs-triage|fbca04|Not yet triaged; needs a first look" \
202-
"jules|57ab5a|Hand this issue to remediation (issue-labeled job in jules.yml, via pm-dispatch)"; do
252+
"jules|57ab5a|Hand this issue to remediation (issue-labeled job in jules.yml, via pm-dispatch)" \
253+
"flake-fix|f9d0c4|Third-strike flake: diagnose and deflake (filed by the main-broken scout leg)"; do
203254
IFS='|' read -r lname lcolor ldesc <<<"$spec"
204255
gh label create "$lname" --repo "$GH_REPO" --color "$lcolor" --description "$ldesc" 2>/dev/null || true
205256
done
@@ -208,46 +259,161 @@ jobs:
208259
# queue/queued + source/dispatch labels pm-dispatch applies).
209260
- name: Queue the breakage via pm-dispatch (creates the issue)
210261
id: dispatch-create
211-
if: steps.identify.outputs.action == 'create'
262+
if: steps.identify.outputs.action == 'create' && (steps.scout.outputs.route == '' || steps.scout.outputs.route == 'fix')
212263
uses: ./.github/actions/pm-dispatch-queue
213264
with:
214265
title: ${{ steps.identify.outputs.title }}
215266
prompt: ${{ steps.identify.outputs.prompt }}
216267
issue: "true"
217268

269+
# Create path, non-fix scout routes: file the breakage issue
270+
# directly WITHOUT queueing a fix task. pm-dispatch has no
271+
# issue-only mode -- its POST always enqueues a fix attempt --
272+
# so a quota/secret or infra/flake breakage must not go through
273+
# it before classification (Codex finding, PR #7806). The scout
274+
# note/routing step below attaches the classification, the
275+
# escalation, or the one automatic re-run to this issue.
276+
- name: File the breakage issue only (scout-gated, no fix dispatch)
277+
id: file-issue-only
278+
if: steps.identify.outputs.action == 'create' && steps.scout.outputs.route != '' && steps.scout.outputs.route != 'fix'
279+
env:
280+
TITLE: ${{ steps.identify.outputs.title }}
281+
BODY: ${{ steps.identify.outputs.body }}
282+
run: |
283+
set -euo pipefail
284+
url=$(gh issue create --repo "$GH_REPO" --title "$TITLE" --body "$BODY")
285+
inum=${url##*/}
286+
{
287+
echo "issue_number=$inum"
288+
echo "issue_url=$url"
289+
} >> "$GITHUB_OUTPUT"
290+
echo "Filed issue #$inum with no fix task queued (scout route: ${{ steps.scout.outputs.route }})"
291+
218292
# The queuer only applies queue/queued + source/dispatch, so this
219293
# workflow's own label set is applied here from its output.
220294
- name: Apply the chain label set to the created issue
221295
if: steps.identify.outputs.action == 'create'
222296
env:
223-
INUM: ${{ steps.dispatch-create.outputs.issue_number }}
297+
INUM: ${{ steps.dispatch-create.outputs.issue_number || steps.file-issue-only.outputs.issue_number }}
298+
ROUTE: ${{ steps.scout.outputs.route }}
224299
run: |
225300
set -euo pipefail
226301
if [ -z "${INUM}" ]; then
227302
echo "::error::pm-dispatch queuer returned no issue_number"; exit 1
228303
fi
229304
gh issue edit "$INUM" --repo "$GH_REPO" \
230305
--add-label "kind/ci" --add-label "priority/critical" \
231-
--add-label "main-broken" --add-label "queue/queued" \
306+
--add-label "main-broken" \
232307
--add-label "status/needs-triage"
308+
# queue/queued asserts a fix task exists; only the dispatch
309+
# path queued one (fix route or fail-open).
310+
if [ -z "$ROUTE" ] || [ "$ROUTE" = "fix" ]; then
311+
gh issue edit "$INUM" --repo "$GH_REPO" --add-label "queue/queued"
312+
fi
233313
echo "Filed issue #$INUM via pm-dispatch: ${{ steps.dispatch-create.outputs.issue_url }}"
234314
235315
- name: Record the filing holder note
236316
if: steps.identify.outputs.action == 'create'
237317
env:
238-
INUM: ${{ steps.dispatch-create.outputs.issue_number }}
318+
INUM: ${{ steps.dispatch-create.outputs.issue_number || steps.file-issue-only.outputs.issue_number }}
239319
TS: ${{ steps.identify.outputs.ts }}
240320
BID: ${{ steps.identify.outputs.bid }}
241321
run: |
242322
set -euo pipefail
243323
gh issue comment "$INUM" --repo "$GH_REPO" \
244324
--body "agent-note:v1 — holder: chain (filing), at $TS. Breakage-ID: $BID"
245325
326+
327+
- name: Scout - post the classification note and route (#2176)
328+
if: (steps.identify.outputs.action == 'create' || steps.identify.outputs.action == 'append') && steps.scout.outputs.classification != ''
329+
continue-on-error: true
330+
env:
331+
INUM: ${{ steps.dispatch-create.outputs.issue_number || steps.file-issue-only.outputs.issue_number || steps.identify.outputs.existing_number }}
332+
CLASS: ${{ steps.scout.outputs.classification }}
333+
ROUTE: ${{ steps.scout.outputs.route }}
334+
DETAIL: ${{ steps.scout.outputs.detail }}
335+
BID: ${{ steps.identify.outputs.bid }}
336+
RUN_URL_OUT: ${{ steps.identify.outputs.run_url }}
337+
WF: ${{ steps.identify.outputs.wf }}
338+
run: |
339+
set -euo pipefail
340+
ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
341+
ev=$(sed 's/^/ /' scout-evidence.txt 2>/dev/null || true)
342+
[ -n "$ev" ] || ev=" (no evidence lines extracted)"
343+
action_line="route: existing Jules/queue fix routing, diagnosis attached."
344+
do_rerun=false
345+
if [ "$ROUTE" = "escalate" ]; then
346+
action_line="escalating: quota/secret - zero fix attempts. Drew: $DETAIL"
347+
elif [ "$ROUTE" = "rerun" ]; then
348+
attempt=$(gh api "repos/$GH_REPO/actions/runs/$RUN_ID" --jq '.run_attempt // 1')
349+
if [ "${attempt:-1}" -lt 2 ]; then
350+
do_rerun=true
351+
action_line="route: one automatic re-run of the failed jobs (this was attempt $attempt)."
352+
else
353+
action_line="escalating: already re-run once (attempt $attempt) and still failing - treat as infrastructure, not a code fix."
354+
fi
355+
if [ "$CLASS" = "flake-suspect" ]; then
356+
# --paginate + count matching comment ids: counting only
357+
# the first page of comments misses strikes on long-lived
358+
# breakage issues (CodeRabbit finding, PR #7806).
359+
strikes=$(gh api --paginate "repos/$GH_REPO/issues/$INUM/comments?per_page=100" \
360+
--jq '.[] | select(.body | test("scout: classification flake-suspect")) | .id' | wc -l | tr -d ' ')
361+
if [ "${strikes:-0}" -ge 2 ]; then
362+
action_line="$action_line Third flake strike for Breakage-ID $BID - filing a flake-fix issue."
363+
fi
364+
fi
365+
fi
366+
gh issue comment "$INUM" --repo "$GH_REPO" \
367+
--body "agent-note:v1 - scout: classification $CLASS, at $ts. Breakage-ID: $BID. Run: $RUN_URL_OUT
368+
Evidence (failing job log tails):
369+
$ev
370+
$action_line"
371+
if [ "$ROUTE" = "escalate" ]; then
372+
gh issue edit "$INUM" --repo "$GH_REPO" --add-label "status/needs-triage" || true
373+
fi
374+
if [ "$do_rerun" = "true" ]; then
375+
# A failed rerun request must not read as a rerun on the
376+
# issue: report it so the breakage gets manual triage
377+
# (CodeRabbit finding, PR #7806).
378+
if ! gh run rerun "$RUN_ID" --repo "$GH_REPO" --failed; then
379+
gh issue comment "$INUM" --repo "$GH_REPO" \
380+
--body "agent-note:v1 - scout: automatic re-run request FAILED for run $RUN_URL_OUT (Breakage-ID: $BID); no rerun happened and no fix task is queued - triage manually." || true
381+
fi
382+
fi
383+
if [ "$CLASS" = "flake-suspect" ] && [ "${strikes:-0}" -ge 2 ]; then
384+
# in:title + exclude this breakage issue itself: the scout
385+
# note just posted carries both "flake-fix" and the
386+
# Breakage-ID in a COMMENT, and issue search covers
387+
# comments -- unfiltered, the breakage issue matches its
388+
# own dedupe lookup and suppresses the flake-fix filing
389+
# (Codex finding, PR #7806).
390+
existing_fix=$(gh issue list --repo "$GH_REPO" --state open \
391+
--search "flake-fix in:title Breakage-ID: $BID" --json number \
392+
--jq '.[].number' | grep -vx "${INUM:-0}" | head -n1 || true)
393+
if [ -z "$existing_fix" ]; then
394+
# Distinct flake-fix label, NOT main-broken: the auxiliary
395+
# issue body carries the Breakage-ID, so with the main-broken
396+
# label it would match Identify's canonical-breakage lookup
397+
# (label + ID search) and steal the breakage from the
398+
# original issue (Codex finding, PR #7806).
399+
# gh issue create does not coin missing labels, and the
400+
# coin-labels step only runs on the create path while a
401+
# third strike happens on a recurrence -- ensure the
402+
# flake-fix label exists here too, or the filing fails
403+
# silently under || true (Codex finding, PR #7806).
404+
gh label create "flake-fix" --repo "$GH_REPO" --color "f9d0c4" --description "Third-strike flake: diagnose and deflake (filed by the main-broken scout leg)" 2>/dev/null || true
405+
gh issue create --repo "$GH_REPO" \
406+
--title "flake-fix: $WF - Breakage-ID: $BID" \
407+
--label "kind/ci" --label "flake-fix" \
408+
--body "Third flake-suspect strike for Breakage-ID $BID (breakage issue #$INUM). The scout leg of the main-broken chain files this per the #2176 failure-triage design: diagnose and deflake the failing job(s) named in the scout notes on #$INUM." || true
409+
fi
410+
fi
411+
246412
# Remediation budget: <3 concurrent remediations in flight. The
247413
# `jules` label application logic is unchanged; the label now
248414
# triggers an OpenCode session via the migrated jules.yml.
249415
- name: Apply the jules label within the remediation budget
250-
if: steps.identify.outputs.action == 'create'
416+
if: steps.identify.outputs.action == 'create' && (steps.scout.outputs.route == '' || steps.scout.outputs.route == 'fix')
251417
env:
252418
INUM: ${{ steps.dispatch-create.outputs.issue_number }}
253419
BID: ${{ steps.identify.outputs.bid }}
@@ -270,15 +436,15 @@ jobs:
270436
# existing Breakage-ID issue -- no second issue is created.
271437
- name: Queue a fresh fix task via pm-dispatch (existing issue)
272438
id: dispatch-append
273-
if: steps.identify.outputs.action == 'append'
439+
if: steps.identify.outputs.action == 'append' && (steps.scout.outputs.route == '' || steps.scout.outputs.route == 'fix')
274440
uses: ./.github/actions/pm-dispatch-queue
275441
with:
276442
title: ${{ steps.identify.outputs.title }}
277443
prompt: ${{ steps.identify.outputs.prompt }}
278444
issue_number: ${{ steps.identify.outputs.existing_number }}
279445

280446
- name: Append a recurrence comment to the existing issue
281-
if: steps.identify.outputs.action == 'append'
447+
if: steps.identify.outputs.action == 'append' && (steps.scout.outputs.route == '' || steps.scout.outputs.route == 'fix')
282448
env:
283449
EXISTING: ${{ steps.identify.outputs.existing_number }}
284450
RUN_URL_OUT: ${{ steps.identify.outputs.run_url }}
Collapse file

‎.github/workflows/scripts-test.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/scripts-test.yml
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ jobs:
3434
run: python3 -m unittest discover -s scripts/tests -p 'test_update_nixpkgs_inputs.py' -v
3535
- name: Run worker preflight contract tests (#4862)
3636
run: python3 -m unittest discover -s scripts/tests -p 'test_worker_preflight.py' -v
37+
- name: Run failure classifier contract tests (#2176)
38+
run: python3 -m unittest discover -s scripts/tests -p 'test_classify_failure.py' -v
3739
- name: Run bitwarden-load-secrets multiline contract tests (#5650)
3840
run: python3 -m unittest discover -s scripts/tests -p 'test_bitwarden_load_secrets.py' -v
3941
- name: Run provider retirement gate contract tests (#5610)

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.