spec §25.4: always-on workers are released, not taken, in a drain
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md+2 −1
CI failed — run details
Intent
<task-notification> <task-id>a890e20fe29e249dd</task-id> <tool-use-id>toolu_01NGzWxB1RvgH3XhnkMkP9GS</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/283be278-5c6a-4a71-a8d6-b3d32c668985/tasks/a890e20fe29e249dd.output</output-file> <status>completed</status> <summary>Agent "Implement Task 4: take endpoint" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Fix round 1 is committed, but one part needs your ruling: a successor still can't take an always-on worker that another box just released. Status: DONE_WITH_CONCERNS Commits: - `d70c6b58` code and tests - `b9d30555` census, re-proposed with NAME=region-ha-held-build; the test passes, seal `a9a4ed80` Tests: - The take tests pass in activator and edge, and so do the broader regression runs in both packages. - All six new fix mutations fail a test. M1 (take bypasses DecideAcquire) and M9 (take counts as activity) still fail a test after the change. - gofmt, vet, and the darwin and windows builds are clean. **T4-1 (P1), worker takes:** - When the HTTP route table has nothing for the host, the edge now looks up the host's own worker row in its registry. It accepts only status ready or empty, and the worker never enters HTTP routing. - The activator wakes a worker through the worker wake path. The pool, admission, drain and lifetime checks still run first. - The edge test shows a signed take reaching a worker, and an ordinary request for the worker's name reaching nothing. **T4-2 (P2), the 30 s bound:** - A take now waits under its own 30 s deadline, which a first wake's extension cannot lengthen. - Ordinary waiters on the same wake still get the extension, and the wake itself is not cancelled. - The test covers a first wake for both an instance and a worker, with shortened bounds. **Concern (needs a ruling):** - Every worker wake also runs under the HA duty rule (§7.1). That rule drops the duty when the lock shows a release by another box. - So the real-lease worker test splits in two: - a marker this box released: the take succeeds, at 1 GET + 1 PUT; - a marker another box released: the take answers no holder (`ha_duty_not_owner`) and writes nothing. - §25.4 step 3.4 sends a worker to its HRW successor, which conflicts with §7.1. Fixing it would mean a new authorization in the duty layer, so I did not invent one. - Until you rule, Task 5 will get `ErrTakeNoHolder` for workers, and the drain fails safely. The census verdict on #280 is still owed. Report (fix section appended): /home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-held-build/.superpowers/sdd/2026-11-08-region-ha-held-requests/task-4-report.md</result> <usage><subagent_tokens>333487</subagent_tokens><tool_uses>28</tool_uses><duration_ms>790733</duration_ms></usage> </task-notification>
Attributed to this commit: 47.0 g CO₂e (6,072,462 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on region-ha-held-build, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md b/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md| index 04f08ed99..ced37c1fd 100644 |
| --- a/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md |
| +++ b/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md |
| @@ -1092,7 +1092,7 @@ The roll tool runs a new root verb, `carlos system group-maintenance drain`, ove |
| 1. *Hold.* From now `MoveState(H)` is `holding` (§25.5). |
| 2. *Finish in-flight work.* Requests already admitted to H's app get up to 10 s, today's HTTP drain bound. Then the stop proceeds as a shutdown stop does, which ends long requests, WebSockets and edge-held stream legs (#432 G5). |
| 3. *Release.* `finishStop` writes the marker (§5.2), with the drain as its stop reason and the existing budgets. |
| - 4. *Take.* A chooses a successor B: `ChooseRoomiest` over its eligible serving set (§6.3), or the HRW box for an always-on worker (A10). A sends B a signed take request (§25.7). B acquires and wakes H, then answers with the owner it now sees in `lock.json`. That owner is the **confirmed holder**: B, or a third box that won the marker first (§6.7). |
| + 4. *Take.* A chooses a successor B: `ChooseRoomiest` over its eligible serving set (§6.3). **Always-on workers are not taken** (build ruling, 2026-11-09): the duty rule (§7.1, A11) gives a released worker's duties to its releaser, and a take that moved them would need new authority in the duty layer, the I3 family. A drain releases each worker with a marker, which leaves no lease naming A (H5), and the worker resumes on its HRW box (A10) through the departure scan's import (§7.4) after the provider action. The report lists such workers as released. A sends B a signed take request (§25.7). B acquires and wakes H, then answers with the owner it now sees in `lock.json`. That owner is the **confirmed holder**: B, or a third box that won the marker first (§6.7). |
| 5. *Release the holds* (§25.5). Edge-held SSE streams for H whose outer connection is on A are closed now, at an event boundary, so they reconnect to the new holder without waiting for the rest of the drain (R3.5). `MoveState(H)` becomes `taken(holder, lock generation)` for 30 s, and then the entry is dropped. After that, a stale hop for H is answered as by any non-holder (§6.4). |
| 4. **Drain the connections.** When no lease names A, it publishes `drained` and asks for the same acknowledgement as in step 1. Peers drop holder-cache entries naming A (§6.6). A then sends `Connection: close` on every response, closes idle keep-alive connections, and waits up to 60 s for the requests it is still forwarding to finish. Edge-held SSE streams still open through A are closed at an event boundary, and the browser reconnects through the NLB to another box, with `Last-Event-ID`. WebSockets and responses still running at 60 s are closed, and the report counts them. |
| 5. **Report.** The report lists hosts moved, each one's confirmed holder, the longest hold, holds that got today's answer, unclean releases, connections closed at the bound, and the agent's incarnation. The agent keeps it until it exits, for the tool's pre-action check (H5). |
| @@ -1176,6 +1176,7 @@ Both control paths, `/.carlos/ha-take` and `/.carlos/ha-drain`, are reserved on |
| - a cross-region request with a body (Q2: the body rule is in-region only); |
| - any bound hit or failed move. |
| - **Connections:** keep-alive connections are closed between requests. SSE streams reconnect with `Last-Event-ID` after the browser's retry delay. WebSockets still open through A 60 s after its leases have moved are closed, and their clients reconnect. Requests already dispatched to an app (uploads, downloads, upgrades) that run past H's 10 s drain, or past the final 60 s, are cut and never retried, because they may have reached the app (R3.5). |
| +- **Always-on workers** pause from their release until the departure finishes, a few minutes. They serve no HTTP requests. |
| - **An unplanned death:** today's behaviour, unchanged. |
| ### 25.9 The floor |