Skip to content

A refused embed lease waits on the authority's own answer, never a timer (Codex on #5991) - #5995

Merged
joelteply merged 5 commits into
canaryfrom
fable/embed-lease-waits-on-its-owner
Nov 14, 2026
Merged

joelteply merged 5 commits into
canaryfrom
fable/embed-lease-waits-on-its-owner

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Fixes Codex's blocking finding on #5991 (#5991 (comment)). Residents' speed (path step 1) under RTOS rule 10: a timeout never decides flow.

The problem. H17 in embed_lane_memory.rs ran attempt(1) after timeout(cadence, room) whether room was published or the timeout expired. It also returned () when the authority's publisher closed, and logged that as published=true.

Now. The wait is await_room and resolves to a typed RoomOutcome:

  • Published { available }: the authority's board covers the need. This is the only outcome the second attempt runs on.
  • AuthorityClosed: a terminal refusal that names the bytes requested and the availability measured.

There is no timeout. While the authority publishes nothing, or publishes boards that still fall short, the wait stays pending until the caller's own bound (her act) ends it. This is a behaviour change: before #5991 the refusal stood after about 2 s, so recall that met a lasting over-commit now waits on the act's bound. available_for is still read outside any borrow of the board, because the authority publishes while holding its governor lock.

Other rows from #5991, re-checked for the same shape (a timeout whose expiry still proceeds, or a closed channel read as success). I found none:

  • H4 lane_send::await_relaunch: when the relaunch wait expires (Lapsed) or the daemon is absent or closed (NoOwner), the request ends: the 503 is classified as an error, and a refused connection returns InferenceError::Unavailable. It is never resent.
  • H18 await_lane_memory_headroom: an expired deadline or a closed monitor returns the refusal.
  • H3: there is no timer.
  • H14: the wait was deleted.

Tests, all in the file's one test mod:

  • New the_room_wait_answers_only_the_authoritys_publication_or_its_closure (paused clock):
    • closure returns AuthorityClosed;
    • a silent authority stays pending across advance(1 h);
    • a publication that still falls short stays pending;
    • the publication with room returns Published { available: 70 }.
  • Kept a_refused_embed_lease_is_granted_by_the_release_that_makes_room: through the real ResourceDaemon, the release is granted with zero elapsed time.

Coordination. fable/the-embedder-holds-its-need changes this file's floor and lease sizing. This PR touches only the wait and its outcome; I'll merge canary in if that lands first.

Not compiled locally: this machine serves live minds, so CI is the compiler.

Measured

Nothing is measured yet. This needs a deploy. The embed.vram.room_wait probe now carries the outcome and waited_ms; its count and distribution after deploy are the receipt, owed by whoever deploys this to the M5.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…shed or the authority closed, never a timer (Codex on #5991)

The H17 wait from #5991 ran the second attempt when one daemon cadence expired, and read
the authority's closure as "published". It now resolves to a typed RoomOutcome from the
owner: Published { available } (the only outcome a retry runs on) or AuthorityClosed (a
terminal refusal). No timeout remains; a silent or still-short authority keeps the wait
pending for the caller's own bound to end. Deterministic test covers closure, silence
across an hour of paused clock, a short publication, and the publication with room.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…er-outcome wait

Keeps #5996's typed lease (EmbedLeaseError, floor raised on grant and lowered on release).
The wait answers with the authority's own outcome: Published (the only retry), StillShort
on its next board (typed Refused), AuthorityClosed (new typed terminal variant). No timeout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Merged origin/canary (#5996) in as dc0acba, no rebase. #5996's typed lease and its grant/release floor are kept. #5996's floor test expects a lease that can't fit to end as Refused, so the wait now resolves on the authority's own answer, still with no timeout:

  • Published: the board has room; this is the only outcome that retries;
  • StillShort { available }: the authority's next published board still has no room; ends as a typed Refused;
  • AuthorityClosed: the authority closed; ends as a new typed EmbedLeaseError::AuthorityClosed, never read as room;
  • an authority that publishes nothing keeps the wait pending.

The authority's tick publishes every cadence (reconcile -> publish_locked), so a refused lease gets its answer at the next board. That is the owner's verdict; it is not a timer in this code.

@joelteply

Copy link
Copy Markdown
Contributor Author

Reviewed exact head 5621f71 against my H17 finding on #5991. The original two defects are corrected: elapsed time no longer authorizes attempt(1), and publisher closure returns the typed AuthorityClosed error rather than success. Subscription precedes the first acquire, and availability reads occur outside a watch borrow.

Please correct the PR description before integration: the actual implementation has a third outcome, StillShort, and refuses on the next still-short publication. The description currently promises it keeps waiting through still-short publications. This difference matters because an ordinary governor tick can be that publication; the latest fixture explicitly lengthens tick_interval to avoid it. Document the actual policy and retain a deterministic test of that outcome; do not describe the one-day test setting as live load evidence.

This closes my original H17 code finding only. CI for this exact head is pending and live proof is still owed; this is not merge/deployment approval or a claim that broader embedding custody is proved.

…ibes, so only a later publication answers it

ResourceDaemon::subscribe hands out a clone of the channel's stored receiver, whose seen
version is the channel's start: changed() returned at once and the wait answered StillShort
from a board older than the refusal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply merged commit 7f875cc into canary Nov 14, 2026
32 checks passed
@joelteply
joelteply deleted the fable/embed-lease-waits-on-its-owner branch November 14, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant