Skip to content

feat(fields): ticket state is a Stage field; a PR's state is its draft flag - #36

Merged
Ardnived merged 1 commit into
mainfrom
claude/feat-stage-field-workflow
Sep 3, 2026
Merged

Ardnived merged 1 commit into
mainfrom
claude/feat-stage-field-workflow

Conversation

@Ardnived

@Ardnived Ardnived commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Assignment stops moving. assignee:sydevs-bot still is the worklist, but only you write it and it stays put until you take it back — so assignment answers exactly one question, is this the loop's to touch. The hand-back it replaces cost a round trip on every unit of work.

What kind of turn it is moves to two new org-level issue fields:

Stage Means
Proposed Filed, awaiting your verdict
Revising Being worked out — whose turn it is is whoever commented last
Blocked Parked, with a Hold Until date saying when it comes back
Implement You cleared it for code — only you may set this
Implemented A PR is in flight; the loop unassigns itself here

Hold Until is a date. While it is in the future the item is invisible, including in the journal — the loop has already promised to look again on that day.

A PR's baton is its draft flag. Every loop PR opens as a draft and is marked ready exactly once, at green CI. The assignee never changes.

Retires six labels: ready-to-implement, proposal, needs-info, blocked-upstream, hold, and claude:working. ops-journal is the only one left.

Findings that shaped it — all measured, not assumed

  1. Date fields exist and MCP can write them. issue_write takes value for text/number/date and delete:true to clear one field, so Hold Until clears without the PUT-replaces-everything trap.
  2. Fields are NOT searchable. field.priority:high returns 0 through the REST search a routine has, against a control of 24, with the negation also 0. So no worklist query filters on a field: candidates come from indexed qualifiers, field values are attached from list_issues — five calls, cheaper than the census this replaces.
  3. No MCP tool reads an issue timeline, and the REST field-change event carries no field name and no old value. So a blocked ticket's prior Stage goes into the Blocked by: marker as (was: X). Unblocking restores it — except Implement, which becomes Revising, because a blocker usually changes the shape of the work.
  4. Every PR qualifier IS indexed — draft:, review:, -reviewed-by: all work through REST search.

The safety property is unchanged

The loop may never write Stage: Implement. It may move a ticket off it — revoking only ever reduces its own autonomy. The danger of the field version is that four other Stage writes are routine, so this is a bare imperative in preflight, triage-issue and implement-issue, not something inferred from an ownership table.

assignment.respondTo — an allowlist

Replaces "the author is not me", which was a blocklist with one entry. Of the 200 most recent comments across SahajCloud and SahajAtlasWeb: Ardnived ×100, cloudflare-workers-and-pages[bot] ×93, antontcymbal ×7. Under the old rule the preview-URL bot would have been the largest single source of work. An allowlist fails closed, and it is how Copilot gets adopted later — one config entry, no skill change.

⚠ Copilot's literal author.login is unverified — no Copilot review exists in the org yet. An unmatched entry fails closed and is silently inert; confirm it against a real review before relying on it.

Also

  • Journal title terms are now filed / opened / merged / closed. revised was defined as hand-backs and was never measurable anyway (finding 3) — a number nothing can measure does not belong in a title read as measured fact.
  • The dropped-baton sweep becomes an unheard-replies sweep: "replied but forgot to reassign" means nothing once nothing is handed back. The failure worth catching is now the opposite — a comment on something the loop was never holding.
  • The legacy-identity exception is deleted rather than carried, per your call.
  • Drive-by: repairs the AGENTS.md sentence refactor(loop): split the routines into work-routine and survey-routine over shared bookends #35's search-and-replace clobbered.

Already done, outside this PR

  • Org fields created: Stage = 46423931, Hold Until = 46423871. (Status and State are both reserved names on GitHub — hence Stage.)
  • 17 open issues backfilled from their labels: 9 → Blocked + Hold Until 2026-10-02, 3 → Implemented (PR in flight), 2 → Implement, 2 → Revising, 1 → Proposed. Priority and Effort verified preserved on every one.

Test results

  • ✓ claude plugin validate ./workflow --strict
  • ✓ jq -e . loop-config.json
  • ✓ Every (why: docs/why.md#…) citation resolves to a real anchor; no orphaned anchors beyond the one that was already orphaned
  • ✓ Reference sweep: no ready-to-implement, blocked-upstream, needs-info, label:proposal, label:hold, claude:working, claimLabel or legacy-identity reference survives outside deliberate historical mentions
  • ✓ Field write path verified live on SahajCloud#249: PUT with four values round-trips; single-field DELETE clears Hold Until leaving Priority and Effort intact

Manual verification

  1. Do not delete the six labels until this is merged and one full run is watched — that ordering is the rollback point. Revert this PR and the labels are still authoritative.
  2. /workflow:work-routine --dry-run locally: the 2 Implement tickets appear in rung 3; the 9 Blocked ones appear nowhere; no PR is listed for a hand-back.
  3. Read the next scheduled run's journal: title carries the four new terms, and 📋 Awaiting you contains no held ticket.

One PR, deliberately, against the usual one-behaviour rule: a state model cannot be half-migrated, and splitting it would leave the loop reading a half-old, half-new contract between merges.

🤖 Generated with Claude Code

…t flag

Assignment stops moving. `assignee:sydevs-bot` still IS the worklist, but only
the user writes it, and it stays put until they take it back — so assignment
answers exactly one question, *is this the loop's to touch*, and never drifts.
The hand-back it replaces cost a round trip on every unit of work: the loop
reassigned to say "done", and the user reassigned back to say "continue".

What kind of turn it is moves to two new org-level issue fields alongside
Priority and Effort:

  Stage       Proposed · Revising · Blocked · Implement · Implemented
  Hold Until  a date; while it is in the future the item is invisible

That retires five labels whose meanings overlapped and, in one case,
contradicted each other outright — triage-issue said `blocked-upstream` had no
bot meaning while the ladder made it a hard implementation gate. It also
retires `claude:working`, which existed in one repo, carried zero issues, and
was never applied by anything: only swept.

Four findings shaped this, all measured rather than assumed:

  1. Date fields exist and MCP can write them — `issue_write` takes `value` for
     text/number/date and `delete:true` to clear one field, so Hold Until can be
     cleared without the PUT-replaces-everything trap.
  2. Fields are NOT searchable. `field.priority:high` returns 0 through the REST
     search a routine has, against a control of 24, with the negation also 0.
     So no worklist query filters on a field; candidates come from indexed
     qualifiers and field values are attached from list_issues, five calls.
  3. No MCP tool reads an issue timeline, and the REST field-change event
     carries no field name and no old value — so a blocked ticket's previous
     Stage is written into the `Blocked by:` marker as `(was: X)`. Unblocking
     restores it, except `Implement`, which becomes `Revising`: a blocker
     usually changes the shape of the work.
  4. Every PR qualifier IS indexed. draft:, review:, -reviewed-by: all work.

So a PR's baton is its `draft` flag. Every loop PR opens as a draft and is
marked ready exactly once, at green CI; the assignee never changes. `draft:false`
therefore means "has been ready at least once", which is what keeps the
adversarial review firing once and only once.

The safety property is unchanged and restated on the new mechanism: the loop may
never write `Stage: Implement`. It may move a ticket off it — revoking only ever
reduces its own autonomy — and the danger of the field version is that four
other Stage writes are routine, so the prohibition is a bare imperative in
preflight, triage-issue and implement-issue rather than inferred.

Feedback is now an allowlist, `assignment.respondTo`, replacing "the author is
not me". That test was a blocklist with one entry: of the 200 most recent
comments across two repos, 93 were cloudflare-workers-and-pages[bot], which
under the old rule would have been the largest single source of work. An
allowlist fails closed and is how Copilot gets adopted later — one config entry.

Also: journal title terms are now filed/opened/merged/closed, because `revised`
was defined as hand-backs and was never measurable anyway (finding 3); the
dropped-baton sweep becomes an unheard-replies sweep, since "replied but forgot
to reassign" means nothing once nothing is handed back; and the legacy-identity
exception is deleted rather than carried, per the maintainer.

Org fields are already created (Stage=46423931, Hold Until=46423871) and 17 open
issues backfilled from their labels, so this merge is the only remaining step
before the labels can be deleted. `Status` and `State` are both reserved names
on GitHub, which is why the field is `Stage`.

Drive-by: repairs the AGENTS.md sentence #35's search-and-replace clobbered.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@Ardnived
Ardnived merged commit 5bad3fe into main Sep 3, 2026
@Ardnived
Ardnived deleted the claude/feat-stage-field-workflow branch September 3, 2026 03:47
Ardnived added a commit that referenced this pull request Sep 3, 2026
…#37)

Two corrections to #36, both from watching the first real runs.

**A PR is ours because we wrote it.** #36 made `assignee:<bot>` the gate for
PRs as well as tickets, which forced a migration — every PR open at cutover had
to have the bot added — and left all three carrying two assignees, the
reviewer's and ours, with the field meaning two things at once. `author:<bot>`
was the answer already sitting there: exact, indexed, no write, no migration.

So the loop now writes no PR assignee at all, on creation or after. That frees
the field for the one thing it could not express before, pointing the other way:
**assigning the bot to a PR it did not write is how a human hands one over**,
and unassigning withdraws it. Preflight gains a second, disjoint PR query
(`assignee:<bot> -author:<bot>`) for exactly that case. Tickets are unchanged —
assignment is still their queue.

**hasWorkflows is a filesystem check.** `mcp__github__list_workflows` is not in
the routine's MCP build; four consecutive runs journalled its absence under
⚠️ Failed, every time for a fact sitting on disk. Every repo in `repos` is
cloned into the run before Claude starts, so `.github/workflows/*.yml` answers
it exactly, for free, and cannot 403. The general rule, now in why.md: when the
run already holds the checkout, read the checkout.

The failure was harmless — an absent hasWorkflows reads as "this repo has CI",
so the gate stayed closed — but a recurring ⚠️ Failed line trains a reader to
skim the section that exists to be read.

Not changed: the survey-vs-journal weekday mismatch reported last night. At the
real cron time (`0 8 * * *`) UTC and Vancouver agree year-round — 08:00Z is
01:00 PDT and 00:00 PST, the same weekday either way. It diverged only because
the run was fired by hand at 04:19Z.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Ardnived added a commit that referenced this pull request Sep 7, 2026
…, and relax the one-behaviour rule (#61)

* fix(loop): pass draft:true when creating the PR

`finalize-pr/SKILL.md:232` is the only place the pipeline creates a PR, and
its `create_pull_request` template omitted `draft`. The tool defaults to
`false`, so every PR the loop opened was born ready for review — while the
prose 13 lines below states the opposite as an invariant: "Every PR opens as
a draft, without exception."

Draft is the PR's baton (docs/why.md#draft-is-the-prs-baton). A PR born ready
puts unfinished work in the reviewer's queue before CI has run, and makes the
once-ever rung 5 review a moving target, because `draft:false` is what marks
a PR as having been ready at least once.

#57's table is the evidence: 4 of 5 loop PRs opened on 2026-09-06 were
non-draft, three days after #36 landed the rule. #59 made those PRs visible
on the board. This stops them being born ready in the first place.

`version` bumped because a skill body changed and the cache key is the
version (why: docs/why.md#an-installed-plugin-does-not-track-main).

Follow-up 1 of 2 from #59.

* fix(state): restore `awaiting` when a non-draft PR is reopened

The `closed` arm removes `awaiting` and nothing put it back, so a reopened
non-draft PR was ready for review and invisible on the board — the same hole
#59 closed one line up for `opened`. `ready_for_review` cannot cover it:
GitHub emits that event only on a draft -> ready transition, and a reopened
PR never transitions.

It compounded. The `opened`/`reopened` arm below also clears the linked
ticket's `awaiting` on reopen, on the grounds that the PR carries the signal
now. It did not. After a reopen neither item carried it, and only the nightly
drift sweep would have noticed.

Widen the label gate to `reopened`, keeping the `!pr.draft` test. `assignBot`
stays on `opened` alone — it is split out above rather than widened, because
unassigning a PR is the kill switch for a delegated one, and re-adding on
reopen would undo a deliberate removal.

Follow-up 2 of 2 from #59.

* docs: make one-behaviour-per-PR a default, not a prohibition

The rule read as absolute in three places, and #61 hit it immediately: two
follow-ups from #59, disjoint files, one commit each, and no reviewer benefit
from splitting them into two rounds.

What the rule is actually protecting is attribution — you cannot test a change
here by running it, so when the next run behaves oddly you need to know which
change caused it. One commit per behaviour gives that. A separate PR is a
stronger form of the same guarantee, and it is not free: it costs a review
round, and `wipCapPerRepo` bounds how many may be open at once.

So the default stands and the prohibition goes, with one exception kept hard:
a skill change and a ceiling change together. Those two move the next run's
output in the same direction, so a combined PR is genuinely unattributable.

reflect/SKILL.md:161 states that exception too, unchanged and still correct.
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