Skip to content

chore: main into next (run record for the life of its engine) - #356

Merged
T-Crypt merged 3 commits into
nextfrom
T-Crypt/main-into-next-run-record
Nov 20, 2026
Merged

T-Crypt merged 3 commits into
nextfrom
T-Crypt/main-into-next-run-record

Conversation

@T-Crypt

@T-Crypt T-Crypt commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Merges #355 into next.

A berthd that restarted while a pinned or training engine was alive could
grant a second whole-card lease. The runner wrote its record only after it
noticed the lost socket, so a run that was stopped, or slow to read EOF,
left the new daemon nothing to see, and it granted at once. #354 has the
reproducer.

The record now covers the whole life of the engine. It is written when the
child starts, rewritten with the reason when the daemon goes away, cleared
when the run re-attaches, and removed when the child exits. berthd counts
every live record it has no lease for as due back, so the card stays held
until the run re-attaches or the window closes. A training still holds with
no timer, and a keep-up record holds nothing because that drain freed the
card on purpose.

The new tests failed before the change: TestLiveRunHoldsTheCardUntilItReattaches,
TestRecordForALeasedRunHoldsNothing, the two-record table in
TestTrainingLocksTheCardUntilItReattaches, and the reattach e2e, which now
asserts the record before the daemon stops and its cleared state after the
re-attach.

One interval remains: a daemon that dies between the grant and the child
start. No process exists there for a runner record to describe, so closing
it needs a durable grant record in berthd.
fix(runner): record a run for the life of its engine
@T-Crypt
T-Crypt merged commit 066f2b4 into next Nov 20, 2026
4 checks passed
@T-Crypt
T-Crypt deleted the T-Crypt/main-into-next-run-record branch November 20, 2026 21:03
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