Skip to content

refactor(maintenance): take agent-ready off rewritten issues through Work status - #14019

Merged
kyle-sexton merged 2 commits into
mainfrom
refactor/13486-agent-ready-field-write
Nov 7, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
refactor/13486-agent-ready-field-write

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Refs: #13486

Summary

Toward #13486 done-when 3 ("No .github or plugin code writes an issue status label"): the monitor and lane-sweep rewrites stop deleting the agent-ready label, and the trust rule they serve still holds: a rewrite takes agent-ready off, since a person vetted the earlier text.

Fix

  • .github/actions/resolve-config/write-status.mjs: leaveAgentReady(number, state, {orUnset}) also writes state when the issue has no trusted Work status (unset, or set by an untrusted account). A set field drops the agent-ready label as a queue label (read-status.mjs statusLabels), so a rewritten issue still reads not-agent-ready. Any other trusted state is left alone. The default (without orUnset) is unchanged for its other callers (report-outcome.mjs, label-unblocked.mjs, sync-status.mjs).
  • .github/scripts/maintenance-monitor-signals/monitor.mjs and .github/scripts/maintenance-audit-lane-runs/file-findings.mjs: the agent-ready label DELETE is removed; each calls leaveAgentReady(number, "needs-triage", { orUnset: true }). A failed status write still lands in done.failed before the body PATCH, so the rewrite never runs with agent-ready left on.

Verification

  • node --test on write-status.test.mjs, monitor.test.mjs and file-findings.test.mjs: 70 pass, 0 fail. Cases: field unset and field agent-ready both write needs-triage; a person's needs-owner-decision gets no write; a failed write lands in done.failed with no PATCH; no test issues a label DELETE.

Related

  • The two status: needs-decision removals in intake-triage/refine.mjs stay: the reader keeps hold labels on top of the field (read-status.mjs:3, :47), so whether done-when 3 covers hold labels is with the owner.

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits November 7, 2026 14:54
…Work status

Refs: #13486

The monitor and lane-sweep rewrites deleted the agent-ready label, then
moved a Work status field at agent-ready to needs-triage. On an issue whose
field was unset, the label DELETE was the only thing taking agent-ready
off. leaveAgentReady now takes an orUnset option that also writes the state
while no trusted state is set; a set field drops the agent-ready label as a
queue label, so both call sites drop their label DELETE and the rewritten
issue still reads not-agent-ready. A failed write still throws
StatusWriteError into done.failed, and the other callers keep the
agent-ready-only default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgc4pJaXmFWFcgoa4NW
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 7, 2026 20:05
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-07T20:05:03.439138Z
We couldn’t complete this review. Comment @codex review to try again.
298c4fc 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

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

Security review: PR #14019 (head 298c4fc)

I found no security issues. I read every hunk of all 6 changed files.

critical-findings: 0

What I checked

Trusted path .github/actions/resolve-config/write-status.mjs

  • The only code change is to leaveAgentReady. When a caller passes orUnset, it now also calls set(number, state) if the field has no trusted state (held === null || undefined). See write-status.mjs#L125-L132.
  • Without the option, behaviour is unchanged for the other callers.
  • This file is not the token broker's signer control. The only import of it I found in resolve-config is FIELD_API from read-status.mjs.
  • The change mints no token, widens no scope, and adds no code that reads the signing key, a token or the environment.

Did removing the agent-ready label DELETE open a path into the issue lane? No.

  • The two rewrite paths (monitor.mjs and file-findings.mjs) no longer delete the label. They now write needs-triage to the Work status field when it is unset or set by an untrusted account, and also (as before) when it is at a trusted agent-ready.
  • Once the field has a trusted state, statusLabels drops every queue label, agent-ready included, and keeps only hold labels. See read-status.mjs#L41-L53.
  • So readers that go through the status reader see the rewritten issue as not agent-ready.
  • If the field already has some other trusted state, the label is dropped there too, so leaving it alone is still safe.
  • The issue lane starts from a Work status field_added agent-ready event set by a trusted actor, not from the label. See work-resolve-issue.yml#L4 and #L61.
  • A leftover label that nobody re-adds sends no labeled event.
  • The one raw-label reader I found, intake-reenter.yml#L95, uses the label only as an exclusion. A stale label there blocks re-entry, which is the safe direction.
  • Writing needs-triage to the field does not start intake-triage.yml, which runs only on opened, reopened or dispatch events.

Failure ordering

  • If the field read or write fails, StatusWriteError is thrown before the body PATCH. The issue lands in done.failed and its old text, which a person vetted, stays in place.
  • So the rewritten text never goes out with agent-ready still in effect. This matches the PR's claim, and the new tests cover it.

Other lenses

  • Trust controls: nothing widened. The trusted-trigger check, lane token, kill switch, merge holds and the signer grants are untouched.
  • Instruction-surface deletions: none. The diff changes only code and code comments.
  • Plugin manifests: none changed.
  • Spend: none.
  • PR context: no instructions to the review lane are embedded in it.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14019, full review of 6 of 6 files

No findings.

The PR stops the monitor and lane-sweep rewrites from deleting the agent-ready label. Instead, each calls leaveAgentReady(number, "needs-triage", { orUnset: true }). The new orUnset option also writes the state when the issue has no trusted Work status.

Correctness

  • New orUnset branch (write-status.mjs#L125-L132): it writes only when the trusted state is agent-ready, or when it is null or undefined and orUnset is set. Any other trusted state, including a person's hold, comes back unchanged. The default stays the same for the existing callers in report-outcome.mjs, label-unblocked.mjs and sync-status.mjs. None of them passes the new option.
  • The stale label is now ignored rather than removed. After the write, the field holds needs-triage, set by melodic-automation-lanes[bot], which is on the trusted list. read-status.mjs statusLabels then drops every queue label, agent-ready included. The WIP cap's raw labels=agent-ready listing also runs its results through statusOf and statusLabels (check-wip-cap.mjs#L234-L260). So a leftover label on a rewritten issue no longer reads as queued work.
  • The issue lane is not started by this. It runs on a field_added to option 84879220 (agent-ready). Writing needs-triage does not trigger it.
  • Both production callers pass a real writer. monitor.mjs:244-245 and file-findings.mjs:254-255 each build one with statusWriter, so the async () => {} default never runs in production.
  • A failed status write still blocks the rewrite. It throws inside the per-issue try before the PATCH, so the old body is kept and the next run retries it. Tests cover this for both scripts.

Tests: The new cases run a real statusWriter over a fake field. They cover:

  • an unset field and a field at agent-ready, both written to needs-triage
  • a person's needs-owner-decision and confirmed, left alone
  • a field set to agent-ready by an account not on the trusted list, overwritten
  • a failed POST, which is reported and skips the PATCH
  • no label DELETE in any case

I did not run the tests. The author's "70 pass, 0 fail" is their claim and I have not verified it.

PR context: The PR only refers to #13486 ("Refs") and closes no issue, so there are no acceptance criteria to check. The PR context has no text addressed to the review lane.

Spend: Rolling issues with an unset field now get one extra Work status write the first time they are rewritten. Later runs make no write. This uses only API calls, not paid billing.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit 1151ade Nov 7, 2026
81 checks passed
@kyle-sexton
kyle-sexton deleted the refactor/13486-agent-ready-field-write branch November 7, 2026 20:27
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