Skip to content

feat(leasing): a waiting request says why it is not placed, on a worker - #692

Closed
V3RON wants to merge 0 commit into
task/635from
task/636
Closed

V3RON wants to merge 0 commit into
task/635from
task/636

Conversation

@V3RON

@V3RON V3RON commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #636

Status

Implement: done Review: passed (round 2 + 4 fix-checks) Hardware: n/a Gate: waiting for the stack

Assumptions

  • Assumption: the plan field name — the planner's wait, no-capacity and both eviction plans carry the reason as reason; the console row carries its text as why.
  • Assumption: a victim whose eviction claim is taken at plan time cannot happen with the real claims (they are excluded first), so the planner test uses claims that refuse an eviction or boot claim.
  • Assumption: three existing tests changed with the behaviour the spec decided — src/daemon/dispatcher.test.ts "list.get requests ... queue position" now lists each entry's reason, and the RAM-budget noWait test now expects code: "NO_CAPACITY" (a DispatchError with details, not a bare NoCapacityError); src/gateway/dispatcher.test.ts types the helper's reason as the enum.
  • Assumption: waitingRequestSchema stays an object with .shape (the CLI and console tests read the reason field from it) while a refinement refuses reason on a starting entry.
  • Assumption: createTestEngine stores NO_CAPACITY for a refused noWait request, so a replay in the dispatcher test answers that code; the daemon passes its own classifier.
  • Assumption: the reject reason of a twice-failed provision on the lease.rejected event — unresolvable-spec for a local request and no-wait (a lease.declined) for a probe, the nearest existing reasons, so the event catalog stays unchanged ("Events: none").
  • Assumption: PROVISION_FAILED exits 1, not the lease-ended 14 — the two stay distinct; docs/CLI.md lists the row.
  • Assumption: the planner no longer takes failures — a waiter that failed twice is rejected and never plans again, so the "two failures block a provision" branch is gone.

Review

Spec review: 3 blocking, 3 fixed, 0 notes. Code review: 4 blocking, 4 fixed, 4 notes. Claims review: 3 blocking, 3 fixed, 2 notes.
Rounds: 2. Tokens: 11.9M.
Assessment: complete

Fix-checks: 4. The maintainer changed the spec after the third (a second provisioning failure now rejects with PROVISION_FAILED), which superseded X1, X3, X5 and F1; they were closed by reverting the skip logic.

Written by an agent.

@V3RON

V3RON commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

Decision taken

Question: after a request's second provisioning failure re-queues it, the new wake (item 2) makes the head plan again. Does the twice-failed request plan again too? If it does, it is placed at once (starting, no reason), and nobody ever sees provisioning-failed.

Options:

  1. The wake plans only the waiters behind it. The twice-failed request stays queued with provisioning-failed until the next kick, as it does today. Users see — provisioning failed on its line.
  2. The wake plans every waiter, the failed one included. It retries at once and may fail a third time, and its reason is seldom visible.

Taken: 1. It is closest to today's code, where a second failure enqueues without a wake, and it is the only option where the spec's provisioning-failed line can be seen.

Reverting: drop the skip in the wake, and the Tests line marked "decided in delivery" in #636.

Written by an agent.

@V3RON

V3RON commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

Review notes

Not blocking, not verified. Each is one reviewer's claim.

  • code: src/leasing/lease-acquisition-coordinator.ts:618, :776-786 — if a physical waiter is cancelled between the #grantPhysical replan and #decidePhysical, it holds no claim, so nothing wakes the queue.
  • code: e2e/console/workers.spec.ts:70 — answerMemory's route.fetch has the same end-of-test race as the one fixed in answerWithoutLoad.
  • code: src/core/warm-pool/policy.ts:293 — the warm pool treats waiting-demand position 0 as the head, but leasing now skips twice-failed waiters, so a device booted for one of them may sit unclaimed.

Written by an agent.

@V3RON

V3RON commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

Decision changed

The maintainer replaced the delivery decision on #636 (2026-10-18).
A second provisioning failure no longer re-queues the request: it is rejected with a new error code PROVISION_FAILED carrying the driver's message, a probe included. The provisioning-failed waiting reason is dropped.
The gateway part (walk on, reject when every worker fails) goes to #637.

Written by an agent.

@V3RON

V3RON commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

Review notes (after the spec change)

Not blocking, not verified. Each is one reviewer's claim. Earlier notes are in the comment above.

  • code: src/leasing/lease-acquisition-coordinator.ts — a local PROVISION_FAILED rejection emits lease.rejected with reason unresolvable-spec. That is the nearest existing reason, but not an exact fit.
  • claims: docs/internal/adr/0021 §1 (line 111) still says a probe is declined after a "second failed provision". The ADR is a decision record and is left unedited.

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review October 18, 2026 18:18
@V3RON
V3RON added this pull request to stack #691 October 18, 2026 18:18
@V3RON V3RON closed this Oct 19, 2026
An error occurred while trying to automatically change base from task/635 to main October 19, 2026 13:26
V3RON added a commit that referenced this pull request Oct 19, 2026
…stats and console figures (#623) (#626)

Delivers #623: the event history moves to `history.db`, with usage
projections, `simlock stats`, `GET /v1/stats` and the console's figures.
It also includes ADR 0032.

This PR carries the whole feature. The stack's PRs were reviewed one by
one, and then a stack sync pushed every branch to one commit. GitHub
then marked them as merged into each other, never into `main`. Their
reviews stay there:

- ADR 0032 (this PR)
- #635 → #690
- #636 → #692
- #637 → #693
- #629 → #694
- #630 → #695
- #631 → #711
- #632 → #724
- #633 → #727
- #634 → #731

After the sync onto `main`, a fix-check reviewed the conflict
resolutions. Its fix makes `history.db` and its WAL/SHM files owner-only
(0600), as #685 did for `events.jsonl`.

Closes #629, closes #630, closes #631, closes #632, closes #633, closes
#634, closes #635, closes #636, closes #637.

### Status
Implement: done Review: per-task PRs passed; sync fix-check passed
Hardware: n/a Gate: running

## Review

Spec review: skipped. Code review: 4 blocking, 4 fixed, 1 notes. Claims
review: 0 blocking, 0 fixed, 0 notes.
Rounds: 1. Tokens: 29.0M.

*Written by an agent.*
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.

A waiting request says why it is not placed, on a worker

1 participant