Skip to content

feat(vmpool): decompose Resume — 80% is the guest ext4 mount, and it will not yield a multiple (#307) - #339

Merged
pdettori merged 7 commits into
rossoctl:mainfrom
pdettori:feat/307-resume-decomposition
Sep 25, 2026
Merged

pdettori merged 7 commits into
rossoctl:mainfrom
pdettori:feat/307-resume-decomposition

Conversation

@pdettori

@pdettori pdettori commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Decomposes Resume, the last opaque phase on the execGate-held critical path, and records
that it will not yield a multiple — so the search for a lever here can stop.

Supersedes #337, which was approved by @mrsabath but merged to the wrong base: it targeted
a mirror of #336's branch that I had pushed to this repo for stacking, so no code reached
main
and the mirror has since been deleted. Same work, now that #336 has landed;
the review discussion and its three resolved threads are on #337.

Every other opaque phase this campaign decomposed produced a multiple (#258 → #304, #307,
#315, #317, #319 — the 5.3x, the 3.25x, the 18%, #336's 1.7x). This one does not, because the
dominant term is single-threaded guest-kernel work on a code path we do not own.

Changes

  • vmresume_us / vsockdial_us / mount_us on the exec phase line and in
    vmpoolctl --json. resume_us is unchanged and still means the whole phase, which the three
    sum to — feat(vmpool): defer the VM reap off the execGate path — 1.70x gate-held, 1.12x end to end (#307) #336 kept total_us the same way, because campaign tables compare resume_us
    across runs and a silently redefined field reads as a missing phase rather than as an error.
  • The seam is an optional interface (resumePhaser), not a widened VM interface: the CHV
    launcher's Resume is a different shape (virtio-fs, no workspace mount) and would otherwise
    have to answer a question that does not apply to it.
  • Two tests, because the whole decomposition hangs off one type assertion. Dropping it leaves
    resume_us reporting while the sub-phases silently read zero, so
    TestExecPhasedReportsResumeSubPhases asserts on values, not field names — confirmed to
    fail when the assertion is removed.
  • The design note with the measurements.

Results

Descending ladder, deferred reap ON, 250 iterations per slot, cheapest rung repeated last.
Anchor drift, rung 8 vs 8′: +0.10% on resume, +0.14% on mount (#336 measured 12.4% on
one sweep, which disqualified a whole column). p50 µs. The arms table further down has its own
anchor and its own drift figures; the two sweeps are separate runs, each read against its own
repeat.

rung thru/s total resume vmresume vsockdial mount run
64 655.8 82180 35545 1192 (3.4%) 5770 (16.2%) 27630 (77.7%) 4542
32 646.6 45404 31135 563 (1.8%) 5423 (17.4%) 24602 (79.0%) 3811
16 433.0 35101 25327 412 (1.6%) 4446 (17.6%) 20271 (80.0%) 2927
8 240.6 31104 23871 361 (1.5%) 4159 (17.4%) 19225 (80.5%) 2762
8′ 237.8 31596 23896 367 4172 19251 2761

vmresume is sub-millisecond at every rung (361–563 µs at ≤32 slots, 1.2 ms at 64) — the vcpu
un-pause is not the cost. mount is 78–81% at every rung. Note Resume is 35.5 ms of 82.2 ms at 64 slots (43.3%), not the ~23 ms some tables
carry for that rung; the ~23 ms is the ≤8-slot value, and the record those tables came from
(i307-e2e1/s64-rep1-on.json, p50_resume_us=34287) is within 3.7% of this run.

The journal hypothesis is half right, and its fix is a regression

The workspace ext4 really is never cleanly unmounted: needs_recovery is set on a real leftover
image and a host loop-mount logs EXT4-fs: recovery complete. Worth knowing —
Filesystem state reads clean in both cases, because for a journaled ext4 the dirty bit
is the needs_recovery feature flag, not s_state.

But recovery is only 0.55 ms of a 19.3 ms mount, and removing it costs more than it saves.
Measured with no code change, by passing the unmount as the user command so it lands on the
same gate-held path a real fix would occupy, with a dumpe2fs probe per arm proving the arm
applied rather than silently failing:

arm (8 slots, 2000 iters) mount_us run_us thru/s fs left
A true 19261 2756 239.2 needs_recovery
C cd /; umount /workspace 18710 (−2.86%) 5052 (+83%) 228.7 (−4.38%) clean
A′ true (anchor) 19271 2758 240.0 needs_recovery

Drift on this arms rung, A vs A′: +0.07% resume, +0.05% mount, +0.35% throughput.

−4.38% throughput, p95 +4.8%. It joins the jail pool (#332, −9.24%) as a component win that
reverses under load. The 64-slot arms of that A/B are excluded as unreadable: the anchor drifted
−5.19% on mount there, which is the whole apparent effect.

The remaining ~13 ms is not spawn (~1.3 ms/binary), transport (<2.76 ms) or metadata volume —
host mount cost moves only 5568→5006 µs across an 8x size and 128x inode-count change. Against
a geometry-insensitive ~5 ms host floor and vcpu_count: 1, the mount is CPU-bound in the
guest on a fixed ext4 path
.

Recommendation (nothing optimised in this PR)

  • Don't build the journal fix, or data=writeback / ^has_journal / geometry tuning — all
    capped by the 2.86% recovery share or the mount floor.
  • One cheap win, identified and deliberately not implemented here: both vsock dials happen
    after the resume, so the "two dials are unamortisable" constraint — which forbids carrying a
    connection across a resume — does not force two. Folding the mount into wrapCommand's
    prologue removes one dial and one round trip, ~2.5 ms of a 31.2 ms Exec (~8% at 8 slots). It
    moves the mount-failure boundary from RefuseSpawn to an exit code, and at 64 slots the bound
    is the replenish rate (coldAcquireRateTrue 0.643), so it must be measured as throughput.
  • A multiple here needs a substrate change, not a tweak: virtio-fs for the workspace, which
    the CHV launcher already uses.

Verification

Re-verified against main after #336 merged (1bcc138), on a throwaway merge of this
branch into it: go build, go vet, go test ./... -count=1 green (9 packages), full vmpool
package clean under -race, make lint clean. Merges without conflict, and this branch's
commits are the entire diff because it is parented on #336's head. Review rounds have been folded
in since, each as its own commit titled with its round number, so the commit list is the count.
This paragraph no longer carries one: the number it did carry said five at round 2 and was still
saying five at round 4.

Instrument verified before the ladder was spent: at c=1/24 iterations the three sub-phases sum
to 22891 µs against a resume_us of 22916 — a +0.11% residual. Rig srv-r16b14s16,
SH_SUBSTRATE=metal, 72 cores, swap off, governor performance, 0 orphans, dying cgroups flat
48→50 across the ladder.

🤖 Generated with Claude Code

…rossoctl#307)

Resume was the last opaque phase on the execGate-held critical path: ~23 ms of a
~102 ms per-Exec at 64 slots, reported as one number. Every opaque phase this
campaign has decomposed has yielded a multiple, so split it into the three steps
firecrackerVM.Resume actually performs:

  vmresume_us   PATCH /vm {state: Resumed} -- Firecracker un-pauses the vcpus
  vsockdial_us  host-initiated vsock dial + "CONNECT <port>" handshake
  mount_us      guest round trip running the /workspace mount

resume_us is UNCHANGED and remains the whole phase, which the three sum to.
rossoctl#336 kept total_us meaning the whole teardown for the same reason: several
campaign tables compare resume_us across runs, and a silently redefined field
reads as a missing phase rather than as an error.

The seam is an optional interface (resumePhaser) rather than a widened VM
interface, because the CHV launcher's Resume is a different shape entirely --
virtio-fs, no workspace mount -- and would otherwise have to answer a question
that does not apply to it. A launcher without the seam reports zeros, which are
distinguishable from "measured zero" because resume_us stays populated beside
them.

Two tests, because the whole decomposition hangs off one type assertion: drop it
and the sub-phases silently read zero while resume_us keeps reporting.
TestExecPhasedReportsResumeSubPhases asserts on VALUES, not field names, and was
confirmed to fail when the assertion is removed.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
…es throughput (rossoctl#307)

Resume was the last opaque phase on the execGate-held critical path. It does NOT
yield a multiple, and this records why so the search stops here.

The decomposition is stable across a descending 8->64 slot ladder (anchor drift
+0.07% on resume, +0.05% on mount): vmresume 1.5-3.4%, vsockdial 16-18%, and
mount 78-81%. vmresume is sub-millisecond, so the vcpu un-pause is not the cost.

THE LEADING HYPOTHESIS IS HALF RIGHT. The workspace ext4 really is never cleanly
unmounted -- needs_recovery is set on a real leftover image, and a host loop-mount
logs "EXT4-fs: recovery complete" -- but recovery is only 0.55 ms of a 19.3 ms
mount. Note that Filesystem state reads "clean" in both cases: for a journaled
ext4 the dirty bit is the needs_recovery feature flag, not s_state, so reading
Filesystem state alone says the fs is fine when it is not.

The fix the hypothesis implies is a measured REGRESSION: -4.38% throughput at 8
slots, p95 +4.8%. Tested with no code change by passing the unmount as the user
command, which lands it on the same gate-held path, with a dumpe2fs probe per arm
proving the arm applied rather than silently failing. It joins the jail pool
(rossoctl#332, -9.24%) as a component win that reverses under load.

The remaining ~13 ms is not spawn, transport or metadata volume -- host mount cost
moves only 5568->5006 us across an 8x size and 128x inode-count change. Against a
geometry-insensitive ~5 ms host floor and vcpu_count: 1, the mount is CPU-bound in
the guest on a fixed ext4 path. Removing the term needs a substrate change
(virtio-fs, as the CHV launcher already uses), not a tweak.

One cheap win is identified and NOT implemented here: both vsock dials happen
AFTER the resume, so the "two dials are unamortisable" constraint -- which forbids
carrying a connection ACROSS a resume -- does not force two. Folding the mount
into wrapCommand's prologue removes one dial and one round trip, ~2.5 ms of a
31.2 ms Exec. It must be measured as throughput before it is believed.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
…g what zeros mean (rossoctl#337 review)

Three review points, none of which changes a measurement.

ROUTE THE TEST LAUNCHER THROUGH New. TestExecPhasedReportsResumeSubPhases assigned
p.(*pool).lc after construction, and New starts `go p.reclaimLoop()` before it
returns, so that was an unsynchronized write to a field warm reads from that
goroutine. It stayed green under -race only because testPool leaves StandbyPerKey
unset and the reclaim path therefore never reaches warm -- a tripwire armed for
whoever gives that helper a standby count, which would then surface as a flake in
an unrelated test. Every other test in the package injects through New; the new
testPoolWith keeps this one on that path, and testPool now delegates to it so
there is a single construction path rather than two.

STOP OVERSTATING WHAT ZEROS MEAN. diag.go claimed zeros unambiguously read as "not
decomposed", but a Resume that fails part-way stashes zeros for the steps it never
entered -- so a failed fc.Resume reports a populated vmresume_us beside two zeros,
the same shape as a launcher that decomposes only the first step. That is exactly
the path pool.go deliberately reads. The zeros are truthful and the stash is
intended, so the comment is what was wrong: it now names the exception, says the
two cases are told apart by the Exec having errored rather than by the phase line,
and notes that no ladder row comes from a failed Exec.

phaseStart now starts below newFCClient, so vmresume_us is the PATCH alone as
Phases.VMResume documents it. newFCClient only allocates, so this is a
sub-microsecond correction against a 361 us measurement and no conclusion moves.

Verified: full vmpool package clean under -race, `go test ./...` green (9
packages), and the mutation check re-run -- removing the resumePhaser assertion
still fails TestExecPhasedReportsResumeSubPhases after the refactor.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

@huang195 huang195 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

The decomposition itself is sound and the plumbing is honest: resume_us keeps its old meaning, the seam is an optional interface rather than a widened VM, and the zero-vs-absent problem is documented including the partial-failure exception (which I verified behaves as described — a failed fc.Resume does stash a populated vmresume_us with the other two at zero). The measurement note is unusually well controlled. Three things block: a new code comment carries the exact figure this PR's own note corrects, and a mutation pass shows the vmpoolctl JSON path and the whole of firecrackerVM.Resume's stamping are unprotected by any assertion.

Author: pdettori (MEMBER — maintainer)
Areas reviewed: Go (7 files, +218/−14), Docs (1 new file, +228)
Risk shapes found: PRESENCE-VS-VALUE (dominant), DUAL-PATH-PARITY (two clocks for one figure; log vs JSON sink; 4-hop copy chain), GEOMETRY-INVARIANT (the prose-only sum invariant), RENAME (err→resumeErr, testPool→testPoolWith), DERIVED-CONSTANT (none in production)
Agent/IDE config (.claude/.vscode): none
Mutation gate: 12 mutated, 6 killed, 6 SURVIVED (one of those — mount_us=0 in the log line with the field name kept — is survival the existing comment documents as intended, so 5 are actionable)
Norms extracted / violations: 6 / 1 (the ~23 ms figure; the other five verified accurate)
Body claims checked: 13 verified, 2 refuted
Sections skipped as CI-covered: 3.4, 3.6 (CI green: lint, shellcheck, hadolint, CodeQL, Trivy, DCO all pass)
Commits: 3, all signed-off: yes
CI: passing (13/13)

Mutation gate detail

Control: internal/vmpool EXIT:0, cmd/vmpoolctl EXIT:0 (clean tree, PR head 8b1527e).

Mutation Module/pkg Killed by Verdict
delete the resumePhaser assertion block in ExecPhased internal/vmpool TestExecPhasedReportsResumeSubPhases killed
drop the , ok (unchecked assertion), isolated internal/vmpool TestResumeSubPhasesAreZeroWithoutTheSeam killed
populate the three sub-phases unconditionally internal/vmpool TestResumeSubPhasesAreZeroWithoutTheSeam killed
rename mount_us= in logPhases internal/vmpool TestRunnerEmitsAllFourPhases killed
rename the p50_mount_us JSON tag cmd/vmpoolctl TestRunsOneExecInAVMAndReportsItAsJSON killed
delete s.vmResume, s.vsockDial, s.mount = ph.* (main.go runExecMode) cmd/vmpoolctl — SURVIVED
delete res.P50MountUs, res.P95MountUs = pct(…) cmd/vmpoolctl — SURVIVED
delete the phMount = time.Since(mountStart) stamp internal/vmpool — SURVIVED
register the stash defer last (LIFO broken → mount_us always 0) internal/vmpool — SURVIVED
move the vmresume clock above newFCClient internal/vmpool — SURVIVED
log mount_us=0 always, field name kept internal/vmpool — SURVIVED (documented as intended)

The body's claim that TestExecPhasedReportsResumeSubPhases "was confirmed to fail when the assertion is removed" reproduces exactly — that test is real, and so is TestResumeSubPhasesAreZeroWithoutTheSeam, which independently catches both an unchecked assertion and an unconditional populate. The gap is everywhere the value is copied after Phases.

Claims verified

  • resume_us is genuinely untouched — ph.Resume = p.clk.Now().Sub(t0) unchanged, and the VM interface is not widened.
  • VsockDial's comment ("dial + CONNECT <port> handshake") is accurate: dialVsock sends CONNECT %d\n and requires an OK ack (vsock.go:29-42), so the note's reading that this measures guest-readiness rather than dial mechanics is well founded.
  • Every composition percentage in both tables (15 cells), 43.3%, the 2.86% recovery share, +2296 µs/+83%, p95 +4.8%, ~16.5 ms, the ~7x round-trip ratio, the ~13 ms remainder, 19.3/5.0 ≈ 3.8x, ~2.5 ms of 31.2 ms ≈ 8%, and the +0.11% instrument residual all recompute from the tables given.
  • No consumer drift: e10-lifecycle.sh:825 sums acquire/resume/run/destroy only, so the six new fields introduce no double-counting.

Two numeric claims do not recompute — see the inline comments on the note.

Comment thread remote-worker/internal/vmpool/pool.go Outdated
// tables compare resume_us across runs, and a silently redefined field reads as a
// missing phase rather than as an error (#336 kept total_us the same way).
//
// Resume was the last opaque phase on the execGate-held critical path -- ~23 ms of

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must-fix — this comment carries the exact figure this PR's own note corrects.

docs/notes/2026-09-23-307-resume-decomposition.md:59-62 says:

Resume is BIGGER than the campaign table says. The task brief put it at ~23 ms of a ~102 ms Exec at 64 slots; it is 35.5 ms of 82.2 ms (43.3%) there. The ~23 ms figure is the ≤8-slot value.

And this new comment states, as fact, ~23 ms of a ~102 ms Exec at 64 slots. Both terms are the ones the note identifies as the brief's error: measured is 35.5 ms of 82.2 ms at 64 slots, and ~23 ms is the ≤8-slot value (where total is ~31 ms, not ~102 ms).

This is the highest-value thing to fix here precisely because the PR supplies both halves — the correction and the re-seeded error land in the same changeset, and the comment is the copy a future reader reaches first. Suggest ~35.5 ms of an ~82 ms Exec at 64 slots (43%), or drop the figures and point at the note.

(Pre-existing and out of scope, but adjacent: ~102 ms also survives in cmd/vmpoolctl/replenish_concurrency_test.go:187 and docs/notes/2026-09-23-307-deferred-reap-design.md:696 as the per-slot cycle time, which #336's 1.7x should have moved.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1a315eb. This was the worst of the three — the PR shipped the correction and re-seeded the error in one changeset, and as you say the comment is the copy a reader reaches first.

Now reads ~35.5 ms of an ~82 ms Exec at 64 slots (43%), plus a pointer to the note and the 78–81% mount share so the figure has provenance rather than sitting there as a bare number.

Agreed the two adjacent ~102 ms survivals in replenish_concurrency_test.go:187 and the #336 note are out of scope here; leaving them for whoever revisits the per-slot cycle time, since #336's 1.7x should indeed have moved it.

for _, f := range []string{
// Resume's sub-phases must reach the JSON record, or a ladder cannot read the
// decomposition back even though the worker log has it (#307 follow-up).
`"p50_vmresume_us"`, `"p95_vmresume_us"`,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must-fix — two surviving mutants: this assertion cannot detect the values failing to reach the record, which is what its own comment says it is for.

The comment two lines up states the requirement as "Resume's sub-phases must reach the JSON record, or a ladder cannot read the decomposition back" — but strings.Contains on a key is satisfied by Go emitting a zero-valued int64 tag. Both of these leave ./cmd/vmpoolctl/ green:

  • deleting s.vmResume, s.vsockDial, s.mount = ph.VMResume, ph.VsockDial, ph.Mount in runExecMode
  • deleting res.P50MountUs, res.P95MountUs = pct(…) in realMain

Either one ships a ladder that reads mount_us: 0 at every rung — the exact failure the comment names, and the one that would have silently voided this PR's headline result. Swapping the VsockDial/Mount arguments is likewise invisible.

The inherited justification for presence-only ("the fake's Resume is a no-op so it may legitimately measure ~0us") does not carry over to the sub-phases, because they do not come from the clock — they come from ResumePhases(), which a fake returns canned values from. diag_test.go's phasingVM already does exactly this. Here the seam is fakeHostVM (internal/vmpool/testlauncher.go:53), which is in a non-test file and so reachable from this package: give it a ResumePhases() returning three fixed distinct durations and assert rec.P50VMResumeUs / P50VsockDialUs / P50MountUs against them. Distinct values also pin the ordering. This test already asserts a value for P50RunUs, so the precedent is local.

Adding the method to fakeHostVM is safe for TestResumeSubPhasesAreZeroWithoutTheSeam — that test uses the unexported fakeLauncher from launcher_fake_test.go, a different type.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1a315eb, taking your approach exactly.

fakeHostVM now implements resumePhaser with three distinct canned durations (11/222/3333 µs, exported as FakeVMResumeUs/FakeVsockDialUs/FakeMountUs so the test asserts against named constants rather than restating magic numbers), and the test compares rec.P50VMResumeUs/P50VsockDialUs/P50MountUs against them. The key-presence loop stays, because the struct fields would follow a JSON tag rename silently — so the two checks cover different failures.

Your point that the inherited presence-only justification does not carry over is the crux: these do not come from the clock, so ~0 is never legitimate for them. Distinct values pin ordering as you suggested, and I verified fakeLauncher in launcher_fake_test.go is untouched by the addition, so TestResumeSubPhasesAreZeroWithoutTheSeam still exercises a launcher without the seam.

Mutation-checked all three:

mutant before now
delete s.vmResume, s.vsockDial, s.mount = ph.* SURVIVED KILLED
delete res.P50MountUs, res.P95MountUs = pct(…) SURVIVED KILLED
transpose ph.VsockDial / ph.Mount invisible KILLED

// these steps is when knowing which one matters most -- so each assignment happens
// before the error check, and stashPhases runs via defer.
var phVMResume, phVsockDial, phMount time.Duration
defer func() { v.stashResumePhases(phVMResume, phVsockDial, phMount) }()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must-fix — mount_us, the term this PR exists to measure, is correct only by defer registration order, and nothing asserts it.

This works today: the stash defer is registered first, so LIFO runs it last, after line 855 has assigned phMount. Move this line below line 855 — a plausible edit, since grouping the two defers reads as tidier — and mount_us reports 0 forever while resume_us keeps reporting normally. The whole internal/vmpool package stays green. Given mount is 78–81% of Resume, that is a silent zero on the dominant term.

Two more mutants survive in the same function, confirming nothing constructs a firecrackerVM:

  • deleting the phMount = time.Since(mountStart) stamp entirely
  • moving phaseStart := time.Now() above newFCClient, which the comment at line 836 explicitly says must stay below it

The ordering constraint is the part worth hard-coding rather than documenting. Folding the mount stamp into this same closure removes it:

var phVMResume, phVsockDial, phMount time.Duration
var mountStart time.Time
defer func() {
	if !mountStart.IsZero() {
		phMount = time.Since(mountStart)
	}
	v.stashResumePhases(phVMResume, phVsockDial, phMount)
}()

Then line 855's separate defer goes away, mountStart stays zero on both early returns (preserving the documented partial-failure shape, which I verified is accurate as written), and there is no order to get wrong.

Separately, line 832 says "stashPhases runs via defer" — the method is stashResumePhases.

I could not find a way to exercise this function without a real Firecracker, so I am not asking for a test of the stamps themselves; ResumePhases/stashResumePhases are trivially unit-testable on a bare &firecrackerVM{} if you want the round trip pinned. No self-deadlock here, for the record: Resume holds no lock at any return point.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1a315eb with your folded-closure form, including the mountStart.IsZero() guard.

Both stamps are in one closure now, so the LIFO mutant is not merely caught but unconstructible — there is one defer, hence no registration order to get wrong. That seemed better than a test, since a test would pin the behaviour while leaving the hazard in place. I verified the partial-failure shape you checked earlier still holds: mountStart stays zero on both early returns, so a Resume failing at fc.Resume still reports a populated vmresume_us with the other two at zero.

Also fixed the stashPhases → stashResumePhases comment.

Took the optional suggestion too: TestFirecrackerResumePhasesRoundTrip pins the stash/read pair on a bare &firecrackerVM{} — zero before any Resume, values back in the right slots, and last-write-wins on a restash. Three distinct values there as well, for the same transposition reason.

To be straight about what is still uncovered: deleting the phMount stamp or moving the vmresume clock above newFCClient are still invisible to tests, because Resume needs real Firecracker. The fold removes the ordering hazard structurally; the other two remain documented-only, as you allowed.

| 8 | 240.6 | 31104 | 1 | 23871 | 361 | 4159 | 19225 | 2762 | 1977 | 0.331 | 0 |
| 8' | 237.8 | 31596 | 1 | 23896 | 367 | 4172 | 19251 | 2761 | 2027 | 0.343 | 0 |

**Anchor drift: +0.07% on `resume`, +0.05% on `mount`, −1.14% on throughput.** The session

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion — the anchor drift does not recompute from the ladder table above it; both figures appear to be the arms sweep's.

From the 8 vs 8′ rows: resume 23871→23896 = +0.105%, mount 19225→19251 = +0.135%. Throughput 240.6→237.8 = −1.16%, which matches the −1.14% given.

The quoted +0.07% and +0.05% both land in the arms table instead: run_us 2756→2758 = +0.07%, mount_us 19261→19271 = +0.05% — and line 124 already attributes that +0.05% to the arms rung, correctly. So the ladder's resume drift is being reported with the arms' run_us figure.

The conclusion is untouched (every value is ≪1% and the session did hold still), which is why this is a suggestion — but these tables are the deliverable, and the same pair is repeated in the PR body's Results section, so both need the edit.

Same class, line 71: "At 8 slots: run_us = 2756 µs … versus mount_us = 19261 µs" are arms-table values presented as the ladder's 8-slot row, which reads 2762 / 19225. Harmless to the arithmetic that follows, worth a word on which sweep they come from.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1a315eb, in the note and the PR body. Recomputed from the raw records before editing, and your arithmetic is right:

ladder 8 → 8′ arms A → A′
resume +0.105% +0.071%
mount +0.135% +0.052%
run_us −0.04% +0.073%

One refinement on the diagnosis: the +0.07% I quoted is the arms sweep's resume drift (+0.071%), not its run_us — those two happen to both round to +0.07%, which is what made the misattribution easy to make and hard to spot. Either way the conclusion is yours: a ladder row was reported with the arms sweep's figure. The ladder section now carries +0.10% / +0.14%, and each drift figure names its sweep.

Line 71 likewise now reads the ladder's 2762 / 19225, with the arms values cited as a 0.2% alternative. Every derived number survives: 19225 − 2762 = 16463 µs is still ~16.5 ms, and 19225/2762 = 6.96 is still ~7x.


Three immediate readings:

- **`vmresume` is not a finding.** `PATCH /vm {state: Resumed}` is 361–368 µs at ≤32 slots,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion — "361–368 µs at ≤32 slots" is contradicted by the table directly above: 32 slots reads 563 µs and 16 slots reads 412 µs, both outside the range. 361–368 is the 8 and 8′ rungs only.

The finding survives intact — 563 µs is still sub-millisecond and still not the cost — so this is just the range needing to be 361–563 µs at ≤32 slots, or the claim re-scoped to ≤8.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1a315eb — now 361–563 µs at ≤32 slots, with the per-rung values spelled out (361/367 at 8 and 8′, 412 at 16, 563 at 32) so the range is checkable against the table without arithmetic.

Confirmed the finding is untouched: 563 µs is still sub-millisecond, so the vcpu un-pause is still not the cost.

19261 µs for a round trip carrying only the mount. **The mount command's own execution is
~16.5 ms**, i.e. about 7x a comparable complete round trip.

One consequence is worth stating separately: **`vsockdial_us` (4196 µs) is larger than Run's

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit — vsockdial_us (4196 µs) is not a value any table in this note carries: the ladder reads 4159 at 8 slots and 4172 at 8′, and the arms table has no vsockdial column. The comparison against Run's 2756 µs holds at either number; worth citing whichever sweep 4196 came from so the ratio is reproducible from the note alone.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1a315eb. 4196 µs is the arms sweep's arm A, which the note's arms table has no column for — so it was unreproducible from the note alone, exactly as you say.

Now quotes the ladder's 8-slot row (4159 µs vs run_us 2762 µs) and names the arms figures (4196 / 2756) as the alternative, noting the inequality holds either way.

@@ -72,7 +73,14 @@ func TestRunnerEmitsAllFourPhases(t *testing.T) {
// clock does not advance, so all four are legitimately 0 even on correct code. What the

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit — this PR grows the checked list to 8 tokens covering 7 phases, but the test is still TestRunnerEmitsAllFourPhases and this comment still says "all four are legitimately 0". The name is the count, and the PR adds to the very list it counts. TestRunnerEmitsEveryPhase would stop this drifting again on the next decomposition — and this file's own comment on line 79 names "a rename" as the failure the test exists to catch.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to TestRunnerEmitsEveryPhase in 1a315eb, and the "all four are legitimately 0" comment now says "every one of them". Named for the property rather than a count, so the next decomposition does not invalidate it — and the doc comment records why, since line 79 naming a rename as the target failure is precisely the irony you spotted.

// that goroutine can reach — so `p.(*pool).lc = lc` after construction is an
// unsynchronized write to a field a live goroutine may read. It happens to stay green
// under -race today only because this helper leaves StandbyPerKey unset, so the reclaim
// path never reaches warm; that makes it a tripwire armed for whoever gives this helper a

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit — the tripwire this clause warns about is the one the change disarms. Routing the launcher through New is what makes a standby count safe here; the hazard belonged to the p.(*pool).lc = lc pattern being replaced. As written ("that makes it a tripwire armed for whoever gives this helper a standby count") it reads as a live hazard in testPoolWith, sending the next reader hunting for something that is no longer there. The factual half checks out — this helper does leave StandbyPerKey unset. Suggest past tense for the alternative: "...which would have stayed green only because...".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1a315eb — past tense, as suggested, and explicit that passing the launcher to New removes the hazard rather than documenting it, so nobody goes hunting in testPoolWith for something that is not there.

The factual half you confirmed is kept: the helper does leave StandbyPerKey unset, which is what the old p.(*pool).lc = lc write would have hidden behind.

… depending on defer order (rossoctl#339 review)

Three must-fixes, three suggestions, two nits. Two of the must-fixes were
surviving mutants; the third was a figure this PR's own note corrects.

THE ~23 MS FIGURE, RE-SEEDED BY THIS PR. Phases' new comment stated "~23 ms of a
~102 ms Exec at 64 slots" as fact -- both terms are the ones the note identifies
as the brief's error. Measured is 35.5 ms of ~82 ms at 64 slots (43%), and ~23 ms
is the <=8-slot value where total is ~31 ms. The correction and the re-seeded
error were landing in one changeset, and the comment is the copy a reader reaches
first.

ASSERT THE JSON RECORD BY VALUE. strings.Contains on a tag is satisfied by a
zero-valued int64, so the presence-only check could not detect the values failing
to reach the record -- which is what its own comment said it was for. Deleting the
sample copy in runExecMode, or the mount pct() call in realMain, both left
cmd/vmpoolctl green while shipping a ladder that reads mount_us=0 at every rung.
fakeHostVM now implements resumePhaser with three DISTINCT canned durations and
the test compares against them, which also pins slot ordering along the whole
VM -> Phases -> sample -> runResult chain. The inherited "the fake's Resume is a
no-op so it may measure ~0" justification does not apply to these three: they come
from ResumePhases(), not from a clock. All three mutants now die, including a
transposition of VsockDial and Mount.

THE MOUNT STAMP NO LONGER DEPENDS ON DEFER ORDER. mount_us was correct only by
LIFO: the stash defer was registered first so it ran last. Regrouping the two
defers -- which reads as tidier -- would report 0 forever on the term that is
78-81% of the phase, with resume_us still reporting normally and the package still
green. Both stamps now live in one closure guarded by mountStart.IsZero(), so
there is no order to get wrong and the documented partial-failure shape is
preserved: a Resume failing earlier still reports zero for steps it never entered.
Also fixes a comment naming stashPhases instead of stashResumePhases, and adds
TestFirecrackerResumePhasesRoundTrip to pin the stash/read pair on a bare
firecrackerVM (Resume itself needs real hardware, as the review notes).

SWEEP ATTRIBUTION IN THE NOTE. The ladder's anchor drift was quoted using the
ARMS sweep's figures. The ladder's own are +0.10% resume and +0.14% mount; the
+0.07%/+0.05% pair belongs to the arms rung. Same class: "361-368 us at <=32
slots" excluded 32 (563) and 16 (412), now 361-563; and run_us 2756, mount_us
19261 and vsockdial 4196 were arms values presented as ladder 8-slot rows, now the
ladder's 2762 / 19225 / 4159 with the arms values named as such. Every derived
figure survives unchanged -- ~16.5 ms, the ~7x ratio, and the dial exceeding a
whole warm round trip. Each drift figure now states which sweep it is from, and
the PR body carries the same corrections.

Nits: TestRunnerEmitsAllFourPhases checked 8 tokens over 7 phases, so it is now
TestRunnerEmitsEveryPhase -- named for the property rather than a count that the
next decomposition invalidates. And testPoolWith's comment described the tripwire
in the present tense when routing the launcher through New is what disarms it.

Verified: go test ./... green (9 packages), internal/vmpool clean under -race,
make lint clean, and the three previously-surviving vmpoolctl mutants confirmed
killed.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

@huang195 huang195 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Bellissimo — and I mean that about the method, not just the code. A decomposition PR whose
headline result is "there is no lever here, stop looking" is the hardest kind to write
honestly, and this one spends a whole measurement ladder proving a negative rather than
quietly moving on. The A/B that refutes your own journal hypothesis, run with no code
change
by passing the unmount as the user command so it lands on the same gate-held path,
with a dumpe2fs probe per arm proving the arm applied — that is the part I'd frame and put
on the wall. mamma mia, the anchor-drift discipline alone (every figure read against its own
repeat, the 64-slot arms excluded as unreadable) is better than most published benchmarks.

All eight findings from my last pass verify as fixed, and I checked them by breaking the
code rather than by reading the replies:

Round 1 finding Now
main_test.go presence-only could not see a dropped value deleting the sample copy, deleting the pct call, and transposing dial↔mount are all three killed
mount_us correct only by defer LIFO order one closure, no order to get wrong; the stash/read pair is killed in both transposition directions
pool.go re-seeded the ~23 ms / ~102 ms figure reads ~35.5 ms of an ~82 ms Exec at 64 slots (43%); recomputes to 43.25%
four doc/figure drifts all four recompute against the tables now

Gate this round: 18 mutations, 10 killed, 5 survived (4 discarded as false kills —
declared and not used and a vet printf error — and re-run in a form that compiles).

Four of the five survivors are inside firecrackerVM.Resume, the region we already agreed
needs real Firecracker; I am not re-filing those, and folding the hazard out structurally
was the better answer than a test. The fifth is new, and one finding below lives in that same
"untestable" function but returns before any Firecracker contact — so it is reachable from a
unit test after all.

Mutation Verdict
transpose ph.VsockDial / ph.Mount in the logPhases call SURVIVED (finding 1)
phMount = 0 / phVsockDial = 0 / phVMResume = 0 / drop the IsZero guard SURVIVED — acknowledged Firecracker gap, not re-filed
10 others (sample copy, pct, both transposition directions, the seam assertion, the format-string name, the stash round trip, the fake's triple) killed

Author: pdettori (MEMBER — maintainer)
Areas reviewed: Go production (5 files), Go tests (4), Docs (1 new note)
Risk shapes found: PRESENCE-VS-VALUE, DERIVED-CONSTANT, GEOMETRY-INVARIANT, DUAL-PATH-PARITY, RENAME
Agent/IDE config (.claude/.vscode): none
Mutation gate: 18 mutated, 10 killed, 5 SURVIVED, 4 false kills discarded and re-run
Norms extracted / violations: 9 / 2
Body claims checked: 11 verified, 4 refuted (findings 3–6)
Classes found again: UNFAILABLE-ASSERTION (round 1) — 1 new instance · DERIVED-CONSTANT (round 1) — 3 new instances
New classes: PRESENCE-VS-VALUE (finding 2)
Sections skipped as CI-covered: lint / shellcheck / CodeQL / Trivy / hadolint all green
Commits: 4, all signed-off: yes
CI: passing (13/13)

Two things I checked and am not filing, so you know they were considered: the
~5 ms host floor is sound (5006 µs is the floor, so 19.3/5.0 ≈ 3.8x is the right
reading of "floor", not a cherry-pick of the 5568 shipping row), and the "8x size / 128x
inode" span correctly describes the corners of the host table. One stale detail: the body
still says "the three commits are the entire diff" — there are four now.

phaseLog("vmpool: exec phases acquire_us=%d resume_us=%d run_us=%d destroy_us=%d cold=%q",
phaseLog("vmpool: exec phases acquire_us=%d resume_us=%d vmresume_us=%d vsockdial_us=%d mount_us=%d run_us=%d destroy_us=%d cold=%q",
ph.Acquire.Microseconds(), ph.Resume.Microseconds(),
ph.VMResume.Microseconds(), ph.VsockDial.Microseconds(), ph.Mount.Microseconds(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must-fix · class UNFAILABLE-ASSERTION (recurrence of round 1's class) · sweep below

Transposing ph.VsockDial and ph.Mount in this argument list leaves both packages green. Confirmed with -count=1, because the first run reported cmd/vmpoolctl as (cached) and I did not want to trust that:

ok  	.../internal/vmpool	5.451s
ok  	.../cmd/vmpoolctl	1.1s

This is the third site where the same three same-typed values are copied positionally, and the diff names the hazard three separate times — testlauncher.go:69-71 ("a transposition anywhere along the copy chain compiles silently, and on real data would relabel the mount — 78-81% of the phase — as the dial"), launcher_firecracker_test.go:457-459, and main_test.go:103-105. Round 1's fix guarded two of the three: main_test.go now asserts the JSON record by value, and TestFirecrackerResumePhasesRoundTrip pins the stash/read pair in both directions. The phase line is the one left on presence-only, and TestRunnerEmitsEveryPhase checks only that the keys appear (diag_test.go:80-87) — so a swapped pair prints vsockdial_us=27630 mount_us=5770 and nothing notices.

The reason names-only is right for acquire_us/resume_us does not extend to these three, and that is your own argument from main_test.go:100-102: the fake clock cannot advance, so those are legitimately 0 — but the sub-phases are not clock-derived, they come from ResumePhases(). Same reasoning, one file over.

Cheap because the fixture is already in this file. phasingLauncher has distinct values (300 µs / 2 ms / 20 ms) and capturePhaseLog is right there:

func TestPhaseLineReportsResumeSubPhasesByValue(t *testing.T) {
	lines := capturePhaseLog(t)
	pl := &phasingLauncher{fakeLauncher: newFakeLauncher(),
		vmResume: 300 * time.Microsecond, vsockDial: 2 * time.Millisecond, mount: 20 * time.Millisecond}
	p, _ := testPoolWith(t, pl)
	// ... ExecPhased ...
	// Distinct values, so a transposition fails rather than merely printing three keys.
	for _, want := range []string{"vmresume_us=300", "vsockdial_us=2000", "mount_us=20000"} {
		if !strings.Contains((*lines)[0], want) {
			t.Errorf("phase line missing %q: %s", want, (*lines)[0])
		}
	}
}

Extending TestExecPhasedReportsResumeSubPhases with a capturePhaseLog would work equally well and adds fewer lines — it already builds exactly this launcher.

Sweep before fixing (the class, not this line): list every site that copies the triple positionally and ask whether any test pins the order rather than presence.

grep -rn 'VMResume, ph.VsockDial, ph.Mount\|phVMResume, phVsockDial, phMount\|vmResume, vsockDial, mount' \
  --include='*.go' remote-worker/

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b38a624. Ran the sweep first, as asked — logPhases was the only unpinned value-carrying site:

site order pinned by
launcher_firecracker.go stash assignment TestFirecrackerResumePhasesRoundTrip (both directions)
pool.go:338 ph.* = rp.ResumePhases() TestExecPhasedReportsResumeSubPhases (300µs / 2ms / 20ms)
main.go:483 sample copy and the three pct accessors TestRunsOneExecInAVMAndReportsItAsJSON (11 / 222 / 3333)
diag.go:35 format args nothing ← this finding
the stamps inside Resume nothing; needs real Firecracker

One correction to the suggested fix: the snippet calls ExecPhased, but logPhases is invoked from Runner.Run (runner.go:31) and never from ExecPhased — so (*lines)[0] would panic on an empty slice. Same for extending TestExecPhasedReportsResumeSubPhases, which calls ExecPhased directly. TestPhaseLineReportsResumeSubPhasesByValue therefore routes through Runner.Run with the phasingLauncher, which is the wiring TestRunnerEmitsEveryPhase already uses. Your fixture choice and distinct values carried over unchanged.

Mutant confirmed dead, and the failure output is the exact relabelling you predicted:

phase line missing "mount_us=20000": vmpool: exec phases acquire_us=0 resume_us=0
  vmresume_us=300 vsockdial_us=20000 mount_us=2000 run_us=0 destroy_us=0 cold="first-exec"

// in diag.go), rather than a duration measured from an unset clock.
var phVMResume, phVsockDial, phMount time.Duration
var mountStart time.Time
defer func() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must-fix · class PRESENCE-VS-VALUE (new class this round)

The defer is registered here, at line 844 — but Resume can already have returned at line 824:

func (v *firecrackerVM) Resume(ctx context.Context) error {
	if err := v.checkNotDestroyed(); err != nil {
		return err          // ← line 825: no defer registered yet, so nothing is stashed
	}
	...
	defer func() { ... v.stashResumePhases(...) }()   // ← line 844

diag.go:55-57 states the opposite as a deliberate property:

The three values are the LAST Resume's... A failed Resume therefore overwrites the previous successful one's values, which is intended: they describe an attempt, not a VM.

On this one path it overwrites nothing. And because firecrackerVMs are reused warm across Execs, and pool.go:337-338 reads the stash unconditionally on the error path, the failed Exec reports the previous Exec's sub-phases as its own. Not zeros — which your framework has a story for — but another attempt's real measurements, which it does not.

Probe on this branch, no Firecracker needed:

v := &firecrackerVM{}
v.stashResumePhases(300*time.Microsecond, 2*time.Millisecond, 20*time.Millisecond)
v.destroyed = true
err := v.Resume(context.Background())   // "used after Destroy"
v.ResumePhases()                        // → (300µs, 2ms, 20ms)   STALE

That is the interesting part: this return happens before any Firecracker contact, so it is the one piece of Resume that is unit-testable. The coverage note at launcher_firecracker_test.go:453-454 ("Resume itself cannot run without a real Firecracker") is right about the stamps and slightly too broad about the function.

One-line fix — hoist the defer above the guard, so entry always resets the stash:

 func (v *firecrackerVM) Resume(ctx context.Context) error {
+	var phVMResume, phVsockDial, phMount time.Duration
+	var mountStart time.Time
+	defer func() {
+		if !mountStart.IsZero() {
+			phMount = time.Since(mountStart)
+		}
+		v.stashResumePhases(phVMResume, phVsockDial, phMount)
+	}()
 	if err := v.checkNotDestroyed(); err != nil {
 		return err
 	}

Then "a failed Resume overwrites the previous one's values" is true without exception, the partial-failure shape you documented is unchanged (all three still zero for steps never entered), and diag.go's exception paragraph gets simpler rather than needing a second caveat. Worth the three-line test alongside it, since the mechanism now has one.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b38a624, with your hoist exactly as written plus the test.

You are right about the mechanism, and right that the invariant in diag.go was false on that path: below the guard, that return stashed nothing and left the previous values in place. Moving the defer back below it now fails TestFirecrackerResumeResetsPhasesOnRefusal, which uses your probe.

You are also right that I over-scoped the coverage note — that branch returns before any Firecracker contact, so it was unit-testable all along and I had written off the whole function on the strength of the stamps.

One thing I would qualify: the consequence as stated needs one VM to serve two Execs, and the pool forbids that. Pool.Exec's contract is "runs exactly one command, and destroys the VM before returning. A VM is NEVER reused", and vm.Resume has exactly two callers — pool.go:332, once per Exec, and snapshot.go:197 on a freshly restored Probe VM. So I could not find a path today where a live Exec reads an earlier Exec's sub-phases; reaching it needs a second Resume on one firecrackerVM, which nothing does.

So I read this as a latent inconsistency between code and comment rather than a live mis-measurement. The fix is in regardless, on three grounds that do not depend on today's reachability: it is three lines, it makes the documented invariant hold with no exception, and it disarms the trap for whoever later adds a retry or starts reusing VMs.


At 8 slots, reading the ladder table above: `run_us` = 2762 µs covers a dial, a round trip, the
command and its `sync`, versus `mount_us` = 19225 µs for a round trip carrying only the mount.
**The mount command's own execution is ~16.5 ms** (19225 − 2762 = 16463 µs), i.e. about 7x a

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion · class DERIVED-CONSTANT

The ratio does not follow from the two numbers the sentence just derived. It defines the comparison as the mount command's own execution (16463 µs) against a comparable complete round trip (run_us = 2762 µs):

16463 / 2762 = 5.96x   →  about 6x
19225 / 2762 = 6.96x   →  about 7x

7x is the un-subtracted ratio — the one the sentence deliberately moved away from by subtracting run_us. So the number carried forward is from the quantity the clause abandoned.

about 6x fixes it, and the point lands just as hard: a round trip carrying only mountpoint || mount costs six times a round trip carrying a command plus its sync. Perfetto either way — this is one digit, not a wrong conclusion.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b38a624 — now about 6x, with the arithmetic shown inline so the next reader does not have to redo it:

The mount command's own execution is ~16.5 ms (19225 − 2762 = 16463 µs), i.e. about 6x a comparable complete round trip (16463 / 2762 = 5.96). The un-subtracted ratio, 19225 / 2762, is 7.0x; 6x is the one that follows from the subtraction this sentence just did.

Confirmed both: 16463 / 2762 = 5.96 and 19225 / 2762 = 6.96. I had carried forward the ratio of the quantity the clause explicitly moved away from. The same ~7x was in the PR body and is corrected there too.

run had been spent. At c=1 over 24 iterations the three sub-phases sum to 22891 µs against a
`resume_us` of 22916 µs — a **+0.11% residual**, which is `checkNotDestroyed` plus the error
checks. (The p95 residual is −2.2% and is not an error: p95-of-a-sum is not the sum-of-p95s,
because each sub-phase's p95 comes from a different iteration. The p50 identity is the check.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion · class SELF-CONSISTENCY

"The p50 identity is the check" invites a check that fails on the ladder this note publishes twelve lines later.

Summing the three sub-phase columns against resume per rung:

rung vmresume + vsockdial + mount resume residual
64 34592 35545 2.68%
32 30588 31135 1.76%
16 25129 25327 0.78%
8 23745 23871 0.53%

At c=1 the +0.11% is a genuine instrument check and the attribution to checkNotDestroyed plus the error checks is convincing. But on the ladder the residual is 25x that and grows monotonically with slot count — which is not un-instrumented code, it is the same non-additivity the parenthetical grants p95: at c>1 each sub-phase's p50 comes from a different iteration too, so p50-of-a-sum is not the sum-of-p50s either.

Nothing in the conclusion moves — mount dominates at 77.7–80.5% by a mile and no residual of this size touches that. But "the p50 identity is the check" is the sentence a skeptical reader tests first, and testing it against the published table makes the instrument look worse than it is. Scoping it is enough:

The p50 identity is the check at c=1; on the ladder both percentiles drift from the sum for the same reason, and the residual grows with concurrency (0.5% at 8 slots to 2.7% at 64).

Same paragraph, one more clause, and it pre-empts the objection instead of inviting it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b38a624. Recomputed the per-rung residuals before editing and they match yours exactly:

rung sum resume residual
64 34592 35545 2.68%
32 30588 31135 1.76%
16 25129 25327 0.78%
8 23745 23871 0.53%

Your diagnosis is the right one and I had missed it: the parenthetical already grants p95 the non-additivity, and at c>1 p50 has it for identical reasons — each sub-phase's median comes from a different Exec. Monotonic growth with slot count is the tell, and I should have noticed the sentence invited a check against a table twelve lines below it.

Scoped as suggested, with the residuals stated and attributed:

The p50 identity is the check at c=1 only. On the concurrent ladder below, p50 is non-additive for the same reason p95 is — each sub-phase's median comes from a different Exec — and the residual grows with concurrency: 0.53% at 8 slots, 0.78% at 16, 1.76% at 32, 2.68% at 64. That is percentile arithmetic, not un-instrumented code, and no residual of that size touches the finding that mount dominates at 77.7–80.5%.

- **`Resume` is BIGGER than the campaign table says.** The task brief put it at ~23 ms of a
~102 ms Exec at 64 slots; it is **35.5 ms of 82.2 ms (43.3%)** there. The ~23 ms figure is
the ≤8-slot value. The on-disk record it was drawn from (`i307-e2e1/s64-rep1-on.json`)
reads `p50_resume_us=34287`, which agrees with this measurement, so the brief's table — not

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion · class DERIVED-CONSTANT

34287 vs this run's 35545 is a 3.67% gap, presented as "agrees with this measurement" with no figure attached — in a note that elsewhere reports drift to two decimal places (+0.10%, +0.05%, +0.07%) and disqualifies a whole column at 12.4% and 5.19%.

The claim is right and the evidence supports it: 34287 is decisively ~34 ms, not ~23 ms, so the brief's table is indeed what was off. It is the unqualified "agrees" that is out of step with the rigour of every other comparison here, and a reader who has just been taught to read drift percentages will compute this one.

reads p50_resume_us=34287 — within 3.7% of this run's 35545, and nowhere near the brief's ~23 ms — so the brief's table…

That also makes the argument stronger, because it shows the gap is an order of magnitude smaller than the error being corrected.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b38a624 — now "within 3.7% of this run's 35545, and nowhere near the brief's ~23 ms", and I took your point that quantifying it strengthens the argument rather than weakening it, so the note now says so explicitly: the gap between the two measurements is an order of magnitude smaller than the error being corrected.

Fair hit on the inconsistency. A note that disqualifies a column at 5.19% should not be using a bare "agrees" for 3.67%. Corrected in the PR body too, which carried the same sentence.

than Run's entire dial + round trip + `sync` (2762 µs).** Both are the ladder's 8-slot row; the
arms sweep reads 4196 and 2756 and the inequality is the same either way. Resume's dial is
therefore not measuring dial mechanics — it is measuring how long the just-unpaused guest takes to become able to answer a
`CONNECT`. `PATCH /vm` returns in 368 µs; the guest kernel and agent then have to be

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit · class DERIVED-CONSTANT

368 µs is in no table in this note. The ladder's 8-slot rows read 361 and 367, 16 slots reads 412.

Worth a mention only because of where it sits: the sentence immediately above is the 4196 / 2756 one from last round, which you fixed by naming the sweep each figure came from — and the very next clause introduces a fresh number with no provenance. Same class, one line apart, which is exactly how this one keeps coming back.

361 µs (or 367, whichever the 8-slot rung you mean) makes the paragraph checkable against the table without arithmetic, the way the fixed sentence above it now is.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b38a624 — now 361 µs at that same 8-slot rung, so the paragraph is checkable against the ladder without arithmetic.

Your point about where it sits is the useful part: 368 is the arms sweep's arm A, and it appeared one line after the sentence I fixed last round by naming each figure's sweep. Introducing a fresh unsourced number immediately below that fix is how the class survives, and it is a fair description of how I was editing — patching the flagged line rather than sweeping the paragraph. I checked the rest of the note for the same shape this time: every remaining figure in prose now either appears in a table on this page or names its sweep.


func (v *fakeHostVM) Key() string { return v.key }

// FakeResumePhases are the sub-phase durations fakeHostVM reports, exported so a test in

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit · class RENAME-DRIFT

FakeResumePhases is not a declared identifier — the const block is unnamed and holds FakeVMResumeUs, FakeVsockDialUs, FakeMountUs. Go's convention is that a doc comment on an exported declaration opens with that declaration's name, so godoc renders this attached to a group it misnames, and anyone grepping FakeResumePhases lands on the method concept instead.

// FakeVMResumeUs, FakeVsockDialUs and FakeMountUs are the sub-phase durations fakeHostVM reports, … costs nothing. The rest of the comment is the good part and I would not touch a word of it — the "equal placeholders could not tell those apart" sentence is precisely why the transposition mutants died.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b38a624. Now opens // FakeVMResumeUs, FakeVsockDialUs and FakeMountUs are the sub-phase durations fakeHostVM reports, … so godoc attaches it to the group it actually names, and a grep for the identifier lands on the constants rather than on the method concept.

…ase line's slot order (rossoctl#339 review round 2)

Two must-fixes, four suggestions, one nit.

THE STASH IS NOW RESET BEFORE THE FIRST RETURN. The defer sat below
checkNotDestroyed, so that one path stashed nothing and left the previous values
in place -- making resumePhaser's "a failed Resume overwrites the previous one's
values" false by exception, and letting a caller that reads the stash on the error
path (pool.go does, unconditionally) attribute an earlier attempt's real
measurements to the refused one. Zeros the framework has a story for; another
attempt's numbers it does not. Hoisting the defer makes the invariant hold with no
exception.

That branch returns before any Firecracker contact, so unlike the stamps it IS
unit-testable -- my previous coverage note was too broad about the whole function.
TestFirecrackerResumeResetsPhasesOnRefusal pins it, and moving the defer back below
the guard now fails.

THE PHASE LINE'S SLOT ORDER IS PINNED. logPhases was the last site copying the
three same-typed values positionally with nothing checking the slots:
TestRunnerEmitsEveryPhase covers names only, so transposing ph.VsockDial and
ph.Mount printed `vsockdial_us=20000 mount_us=2000` -- relabelling 78-81% of the
phase as the dial -- with both packages green. Names-only is right for
acquire/resume/run/destroy because the fake clock cannot advance, but the
sub-phases are not clock-derived, so a fake can return fixed values and the line
can be checked against them. TestPhaseLineReportsResumeSubPhasesByValue does that
and kills the transposition.

It routes through Runner.Run rather than ExecPhased: logPhases is called from the
Runner, so an ExecPhased call emits no line at all.

A sweep of every positional copy of the triple found no other unpinned site. The
stash/read pair, pool.go's assertion, the vmpoolctl sample copy and the pct
accessors are each pinned by value against distinct fixtures; the remaining
unpinned copies are the stamps inside Resume, which need real hardware.

FOUR FIGURE CORRECTIONS IN THE NOTE. The ~7x round-trip ratio was the
un-subtracted one: the sentence subtracts run_us to get 16463 us, and
16463/2762 = 5.96, so it is ~6x (19225/2762 = 7.0 is the quantity the clause
abandoned). "The p50 identity is the check" is now scoped to c=1, with the ladder's
residuals stated (0.53% at 8 slots rising to 2.68% at 64) and attributed to the
same percentile non-additivity the note already grants p95 -- it invited a check
that fails on the table twelve lines below it. 34287 vs 35545 is now "within 3.7%"
rather than an unqualified "agrees", in a note that disqualifies columns at 12.4%.
And `368 us` appeared in no table; the 8-slot rung reads 361.

Nit: the const block's doc comment opened with FakeResumePhases, which is not a
declared identifier -- now opens with the three names godoc will attach it to.

Verified: go test ./... green (9 packages), internal/vmpool clean under -race,
make lint clean, and both new mutants confirmed killed.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

@huang195 huang195 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Round 3. Both of round 2's fixes are real — I verified them by breaking the code, not by reading the replies: the logPhases order fix and the checkNotDestroyed defer hoist each kill their mutant. The hoist is also deadlock-free, since checkNotDestroyed releases v.mu on its own return before the deferred stashResumePhases acquires it.

What blocks is one class, and it is the class that has now appeared in all three rounds: strings.Contains against a space-delimited key=value line with no delimiter anchor. Two instances, one root cause, both in the code rounds 1 and 2 added. The PR introduced the first one by adding vmresume_us to a line that was already being checked for resume_us — "resume_us=" is a substring of "vmresume_us=", so renaming or deleting resume_us outright is now invisible. The second is narrower: vsockdial_us=2000 matches vsockdial_us=20000, so one of the three by-value assertions cannot fail in the transposition direction — visible in the very output you pasted as proof the transposition dies.

The measurement work remains excellent, and all four of round 2's figure corrections recompute. The doc findings below are two range/provenance items of the class that keeps returning, not new problems.

Author: pdettori (MEMBER — maintainer)
Areas reviewed: Go production (5 files, +135/-11), Go tests (4 files, +252/-10), Docs (1 note, +243)
Risk shapes found: UNFAILABLE-ASSERTION, PRESENCE-VS-VALUE, DERIVED-CONSTANT, SELF-CONSISTENCY, DUAL-PATH-PARITY, RENAME
Agent/IDE config (.claude/.vscode): none
Mutation gate: 6 mutated, 2 killed, 4 SURVIVED (3 live gap / 0 unreachable / 1 declared + declined)
Norms extracted / violations: 20 / 3
Body claims checked: 14 verified, 0 refuted
Classes found again: UNFAILABLE-ASSERTION (rounds 1, 2) — 2 new instances · DERIVED-CONSTANT (rounds 1, 2) — 2 new instances · SELF-CONSISTENCY (round 2) — 2 new instances
New classes: none
Sections skipped as CI-covered: 3.4 / 3.6 (lint, shellcheck, hadolint, CodeQL, Trivy, dependency-review all green)
Commits: 5, all signed-off: yes
CI: passing (13/13)

Mutation gate detail

Control: internal/vmpool EXIT:0, cmd/vmpoolctl EXIT:0 at b38a624, clean worktree, -count=1, env -u SSL_CERT_FILE.

Mutation Killed by Verdict
rename resume_us=%d -> resumeus=%d (diag.go:33) — SURVIVED — live gap (finding 1)
delete resume_us=%d + its arg (vet clean) — SURVIVED — live gap (finding 1)
print ph.Mount in the vsockdial slot (diag.go:35) — SURVIVED — live gap (finding 2)
feed ph.VMResume into the resume_us slot (diag.go:34) — SURVIVED — declared + declined (finding 3)
transpose ph.VsockDial / ph.Mount in logPhases TestPhaseLineReportsResumeSubPhasesByValue killed
move the stash defer back below checkNotDestroyed TestFirecrackerResumeResetsPhasesOnRefusal killed

Verified and not filed

  • RENAME drift clean repo-wide: FakeResumePhases 0 hits, stashPhases 0 hits — both round-2 fixes swept properly. The one TestRunnerEmitsAllFourPhases hit is the deliberate historical mention at diag_test.go:47.
  • deploy/microvm/e10-lifecycle.sh:825 reads exact dict keys (d.get('p50_resume_us',0)), so the JSON consumer is immune to finding 1's shadowing, and it still sums acquire+resume+run+destroy only — no double-counting from the six new fields.
  • All four round-2 figure corrections recompute: residuals 0.53/0.78/1.76/2.68%, "within 3.7%", about 6x (16463/2762 = 5.96 against the abandoned 6.96), 361 µs.
  • Body claims: 9 packages with tests of 12 total; coldAcquireRateTrue 0.643 is the ladder's 64-slot coldRate cell; -race on internal/vmpool re-run here, EXIT:0; 5 commits all signed off; base is #336's merge 1bcc138, so this branch's commits really are the entire diff. Every ladder and arms composition percentage recomputes.
  • The throughput drift figures (−1.14% ladder, +0.35% arms) are attainable from the 1-decimal table values once the unrounded underlying numbers are allowed, so I am not filing them.

Assisted-By: Claude (Anthropic AI) [email protected]

// What the field set catches is a dropped phase or a rename, which is the failure that
// makes an aggregated run silently miss a term.
for _, field := range []string{
"acquire_us=", "resume_us=",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must-fix · class UNFAILABLE-ASSERTION (third consecutive round for this class) · sweep below

strings.Contains(got, "resume_us=") is satisfied by the vmresume_us=300 token, because "resume_us=" is a substring of "vmresume_us=". This PR created the shadowing — before it, resume_us= was unambiguous on this line.

Two mutants survive, both packages green, -count=1:

  • rename resume_us=%d -> resumeus=%d in diag.go:33 — EXIT:0
  • delete resume_us=%d and its ph.Resume.Microseconds(), arg outright — EXIT:0, and go vet is clean

That is precisely the failure diag.go:26-28 says logPhases centralises the field names to prevent ("a silently renamed field reads as a missing phase rather than as an error") and that lines 78-79 right here say this loop exists to catch ("a dropped phase or a rename"). It is also the one field the PR's whole compatibility story rests on: resume_us keeping its old meaning is what lets campaign tables compare across runs.

The JSON sink already gets this right. main_test.go:134 asserts "p50_resume_us" with the quotes, and that is not a substring of "p50_vmresume_us" because the " anchors it. The phase line is the one sink with no delimiter anchor — so this is a parity gap, not a fresh idea.

Cheapest fix: anchor on the delimiter. " resume_us=" (leading space) does not match " vmresume_us=". Better, and it covers finding 2 and lines 85-86 in one edit: split got on spaces into a key set and assert exact membership.

Sweep before fixing (the class, not this line) — every Contains against an unanchored token on this line:

grep -rn 'resume_us=\|acquire_us=\|mount_us=\|vsockdial_us=\|run_us=\|destroy_us=' \
  --include='*_test.go' remote-worker/

That returns exactly four lines: diag_test.go:81, :85, :86, :211. Patching 81 and 211 alone leaves 85-86 in the same shape.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 31222c9. Ran the sweep first and it returned exactly the four sites you named — diag_test.go:81, :85, :86, :211 — so I fixed the class rather than anchoring two of them and leaving the others in the same shape.

phaseFields splits the line on spaces and the assertions do exact map lookups. Anchoring on " resume_us=" would have worked for this instance, but exact lookups cannot match a neighbouring token whatever the fixtures are, and one helper covers finding 2 and the cold= check in the same edit.

You are right that this PR created the shadowing, and right about where the irony sits: the loop whose stated job is catching "a dropped phase or a rename" stopped being able to see either, on the one field whose stability is the whole compatibility claim. Both mutants confirmed dead:

mutant before now
rename resume_us=%d → resumeus=%d SURVIVED KILLED
delete resume_us=%d + its arg SURVIVED KILLED

}
got := (*lines)[0]
// Distinct values, so a transposition fails rather than merely printing three keys.
for _, want := range []string{"vmresume_us=300", "vsockdial_us=2000", "mount_us=20000"} {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must-fix · class UNFAILABLE-ASSERTION · same root cause as finding 1

"vsockdial_us=2000" is a prefix of "vsockdial_us=20000", and 20000 is the mount fixture. Line 210 says "Distinct values, so a transposition fails rather than merely printing three keys" — distinct is not sufficient against a prefix-tolerant matcher. The values must be prefix-free, or the match must be anchored.

Surviving mutant: print ph.Mount.Microseconds() in the vsockdial slot, leaving mount correct. EXIT:0. The line reads vsockdial_us=20000 mount_us=20000 — the dial relabelled with the mount's value, 78-81% of the phase reported as the dial, and all three assertions pass.

The proof is already in your round-2 reply. The output you pasted as evidence the transposition dies is:

vmresume_us=300 vsockdial_us=20000 mount_us=2000

and the test reported only mount_us=20000 as missing. It never flagged the dial slot — vsockdial_us=2000 matched vsockdial_us=20000 by prefix. One of the three assertions did all the killing; the other two are along for the ride in that direction.

Fix: "vsockdial_us=2000 " with the trailing space (every field in the format string is space-followed), or prefix-free fixtures, or the split-and-exact-match from finding 1 — which fixes both at once.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 31222c9 by the same phaseFields change — exact lookups, so prefixes cannot match.

The proof being in my own pasted output is a fair hit, and worth being precise about what I got wrong: I read mount_us=20000 failing as "the test caught the transposition" and did not check whether the other two assertions had contributed. They had not. vsockdial_us=2000 matched vsockdial_us=20000 by prefix, so one assertion was doing all the killing and I reported all three as working.

Your mutant — ph.Mount in the vsockdial slot with mount left correct — is the one that shows it, because it produces vsockdial_us=20000 mount_us=20000 and nothing on the old matcher could fail. Confirmed KILLED now.

Also noted for the record: "distinct values" was the wrong property to reach for. Against a prefix-tolerant matcher the requirement is prefix-free, which 2000/20000 is not. Exact matching removes the need to reason about it at all.

}
phaseLog("vmpool: exec phases acquire_us=%d resume_us=%d run_us=%d destroy_us=%d cold=%q",
phaseLog("vmpool: exec phases acquire_us=%d resume_us=%d vmresume_us=%d vsockdial_us=%d mount_us=%d run_us=%d destroy_us=%d cold=%q",
ph.Acquire.Microseconds(), ph.Resume.Microseconds(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion · class PRESENCE-VS-VALUE · disposition: declared and declined, recorded so round 4 does not re-find it as new

Feeding ph.VMResume into the resume_us slot survives: EXIT:0, both packages. resume_us would report the vcpu un-pause (361 µs at 8 slots) instead of the whole phase — directly contradicting this PR's headline compatibility claim, on the field campaign tables compare across runs.

I am not asking for a test. The only guard is asserting resume_us=0 under the fake clock, which is the clock test lines 76-77 here and main_test.go:74-80 both explicitly reject: "Asserting on durations would be a clock test -- the fake clock does not advance, so every one of them is legitimately 0 even on correct code." Your reasoning, quoted back, and I agree with it.

Worth knowing: finding 1's anchoring fix does not cover this. It pins the name, not the slot. So after both must-fixes land, resume_us is the one field on this line with a name check and no value check. A single line in the comment saying so would stop the next reader assuming the by-value coverage extends to it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recorded, not tested — agreed on all three points, including that the anchoring fix pins the name and not the slot.

logPhases' doc comment now states the boundary explicitly:

WHAT THE TESTS DO AND DO NOT PIN. Every field NAME here is asserted exactly, by key, in TestRunnerEmitsEveryPhase (via phaseFields — a Contains would match across token boundaries, since "resume_us=" is a substring of "vmresume_us="). The three sub-phase VALUES are asserted too, because they come from ResumePhases() and a fake can return fixed ones. acquire_us / resume_us / run_us / destroy_us have no value check and cannot get one here: they are clock-derived, and the fake clock does not advance, so asserting on them would be a clock test. So feeding the wrong Phases field into one of those four slots — resume_us carrying VMResume, say — is caught by review, not by a test.

Thanks for declaring it rather than leaving it for a future round to re-find as new; that framing is what made it cheap to answer.

Comment thread remote-worker/internal/vmpool/pool.go Outdated
Cold ColdCause // "" when the acquire was warm

// Resume's three sub-phases, populated only by a launcher implementing
// resumePhaser (Firecracker does; CHV does not, and reports zeros). They SUM to

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit · class SELF-CONSISTENCY

The claim is correct as written and I am not calling it wrong: these are per-Exec durations, and the note measures the per-Exec residual at +0.11%. No test can assert it either — with phasingVM the sub-phases are canned while Resume is clock-derived and reads 0, so the identity is a property of real Firecracker timing, not something a fake can exhibit. Unreachable by construction, not an untested invariant.

The only thing worth a clause is the reading round 2 established: a reader tests "the sum" against the published ladder, where the p50 columns leave 0.53% to 2.68%. The note now pre-empts exactly that ("The p50 identity is the check at c=1 only"); this comment — the copy a reader reaches first, which was round 1's argument about the ~23 ms figure in this same block — states it flat, in caps.

"They SUM to Resume per Exec (to ~0.1%); the ladder's p50 columns do not add, for the percentile reason the note gives" closes it. Raised only because of where it sits.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 31222c9. The block now reads:

They sum to Resume PER EXEC, to ~0.1% — the remainder is checkNotDestroyed, newFCClient and the pre-mount error checks. Aggregated percentiles do NOT add: each sub-phase's p50 comes from a different Exec, so the ladder's columns leave 0.5% at 8 slots rising to 2.7% at 64 (the note has the figures).

Your point about position is the one that persuaded me — this is the same block where round 1's ~23 ms figure sat, and for the same reason: it is the copy a reader reaches before the note. A claim in caps that a reader can falsify against the published ladder is worse than a longer one that holds.

Agreed it is unreachable by construction rather than untested: with phasingVM the sub-phases are canned while Resume is clock-derived and reads 0, so no fake can exhibit the identity.

var mountStart time.Time
defer func() {
if !mountStart.IsZero() {
phMount = time.Since(mountStart)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit · class SELF-CONSISTENCY · the diff states this standard 10 lines below

phMount is computed in the deferred closure, so it measures from mountStart (line 878) to Resume's return — which includes the post-mount if err != nil (898-900) and if res.ExitCode != 0 (901-903). pool.go:232 documents Mount as "guest round trip running the /workspace mount", and the note calls it the mount.

Numerically this is nothing: two comparisons against a 19.2 ms measurement. I raise it only because line 861-864 sets the standard explicitly — the vmresume clock starts below newFCClient for a sub-microsecond correction, on the stated grounds that "the stamp should mean what its comment says". By that standard phMount is the one stamp that doesn't.

Do not restructure this to fix it — moving the stamp out of the closure reintroduces the LIFO hazard round 1 removed, and that trade is clearly the wrong way round. Either a clause on the closure noting the boundary includes the exit-code check, or a mountEnd captured after line 903 and used in the closure if you want the stamp exact. The comment is the better value.

Related, and the reason I looked: the note's md:23-24 attributes the c=1 residual to "checkNotDestroyed plus the error checks". The two pre-mount error checks are indeed in the residual, but the two post-mount ones are inside mount_us by the mechanism above, and newFCClient is in the residual too (as 861-864 notes). Not worth rewording unless you touch that sentence anyway.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documented rather than moved, taking your recommendation on the trade.

The closure now carries:

ONE IMPRECISION, ACCEPTED DELIBERATELY: because phMount closes in the closure, it runs to Resume's RETURN, so it also covers the two checks after runOverConn (the error and the exit code) — two comparisons against a 19.2 ms measurement. Capturing a mountEnd after them would make the stamp exact, and moving the stamp out of the closure would too, but the latter reinstates the LIFO hazard above; that trade is the wrong way round, so the boundary is documented instead of moved.

You are right that the newFCClient clock sets a standard phMount then fails, and that is a fair inconsistency to name even at two comparisons' worth of error.

I did take the related item, since I was editing that sentence anyway: the note's c=1 residual now reads "checkNotDestroyed, newFCClient, and the two error checks that sit BEFORE the mount. The two after it are inside mount_us, because that stamp closes when Resume returns." That was simply wrong before, not just imprecise — it claimed all the error checks were in the residual.

each sub-phase's median comes from a different Exec — and the residual grows with concurrency:
0.53% at 8 slots, 0.78% at 16, 1.76% at 32, 2.68% at 64. That is percentile arithmetic, not
un-instrumented code, and no residual of that size touches the finding that `mount` dominates
at 77.7–80.5%.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion · class DERIVED-CONSTANT (recurrence — rounds 1 and 2)

"77.7–80.5%" excludes a row of its own table. The composition table at lines 54-60 reads 80.6% for the 8′ rung:

rung mount
64 77.7%
32 79.0%
16 80.0%
8 80.5%
8' 80.6%

This is the same shape as round 1's "361–368 µs at ≤32 slots", which the table above it contradicted at 563 — a stated range narrower than the data it summarises. The conclusion is untouched (80.6% is more dominant, not less), which is why this is a suggestion; but these tables are the deliverable and the anchor row is printed right there.

77.7–80.6% makes it exact. Line 66's "78–81% at every rung" already covers 80.6% correctly, and the PR body uses that form — so it is only this one sentence.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 31222c9 — now 77.7–80.6%.

Confirmed the 8′ row: 19251 / 23896 = 80.6%. Same shape as round 1's 361–368 µs, as you say: a stated range narrower than the table it summarises, with the contradicting row printed immediately below. Line 66's "78–81% at every rung" was already correct and is untouched.

| C `cd /; umount /workspace` | **18710** | **5052** | 32611 | 44016 | **228.7** | **clean** |
| A' `true` (anchor) | 19271 | 2758 | 31322 | — | 240.0 | `needs_recovery` |

Anchor drift, A vs A′ on this arms rung: +0.07% `resume`, +0.05% `mount`, +0.35% throughput —

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit · class DERIVED-CONSTANT (recurrence — rounds 1 and 2)

"+0.07% resume" cites a column the arms table does not print. Lines 124-130 carry mount_us, run_us, total, p95 total, thru/s and fs-left — there is no resume column, so this figure cannot be checked against the note.

Round 2 fixed the labelling half of this class and line 47-49 now states the rule: "Every drift figure in this note is labelled with the sweep it comes from." This figure obeys that rule — it names the arms rung — and still is not reproducible, because the rule addresses which sweep rather than whether the column exists. Same class as round 1's 4196 µs, surviving one level up.

Two ways out, either fine: add a resume column to the arms table, or drop resume from this sentence — mount (+0.05%, checkable at 19261→19271) and throughput carry the "the arm deltas are real" argument on their own.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 31222c9 by adding the missing column rather than removing the figure — the arms table now prints resume alongside mount_us:

arm resume mount_us run_us …
A true 23934 19261 2756 …
A′ true (anchor) 23951 19271 2758 …

so (23951 − 23934) / 23934 = +0.071% is now checkable on the page. It also makes arm C's resume visible (23384), which is the term the whole journal A/B is about, so the column earns its place beyond fixing the citation.

Your distinction is the useful part: round 2's rule addresses which sweep a figure came from, not whether the column exists, so a figure can satisfy the rule and still be unreproducible. Same class surviving one level up, exactly as you put it.

…ring matching (rossoctl#339 review round 3)

Two must-fixes with one root cause, plus four smaller items. The class is
UNFAILABLE-ASSERTION for the third round running, so this fixes the class rather
than the two instances.

strings.Contains CANNOT ASSERT ON A SPACE-DELIMITED key=value LINE, and it matched
across token boundaries in both directions:

  - "resume_us=" is a substring of "vmresume_us=". THIS PR CREATED THAT SHADOWING
    by adding the sub-phases to a line already checked for resume_us, so renaming
    resume_us or deleting it outright became invisible -- on the one field whose
    stability is the PR's entire compatibility claim, and in the test whose stated
    job is catching "a dropped phase or a rename".
  - "vsockdial_us=2000" is a PREFIX of "vsockdial_us=20000", the mount fixture. So
    the by-value test added last round passed against the mount's value in the dial
    slot, and only the mount assertion was killing the transposition. That was
    visible in the output I pasted as proof the transposition dies: the failure
    named mount_us and said nothing about the dial.

phaseFields splits the line and the assertions do exact map lookups, which cannot
match a neighbouring token whatever the fixtures are -- distinct values were not
sufficient, they would have had to be prefix-free. It covers all four sites the
sweep found (diag_test.go:81, 85, 86, 211), including the cold check, rather than
anchoring two of them and leaving the others in the same shape. The JSON sink
already had this right, asserting "p50_resume_us" with the quotes.

Three mutants confirmed killed that previously survived: renaming resume_us,
deleting it with its argument, and printing ph.Mount in the vsockdial slot.

RECORDED RATHER THAN TESTED, as the review allowed: acquire/resume/run/destroy have
name checks but no value checks, because they are clock-derived and the fake clock
does not advance -- asserting on them would be the clock test both test files
explicitly reject. So feeding the wrong Phases field into one of those four slots
is caught by review, not by a test. logPhases' doc comment now says exactly that,
so nobody assumes the sub-phases' by-value coverage extends to them.

Also: Phases' "they SUM to Resume" is qualified -- it holds PER EXEC to ~0.1%, and
aggregated percentiles do not add (0.5% at 8 slots to 2.7% at 64), which is the
reading a comment in caps invites. phMount's boundary is documented rather than
moved: it closes at Resume's return so it also covers the two post-mount checks,
and capturing a mountEnd or hoisting the stamp would fix it at the cost of
reinstating the LIFO hazard -- the wrong trade. The note's c=1 residual attribution
now names newFCClient and says which error checks fall inside mount_us.

Figures: "77.7-80.5%" excluded its own 8' row at 80.6%; the arms table now prints
the resume column its +0.07% drift figure is computed from, which was unreproducible
from the page before.

Verified: go test ./... green (9 packages), internal/vmpool clean under -race,
make lint clean, all three round-3 mutants killed.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

@huang195 huang195 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Round 4. All five of round 3's findings verify as fixed, and I checked them by breaking the
code rather than by reading the replies. phaseFields is the right fix — it removes the class
instead of the two instances, exactly as its own comment claims: exact map lookups cannot match a
neighbouring token whatever the fixtures are. Bellissimo. Both shadowing mutants now die with the
test's own message, and the arms table grew the resume column that makes its own drift figure
checkable.

One thing blocks, and it is your own fix's doing: phaseFields made possible the value check that
diag.go:34-37 says cannot exist. Three slots are still unprotected, one four-line guard closes
all three, and I ran it rather than assuming it.

Round 3 finding Now
resume_us= shadowed by vmresume_us= under Contains killed both ways — rename, and delete-with-go vet-clean
vsockdial_us=2000 a prefix of 20000 killed — vsockdial_us = "20000", want "2000"
"77.7–80.5%" excluded its own 80.6% anchor row :31 reads 77.7–80.6%
"+0.07% resume" cited a column the table did not print arms table now prints resume; drift recomputes to +0.0710%
phMount covers the two post-mount checks documented as a deliberate imprecision, with the LIFO trade stated

Author: pdettori (MEMBER — maintainer)
Areas reviewed: Go production (5 files, +181/−12), Go tests (4 files, +302/−13), Docs (1 note, +244)
Risk shapes found: UNFAILABLE-ASSERTION, SELF-CONSISTENCY, PRESENCE-VS-VALUE, DERIVED-CONSTANT, DUAL-PATH-PARITY, GEOMETRY-INVARIANT, RENAME
Agent/IDE config (.claude/.vscode): none
Mutation gate: 6 mutated at 31222c9, 3 killed, 3 SURVIVED (3 live gap — one class, one guard / 0 unreachable / 0 declared+declined). Candidate guard separately validated in 4 runs.
Norms extracted / violations: 21 / 1
Body claims checked: 15 verified, 1 refuted
Sections skipped as CI-covered: 3.4, 3.6 — CI green 13/13
Commits: 6, all signed-off: yes
CI: passing (13/13)

Classes found again: DERIVED-CONSTANT (rounds 1, 2, 3) — 3 new instances · SELF-CONSISTENCY (rounds 2, 3) — 2 instances · PRESENCE-VS-VALUE (round 1) — 1 instance
New classes: none

Mutation gate detail

Control: internal/vmpool EXIT:0, cmd/vmpoolctl EXIT:0 at 31222c9, clean worktree, -count=1,
env -u SSL_CERT_FILE.

Mutation Killed by Verdict
rename resume_us=%d → resumeus=%d TestRunnerEmitsEveryPhase killed (was a round-3 gap)
delete resume_us=%d + its arg, go vet clean TestRunnerEmitsEveryPhase killed (was a round-3 gap)
ph.Mount into the vsockdial slot TestPhaseLineReportsResumeSubPhasesByValue killed (was a round-3 gap)
ph.VMResume into the resume_us slot — SURVIVED — live gap (finding 1)
ph.Mount into the run_us slot — SURVIVED — live gap (finding 1)
ph.VsockDial into the acquire_us slot — SURVIVED — live gap (finding 1)

Body claims

Verified at 31222c9: go build ./..., go vet ./... and go test ./... -count=1 all EXIT:0 —
9 packages with tests of 12, as stated; go test ./internal/vmpool/ -race EXIT:0; base is #336's
merge 1bcc138, and GitHub reports mergeable: true. Every ladder composition percentage and every
arms figure recomputes: 3.4/16.2/77.7, 1.8/17.4/79.0, 1.6/17.6/80.0, 1.5/17.4/80.5, 1.5/17.5/80.6;
43.25→43.3%; 3.67→"within 3.7%"; ladder drift +0.10/+0.14 and arms drift +0.0710/+0.0519; 551 µs =
2.86%; +2296 µs = +83%; p95 +4.835→4.8%.

One refuted: "the count is five" — there are 6 commits. Round 2 caught this same sentence at
three-versus-four. The class-level fix is to stop printing a number at all: "this branch's commits are
the entire diff" needs no count.

Considered and NOT filed

Listed so they are not re-found as new next round:

  • pool.go:220-223 sum invariant untested — dispositioned unreachable by construction in round 3
    and unchanged: phasingVM cans the sub-phases while Resume is clock-derived and reads 0, so no fake
    can exhibit the identity.
  • "19.3/5.0 ≈ 3.8x" — round 2 verified 5006 µs is the floor row, so this is the right reading of
    "floor", not a cherry-pick of the 5568 shipping row.
  • Throughput drift figures (−1.14% ladder, +0.35% arms, −4.38% arm C) — all attainable from the
    unrounded numbers behind the 1-decimal table. Declined in round 3, declined again.
  • "78-81%" in the Go comments vs "77.7–80.6%" in the note — 77.7 rounds to 78 and 80.6 to 81.
    A legitimate band, not drift.
  • Two different fakes disagree about the seam — fakeHostVM implements ResumePhases, the
    in-package fakeVM does not, and TestResumeSubPhasesAreZeroWithoutTheSeam depends on picking the
    latter. If the in-package one ever grew the method the test would fail loudly, not silently.
  • :9's five issues against four multiples — defensible: #307 is the child that produced no
    multiple, which is this PR's whole point.

The measurement work remains the best-controlled thing I review, and a negative result is the hard kind
to publish honestly. Fix the four lines and this is done.

Assisted-By: Claude (Anthropic AI) [email protected]

Comment thread remote-worker/internal/vmpool/diag.go Outdated
// TestRunnerEmitsEveryPhase (via phaseFields -- a Contains would match across token
// boundaries, since "resume_us=" is a substring of "vmresume_us="). The three sub-phase
// VALUES are asserted too, because they come from ResumePhases() and a fake can return
// fixed ones. acquire_us / resume_us / run_us / destroy_us have no value check and cannot

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must-fix · class UNFAILABLE-ASSERTION + SELF-CONSISTENCY · scope IN-SCOPE · fix cost: 4 test lines in a file this PR already owns

Mamma mia, Paolo — this one is your own fix's fault, in the best possible way. Round 3 I accepted this gap as declared and declined and I quoted your reason. That reason is now false, and phaseFields is what made it false.

The comment says:

acquire_us / resume_us / run_us / destroy_us have no value check and cannot get one here: they are clock-derived, and the fake clock does not advance, so asserting on them would be a clock test.

The fake clock not advancing is exactly what makes the assertion possible. In TestPhaseLineReportsResumeSubPhasesByValue all four legitimately read exactly 0, while the three sub-phase fixtures are 300 / 2000 / 20000. So 0 is an independent witness, not a restatement of the implementation and not a clock test — it cannot pass when a ResumePhases-derived value lands in one of those slots.

Three mutants survive at 31222c9, both packages green, -count=1:

mutation result
ph.VMResume into the resume_us slot EXIT:0 SURVIVED
ph.Mount into the run_us slot EXIT:0 SURVIVED
ph.VsockDial into the acquire_us slot EXIT:0 SURVIVED

I did not just assert a guard would work — I ran it. Added to the by-value test it is green on unmutated code (EXIT:0) and kills all three:

for _, k := range []string{"acquire_us", "resume_us", "run_us", "destroy_us"} {
    if fields[k] != "0" {
        t.Errorf("%s = %q, want 0 -- a sub-phase value reached a clock-derived slot: %s",
            k, fields[k], got)
    }
}

GUARD: resume_us = "300" · GUARD: run_us = "20000" · GUARD: acquire_us = "2000".

Why this blocks rather than riding along as a nit: the slot it leaves open is resume_us, and resume_us keeping its whole-phase meaning is this PR's headline compatibility claim — "campaign tables compare resume_us across runs, and a silently redefined field reads as a missing phase rather than as an error." A mislabelled slot there is precisely the failure logPhases' own doc comment (:26-28) says the function was centralised to prevent.

Either take the guard, or keep the boundary and correct the comment — "cannot" is the part I can't let stand, now that the mechanism is sitting 200 lines below it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reproduced before taking it. ph.VMResume into the resume_us slot at 31222c9, both packages, -count=1: EXIT:0, survived. So the comment was not describing a boundary, it was describing a hole, and it was wrong about why.

You have the mechanism right and I had it backwards: the fake clock not advancing is what makes the assertion possible, not what forbids it. Guard taken verbatim into TestPhaseLineReportsResumeSubPhasesByValue, and all four mutants now die naming the field and the value:

diag_test.go:281: resume_us = "300", want 0 -- a sub-phase value reached a clock-derived slot: ... resume_us=300 vmresume_us=300 ...
diag_test.go:281: run_us = "20000", want 0 -- ...
diag_test.go:281: acquire_us = "2000", want 0 -- ...

Unmutated: EXIT:0, and -race clean.

The diag.go comment is rewritten rather than trimmed — "WHAT THE TESTS PIN", stating that the four are pinned at exactly 0 and that zero is an independent witness there. I left in why it matters most on resume_us, since that is the field the compatibility claim rests on. cannot is gone.

ph.Resume = p.clk.Now().Sub(t0)
// Read the sub-phases even on the error path: a Resume that failed IN one of
// the three steps is exactly when knowing which one matters most.
if rp, ok := vm.(resumePhaser); ok {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion · class PRESENCE-VS-VALUE · disposition: unreachable by construction today, recorded so round 5 does not re-find it as new

On !ok the three fields are not written at all, while ph.Resume two lines up is written unconditionally. diag.go:51-53 describes a launcher without the seam as reporting zeros; what actually happens is that it leaves whatever the struct already held.

Not blocking, because it is unreachable: all three production callers allocate fresh — cmd/vmpoolctl/main.go:456, main.go:477, and internal/vmpool/runner.go:23. A reused *Phases is the only way in, and nothing reuses one.

I raise it because it is the same class you just fixed one layer down. Round 3's firecrackerVM.Resume change was exactly this: "Entry now always resets the stash ... a caller reading the stash after a refused Resume saw another attempt's real measurements rather than zeros." The stash now resets itself; ExecPhased's copy-out still does not. One line makes the documented contract a property of the function instead of caller discipline:

} else {
    ph.VMResume, ph.VsockDial, ph.Mount = 0, 0, 0
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken. ExecPhased now has the else writing the three zeros, with a comment saying it is resumePhaser's documented contract being made a property of the function rather than of every caller.

I also made it fail if removed, since a defensive branch nothing exercises is the next thing to get deleted as dead: TestResumeSubPhasesAreZeroWithoutTheSeam now hands in Phases{VMResume: time.Second, VsockDial: time.Second, Mount: time.Second}. Dropping the branch gives

diag_test.go:218: sub-phases = (1s, 1s, 1s), want all zero for a launcher without the seam

That also upgrades what the test asserts: it was pinning "a fresh struct starts zeroed", which is Go, not this function.

Your "unreachable by construction" reading is right and is recorded in the test comment along with the three fresh-allocating callers, so round 5 reads it as a contract rather than re-finding it as a bug.

- Arm C **provably applied**: the `fsstate` probe shows `needs_recovery` gone after C and
present after A, B and A'. This is the check that keeps a silently-failed `umount` from
being read as "recovery is free".
- Removing recovery saves **551 µs of a 19.3 ms mount — 2.86%.**

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion · class SELF-CONSISTENCY · the note is the deliverable here, so this is worth one clause

Two prices for journal recovery, and the note never puts them side by side:

  • Host table (:112-118): dirty 8584 − clean 4946 = 3638 µs
  • Arms (:139): arm C − arm A = 551 µs, i.e. the 2.86% ceiling

And :173-175 argues the guest is ~3.8x slower than the host — so the host table's naive implication for the guest is ~14 ms, roughly 25x the figure you actually use. That 2.86% ceiling is what rejects the journal fix, data=writeback and ^has_journal (:143-145), so a reader who checks the host table finds a number 6.6x larger with no reconciliation.

Your conclusion is not at risk, and that is why this is a suggestion rather than a block: arm C is an end-to-end measurement on the gate-held path, and −4.38% throughput with p95 +4.8% stands on its own regardless of what recovery costs in isolation.

The reconciliation is probably one clause: 8584 is a first mount of a dirty image while 4946 is the 2nd/3rd mount of the same one, so that delta carries cold-cache cost as well as recovery, where the arms delta is 2000 warm iterations either side. Say which one you trust and why — the note is this careful everywhere else, and this is the one number a skeptic will go after.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reconciled, and your diagnosis of the gap is the one I wrote in. Added directly under the host table, so a reader hits it before the ceiling arguments:

Read that table for whether recovery happens, not for what it costs. Its dirty-vs-clean delta is 8584 − 4946 = 3638 µs, which is 6.6x the 551 µs arm C actually removes below, and scaled into the guest by the ≈3.8x host ratio derived further down it would predict ~14 ms — about 25x. The delta is inflated because 8584 is the first mount of that image while 4946 is the second and third of the same one, so it prices cold page cache and dentry population alongside journal replay. Arm C is the figure to trust, and every ceiling in this note is computed from it: 2000 warm iterations either side, one image, the same gate-held path, the only difference being whether the previous Exec left the journal dirty.

Arm C named explicitly as the trusted one, since that is what the 2.86% ceiling rejecting data=writeback and ^has_journal is computed from.

//
// Named for the property, not the count: it was TestRunnerEmitsAllFourPhases until this
// decomposition added three more, and a name that counts has to be renamed by whoever
// adds the next one -- which is exactly the drift line 79 says this test exists to catch.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit · class DERIVED-CONSTANT (hand-written cross-reference) · recurrence, rounds 1-3

"which is exactly the drift line 79 says this test exists to catch" — new-side line 79 is a bare // separator. The rationale you mean is at :111-112 ("What the field set catches is a dropped phase or a rename"). The same hunk that wrote the reference moved its target.

Perfetto irony: a hand-maintained number drifting from its source, inside the very comment explaining why the test is named for a property rather than a count. Name the thing — "the field-set rationale below" — and it cannot drift again.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by naming it — "the drift the field-set rationale below says this test exists to catch" — plus one parenthetical recording why it is not a line number, since that is the second time this comment has drifted:

(Named, not cited by line number: the hunk that added this comment moved the line the first draft pointed at.)


One consequence is worth stating separately: **`vsockdial_us` (4159 µs at 8 slots) is larger
than Run's entire dial + round trip + `sync` (2762 µs).** Both are the ladder's 8-slot row; the
arms sweep reads 4196 and 2756 and the inequality is the same either way. Resume's dial is

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit · class DERIVED-CONSTANT · recurrence — this is round 3's finding, one column over

"the arms sweep reads 4196 and 2756": 2756 is arm A's run_us in the table at :125-130, but 4196 is in no table — the arms table still has no vsockdial column.

This is exactly the shape you fixed last round. "+0.07% resume" cited a column the arms table did not print, and you fixed it by adding the resume column — bellissimo, and the drift recomputes to +0.0710% against it. The figure one column over is still uncheckable.

The inequality is true either way (4196 > 2756 from the arms, 4159 > 2762 from the ladder), so this is provenance, not correctness. Add the column, or drop the parenthetical.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped, and said why the cross-check is absent rather than deleting the clause silently — the rig (srv-r16b14s16) is gone, so I cannot read a vsockdial column out of the arms records to add it:

Both figures are the ladder's 8-slot row, and the comparison is made there only — the arms table below carries no vsockdial column, so it cannot second the inequality.

Every number in that sentence now prints in the ladder table above it. Same disposition as last round's resume column, one notch weaker: there I could add the column, here I can only say it is not there.

… sub-phases without the seam (rossoctl#339 review round 4)

One must-fix, one accepted suggestion, and three documentation items. The must-fix
is this PR's own doing, and the previous round is what made it possible.

ROUND 3 ACCEPTED A GAP THAT NO LONGER EXISTS. diag.go said acquire_us / resume_us /
run_us / destroy_us "have no value check and cannot get one here: they are
clock-derived, and the fake clock does not advance, so asserting on them would be a
clock test." That is backwards. The clock not advancing is exactly what makes the
assertion possible: in TestPhaseLineReportsResumeSubPhasesByValue all four
legitimately read exactly 0 while the three sub-phase fixtures are 300 / 2000 /
20000, so 0 is an INDEPENDENT witness -- not a restatement of logPhases, and not a
clock test. It cannot hold once a ResumePhases-derived value lands in one of those
four slots.

Confirmed by mutation at 31222c9, both packages, -count=1. Three mutants that
survived:

  - ph.VMResume into the resume_us slot      EXIT:0 SURVIVED
  - ph.Mount into the run_us slot            EXIT:0 SURVIVED
  - ph.VsockDial into the acquire_us slot     EXIT:0 SURVIVED

With the guard all three fail, naming the field and the offending value, and
unmutated code stays green. The slot that mattered was resume_us: its unchanged
whole-phase meaning is this PR's headline compatibility claim, and a mislabelled
value there is precisely the failure logPhases' own doc comment says the function
was centralised to prevent. The comment now states what IS pinned rather than
asserting an impossibility.

ExecPhased now zeroes the three sub-phases when the VM does not implement
resumePhaser, instead of leaving whatever the caller's Phases held while writing
ph.Resume unconditionally two lines up. "A launcher without the seam reports zeros"
is resumePhaser's documented contract; this makes it a property of the function
rather than of every caller. Unreachable today -- all three production callers
allocate fresh (cmd/vmpoolctl/main.go x2, runner.go) -- so it is recorded as a
contract, not a bug fix. It is the same class as round 3's stash reset one layer
down, and TestResumeSubPhasesAreZeroWithoutTheSeam now hands in a pre-populated
Phases, which fails without the branch.

The design note reconciles its two prices for journal recovery. The host table's
dirty-vs-clean delta is 3638 us, 6.6x the 551 us arm C removes and ~25x once scaled
by the note's own 3.8x guest ratio. It is inflated because 8584 is the FIRST mount
of that image and 4946 the second and third of the same one, so it prices cold page
cache and dentry population alongside replay. Arm C is the figure every ceiling in
the note is computed from, and the note now says which one it trusts and why. The
conclusion is unaffected: -4.38% throughput is an end-to-end measurement on the
gate-held path.

Two hand-written cross-references dropped rather than repaired, since both had
already drifted once: a "line 79" whose target the same hunk moved (now named, not
numbered), and an arms-sweep vsockdial figure of 4196 that appears in no table --
the arms table has no vsockdial column and the rig is gone, so the inequality is now
stated against the ladder only, which prints both terms.

Verification: go build, go vet, go test ./... -count=1 green (9 packages), vmpool
clean under -race, make lint clean on the four files touched.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
@pdettori

Copy link
Copy Markdown
Member Author

Round 4 addressed — eec6bf5

All five items in: one must-fix, one suggestion taken, three documentation items. CI green on the head commit (every check complete, all success).

The must-fix was real, and I reproduced it before fixing it. ph.VMResume into the resume_us slot at 31222c9, both packages, -count=1: EXIT:0, survived. @huang195 has the mechanism right and I had it backwards — the fake clock not advancing is what makes the assertion possible, not what forbids it — so diag.go's "cannot get one here" was the part that had to go, not just the missing check. The guard is in TestPhaseLineReportsResumeSubPhasesByValue:

mutant at 31222c9 at eec6bf5
ph.VMResume → resume_us slot EXIT:0 survived killed — resume_us = "300", want 0
ph.Mount → run_us slot EXIT:0 survived killed — run_us = "20000", want 0
ph.VsockDial → acquire_us slot EXIT:0 survived killed — acquire_us = "2000", want 0
drop ExecPhased's new else — killed — sub-phases = (1s, 1s, 1s), want all zero

Unmutated: EXIT:0, and vmpool clean under -race.

The rest:

  • ExecPhased zeroes the three sub-phases when the VM has no seam. Taken as a contract, not a bug fix — it is unreachable today and the test comment records why, naming the three fresh-allocating callers. It is not dead code either: TestResumeSubPhasesAreZeroWithoutTheSeam now hands in a pre-populated Phases, so removing the branch fails. That also upgrades what the test asserted, which was "a fresh struct starts zeroed" — Go, not this function.
  • The two recovery prices are reconciled, placed under the host table so a reader meets it before the ceiling arguments. Its 3638 µs delta also prices cold page cache and dentry population, because 8584 is a first mount while 4946 is the second and third of the same image; arm C's 551 µs is named as the figure to trust, and as the one every ceiling in the note is computed from.
  • Both hand-written cross-references are dropped rather than repaired, since each had already drifted once. line 79 is now named ("the field-set rationale below"), with one clause saying why it is not a number. The arms vsockdial figure of 4196 is gone: the rig (srv-r16b14s16) is decommissioned, so I cannot read the column out of the records to add it, and the note now says the arms table cannot second that inequality instead of implying it does.
  • The PR body carried the same class and is fixed too: its own commit count said five at round 2 and was still saying five at round 4. Replaced with the commit list rather than a corrected number — each round is its own commit, titled with its round.

Every thread from rounds 1–4 has a reply. Ready for a final look.

@huang195 huang195 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round 5, and bellissimo — this is the round where the code stops giving. I mutated the production side twelve ways and eleven died, including both of the defects earlier rounds introduced: moving the stash defer back below checkNotDestroyed (round 2's bug) and transposing ph.VsockDial/ph.Mount in logPhases (round 3's). Deleting resume_us from the phase line outright now fails too, which is exactly what phaseFields was built for. The compatibility claim this whole decomposition rests on is genuinely nailed down.

The one survivor is benign and I am not blocking on it. Everything else I found is in the note and the PR body.

I also want to record what I checked and could not break, because on this PR that is the more useful half:

  • Every ladder figure recomputes. All 12 composition percentages, all four additivity residuals (0.53 / 0.78 / 1.76 / 2.68%), the 43.3%, the 3.7% against p50_resume_us=34287, the arms 2.86% / +83% / +4.8%, the 6.6x / 25x / 5.96x / 3.8x ratios, and the +0.11% c=1 residual. Perfetto.
  • The three "off-by-0.01pp" drift figures are not errors. −4.38%, +0.35% and −1.14% all disagree with a recomputation from the rounded throughput column, but each sits inside that column's rounding envelope — −1.14% needs |Δ|=2.743 where the displayed 240.6/237.8 admit Δ∈[2.70, 2.90] → [1.12%, 1.21%]. Please do not "correct" these. I nearly filed all three.
  • "go test ./... -count=1 green (9 packages)" — exact at HEAD: EXIT 0, 9 ok, 3 no test files, 12 total.
  • "confirmed to fail when the assertion is removed" — independently reproduced.
  • I looked hard at whether the new type assertion costs anything on the plain Exec path. It does not: Exec passes nil at pool.go:207 and the read is inside if ph != nil. Non-issue, noting it so nobody else has to go looking.

One thing for the next round, and it is the important bit. The docs DERIVED-CONSTANT class has now come back in 3 of the 4 rounds (A4/A5/A6, then B11/B13/B14, now three more). Please don't fix the three I list — sweep the note: for every bolded percentage and every µs figure, name the table row it comes from. Anything with no row is an instance. Fixing them one at a time is what has been generating round N+1.

Summary

Author: pdettori (MEMBER — maintainer)
Areas reviewed: Go prod (5 files), Go test (4), Docs (1)
Risk shapes found: DERIVED-CONSTANT, GEOMETRY-INVARIANT, PRESENCE-VS-VALUE, DUAL-PATH-PARITY, RENAME, NEW-ASSERTIONS
Agent/IDE config (.claude/.vscode): none
Mutation gate: 12 mutated, 11 killed, 1 survived (0 live gap / 1 benign / 0 declined)
Norms extracted / violations: 52 / 2
Body claims checked: 6 verified, 3 refuted
Classes found again: DERIVED-CONSTANT in the note (rounds 1, 3); STALE-BODY-CLAIM (round 1)
New classes: REMEDIATION-DRIFT — each round's fix seeded the next round's finding
Sections skipped as CI-covered: 3.3, 3.4, 3.5, 3.6
Commits: 7, all signed-off: yes
CI: passing (13/13)

Two nits on the body itself, since they have no line to hang off:

  • "Two tests, because the whole decomposition hangs off one type assertion" — the PR now adds 5 new Test* funcs, renames and rewrites a 6th, and extends a 7th. Same class as the count you already removed from the Verification paragraph; delete it rather than correct it.
  • "each as its own commit titled with its round number, so the commit list is the count" — round 1's commit is titled (#339 review) with no number, so the rule as stated yields 3 where the real count is 4.

And a question, not a finding: the title, the branch and the note filename all cite #307, which is titled "Destroy is still ~55% of every Exec, and 89% of it is cmd.Wait" and which #336 addressed. #258 is the one that literally asks for "decompose resume … into their sub-costs". An explicit Fixes #N would settle it.

Grazie Paolo — approving. This code is well seasoned at this point.

type sample struct{ acquire, resume, run, destroy, total time.Duration }
type sample struct {
acquire, resume, run, destroy, total time.Duration
// Resume's sub-phases. Zero on every mode but "exec", and zero on the CHV arm,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion — SELF-CONSISTENCY: this rule is stated but not pinned.

The comment says the three fields are "Zero on every mode but exec", "for the same reason the other fields are". For run, that reason has a test behind it — TestModeReplenishMeasuresRestoreOnly asserts if rec.P50RunUs != 0 { t.Fatalf }, with a comment saying why ("reporting one would invite reading a replenishment rung as a hot-path rung"). The three new fields joined the convention but not the test.

The rule does hold today — I checked every writer, and only runExecMode touches them — so this is an unpinned claim rather than a live bug. Worth noting runTeardownPerVMMode does call vm.Resume on the teardown-inflight arm, and under --vmm=fake that returns your canned 11/222/3333; it just never copies them into sample. So the shape where this breaks already exists in the file.

Three lines in main_test.go, which this PR already touches:

if rec.P50VMResumeUs != 0 || rec.P50VsockDialUs != 0 || rec.P50MountUs != 0 {
    t.Fatalf("sub-phases = (%d, %d, %d) in replenish mode, want all 0",
        rec.P50VMResumeUs, rec.P50VsockDialUs, rec.P50MountUs)
}

// one of these slots. Without it, feeding ph.VMResume into the resume_us slot leaves
// both packages green -- verified by mutation, and resume_us is the one field whose
// whole-phase meaning this PR's compatibility claim rests on.
for _, key := range []string{"acquire_us", "resume_us", "run_us", "destroy_us"} {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion — the field set is pinned against rename and drop, but not against addition.

I ran this as a mutation. Renaming mount_us dies here, and so does deleting resume_us outright — phaseFields earns its keep, and the substring hazard your comment describes really is gone. But adding a 9th field to logPhases survives the entire suite: both loops look up keys they already know, so neither can see a key that appeared.

One line above this loop closes it:

if len(fields) != 8 {
    t.Errorf("phase line has %d fields, want 8: %s", len(fields), got)
}

I'm filing this as a suggestion rather than a must-fix on purpose: an extra key breaks no aggregator, so the mutant is benign rather than a live gap. But it is the mirror image of the failure diag.go says this test exists to catch — "a silently renamed field reads as a missing phase rather than as an error" — and it is cheap.

delta is 8584 − 4946 = 3638 µs, which is 6.6x the 551 µs arm C actually removes below, and
scaled into the guest by the ≈3.8x host ratio derived further down it would predict ~14 ms —
about 25x. The delta is inflated because 8584 is the **first** mount of that image while 4946
is the **second and third of the same one**, so it prices cold page cache and dentry population

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion — DERIVED-CONSTANT: this sentence contradicts the table two lines above it.

The table reads clean (2nd / 3rd mount) | 4946 / 5167, which makes 4946 the 2nd and 5167 the 3rd. This sentence calls 4946 "the second and third of the same one". The 8584 − 4946 = 3638 delta above it is likewise the first-vs-second, not first-vs-second-and-third (the 2nd/3rd mean is 5056.5, giving 3527.5 and a 6.4x rather than 6.6x).

The argument survives either way — arm C is the figure you tell the reader to trust, and the 2.86% ceiling everything rests on comes from there and recomputes exactly. It is just this one clause.

Please fold it into the class sweep rather than patching the clause; see my summary comment.

pool (#332, −9.24%): a component improvement that reverses under load. `data=writeback` and
`-O ^has_journal` are bounded by the same 2.86% ceiling and are not worth building either.

The 64-slot arms are **not readable** and are excluded: the anchor drifted −5.19% on `mount`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion — DERIVED-CONSTANT, and this is the recurrence I care about most.

−5.19% on mount, −4.11% on throughput, and arm C's apparent −5.15% are all 64-slot arms figures, and the arms table in this note is 8-slot only. There is no row a reader can check them against.

This is the same shape as round 1's 4196 µs and round 3's 368 µs — both fixed by publishing the operands. You already have the right pattern elsewhere in this very note: L71 cites i307-e2e1/s64-rep1-on.json by name. Doing that here would settle it without publishing rows you have just declared unreadable.

Excluding those arms is clearly the right call, by the way — the reasoning is sound. It is only the provenance of the three numbers that is missing.

Three immediate readings:

- **`vmresume` is not a finding.** `PATCH /vm {state: Resumed}` is 361–563 µs at ≤32 slots
(361/367 at 8 and 8′, 412 at 16, 563 at 32) and 1.2 ms at 64. Sub-millisecond as predicted;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit — "Sub-millisecond as predicted" lands one clause after "and 1.2 ms at 64", and 1192 µs is not sub-millisecond.

The note is the milder of the two: the PR body states it as "vmresume is sub-millisecond at every rung (361–563 µs at ≤32 slots, 1.2 ms at 64)", where the parenthetical refutes the claim in the same sentence.

"Sub-millisecond at every rung up to 32 slots, and 1.2 ms at 64" costs nothing and is exactly true. The finding itself — that vmresume is not where the cost is — is untouched by this.

run had been spent. At c=1 over 24 iterations the three sub-phases sum to 22891 µs against a
`resume_us` of 22916 µs — a **+0.11% residual**: `checkNotDestroyed`, `newFCClient`, and the
two error checks that sit BEFORE the mount. The two after it are inside `mount_us`, because
that stamp closes when `Resume` returns (see the closure in `launcher_firecracker.go`). (The p95 residual is −2.2% and is not an error: p95-of-a-sum is not the sum-of-p95s,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit — 174 characters, where the rest of the note's prose wraps at ~95.

The (The p95 residual is −2.2% … sentence was appended onto the tail of an already-wrapped line instead of starting a new one. Only prose line in the file over 130.

While here: −2.2% has no p95 sub-phase table to check it against either — but unlike the L157 figures, the sentence explains why it isn't derivable (p95-of-a-sum ≠ sum-of-p95s), so I'm not filing it separately. Mentioning it only so the sweep doesn't trip over it and "fix" a number that is fine.

@pdettori
pdettori merged commit 82d91f0 into rossoctl:main Sep 25, 2026
13 checks passed
@pdettori
pdettori deleted the feat/307-resume-decomposition branch September 25, 2026 02:22
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.

2 participants