Skip to content

fix(pr-pipeline): keep the last known admission pause when check-wip-cap reads fail - #8904

Merged
kyle-sexton merged 5 commits into
mainfrom
fix/8804-keep-last-pause
Oct 21, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
fix/8804-keep-last-pause

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Closes #8804

Summary

check-wip-cap failed open: when the open lane PR listing or the base config could not be read, neither the WIP cap nor the held cap could pause the issue lane. Owner decision 2026-10-21 (W-30): keep the last known pause; fail open only when there is no prior state.

Fix

  • Who saves, who reads. issues is a low-trust trigger, so its runs "can restore existing caches but cannot create or overwrite them" (dependency caching, "Cache access for low-trust workflow triggers"). So the state is saved only by work-unblock's own wip-state job, which runs on the hourly schedule (a trusted trigger) on main with contents: read and pull-requests: read only (no id-token, no secrets, so a planted cache entry cannot reach a token mint), through one check-wip-cap step with save-state: "true". work-resolve-issue's pick-slot runs with cache-mode: read and only restores. The key is run-scoped (check-wip-cap-state-<run_id>-<attempt>) and restore-keys: check-wip-cap-state- restores the newest.
  • action.yml: new save-state input (default "false"); the save step runs only when it is true and the read succeeded.
  • check-wip-cap.mjs: a read error is a failed open listing, a base config that could not be read, or an invalid repository name. On a read error the status keeps the prior paused/pause_reason (pause_basis: last-state), or fails open when there is no prior state (pause_basis: fail-open). A saved state is accepted only as paused: false, or paused: true with pause_reason in {wip, held-cap, wip,held-cap}; anything else counts as no prior state.
  • A kept pause ends when a config that was read no longer pauses (pause-from cleared or in the future), so the owner can still unpause the lane during a search outage.
  • One step-summary line and ::notice per pause stay machine-readable (refactor(pr-pipeline): fold the admission window into check-wip-cap with a queued-work count #8794): admission paused: reason=<reason> (read-error, kept last state).

Verification

  • Action tests: 22/22 before, 29/29 after (node --test in .github/actions/check-wip-cap). Every new test failed before its change: kept-pause cases, the pause-reason allowlist (newline injection, other, null), and a YAML wiring test (one gated save step; the only save-state: "true" caller is work-unblock's schedule; pick-slot is read-only).
  • actionlint: clean. zizmor --no-online-audits on action.yml, work-resolve-issue.yml, work-unblock.yml: no findings.
  • Security review: GitHub Security & Cost (W-26: the restore runs in pick-slot, which has no id-token and no secrets).

Related

🤖 Generated with Claude Code

kyle-sexton and others added 4 commits October 21, 2026 14:16
…ads fail

When the open listing or the base config cannot be read, check-wip-cap
keeps the last known WIP and held-cap pause instead of failing open
(owner decision 2026-10-21). The last run whose reads succeeded saves its
status to the Actions cache; with no saved state the check fails open.
A kept pause logs `admission paused: reason=<r> (read-error, kept last
state)`, and the status gains `pause_basis`.

Closes #8804

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nger pauses

An owner who clears or postpones wip.pause-from during a search outage
now unpauses the lane: a kept last-state pause applies only while the
config that was read still pauses (or could not be read).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… only

An issues-triggered run is a low-trust trigger: it can restore a
default-branch cache but its save fails silently, so pick-slot never
saved the last known state. work-unblock's hourly schedule job now runs
check-wip-cap with save-state; pick-slot sets cache-mode: read and only
restores. A saved pause_reason outside wip, held-cap and wip,held-cap
counts as no prior state before it reaches the step summary.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…token

check-wip-cap restores a cache into the workspace, so it must not run in
label-unblocked, which holds id-token: write to mint through the token
broker. The save now runs in its own schedule-only wip-state job with
contents and pull-requests read only, no id-token and no secret.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton kyle-sexton changed the title fix(pr-pipeline): keep the last known WIP pause when check-wip-cap reads fail fix(pr-pipeline): keep the last known admission pause when check-wip-cap reads fail Oct 21, 2026
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 21, 2026 22:30
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-10-21T22:31:57.420389Z — 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

Copy link
Copy Markdown
Contributor

claude-security-review reviewed e1831b96c0e537f671ab9878072749eee8acc7f1: 0 finding(s), 0 as inline comments.

Security review: PR #8904 (head e1831b9)

No security findings. No .claude-plugin/plugin.json or marketplace.json changed, so no manifest <field> lines apply. No standing instruction was deleted or softened. The docs and changelog edits only describe the new behavior.

The PR makes check-wip-cap keep the last known pause when its reads fail. It restores a cache file written by an earlier run.

Cache poisoning

  • Only the new wip-state job in work-unblock.yml can save the state file. It runs on schedule and only when github.ref == 'refs/heads/main'. The job has contents: read and pull-requests: read, no id-token and no secrets.
  • save-state defaults to "false", and the only actions/cache/save step is gated on it. The test pins both facts, so pick-slot in work-resolve-issue.yml cannot save even though it restores.
  • pick-slot holds only contents: read and pull-requests: read. The jobs with id-token: write or secrets do not use check-wip-cap, so a restored cache never lands in them.
  • cache-mode: read is a key GitHub honors, and .github/actionlint.yaml already ignores actionlint's unexpected key message for it. It is not a parse error.
  • Cache scoping keeps pull-request and fork refs out of the default-branch cache that pick-slot restores.

Handling of the restored file

  • lastState() accepts only paused === false, or paused === true with pause_reason in the fixed set wip, held-cap or wip,held-cap. Anything else, including a malformed file, becomes "no prior state" and fails open.
  • Only paused and pause_reason are taken from the file. The capped output is String(boolean), so file content cannot inject into GITHUB_OUTPUT, the step summary or workflow commands. The test covers a wip\n::error::injected reason.
  • A stale kept pause is bounded. It applies only while reads fail, the hourly job refreshes the file, and a readable config with pause-from cleared or in the future ends it.

Only the changed files were read for this review. The protected-class register under docs/conventions/instruction-exception-register/ was not needed because no instruction text was removed.

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed e1831b96c0e537f671ab9878072749eee8acc7f1: 0 finding(s), 0 as inline comments.

No blocking findings. I read the full diff and the PR context, and checked the cache-mode key and the cache wiring against the repository. I did not run the tests, so the PR's 29/29 test result and the clean actionlint and zizmor runs are author-claimed and unverified.

Closing issue #8804. Both criteria are met. On a failed read the check keeps the last known pause (pause_basis: last-state) and fails open only when there is no prior state. New tests pin the failed-read cases: kept pause, the pause-reason allowlist, a pause ended by a readable config, and the no-prior-state case.

What I checked.

  • cache-mode: read. It is a job-level key GitHub honors. .github/actionlint.yaml:33-45 already ignores actionlint's unexpected key "cache-mode" rejection of it, so the new cache-mode: read on pick-slot (.github/workflows/work-resolve-issue.yml:107) lints clean.
  • Save and restore trust split. Only wip-state in work-unblock.yml sets save-state: "true", on schedule on main, with contents: read and pull-requests: read and no id-token or secrets. pick-slot only restores. A new test (check-wip-cap.test.mjs:312) enforces this.
  • Failed-read logic. readError, pausing and keepLastState hold in the cases I traced:
    • a failed listing with a readable config;
    • an unreadable config;
    • an invalid repository name;
    • pause-from empty, in the future, or malformed;
    • a saved state that is invalid or injected.
  • Save condition. A status is saved only when the read succeeded and WIP_STATE is set, and the action's save step is gated on that.
  • Step wiring. Step id check exists, so steps.check.outputs.state-saved resolves.
  • Changelog fragment. bump: patch fits a bug fix.
  • Manifests. The diff changes no plugin.json or marketplace.json, so there are no manifest <field> lines.

Observation, not a finding. The work-unblock sweep reads the WIP status through its own script, .github/scripts/work-unblock/label-unblocked.test.mjs:1340, which still re-fires on a failed read. The PR's docs say a pause means "work-unblock re-fires none", and during an outage a re-fired issue only ends up paused if pick-slot's own read also fails. This is outside the issue's check-wip-cap scope, so I left it as a note.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 21, 2026
Merged via the queue into main with commit a78acd7 Oct 21, 2026
59 checks passed
@kyle-sexton
kyle-sexton deleted the fix/8804-keep-last-pause branch October 21, 2026 22:39
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.

fix(pr-pipeline): keep the last known WIP and held-cap pause when check-wip-cap reads fail

1 participant