[ISS-2] UNCERTAIN dispatch can't be cancelled from the UI: cancel gets stuck on CANCEL_REQUESTED and the recover button disappears #145

Closed
opened 2026-10-08 20:45:43 +02:00 by janpeter · 0 comments
Owner

Beheerd door Scrum4Me — wijzigingen hier worden overschreven. Bron: https://thuis.jp-visser.nl/issues/cmuzvu0rh0002qzbkayq52oqq

Status: closed (fixed) · Severity: s2_critical · Gemeld door: claude (max2) · Occurrences: 1 (laatst: 2026-10-08T18:41:05.117Z) · Aangemaakt: 2026-10-08T18:41:05.117Z

Registratie

What happened (2026-10-08)

Two QUEUE_REVIEW dispatches became UNCERTAIN after the /run tmpfs on scrum4me-server filled up (scrum4me-docker ISS-4). They were claimed, no container was ever started, the lease expired, and scope_id/started_at/stopped_at are all null:

  • dfeeffb3-15b4-46ec-88a5-0b1ea5309c21 (job 8c08d1e1, slot srv-review-1)
  • bae3e086-d7ea-47e5-94e8-d605f56b0cbc (job 5c8ad85a, slot srv-review-claude-1)

JP clicked "cancel" on /queue/messages at 18:38 UTC. Both requests went to CANCEL_REQUESTED (version 5, events cancel_requested + cancel_action), and stay there. To JP this looks like "cancelling doesn't work".

Why it gets stuck

  • scrum4me-mcp/src/dispatch/cancel.ts: when an attempt exists, cancel only sets CANCEL_REQUESTED. finishResult runs only if x.a.stopped_at is set. For an attempt that never started, no supervisor ever writes a stop, so the request never reaches CANCELLED.
  • app/(app)/queue/messages/_components/dispatch-status.tsx: the recover button only shows for state === 'UNCERTAIN' (line ~141), and the cancel button disappears on CANCEL_REQUESTED (cancellable). The service does accept recover from CANCEL_REQUESTED (recovery.ts: ['UNCERTAIN','CANCEL_REQUESTED'], mode close_cancelled), but the UI no longer offers it.
  • Result: the UI has no remaining action. Both review slots stay reserved, and the WAITING review requests behind them are blocked.

Needed

  1. UI: also show the recover button (operator statement → close_cancelled/close_failed) for CANCEL_REQUESTED. Optionally explain in the notice after cancel that a stop proof or recovery is still needed.
  2. Consider (service/supervisor): on cancel of an attempt that provably never started (scope_id IS NULL, started_at IS NULL), close it straight away through the claim-bound path (T-1863), without a manual recovery.
  3. Fix the two hanging requests above in the meantime (recover close_cancelled with an operator statement: no attempt container existed, see docker ps -a on 154).

Onderzoek


2026-10-09T10:44:10.647Z — mac:claude

Onderzoek 2026-10-09 (mac:claude)

  • Punt 3 is al opgelost: dfeeffb3… en bae3e086… staan allebei op CANCELLED (versie 6, met result_id, delivery delivered). Dat komt uit get_dispatch.
  • Punt 1 is groter dan een knop. De herstel-dialoog in workers kan nooit uitvoeren:
    • messages-view.tsx geeft altijd attempt={null} mee, met de opmerking dat de service attempt-details nog niet exposeert (IP-13). Daardoor blijft "Herstel uitvoeren" altijd disabled, ook bij UNCERTAIN.
    • De service verwacht voor een operator-attestatie een gestaged attestatie-JSON met een volledige start-binding (stageRecoveryEvidence, PUT /requests/:id/evidence/:key). De UI uploadt een los bestand en kan die binding niet vullen.
    • Alleen de knop ook bij CANCEL_REQUESTED tonen verplaatst de dead-end dus naar een disabled dialoog.
  • Service ondersteunt het wel. recovery.ts accepteert herstel vanuit UNCERTAIN en CANCEL_REQUESTED, en ook voor een nooit-gestarte poging (scope_id null, met first_claimed_at als ondergrens).
  • Punt 2 (cancel.ts). finishResult draait alleen als stopped_at gezet is. Een poging die nooit gestart is blijft daarom op CANCEL_REQUESTED hangen tot er een handmatige recovery komt.

2026-10-09T11:10:02.379Z — mac:claude

Plan en review (2026-10-09, mac:claude)

Plan: scrum4me-mcp docs/superpowers/plans/2026-10-09-iss-2-cancel-unstarted.md, branch plan/iss-2-cancel-unstarted, rev 5 (commit b947107). Codex gaf GO in ronde 4; het Review record staat in het plan.

Beslissing JP: de ontwerpregel "capaciteit blijft bezet tot er stopbewijs is" blijft gelden. Cancel geeft dus zelf niets vrij.

Oorzaak. De claim-gebonden stop van de supervisor (een pre-scope-weigering: bron geweigerd of NO_SPACE, zie ISS-4) wordt alleen geaccepteerd in CLAIMED. Twee situaties lopen daardoor vast:

  • de lease verloopt tijdens prepare, want daar is geen heartbeat (prepare mag 300 s duren, de lease is 120 s), waardoor het verzoek op UNCERTAIN komt;
  • er wordt geannuleerd tijdens prepare, waardoor het verzoek op CANCEL_REQUESTED komt.

Daarnaast bestaat er een gat dat al op main zat: na een geaccepteerde stop komt het resultaat nooit binnen.

Fix (één bestand, stop-evidence.ts): de claim-gebonden stop wordt aangenomen in CLAIMED, UNCERTAIN en CANCEL_REQUESTED, en sluit het verzoek in dezelfde transactie af.

Gematerialiseerd in scrum4me-mcp: sprint S-2026-10-09-1, PBI-37, ST-057, T-176 (bouw en tests) en T-177 (verify en PR).

Buiten scope, als vervolg:

  • een dubbelzinnige pre-scope-fout (prepare-time-out of een fout bij de broker-create);
  • een heartbeat tijdens prepare;
  • rijen van vóór de deploy;
  • de herstel-dialoog in workers (IP-13), die nooit kan uitvoeren omdat attempt altijd null is.

2026-10-09T11:35:54.459Z — mac:claude

Bouw (2026-10-09): PR janpeter/scrum4me-mcp#209

  • Fix in src/dispatch/stop-evidence.ts. De claim-gebonden stop wordt aangenomen in CLAIMED, UNCERTAIN en CANCEL_REQUESTED, en sluit het verzoek in dezelfde transactie af.
  • Scope-aanpassing (beslissing JP): task_implementation is uitgesloten. Het afsluiten zou de taakbinding vrijgeven, en de DB-guard queue_dispatch_guard_task weigert dat na een claim_bound_unscoped-stop. Zo'n taak blijft daarom op het pre-ISS-2-pad. Opvolging staat in Scrum4Me ISS-9.
  • Gevolg voor het incidenttype: QUEUE_REVIEW en alle andere niet-taak-acties zijn met deze PR opgelost.

2026-10-09T15:21:13.847Z — mac:claude

Dispatch-service op 154 geredeployed naar scrum4me-mcp cdbd322 (2026-10-09): bevat #209 (ISS-2 claim-gebonden stop sluit atomair) en #210 (ISS-9: ook task_implementation). Service healthy (/healthz schema_ready/role_ready). Aftekening volgt bij de eerstvolgende echte pre-scope-weigering; zie ISS-9.

Oplossing


2026-10-09T15:49:23.022Z — mac:claude

Opgelost (JP-besluit 2026-10-09: sluiten op CI + uitrol). scrum4me-mcp #209 (48555ea): een claim-gebonden stop sluit een nooit gestarte poging atomair af in CLAIMED/UNCERTAIN/CANCEL_REQUESTED, zodat zo'n dispatch niet meer blijft hangen; #210 (cdbd322) breidt dat uit naar task_implementation (ISS-9, Scrum4Me-guard IDEA-245). Beide live: dispatch-service op 154 op cdbd322 (healthy). Bewijs in CI (scrum4me-mcp runs 318/319). Een echte pre-scope-weigering na claim is op prod niet veilig op te wekken; de proef met een niet-bestaande commit werd al vóór de claim terminaal geweigerd (source_missing, verzoek ba205b04).

> Beheerd door Scrum4Me — wijzigingen hier worden overschreven. Bron: https://thuis.jp-visser.nl/issues/cmuzvu0rh0002qzbkayq52oqq Status: closed (fixed) · Severity: s2_critical · Gemeld door: claude (max2) · Occurrences: 1 (laatst: 2026-10-08T18:41:05.117Z) · Aangemaakt: 2026-10-08T18:41:05.117Z ## Registratie ## What happened (2026-10-08) Two QUEUE_REVIEW dispatches became `UNCERTAIN` after the `/run` tmpfs on scrum4me-server filled up (scrum4me-docker ISS-4). They were claimed, no container was ever started, the lease expired, and `scope_id`/`started_at`/`stopped_at` are all null: - `dfeeffb3-15b4-46ec-88a5-0b1ea5309c21` (job 8c08d1e1, slot srv-review-1) - `bae3e086-d7ea-47e5-94e8-d605f56b0cbc` (job 5c8ad85a, slot srv-review-claude-1) JP clicked "cancel" on `/queue/messages` at 18:38 UTC. Both requests went to `CANCEL_REQUESTED` (version 5, events `cancel_requested` + `cancel_action`), and **stay there**. To JP this looks like "cancelling doesn't work". ## Why it gets stuck - `scrum4me-mcp/src/dispatch/cancel.ts`: when an attempt exists, cancel only sets `CANCEL_REQUESTED`. `finishResult` runs only if `x.a.stopped_at` is set. For an attempt that never started, no supervisor ever writes a stop, so the request never reaches `CANCELLED`. - `app/(app)/queue/messages/_components/dispatch-status.tsx`: the recover button only shows for `state === 'UNCERTAIN'` (line ~141), and the cancel button disappears on `CANCEL_REQUESTED` (`cancellable`). The service does accept recover from `CANCEL_REQUESTED` (`recovery.ts`: `['UNCERTAIN','CANCEL_REQUESTED']`, mode `close_cancelled`), but the UI no longer offers it. - Result: the UI has no remaining action. Both review slots stay reserved, and the WAITING review requests behind them are blocked. ## Needed 1. UI: also show the recover button (operator statement → `close_cancelled`/`close_failed`) for `CANCEL_REQUESTED`. Optionally explain in the notice after cancel that a stop proof or recovery is still needed. 2. Consider (service/supervisor): on cancel of an attempt that provably never started (`scope_id IS NULL`, `started_at IS NULL`), close it straight away through the claim-bound path (T-1863), without a manual recovery. 3. Fix the two hanging requests above in the meantime (recover `close_cancelled` with an operator statement: no attempt container existed, see `docker ps -a` on 154). ## Onderzoek --- *2026-10-09T10:44:10.647Z — mac:claude* ## Onderzoek 2026-10-09 (mac:claude) - **Punt 3 is al opgelost:** `dfeeffb3…` en `bae3e086…` staan allebei op `CANCELLED` (versie 6, met result_id, delivery `delivered`). Dat komt uit `get_dispatch`. - **Punt 1 is groter dan een knop.** De herstel-dialoog in workers kan nooit uitvoeren: - `messages-view.tsx` geeft altijd `attempt={null}` mee, met de opmerking dat de service attempt-details nog niet exposeert (IP-13). Daardoor blijft "Herstel uitvoeren" altijd disabled, ook bij UNCERTAIN. - De service verwacht voor een operator-attestatie een gestaged attestatie-JSON met een volledige start-binding (`stageRecoveryEvidence`, PUT `/requests/:id/evidence/:key`). De UI uploadt een los bestand en kan die binding niet vullen. - Alleen de knop ook bij `CANCEL_REQUESTED` tonen verplaatst de dead-end dus naar een disabled dialoog. - **Service ondersteunt het wel.** `recovery.ts` accepteert herstel vanuit `UNCERTAIN` en `CANCEL_REQUESTED`, en ook voor een nooit-gestarte poging (`scope_id` null, met `first_claimed_at` als ondergrens). - **Punt 2 (`cancel.ts`).** `finishResult` draait alleen als `stopped_at` gezet is. Een poging die nooit gestart is blijft daarom op `CANCEL_REQUESTED` hangen tot er een handmatige recovery komt. --- *2026-10-09T11:10:02.379Z — mac:claude* ## Plan en review (2026-10-09, mac:claude) Plan: scrum4me-mcp `docs/superpowers/plans/2026-10-09-iss-2-cancel-unstarted.md`, branch `plan/iss-2-cancel-unstarted`, rev 5 (commit b947107). Codex gaf GO in ronde 4; het Review record staat in het plan. **Beslissing JP:** de ontwerpregel "capaciteit blijft bezet tot er stopbewijs is" blijft gelden. Cancel geeft dus zelf niets vrij. **Oorzaak.** De claim-gebonden stop van de supervisor (een pre-scope-weigering: bron geweigerd of `NO_SPACE`, zie ISS-4) wordt alleen geaccepteerd in `CLAIMED`. Twee situaties lopen daardoor vast: - de lease verloopt tijdens prepare, want daar is geen heartbeat (prepare mag 300 s duren, de lease is 120 s), waardoor het verzoek op `UNCERTAIN` komt; - er wordt geannuleerd tijdens prepare, waardoor het verzoek op `CANCEL_REQUESTED` komt. Daarnaast bestaat er een gat dat al op main zat: na een geaccepteerde stop komt het resultaat nooit binnen. **Fix (één bestand, `stop-evidence.ts`):** de claim-gebonden stop wordt aangenomen in `CLAIMED`, `UNCERTAIN` en `CANCEL_REQUESTED`, en sluit het verzoek in dezelfde transactie af. **Gematerialiseerd** in scrum4me-mcp: sprint S-2026-10-09-1, PBI-37, ST-057, T-176 (bouw en tests) en T-177 (verify en PR). **Buiten scope, als vervolg:** - een dubbelzinnige pre-scope-fout (prepare-time-out of een fout bij de broker-create); - een heartbeat tijdens prepare; - rijen van vóór de deploy; - de herstel-dialoog in workers (IP-13), die nooit kan uitvoeren omdat `attempt` altijd `null` is. --- *2026-10-09T11:35:54.459Z — mac:claude* ## Bouw (2026-10-09): PR janpeter/scrum4me-mcp#209 - **Fix in `src/dispatch/stop-evidence.ts`.** De claim-gebonden stop wordt aangenomen in CLAIMED, UNCERTAIN en CANCEL_REQUESTED, en sluit het verzoek in dezelfde transactie af. - **Scope-aanpassing (beslissing JP): `task_implementation` is uitgesloten.** Het afsluiten zou de taakbinding vrijgeven, en de DB-guard `queue_dispatch_guard_task` weigert dat na een `claim_bound_unscoped`-stop. Zo'n taak blijft daarom op het pre-ISS-2-pad. Opvolging staat in Scrum4Me **ISS-9**. - **Gevolg voor het incidenttype:** QUEUE_REVIEW en alle andere niet-taak-acties zijn met deze PR opgelost. --- *2026-10-09T15:21:13.847Z — mac:claude* Dispatch-service op 154 geredeployed naar scrum4me-mcp cdbd322 (2026-10-09): bevat #209 (ISS-2 claim-gebonden stop sluit atomair) en #210 (ISS-9: ook task_implementation). Service healthy (/healthz schema_ready/role_ready). Aftekening volgt bij de eerstvolgende echte pre-scope-weigering; zie ISS-9. ## Oplossing --- *2026-10-09T15:49:23.022Z — mac:claude* Opgelost (JP-besluit 2026-10-09: sluiten op CI + uitrol). scrum4me-mcp #209 (48555ea): een claim-gebonden stop sluit een nooit gestarte poging atomair af in CLAIMED/UNCERTAIN/CANCEL_REQUESTED, zodat zo'n dispatch niet meer blijft hangen; #210 (cdbd322) breidt dat uit naar `task_implementation` (ISS-9, Scrum4Me-guard IDEA-245). Beide live: dispatch-service op 154 op cdbd322 (healthy). Bewijs in CI (scrum4me-mcp runs 318/319). Een echte pre-scope-weigering na claim is op prod niet veilig op te wekken; de proef met een niet-bestaande commit werd al vóór de claim terminaal geweigerd (`source_missing`, verzoek ba205b04). <!-- s4m:issue:cmuzvu0rh0002qzbkayq52oqq -->
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
janpeter/scrum4me-workers#145
No description provided.