Skip to content

fix(gatedrive): scope-transferred refusal ends false BLOCKED after parent claims a WAITING drive (change 0459) - #337

Merged
danielhanold merged 9 commits into
mainfrom
fix/worker-s-gate-drive-acknowledge-is-refused-scope-closed-afte
Sep 26, 2026
Merged

danielhanold merged 9 commits into
mainfrom
fix/worker-s-gate-drive-acknowledge-is-refused-scope-closed-afte

Conversation

@danielhanold

@danielhanold danielhanold commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

↩ Change 0459 — Worker's gate.drive.acknowledge is refused scope-closed after the parent claims its WAITING drive

Summary

Fixes a false BLOCKED from a build worker after its parent claims the worker's handed-off (WAITING) test drive. The claim closes the worker's scope, as it should. The worker's acknowledge was then refused scope-closed, and that refusal told the worker to return BLOCKED.

  • New typed refusal scope-transferred. Acknowledge, a scoped start, or a scope reservation with the child capability on a scope closed by a claim or takeover (Closed && !FinalAcked) now returns it. Its message names the real state and never says BLOCKED. A FinalAcked scope still returns scope-closed. Parent-side takeover and bind-scope-change are unchanged.
  • Worker contract (docket-build-task): a handed-off worker never acknowledges or reuses its original scope. It reports on the continuation's verdict and runs further tests only under a fresh scope.
  • Parent contract (docket-build): the continuation carries the drive id, the verdict, a "scope closed" statement, and a fresh scope bundle when more drives may be needed.
  • Regression test (handoff -> claim -> advance -> acknowledge), plus mutation-tested repoguard prose guards.

Departure from spec: some existing child-side takeover and claim assertions were flipped to scope-transferred. Under the spec's own rule that is the right result. The parent takeover HALT stays scope-closed.

Review (docket-review-standard)

Finding Severity State
closeScopeFinal race branch still returned scope-closed on a claim-closed scope minor fixed (551b834)
Comment anchored on non-existent takeoverClose minor fixed (f257fc1)
precheckScopedStart checked closed before capability (state leak) minor fixed (551b834)

command: go run ./cmd/docket development test
result: green
head_sha: a15203f
ran_at: 2026-09-26T15:13:15Z

Docket-Plan-Path: docs/superpowers/plans/2026-09-26-worker-s-gate-drive-acknowledge-is-refused-scope-closed-afte.md
…is never acknowledged or reused (change 0459)
…ility-first scoped start (change 0459)

Review fixes:

- Finding 1: closeScopeFinal's already-closed branch returned ErrScopeClosed
  even when the worker's own acknowledge lost the race to a claim/takeover
  between retirePredecessor and closeScopeFinal (Closed && !FinalAcked), so
  the refusal falsely said the scope was finished by its terminal
  acknowledgement. It now returns ErrScopeTransferred for !FinalAcked and
  keeps ErrScopeClosed for FinalAcked; ownership.go/acknowledge.go doc
  comments updated accordingly.
- Finding 3: precheckScopedStart checked scope.Closed before the child
  capability, unlike Acknowledge and scopeReserveRefusal, so a
  wrong-capability caller learned transferred-vs-finished. The capability
  check now runs first.

TestTransferredScopeRefusalOrdering gains a wrong-capability scoped-start
case and a closeScopeFinal-on-claim-closed-scope case.
@danielhanold
danielhanold force-pushed the fix/worker-s-gate-drive-acknowledge-is-refused-scope-closed-afte branch from 91742d9 to a15203f Compare September 26, 2026 15:13
@danielhanold
danielhanold merged commit cf80dd5 into main Sep 26, 2026
1 check passed
@danielhanold
danielhanold deleted the fix/worker-s-gate-drive-acknowledge-is-refused-scope-closed-afte branch September 26, 2026 15:14
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