Repository navigation
fix(provisioner): keep a held seed bundle until its resend arrives - #618
Conversation
Follow-up to rossoctl#600 review. reserve() no longer drops the held bundle; the old one stays fetchable until the replacement has fully arrived and put() accepts it, so a failed or refused resend keeps it. The global and per-owner checks count the held bundle and every lingering buffer still being served, so in-process bundle memory never exceeds the budget. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Jeremy Cohn <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Summary
A resend now keeps the held bundle until the new one is fully read and accepted (put), and bundles that are dropped but still being sent (lingering) now count against their owner's share. Both close real gaps: losing both copies on a failed resend, and memory going over the per-owner share during a GET. I traced the logic. reserve counts held + reserved + lingering. put drops the old copy, which moves it to lingering if a GET is serving it. The release in server.ts finally runs after put, so the bytes are never counted twice or missed. Every refusal path (retired, kube error, already seeded) leaves the old copy untouched. The new tests cover each case. One suggestion about documenting the stricter resend headroom.
Author: moonlight16 (MEMBER — maintainer)
Areas reviewed: TypeScript (provisioner seed store), tests
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing (incl. k8s-kind-e2e)
| if (replaced) this.drop(wl); | ||
| reserve(own: string, n: number): boolean { | ||
| if (this.inMemory + n > this.budget) return false; | ||
| if (this.ownerBytes(own) + n > this.ownerBudget) return false; |
There was a problem hiding this comment.
suggestion: Behaviour change worth surfacing in docs: with the defaults (budget 1 GiB → owner share 512 MiB, MOCA_CONTEXT_BUNDLE_MAX_BYTES 256 MiB), an owner holding one max-size bundle can resend it only if nothing else of theirs is held, and a resend of a bundle while a seed GET is still sending the previous replacement can need 3× its size. main.ts:72 still enforces only budget >= 2 × max, which now means "a max-size bundle can be resent only when the owner holds nothing else". Consider noting in docs/reference/configuration.md (the MOCA_PROVISIONER_SEED_BUDGET_BYTES row) and spec §5.2 that a resend counts alongside the copy it replaces, so operators who raise MOCA_CONTEXT_BUNDLE_MAX_BYTES know to size the budget at ≥4× for resends to go through. The worker passes 503 + Retry-After through, so the failure mode is correct; this is only about predictability.
There was a problem hiding this comment.
Agreed, documented in 07e7ad6: spec §5.2 now says a resend counts alongside the copy it replaces, and a copy still being sent counts until its GET ends, so a resend can need up to 3× the bundle; with the defaults a 256 MiB bundle can be resent only while its owner holds nothing else. The MOCA_PROVISIONER_SEED_BUDGET_BYTES row in configuration.md says to size the budget at 4× MOCA_CONTEXT_BUNDLE_MAX_BYTES or more for resends to go through.
Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Jeremy Cohn <[email protected]>
Follow-up to Paolo's review of #600 (a PVC per workload).
Background
Today
seed_bundle_missing).With this PR
Behavior change: during a resend, both copies count against the owner's half of the budget until they swap. A large tar file, over about 256 MiB at the defaults, can't be resent while its first copy is still held. It goes through once that copy is seeded or expires.
Tested:
🤖 Generated with Claude Code