Skip to content

feat(loop)!: a derived Status lifecycle replaces the awaiting, blocked and stuck labels - #217

Merged
Ardnived merged 6 commits into
mainfrom
claude/status-lifecycle
Oct 28, 2026
Merged

Ardnived merged 6 commits into
mainfrom
claude/status-lifecycle

Conversation

@Ardnived

Copy link
Copy Markdown
Contributor

Replaces the awaiting / blocked / stuck labels and the Proposed / Revising / Approved / Done Status with one derived Status per item: Awaiting, Blocked, Hold, Pending, Working, Done. It also fixes the five defects that left items in a dead zone.

The failure this prevents

On 2026-10-27, seven open items had none of awaiting, blocked or bot:working: SahajAtlasWeb#318 and #328, and WeMeditateWeb#124, #146, #150, #168 and #198. Each label was written on a transition, so a missed transition left nothing. The root causes, and what fixes each:

Cause Example Fix
A 503 between the lease and the label wedged the lease. Every later fire read the ref as contention, silently. #318, WeMeditateWeb#146 A 5xx is retried under every call. A lease past its deadline is reclaimed, label or not. A refused fire reads Pending and is retried.
An approved, armed PR waited with no owner, and stale mergeable read as clean #328, WeMeditateWeb#198 Pending carries a 2 h due, then a re-read, then a hand-back with the reason. UNKNOWN past the due runs resolve-conflicts. An approved PR with a waiting thread reads Awaiting and names the thread.
awaiting was set on transitions, never re-derived WeMeditateWeb#168 status.mjs derives Status after every plan
The drift sweep looked back 2 h, but the cron lands every 2–7 h WeMeditateWeb#124, #150 A reconciler checks every open item against the board on the cron, and on each event run (capped)
A conflict fix on an approved PR re-asked for review #328, approved 3× An approved PR a session touched stays Pending. Only a question thread on a hunk makes it Awaiting.

What changes

  • Status is output only. It is derived from the record, the relationships, Hold Until, the lock and the PR, and never read back. A drag on the board is reverted and journalled as board-drag. Roadmap goals get a Status too.
  • bot:working stays. It is the lease a session reads, the unlock event Actions wakes on, and the kill switch. No session can read or write Projects v2.
  • Approval lives in the status comment as approved: {by, at}. These spend it: hold, revise, a reopen, an abandoned PR, and a build that ends with no PR.
  • Verbs:
    • hold [until] <N days|weeks|months|date> sets Hold and withdraws approval. With no argument it picks 30–90 days out, spread by item. The cap is 180 days.
    • block on <ref> keeps an approval.
    • block until <reason> asks a session to turn the reason into a relationship or a hold.
    • implement on a Hold clears it and starts. On a blocked, unplanned goal it records the approval.
    • hold and block on a PR are refused: a PR is merged or closed.
  • Removed: recheck sessions and maxRehold. When a blocker closes, an approved ticket starts at once and any other comes back to you.
  • Member PRs (assignment.respondTo) get the loop once ready: the critic, the other member asked to review, fixes and auto-merge. A member's draft is left alone unless they mention the bot.
  • A base merge opens address-review, fix-ci and a continued implement. It is pushed only with the work, or when it resolved a conflict.

Why one PR

The repo's rule is one behaviour per PR, and never a skill change together with a ceiling change. The user chose one combined PR, because every part reads the same new state:

  • the skills name the labels that go;
  • the dispatcher stops writing them;
  • the migration moves approval into the record before either takes effect.

Split, the PRs would deploy a window where the board vocabulary, the labels and the skills disagree. maxRehold goes and maxHorizonDays moves 30 → 180 in the same change.

Commits

  1. fix(dispatcher): retry a GitHub 5xx under every call. Standalone; it passes the old suite.
  2. feat(dispatcher)!: derive Status from state, and retire the awaiting, blocked and stuck labels. This can't be reverted alone: the derived Status replaces the label writes in every row of decide.mjs.
  3. feat(loop): skills read a derived Status, and a base merge is pushed only with work. Plugin bumped 4.1.0 → 5.0.0.
  4. docs(loop): the Status lifecycle in README, why.md and routine-setup
  5. chore(rollback): migrate-to-lifecycle.mjs
  6. fix(dispatcher): no pass but a person's verb approves a goal's children. Found in the replay: the migration marks planned goals approved, and reconcile must not start their children.

rule-delta.mjs --base origin/main workflow/skills: 88 → 88 directives. None were removed and one was reworded (start-run's "never write state" list now names only labels.proposal and Status).

Validation

  • node --test dispatcher/test/*.test.mjs: 332 pass, 0 fail.
    • New files: status.test.mjs (every lane, goals, PRs), lifecycle.test.mjs and retry.test.mjs.
    • They cover reconcile, the due, member PRs, the drag revert, the Pending clock, the goal guard and the 5xx retry.
    • lease.test.mjs covers the deadline reclaim.
  • claude plugin validate ./workflow --strict: passed.
  • Read-only replay of the new gather → decide → deriveStatus against all 85 live open items, with the migration simulated in memory. It matches the 2026-10-27 dry run except where items moved since:

Runbook (in order)

node docs/rollback/migrate-to-lifecycle.mjs records            # dry run; review the list
node docs/rollback/migrate-to-lifecycle.mjs records --apply    # BEFORE the merge: the old dispatcher keeps unknown record fields
# merge this PR
node docs/rollback/migrate-to-lifecycle.mjs board --apply      # immediately: until then each Status write logs board-unreachable
node docs/rollback/migrate-to-lifecycle.mjs labels --apply
node docs/rollback/migrate-to-lifecycle.mjs reconcile --apply  # each repo's workflow-state.yml runs the full reconcile

The board views have no API, so set them in the UI:

View Filter
Awaiting is:open status:Awaiting
Bot Working is:open status:Working,Pending
Pipeline is:open -type:Roadmap (board by Status)
Backlog is:open -type:Roadmap status:Hold,Blocked
Roadmap type:Roadmap, plus a Status column

🤖 Generated with Claude Code

Ardnived and others added 6 commits October 27, 2026 18:46
One 503 mid-plan ended an `act` leg after the lease was taken and before
the lock label was written. sydevs/SahajAtlasWeb#318 and
sydevs/WeMeditateWeb#146 were then refused as contention on every later
fire, silently, for days, until the refs were deleted by hand on
2026-10-27.

`installRetry` wraps the Octokit request hook once per leg, so REST,
`paginate` and GraphQL all retry a 500/502/503/504 or a dropped
connection `dispatch.githubRetry.attempts` times, doubling from
`baseSeconds`. A 4xx is an answer and is never retried.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… blocked and stuck labels

On 2026-10-27 seven open items sat in a dead zone with none of
`awaiting`, `blocked` or `bot:working` (SahajAtlasWeb#318 and #328,
WeMeditateWeb#124, #146, #150, #168 and #198). Each label was written on
a transition, so a transition that was missed left nothing at all.

What changes, each with the failure it prevents:

- Status is derived, never read. `status.mjs` turns the record, the
  relationships, Hold Until, the lock and the PR into one of Awaiting,
  Blocked, Hold, Pending, Working or Done; every plan ends in
  `syncStatus` and `apply` writes it after the plan's other writes.
  `rec.status` remembers the value written, so a different one on the
  board is a drag, reverted and journalled (`board-drag`). Roadmap
  goals get a Status too. `bot:working` stays: it is the lease a session
  reads, the unlock event, and the kill switch.
- Approval lives in the record (`approved: {by, at}`), not in a Status
  the board could lose. `pendingImplement` folds into it; `hold`,
  `revise`, a reopen, an abandoned PR and a build that ends with no PR
  spend it.
- Pending has a due. A wait the machinery owns starts `pendingSince`;
  past `dispatch.pendingDueMinutes` the reconciler checks it again, up to
  `maxAttempts`, then hands it back with the reason. #328 and #198 sat
  approved and armed for days with nobody owning the wait. `handback`
  replaces `stuck` and every give-up label.
- The reconciler replaces the two-hour drift window, which the 2–7 hour
  cron rarely met (#124, #150): a cheap GraphQL view of every open item
  against the board, a full gather only where they disagree, plus every
  Pending item on the cron, and a capped pass on event runs.
- A lease past its deadline is reclaimed whatever the label says, and a
  lease with a session on record and no lock is read as its lost unlock.
- A refused fire sets `rec.pending` with a retry, so it reads Pending and
  is fired again instead of waiting on a drain that never comes.
- `hold [until] <N days|weeks|months|date>`: a date, approval withdrawn,
  a bare hold spread across `holdUntil.defaultDays`, capped at 180 days.
  No recheck sessions and no `maxRehold`: the date passing hands the
  ticket back, and a blocker closing starts an approved ticket at once.
  `block on` keeps an approval; `block until <reason>` asks a session.
  `implement` on a held ticket clears the hold and starts it; on a
  blocked, unplanned goal it records the approval instead of refusing.
- PRs are merged or closed: `hold` and `block` on a PR are refused.
- A member's PR gets the loop: once ready, the critic, the other member
  asked to review (GitHub refuses the author, which failed on #318),
  fixes and auto-merge. Their drafts are left alone unless mentioned.
- An approved PR with a thread waiting on a person reads Awaiting and
  names the thread once; an approved PR a session touched stays Pending,
  so a conflict fix no longer re-asks for review (#328, approved 3x).
  Past its due, mergeability GitHub still calls UNKNOWN is resolved, not
  read as clean.

Not separately revertable: the derived Status replaces the label writes
in every row of decide.mjs, so this lands and reverts as one commit.

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

The skills move with the dispatcher (5.0.0, so an installed plugin picks
them up):

- Labels and Status: start-run's "never write state" list, format-ticket,
  run-audit, finalize-pr, audit-deps, implement-ticket, improve-loop and
  implement-roadmap/cross-repo say Status is derived and name only the
  two labels left, `bot:working` and `proposal`.
- write-ticket and revise-roadmap lose the `recheck` mode. `block` turns
  `block until <reason>` into a `Blocked by:` line or a Hold Until date
  with the reason written into the body, since nothing rechecks it later.
- A base merge opens address-review (as before), fix-ci and a continued
  implement, and is pushed only with the work or when it resolved a
  conflict. address-review used to push a clean merge alone, which
  re-ran CI and put approved PRs back on the reviewer's list for nothing.
- resolve-conflicts asks about a hunk only as a question thread, which is
  the one thing that makes an approved PR the person's turn again (the
  false re-ask on sydevs/SahajAtlasWeb#328). "You cannot push to a human's
  PR" becomes what is true: a session pushes only to `claude/*`, so a
  member's PR on a `claude/*` branch is pushed to like the bot's.

`rule-delta.mjs --base origin/main workflow/skills`: 88 → 88 directives,
none removed, one reworded (start-run's state list).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
README: the Status table replaces the label table, the verbs table gains
`hold` and the reshaped `block`, and member PRs are described.
routine-setup: three labels left, the new Status options and colours,
the board views moved to Status filters, and `gh workflow run
workflow-state.yml` as the on-demand full reconcile. why.md: a new
"Status lifecycle" group with an entry per rule above, and the rules it
replaces moved under Retired with their Replaced-by lines. The citation
of #3, closed on 2026-10-27, is dropped.

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

Four phases, dry run unless --apply: `records` writes `approved` into the
status comment of every issue the old model approved (Status Approved,
`pendingImplement`, `approveOnPlan`, or a goal that was planned), and a
`handback` on an approved ticket still carrying `awaiting`, so it reads
Awaiting rather than firing a build; `board` replaces the Status options
(Done keeps its id and its items); `labels` deletes the three labels in
every repo; `reconcile` dispatches each repo's workflow-state.yml.
`records` runs before the merge: the old dispatcher keeps fields it does
not know when it saves a record.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The migration records `approved` on every goal that was planned, so the
reconcile pass, which starts an approved free ticket, would have reached
sydevs/SahajCloud#902, #941, #897 and sydevs/SahajAtlasWeb#266 and
approved their unstarted children: builds nobody asked for. A goal is now
only ever planned by a pass (an approved goal whose blocker closed), never
has its children approved; reconcile leaves goals alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Ardnived
Ardnived merged commit d17adb2 into main Oct 28, 2026
6 checks passed
@Ardnived
Ardnived deleted the claude/status-lifecycle branch October 28, 2026 01:55
Ardnived added a commit that referenced this pull request Oct 28, 2026
…sal (#218)

The first full reconcile after the Status lifecycle (#217) failed on
SahajAtlasWeb#340, a review-asks refactor stacked on #318's branch. The plan
armed auto-merge; GitHub refused with a GraphQL UNPROCESSABLE ("Pull request
is in clean status"), which carries no HTTP status, so handOver rethrew it and
the pass died before syncStatus. #340 was left with an empty Status, and every
sweep would fail the same way.

Two changes:
- A PR whose base is not the default branch is never armed. Its base has no
  ruleset, so arming would merge an unreviewed change the moment it went
  green; the reviewer's merge is the gate, and the parent carries it to main.
  gather now records base.defaultBranch for this.
- handOver treats a GraphQL FORBIDDEN or UNPROCESSABLE as a refusal, so any
  other refused mutation is handed to a person instead of crashing the job.

Co-authored-by: Claude Opus 5.5 <[email protected]>
sydevs-bot pushed a commit that referenced this pull request Nov 2, 2026
The name promised `never marked awaiting by the other`, and the
assertion backing that promise went with the #217 label retirement in
the previous commit. A name that advertises a dropped assertion is the
same failure this branch set out to remove: a reader counts it as
coverage when nothing can fail. The name now states the one thing left
under test — one leg holds the lock, the other fires nothing. The
SahajAtlasWeb#256 comment above stays; it is history, not a claim.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYAGuKHbV8X2qhfFBf
Ardnived added a commit that referenced this pull request Nov 2, 2026
…#235)

* test(dispatcher): drop tests left behind by the #217 label retirement

#217 replaced the awaiting, blocked and stuck labels with a derived
Status, but the dispatcher tests still carried them:

- Two assertions that the plan never adds the `awaiting` label
  (decide, roadmap). No code writes that label any more, so they
  could never fail.
- `awaiting`/`stuck`/`blocked` keys in the contracts and rerun config
  fixtures. No source reads `labels.awaiting|stuck|blocked`.
- journal-day's "cannot be created" test, a strict subset of the
  same case in journal.test.mjs, plus the fake's now-unused
  failCreate option.

Item fixtures that carry an `awaiting` label stay: old items still
wear it in the wild.

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

* test(dispatcher): name the roadmap lock test after what it asserts

The name promised `never marked awaiting by the other`, and the
assertion backing that promise went with the #217 label retirement in
the previous commit. A name that advertises a dropped assertion is the
same failure this branch set out to remove: a reader counts it as
coverage when nothing can fail. The name now states the one thing left
under test — one leg holds the lock, the other fires nothing. The
SahajAtlasWeb#256 comment above stays; it is history, not a claim.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYAGuKHbV8X2qhfFBf

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant