Skip to content

feat(pr-pipeline): mirror every issue status-label change into the Work status field from a label-event workflow - #13493

Merged
kyle-sexton merged 3 commits into
mainfrom
feat/13491-label-event-status-mirror
Nov 5, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
feat/13491-label-event-status-mirror

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Refs: #13491

Summary

This completes the label-and-field dual-write stage of #7577: every issue status-label change now reaches the Work status field, whoever makes it. A count on 2026-11-05 found 124 open issues: 75 with the field unset and 17 with it disagreeing with the labels. The cause is label edits by people, CLI sessions, an external reusable, babysit and the track skill, none of which mirror to the field. Slice 2 (#13483) makes the field win over the labels, so it is blocked until the field is correct.

Held for a person: this PR edits docs/conventions/pr-pipeline.yaml (a new activity) and work-unblock.yml.

Fix

  • New sync-status job in work-unblock.yml, triggered on issues: [labeled, unlabeled] and on the existing hourly schedule:
    • A label event: the job reads the issue's labels and field back from the API and writes the state the labels collapse to when the trusted field value differs.
    • The hourly schedule: the job sweeps every open issue, sequentially, with a call budget of 800.
    • Labels stay the source of truth, and a failed write only warns.
  • Token: the job writes with the lanes App token from the broker. The reader (issueStatus via dimensions.mjs trustedSetters) counts a field value only when a listed human or melodic-automation-lanes[bot] set it, so a GITHUB_TOKEN write would read as unset.
    • The broker already allows work-unblock.yml an issues event from a listed human, and its schedule. Read from azure-iac's lanes-token-broker; no broker change.
    • A label change by an unlisted account, or by a bot, gets no token. The next hourly sweep corrects that issue.
  • label-unblocked now also requires action == 'closed', so the new label events never start it.
  • pr-pipeline.yaml and lane-grants.json: the sync-status activity, effect mutate-tracker, issues write only.
  • Script: .github/scripts/work-unblock/sync-status.mjs, with tests.

Verification

Remaining

  • A label change made outside any script updates the issue's Work status field within its run, shown by one run's log and the field read after it (first label event after merge).
  • The hourly sweep sets every open issue's field to the state its labels collapse to, and a recount reads 0 drifted and 0 unset (first scheduled run after merge).

#13491 closes when lane 3 posts both on the issue.

Related

#7577 (parent); #13482 / #13490 (slice 1, merged); #13489; #13483 is blocked by this.

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits November 5, 2026 05:10
…rk status field from a label-event workflow

A new work-unblock activity, sync-status, runs in its own job of
work-unblock.yml on a person's status-label add or remove and on the hourly
schedule. It writes the state an issue's labels collapse to into its Work
status field (.github/scripts/work-unblock/sync-status.mjs); the sweep paces
its calls within a budget and logs `swept N: wrote W, unchanged U, failed F`.

The field is written with the lanes App token from the broker, because the
field's reader (issue-status.mjs issueStatus) counts only a value the App or
a listed human set. A label change by an account not listed as a human gets
no token and is corrected by the next hourly sweep. label-unblocked now runs
only on a close.

The pull request holds for a person: it edits docs/conventions/pr-pipeline.yaml.

Closes #13491

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 5, 2026 10:13
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T10:15:35.212478Z 98344a7 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed c445e905ee7d3292d941bf87bd756af9915a34ec: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review (incremental, blocking only): no findings

critical-findings: 0

This review covered only the change since 98344a71. I read every hunk of both files on the incremental list: .github/scripts/work-unblock/sync-status.mjs and .github/scripts/work-unblock/sync-status.test.mjs. This lane already reviewed an earlier head, so it reported CRITICAL and IMPORTANT findings only; none exist.

What changed: when the sweep has a listed issue whose trusted field value differs from the state its listed labels collapse to, mirrorIssue now reads the issue again. It does this with GET /repos/${repository}/issues/${number} (sync-status.mjs#L68-L72). It then compares the field against the fresh labels before calling writeStatus.

What I checked:

  • API path: repository and number come from the same values the existing reads already use. repository is checked against the REPOSITORY regex at L35. In the sweep, number comes from the API listing. On a label event it goes through Number(...). No new input reaches the path.
  • Label provenance: the fresh read takes labels from the API, as the listing does. It does not widen what decides the written state: labels were already the source of truth.
  • Call budget: in the sweep, the extra read goes through the budgeted call wrapper (L94-L100, L113), so the 800-call cap still holds. On a label event issue is undefined, so the branch never runs.
  • Trust controls: the token, broker, kill switch, trusted-actor check and merge holds are all untouched by this push.

Settled thread: the thread on sync-status.mjs L113, about the sweep overwriting a newer label-event write with stale labels, is resolved by the owner and marked lines changed since resolution: no. This push is that fix, and I am not raising the point again.

Spend (not a hold, not a finding): at most one extra API call per would-be write in the hourly sweep, inside the existing 800-call budget.

The PR context and settled threads contain no embedded instructions aimed at this lane.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 98344a715a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-review: 1 inline finding(s) on 98344a715a6882a4c6694a4bd0d66e5a1680ea39; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed c445e905ee7d3292d941bf87bd756af9915a34ec: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Code review (incremental, blocking only): PR #13493 at c445e905

I read every hunk of both files in this push: .github/scripts/work-unblock/sync-status.mjs and .github/scripts/work-unblock/sync-status.test.mjs. This lane already reviewed an earlier head, so this review reports blocking findings only. I ran nothing. The "8 of 8" test result is the author's claim and I have not verified it.

This push fixes the earlier advisory finding (the sweep could overwrite a newer label-event write using stale labels). The owner resolved that thread and its lines are unchanged since, so it stays settled:

  • mirrorIssue now reads the field state (have) first. When the field differs from the labels in the listing and the issue came from the listing, it reads the issue again and recomputes want from the fresh labels before writing (sync-status.mjs:62-76).
  • The write now uses the fresh labels, so the old state is not POSTed back.
  • The re-read goes through the sweep's budgeted call. It costs one extra call, and only for an issue that would otherwise be written. With about 124 open issues and a budget of 800 there is plenty of room.
  • The new test covers the race: the issue is listed with needs-triage, but its current labels and trusted field are agent-ready, and the test expects no write. Without the re-read, the code would write needs-triage, so the test does catch the bug.
  • I recounted the calls in the updated sweep test: 1 list call, then 3 for issue 1 (field values, setters, re-read), 2 for issue 2 and 1 for issue 3, which makes 7. That matches the new assertion.
  • The budget-cap test still holds with the re-read. With a budget of 4, issue 1 uses calls 2-4 and issue 2's first call hits the cap.

Findings: none blocking.

Notes (not findings)

  • A smaller race is still possible: a label change can land between the re-read and the write. That window is one API call, not minutes, so the sweep might revert a field only rarely, and the next hourly run would correct it. This is not blocking.
  • The comment in the budget-cap test, "One list call and two per issue" (sync-status.test.mjs:159), is now out of date: an issue that gets written costs three calls. It is advisory, so blocking-only mode drops it.
  • Closing issue: the PR says Refs: #13491 and the context file has no closing-issue section, so there were no acceptance criteria to check.
  • Spend: no change in this push beyond at most one extra lanes App API call for each issue the sweep would write, within the existing budget of 800. There is no billed resource.

…status

A listed issue's labels can be minutes old by its turn in the hourly sweep,
and a label-event run may have written the newer state since. The sweep
now reads the issue again before a write, so a stale listing never reverts
the field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit 19f7392 Nov 5, 2026
57 checks passed
@kyle-sexton
kyle-sexton deleted the feat/13491-label-event-status-mirror branch November 5, 2026 10:31
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 4, survived 3, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 57%; mutation score 57%.

File Killed Survived Timeout No coverage Invalid Not run
.github/scripts/work-unblock/sync-status.mjs 4 3 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
.github/scripts/work-unblock/sync-status.mjs:95 ROR productive input-gap
.github/scripts/work-unblock/sync-status.mjs:107 ROR productive input-gap
.github/scripts/work-unblock/sync-status.mjs:163 LCR productive input-gap

The run's summary has the full report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant