Skip to content

fix(runs): a re-attach goes on with the turn it was in - #329

Merged
T-Crypt merged 1 commit into
nextfrom
T-Crypt/reattach-keeps-turn
Nov 14, 2026
Merged

T-Crypt merged 1 commit into
nextfrom
T-Crypt/reattach-keeps-turn

Conversation

@T-Crypt

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

Copy link
Copy Markdown
Owner

What changes for users

A berthd restart, such as a deploy, no longer gives every running engine a fresh minimum turn. Before, a holder
with min_turn = "5m" showed a full 5m in the TURN column right after each restart, and waiters stayed out for
that long again.

How

  • berth run remembers when its lease last got the card (the grant, or a resume after a park).
  • Its re-attach message carries held, the seconds since then.
  • The new berthd sets the re-attached lease's grant time back by that much, so the turn and the AGE column go on
    where they were.

Proof

  • TestReattachKeepsTheTurnItWasIn (broker): a re-attach that held 4m of a 5m turn leaves 30s after 30s. Red
    without the fix (4m30s left).
  • TestReattachGoesOnWithTheTurn (runner, real socket): a berth run with a 1h turn, berthd stopped after 2s and
    started again. The re-attached lease has less than 59m58s left. Red without the runner change (59m59.99s).
  • proof.sh full: build, gofmt, vet, tests, Windows build and vet, golangci-lint.

berth run now sends how long its engine has held the card since its last
grant or resume, and the new berthd counts the minimum turn from then.
Before, every daemon restart reset each holder's min_turn, so a deploy kept
waiters out for a full turn again.
@T-Crypt
T-Crypt merged commit 20c64a5 into next Nov 14, 2026
4 checks passed
@T-Crypt
T-Crypt deleted the T-Crypt/reattach-keeps-turn branch November 14, 2026 22: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