Skip to content

E12 + E13: guest-initiated vsock across snapshot restore, and the root cause of rung C@128's dropped connections (#271, #280) - #273

Merged
pdettori merged 28 commits into
mainfrom
feat/e13-vsock-restore-capacity-diagnosis
Sep 18, 2026
Merged

pdettori merged 28 commits into
mainfrom
feat/e13-vsock-restore-capacity-diagnosis

Conversation

@pdettori

@pdettori pdettori commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Carries E12 and E13 together, as one landing. This PR was originally stacked on #272
(E12); its branch already contained every one of #272's commits, so its base has been
retargeted to main and the stack collapsed into this single PR. #272 is closed as
superseded, not discarded
— all of its work is here, and its own headline finding is
corrected here rather than landing on main uncorrected.

The reason for collapsing: merging #272 alone would have put on main (a) E12's driver with
a known startup race whose fix lives in this PR, and (b) an E12 write-up whose C@128
attribution this PR refutes. Those two states should never coexist on main.

E12 — guest-initiated vsock on a second port across snapshot restore (closes #271)

Does a guest-initiated vsock connection on a second port (1025) survive a Firecracker
snapshot restore, and survive N concurrent restores of one snapshot? This gates #268's P4.1
egress transport decision T1.

Core mechanism: yes, reliably. Rungs A (fresh boot), B (single restore — the actual
question), C at N=8, and D (host-initiated regression fence) all pass unanimously, with both
independent witnesses (host-side nonce capture and guest-side ACK) agreeing every time,
across two separate runs on nested-m8i. Snapshot verified pristine before and after every
run; build-snapshot.sh untouched.

At N=128 concurrent restores there was a non-deterministic connection-failure rate (76/128
combined, 127/128 standalone), which E12's own write-up attributed to host resource or
scheduling contention. That attribution was wrong — see E13.

E13 — root-causing rung C@128 (issue rossoctl/moca-experiments#7)

Two diagnostics on the real nested-m8i rig, then confirmation on bare metal:

  • A no-second-port control (e13-restore-capacity-control.sh) — N=128 concurrent
    restores over only the already-shipped agent Exec path (port 1024), via E12's own
    E12_PROBE_SOURCE_ONLY=1 hook. Came back clean, 0/128.
  • Memory/OOM telemetry (e13-mem-telemetry.sh + e13-correlate.py) — samples
    MemAvailable and watches the OOM killer during the window. Sealed prediction 7
    (memory exhaustion) is falsified on letter and substance: zero OOM events, memory
    never below ~12.3 GiB of 15.

Then an overnight run (37,504 VM-attempts) and a bare-metal hour (72 vCPU / 754 GiB) ruled
out steal, iowait and memory as levers and inverted the failure-signature composition:
99.2% of metal failures were a guest-side ConnectionResetError on the 1025 connect()
itself
. That pointed at the probe's own scaffolding, and it was right.

Root cause and fix (b203e38): start_host_listener returned as soon as its python3
listener was backgrounded, not when that process had actually reached listen() — so a
guest CONNECT could land before anything was listening and be answered with RST, correctly.
The listener now signals readiness via a marker file written the instant listen() returns,
and the function blocks on it.

Run Iterations Failure rate Clean iterations Guest-side reset count
Before (metal) 80 9.83% 0/80 999/1,007 failures (99.2%)
After (metal) 40 0.059% 37/40 0 / 5,120 VM-attempts

167.8x reduction, and confirmed independently on nested-m8i with a properly sized run:
the signature was only ~0.119% of pre-fix failures there (37/31,104), so detecting its
absence needed n > -ln(0.01)/p ≈ 3,866 attempts for 99% confidence — 57 iterations (7,296
VM-attempts) were run, with zero occurrences. The 3 residual metal failures are all a
different, still-open family (read: EOF, a handshake-ack EOF, one dial failure).

E12's write-up, corrected in place

The merge commit amends the E12 section rather than rewriting its numbers, matching the
house style #293 set for §E11:

  • A dated caveat under the E12 heading names what is superseded (the contention attribution;
    the 76/128 and 127/128 rates as a property of the mechanism or rig) and what still stands
    (rungs A, B, D, C@8, both witnesses, T1's support).
  • Sealed prediction 6 is re-scored. Its falsifier still fires — post-fix C@128 is not
    100% clean — but on the residual family, not the race. Verdict unchanged, substance
    changed: the mechanism is better supported than E12's section could show, and the
    "concurrency ceiling" reading was wrong.
  • E12's "Effect on PR docs(specs): P4.1 — microVM egress transport for Z5's credentialed-egress proxy #268" paragraph now defers to E13's revised recommendations.

Effect on PR #268

T1 (route sandbox egress over vsock) stands, on firmer ground than after E12 alone.
P4.1's open scale question is re-scoped away from "how many concurrent restores" (answered:
not the lever at N=128). One persistent, pre-bound multiplexed listener is promoted from an
efficiency nicety to the load-bearing design point, since a per-connection listener is
exactly what raced here.

Test plan

  • bash deploy/microvm/tests/e12-vsock-egress-probe.test.sh — all checks pass
  • bash deploy/microvm/tests/e13-restore-capacity-control.test.sh — all checks pass,
    including negative assertions that the control never references the second-port mechanism
  • bash deploy/microvm/tests/e13-correlate.test.sh — all checks pass
  • (cd experiments && ./node_modules/.bin/vitest run test/microvm-predictions.test.ts) —
    3/3, predictions 6 and 7 sealed and pinned
  • make lint — clean (prettier, shellcheck, hadolint, gitleaks, merge-conflict check)
  • Both diagnostics and the post-fix confirmations actually run on nested-m8i and on
    bare metal; rigs left clean, snapshot digest unchanged throughout
  • Full CI on the combined diff against main — 13/13 green on the retarget

Merge notes

EXPERIMENTS.md was the only conflict with main, and it was a pure insertion clash: main
added its "Issue #266 — the metal/nested ratio" section at the same point this branch added
E12 and E13. Both sides kept, #266 placed first since it continues the E10/E11 material it
ratios against. No script, test or prediction file changed in the merge.

Raw per-run rig artifacts are gitignored, per #272's own precedent — the durable record is
EXPERIMENTS.md's tables and prose.

🤖 Generated with Claude Code

pdettori and others added 22 commits September 16, 2026 08:51
Guest-initiated vsock across snapshot restore probe. Verified on the rig
before writing this plan: the golden nested-m8i snapshot already has python3
with working AF_VSOCK (no rebuild needed), its rootfs digest is already
distinct from metal's (no contamination hazard to guard by name), and socat
1.8.0.0 works in the guest despite an earlier note claiming otherwise.

11 tasks: seal the prediction before any rung runs, build the driver
incrementally with a KVM-free contract test at each step (env/preflight/
snapshot-integrity, jail helpers, the two-witness probe, VM lifecycle + rung A,
rung B, rung C concurrent, rung D + main wiring), commit guest_client as its
own buildable Go package, run all four rungs on the rig incrementally then as
a full set, then write up EXPERIMENTS.md from the actual results.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Issue #271 asks for a guest-initiated-vsock-across-restore probe and, per P4
§7.4's practice, for its prediction to be sealed before any rung runs. That
means appending to predictions.json, which is SHA-256 pinned.

The pin moves here for the reason its own docstring allows: this is an append
made BEFORE any measurement it could be informed by, not a restatement fitted
to a result. §7.4's five entries are byte-identical; id 6 is new. E12 has no
verdict machinery, so nothing it measures can feed back into this file.

toHaveLength(5) becomes 6. The per-prediction falsifier assertions are
unchanged and hold for id 6.

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

The skeleton of issue #271's probe: it starts no VM yet, and refuses to run for
every wrong reason. Required rig-labeled SH_SUBSTRATE (a bare "nested" is
rejected), fail-closed preflight, and a per-rung record writer that dies on an
empty or unparseable record -- #266 shipped a ladder with a blank
mem_available_bytes that exited 0 and still printed a verdict.

Two deliberate choices, both explained in the header:

The golden snapshot is protected mechanically rather than by a substrate name
check. The driver hardlinks the snapshot in, mounts rootfs read-only, boots
`ro`, and verifies rootfs_sha256 against manifest.json before AND after every
run. A read-write mount alone changes an ext4 superblock, which would
invalidate #266's comparison invisibly. This guard also holds for the metal
confirmation run #271 defers, which a "never metal" name check would have had
to be edited to allow.

build-snapshot.sh is NOT refactored to share its jail helpers.
build-snapshot.test.sh greps write_guest_client's body for statement ordering,
so extracting shared helpers would break a source-order-coupled test for a
throwaway probe. Each copied helper names its origin.

Four forward-declared globals (PROBE_PORT, GUEST_RAM_MB, GUEST_CID, C_LADDER)
are consumed only by Tasks 3-8, not this one; each carries a shellcheck
disable=SC2034 with a one-line reason rather than deferring the warning.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
api_put, wait_for_socket, prepare_jail, link_snapshot_into_jail, teardown_jail
and the exit trap that runs them. Copied rather than extracted into a shared
lib, for the reason recorded in the driver's own header comment:
build-snapshot.test.sh asserts write_guest_client's internal statement
ordering, and a shared-lib refactor would break that test for a throwaway
probe's benefit.

link_snapshot_into_jail hardlinks by default, matching build-snapshot.sh, which
is also what keeps assert_snapshot_pristine meaningful: a hardlink cannot be
written to without the drift showing up under $SNAPSHOT_DIR too.

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

The core mechanism: a host-side python3 accept-once-and-reply loop on
<jail>/vsock.sock_1025 (the "<uds_path>_<PORT>" naming vsock.md documents for
the guest-initiated direction), and a guest-side python3 script - delivered
through the EXISTING agent Exec path on vsock:1024, base64-piped into the
guest's /tmp - that connects AF_VSOCK to VMADDR_CID_HOST (2) on port 1025.

run_probe_once requires BOTH witnesses before calling anything "ok": the
host-side capture file must contain the VM's nonce, AND the guest's own stdout
(relayed back through guest_client) must show the ACK. Neither alone is
evidence a second-port vsock connection happened; only their conjunction is.

The host listener's accept-loop is proven directly in the test over a real
AF_UNIX socket, no VM involved - real evidence before any Firecracker boot is
attempted.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
boot_fresh_vm and restore_vm match build-snapshot.sh's own
boot_quiesce_snapshot_firecracker / verify_restore_firecracker configs exactly
(drive config, vsock config, machine-config, the vsock_override shape), so any
failure in a later rung is about what E12 adds - a second guest-initiated port
- not about basic VM bringup that this repo already knows works on this rig.

restore_vm's vsock_override rewrites uds_path to the CALLING jail's own
/vsock.sock, which is why concurrent restores in rung C (Task 7) need no
additional socket-naming scheme: chroot already gives every jail its own
filesystem namespace.

Both functions return their vsock uds path via a global (VM_UDS), never via
`echo` captured through $(...): command substitution forks a subshell, and
CLEANUP_PID/CLEANUP_JAIL (set inside the call, a few lines up) would never
propagate back out of it to the caller - teardown_jail would then be handed
an empty pid, failing to kill the VM while still rm -rf-ing the jail out from
under it. Every caller (rung A here; rungs B/C/D in later tasks) calls these
as plain statements for exactly this reason.

Rung A: fresh boot, run the two-witness probe, teardown. This is the control -
if it fails, the failure is our plumbing, not Firecracker's restore mechanism,
because no restore has happened yet.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
The rung issue #271 is actually about. Restores the golden snapshot into a
fresh jail with vsock_override, runs the two-witness probe on port 1025, tears
down. Reuses restore_vm and run_probe_once from Tasks 4-5 unchanged - rung B is
mechanically just "rung A's probe against a restored VM instead of a fresh
one", which is deliberate: any difference in outcome between A and B is then
attributable to the restore itself, not to a different probe path.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Restores 8, then 128, microVMs CONCURRENTLY from the golden snapshot - all
alive at once, all connecting on port 1025 - rather than sequentially, because
sequential restarts cannot surface a socket-naming collision (only one jail
would ever exist at a time) and that is rung C's actual purpose per issue #271.

Each VM gets its own jail, so restore_vm's per-jail vsock_override rewrite
(Task 5) means a collision has structurally nowhere to happen except in this
function's own aggregation - checked explicitly via a nonce-uniqueness pass
across all N per-VM records, rather than assumed.

128 concurrent microVMs at 256 MiB each is within what this same nested-m8i rig
already ran for E11's density ladder (Sigma PSS <= 0.41 GB there), so N=128 is
not new capacity risk, only new plumbing.

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

Rung D restores a VM, starts the 1025 listener so it is PRESENT, and exercises
the EXISTING host-initiated Exec path on 1024 directly (not via
run_probe_once, which drives 1025) - so a failure here is unambiguously about
the second port interfering with the mechanism P4 already ships on, which
issue #271 names as the worst possible outcome.

main() now dispatches every rung named in $RUNGS (default "A B C D"), verifies
the snapshot digest before AND after the full set (not just per-rung), and
prints exactly one "E12 ANSWER:" line - the boolean this whole driver exists to
produce. Still no STOP/MANDATORY anywhere in the source, checked against the
FULL file now that every rung is wired in, not just the Task 2 skeleton.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
deploy/microvm/build-snapshot.sh generates its own guest_client.go into a
throwaway temp package at run time, which is fine for a script that already
owns the whole build pipeline. e12-vsock-egress-probe.sh is not that script,
and reaching into build-snapshot.sh's private write_guest_client to reuse its
output would recreate exactly the cross-script coupling that script's own test
(build-snapshot.test.sh, which greps write_guest_client's body for statement
ordering) makes expensive to touch.

So this commits the same client - identical framed-protocol/CONNECT-handshake
logic - as its own buildable cmd package, the same way cmd/vmpoolctl already
sits alongside the library it drives. Builds and go vets with no KVM and no
snapshot required.

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

The real rig run (issue #271, first hardware execution) showed guest_client
exiting 0 with a genuine "ACK E12 <nonce>" reply, yet run_probe_once reported
both witnesses false on every rung - a false negative that would have made
the whole probe unable to answer its own question regardless of the true
mechanism behavior.

Root cause: guest_probe_command sent "E12 " + nonce over the wire, a
decorative tag, while run_probe_once's own exact-match comparisons
(host_nonce = $nonce, and *"ACK $nonce"* against guest_out) expected the bare
nonce. Every comparison failed unconditionally.

Fix: the guest now sends the bare nonce. The nonce already starts with
"e12-" (built as "e12-${label}-$$-${RANDOM}"), so the tag was purely
redundant - nothing is lost by dropping it.

Added a regression test that decodes guest_probe_command's OWN generated
embedded python source (not a hand-typed stand-in) and asserts it sends the
bare nonce. The prior test exercised the listener with a hand-typed nonce
directly, bypassing the real wire format entirely - which is exactly how
this shipped unnoticed through Task 4's original review.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Per-rung and per-VM JSON records plus the combined run log from the rig at
3.235.29.220 (SH_SUBSTRATE=nested-m8i). Task 11 reads these into
EXPERIMENTS.md's E12 section rather than re-describing them from memory.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
… N=128 scale finding flagged

Records the answer issue #271 asked for, built from the actual run records in
deploy/microvm/e12-results/ (Task 10). The core mechanism question has a
reliable yes: rungs A, B, D and C@8 pass unanimously across both the
standalone and combined runs. Separately, C@128 shows a real, non-deterministic
connection-failure rate on this 4-vCPU rig (76/128 in the combined run, 127/128
standalone) that is markedly worse under concurrent load from other rungs -
consistent with scheduling/resource contention, not with a restore-mechanism
defect (no failure carries the signature of the bug fixed in 1ac8371).

Explains the 4-VM bookkeeping gap in the combined C@128 aggregate (die()'s raw
exit bypasses the per-VM JSON-writing fallback, so the count is right but four
per-VM diagnostics are missing) by reading the driver's own run_rung_c_n
control flow, not by guessing.

Scores predictions.json's id 6 honestly: its falsifier fires on the letter of
its text (rung C reported ok=false at N=128 while rung A reported ok=true),
but the falsifier was sealed before rung A ran and did not anticipate a
concurrency-scale failure mode distinct from a restore-mechanism failure. Both
facts are stated, not resolved by picking the convenient framing.

States what a nested-m8i run can and cannot establish about the metal case,
per the driver's own design comments, and what this means for PR #268's T1
decision (stands; N=128 becomes an open scale/capacity question for P4.1,
not grounds to revert to the NIC option).

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

Four fixes from the final whole-branch review, none touching the driver's
actual probe logic:

- .prettierignore did not cover deploy/microvm/e12-results/, so the prettier
  pre-commit hook (and CI's lint job) would silently reformat 138 committed
  evidence JSON files on the next unrelated `make fmt`/`make lint` run.
- run.log, named in EXPERIMENTS.md's evidence list, was gitignored (*.log)
  and never actually committed - force-added so the evidence directory
  matches what the write-up claims.
- EXPERIMENTS.md said the cause of 4 missing rung-C-128 per-VM records "is
  not recorded anywhere" - it is, in each VM's own .boot.log (restore_vm's
  stderr redirect target), just not archived in the committed results
  directory. Reworded to say so accurately.
- The driver's own failure-branch "E12 ANSWER" log line said the mechanism
  "DOES NOT SURVIVE restore" whenever ANY rung failed - literally false on
  the real run, where only rung C at N=128 failed (a concurrency-scale
  finding, not a restore-mechanism failure) while A/B/D and C@8 all passed.
  Reworded to state the mechanical fact rather than over-interpreting the
  cause, so a future operator reading only the log output (not
  EXPERIMENTS.md) isn't misled into reverting PR #268's T1 decision.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
deploy/microvm/e12-results/ (139 files: per-rung/per-VM JSON records plus
run.log) should never have been committed - it's throwaway rig output, not
source or a maintained artifact, and the previous fix that made it
prettier-clean fixed the symptom rather than the actual problem.

Removed the directory from git and added it to .gitignore (kept the existing
.prettierignore entry too, since `make fmt` walks the directory tree
ignoring .gitignore - if this path is ever repopulated locally without being
re-tracked, it stays out of prettier's way).

EXPERIMENTS.md's numbers are unchanged - only its references to a committed
evidence directory are removed, since the actual data (the table, the
die()-bypass explanation, the prediction scoring) already carries everything
that matters and none of it depended on the raw files being in git.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Follow-up to PR #272 (E12): rung C@128 showed a real, non-deterministic
connection-failure rate, described there as "consistent with resource/
scheduling contention" without naming which resource. Issue #266's own E10/E11
run on this same nested-m8i rig already found a ~288 MiB/VM memory ceiling
around 15 GiB total - a stronger, more falsifiable lead than generic
contention, and one PR #272's own N=128 choice didn't check against.

Sealed before either E13 diagnostic (the no-second-port control, and the
memory-telemetry rerun) has been run, per the same §7.4 discipline id 6 (E12)
followed.

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

Isolates PR #272's rung C@128 finding from anything E12 added: restores N
VMs concurrently (rung C's own shape) and runs ONLY the existing
host-initiated Exec on port 1024 against each - no listener on 1025, no
guest-side probe script, nothing new. Sources e12-vsock-egress-probe.sh via
its own E12_PROBE_SOURCE_ONLY=1 hook to reuse restore_vm/teardown_jail/
write_json_record unchanged, rather than duplicating them.

The contract test's sharpest assertions are negative: it fails if this file
ever references PROBE_PORT, start_host_listener, or run_probe_once - the
entire point of this script is that none of those exist here.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Tests E13's leading hypothesis for PR #272's rung C@128 failures directly:
issue #266's own E10/E11 run on this same nested-m8i rig already found a
~288 MiB/resident-VM admission ceiling against 15 GiB total, and PR #272 ran
128 concurrent restores (4x that already-known-tight budget) with no
admission gate.

e13-mem-telemetry.sh wraps any command with MemAvailable sampling and an
OOM-killer watch for its exact duration. e13-correlate.py cross-references
per-VM record/.boot.log mtimes - a free proxy for "when did this VM finish",
since neither driver is modified to add explicit per-VM timestamps - against
that telemetry. Correlation logic is covered by a fixture-file unit test;
the wrapper itself needs a live host to test meaningfully (Task 4).

The OOM watcher is started via process substitution (`> >(grep ...)`)
rather than a pipeline (`cmd | grep ...`), so `$!` captures the watcher's
own PID instead of grep's - `$!` after a backgrounded pipeline always names
the pipeline's last command. Without this, cleanup() never signalled the
real journalctl/dmesg process, leaking it on every run. cleanup()'s trap is
also now armed before the post-start liveness checks, so even the
immediate-death path (e.g. a missing /proc/meminfo) still cleans up the
watcher instead of leaking it.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
…e probe's own added workload

Both disjuncts of prediction 7's falsifier fired. The no-second-port control
at N=128 is a clean 128/128 pass (control-128.json fail_count=0), while the
telemetry-wrapped rerun of E12's rung C@128 still fails 38/128 with the same
"read: EOF" signature - and correlation-summary.json shows oom_events_total=0,
failed_near_oom_event=0, failed_below_low_water=0, with MemAvailable never
below 12.32 GiB. Memory is not the cause, and the control also refutes PR
#272's own "128 concurrent restores exceed a 4-vCPU rig" framing: the restores
alone are fine in 5.4s. What differs is rung C's own probe apparatus - 128
host-side python3 listeners plus a python3 interpreter and real vsock round
trip inside each guest - and the channel it degrades is the pre-existing Exec
relay on port 1024, not the 1025 path E12 added.

PR #268's T1 (route sandbox egress over vsock) stands, on firmer ground than
after E12. P4.1's open scale question is re-scoped from "how many concurrent
restores" to "how much concurrent CPU-bound work runs alongside a restore
burst, and whether the 1024 Exec channel survives it": no per-connection host
helper process, retry the Exec relay, and gate on a distribution rather than a
run (1/128, 52/128 and 38/128 are all the same rung at the same N).

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

0873b2c's explanatory comment in e13-restore-capacity-control.test.sh has a
line beginning "# shellcheck build - so cd into $DIR first", which shellcheck
parses as a directive and rejects with SC1072/SC1073. That failed the
shellcheck pre-commit hook under `make lint --all-files`, even though the
test's own inner shellcheck invocation passed (it lints the .sh under test,
not the test harness itself), and even though committing only unrelated files
never staged this one. Reworded so no comment line starts with the tool's own
name, and said so inline to stop it recurring.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Every run of deploy/microvm/tests/e13-correlate.test.sh imports
e13-correlate.py and regenerates deploy/microvm/__pycache__/, which showed up
as untracked churn. Not owned by any single E13 task, so picked up here as
routine hygiene rather than folded into one.

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

Review round on the E13 write-up. Two factual errors and two clarity nits:

1. "Every one of the 38 failures carries ... host_witness:no" was wrong. 36
   are "no"; indices 12 and 52 are "yes". host_ok is set only by
   [ "$host_nonce" = "$nonce" ], so in those two the host listener captured
   that VM's own unique nonce on vsock.sock_1025 byte-for-byte: the guest ran
   its python3 payload and got as far as connecting to the host on 1025 and
   sending its nonce, and only then did the 1024 response read fail. That
   upgrades the "1025 is unimplicated" hedge from pure inference to a direct
   observation in at least two cases, and strengthens the added-workload
   reading - the expensive guest-side work demonstrably does get done. Stated
   as an existence proof over a narrow base, and scoped to the guest->host leg
   only: the guest's own recv() of the host ACK still cannot be checked,
   because the channel that would carry that evidence is the one that broke
   (which is also why guest_witness is "no" for all 38 regardless). Also notes
   that all 90 passing VMs are host_witness:yes, so 92 of 128 nonces arrived.
2. The reproduction annotation cited a flag the driver does not have. There is
   no argument parsing at all - RUNGS/C_LADDER come from SH_E12_RUNGS and
   SH_E12_C_LADDER and main "$@" ignores positional args - so the flag form
   would have silently run the full A/B/C/D ladder with C at both 8 and 128,
   i.e. the combined condition whose rate this very section reports as
   different (52/128). Replaced with the env-var form actually used.
3. Cited below_low_water=0, which is a per-row field, not a summary key; the
   summary key is ok_below_low_water.
4. Gave the ~1.9 GB apparatus figure its referent: ~1.87 GB (2.13 - 0.26), the
   incremental cost over the control's own dip, not rung C's absolute dip.

Re-verified against deploy/microvm/e13-results/rung-C-128-*.json and the
driver's own host_ok comparison. No numbers elsewhere in the section change.

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

Ran 293 iterations (37,504 VM-attempts, 8.61% overall failure rate) overnight
on nested-m8i to chase the CPU-measurement gap the single-run write-up named
explicitly. Getting there required first fixing a data-destruction bug: E12's
own teardown_jail deletes console.log before the /dev/kvm-busy partial-unmount
failure that leaves the jail behind, so every prior run's failing VMs had
already lost their guest console. A throwaway CONSOLE_ARCHIVE patch (not
committed - kept as a local diagnostic copy, consistent with this driver's
own "never modify e12-vsock-egress-probe.sh" constraint) made logs readable,
which immediately surfaced a failure signature no prior run had seen.

Findings folded into the E13 section:
- The single-run's bimodal ~19s/~125s duration pattern holds at scale (136
  fast / 107 slow iterations) and now has a real correlate: iowait, not
  steal or memory (Pearson r=0.788 against duration, r=0.41 against
  fail_count - real and stable, not a sufficient sole cause). Steal and
  memory stay exactly as flat and uninformative as the single run found.
  Per-VM failure rate is 2.37% in fast iterations vs 15.81% in slow ones.
- Failure signatures span the whole connection lifecycle (dial failures,
  handshake-ack failures including explicit i/o timeouts, the original
  read:EOF, and 37 guest-side ConnectionResetError tracebacks on the 1025
  connect() itself) - not the one uniform signature the single run showed.
  The 1025 mechanism is now directly implicated, not just unimplicated;
  Effect on PR #268 updated accordingly, and P4.1's recommendations gain two
  new items (measure disk I/O; treat the second port as fallible too) and
  a revised one (CPU utilization itself, not just steal, remains unmeasured).
- Explicitly scoped what this run did NOT do: kernel-level console-log
  mining across all preserved failing-iteration logs was done for exactly
  one example, not systematically - named as a real, still-available next
  step rather than folded into the numbers as if it were comprehensive.

Overnight tooling (e13-overnight-loop.sh + two Python helpers) is not
committed, matching the CONSOLE_ARCHIVE patch's own throwaway status and
this PR's existing precedent of gitignoring raw rig artifacts.

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

Copy link
Copy Markdown
Member Author

Pushed one more commit (1f05359) with an overnight follow-up: 293 iterations (37,504 VM-attempts) on nested-m8i, adding disk iowait% telemetry after steal% and memory both stayed flat and uninformative through the single-run analysis above.

Headline: the bimodal ~19s/~125s duration split holds at scale, and iowait correlates with it (r=0.788 vs duration, r=0.41 vs fail_count) — steal and memory don't. Per-VM failure rate is 2.37% in fast iterations vs 15.81% in slow ones. Getting readable console logs at all required a throwaway (uncommitted) patch, since teardown_jail's rm -rf was destroying them before they could be read — that's what surfaced a new failure signature: 37 guest-side ConnectionResetError tracebacks on the 1025 connect() itself, across the full run. The second port is now directly implicated in a small, real fraction of failures, not just unimplicated.

EXPERIMENTS.md's E13 section and its "Effect on PR #268 and P4.1" closing recommendations are both updated accordingly. Full detail in the commit message and the new "Overnight follow-up" subsection.

…ature inverts

Ran the identical 1-hour diagnostic on the bare-metal host (72 vCPU / 754
GiB) already reserved for this project's E10/E11 work - same golden
snapshot (digest sha256:668af589... confirmed unchanged), SH_SUBSTRATE=metal.
This directly tests the overnight follow-up's own leading hypothesis (disk
I/O contention, plausibly EBS burst-balance throttling - a mechanism
specific to nested-m8i being a shared EC2 instance type) by removing every
candidate confound: no hypervisor above the guest, no shared tenancy, no
EBS.

80 iterations, 10,240 VM-attempts, 9.83% failure rate - the same magnitude as
nested-m8i's 8.61%, but with max_steal_pct=0.0% on every iteration (correct
for bare metal), iowait in a narrow 0.4-1.35% band, memory headroom in the
hundreds of GB, no bimodal duration pattern at all (14-16s throughout), and
near-null correlations for every metric collected (|r| < 0.2 throughout,
vs. nested-m8i's r=0.788 for duration-vs-iowait). None of nested-m8i's
candidate mechanisms explain metal's failure rate - and every one of the 80
iterations had at least 2 failures, a persistent baseline rather than an
occasional bad run.

The failure signature composition inverts completely: nested-m8i was 84%
the 1024-relay read:EOF and 1.75% a guest-side ConnectionResetError on the
1025 connect() itself; metal is 99.2% that same guest-side reset and 0.4%
read:EOF. That inversion plus the null correlations point at a specific,
previously undiagnosed mechanism: per this project's own documented
Firecracker behavior (a ConnectionResetError on the guest's connect() is the
expected response when nobody is listening yet), this is best explained by
a startup race in the throwaway probe's own one-process-per-VM listener
design (start_host_listener backgrounds a python3 process and returns
before it necessarily reaches srv.listen()), not a defect in the vsock
mechanism PR #268 ships. This makes the already-given P4.1 recommendation
(one persistent multiplexed listener, not one process per connection) the
load-bearing fix, not just an efficiency nicety - a pre-bound listener
cannot lose this race at all.

Effect on PR #268 and P4.1 revised accordingly: T1 stands on firmer ground
(this reads as the probe's own artifact, not a mechanism defect); the
disk-I/O correlation is re-scoped from "the mechanism" to "real but
substrate-specific, confirmed absent on metal"; the second-port-fallibility
recommendation is strengthened from "rare edge case" to "the dominant
signature on the cleanest substrate tested."

Rig left clean: no live processes, no leftover jails/mounts, snapshot
digest unchanged throughout. Overnight-loop tooling used here is the same
uncommitted throwaway copy as the earlier addendum.

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

Copy link
Copy Markdown
Member Author

One more push (`5622ffb`): ran the identical diagnostic for 1 hour on the bare-metal host already reserved for E10/E11 (72 vCPU / 754 GiB, same golden snapshot, `SH_SUBSTRATE=metal`) — this directly tests the overnight follow-up's own leading hypothesis (disk I/O contention) by removing every candidate confound (no hypervisor, no shared tenancy, no EBS).

The failure reproduces at the same magnitude (9.83% vs. nested-m8i's 8.61%) with every host-resource metric flat, low, or abundant — steal is 0.0% on literally every iteration, iowait stays in a narrow band, memory headroom is in the hundreds of GB, and there's no bimodal duration pattern at all. Correlations for every metric collected are near-null (|r| < 0.2). This isn't an occasional bad run either — all 80 iterations had at least 2 failures.

The failure signature composition completely inverts, and that's the useful part. On nested-m8i, 84% of failures were the 1024-relay read:EOF and only 1.75% a guest-side ConnectionResetError on the 1025 connect() itself. On metal, 99.2% are that same guest-side reset. Per this driver's own documented Firecracker behavior, that reset is the expected response when nobody's listening yet — which points at a startup race in the throwaway probe's own one-process-per-VM listener design (start_host_listener backgrounds a fresh python3 process per VM and returns before it necessarily reaches srv.listen()), not a defect in the mechanism PR #268 ships. That makes the already-given P4.1 recommendation (one persistent, pre-bound multiplexed listener) the load-bearing fix rather than just an efficiency nicety.

EXPERIMENTS.md's E13 section and its closing "Effect on PR #268 and P4.1" recommendations are both updated. Rig verified clean afterward (snapshot digest unchanged throughout).

@mrsabath

Copy link
Copy Markdown
Member

Filed rossoctl/moca-experiments#7 as the issue half of E13, so the gate is visible in the epic rollup (rossoctl/rossoctl#2546) — this PR carries the run and its verdict, rossoctl/moca-experiments#7 carries the CPU-contention follow-up this PR named rather than performed.

Mirrors E12's split: #271 (issue) + #272 (PR).

… failures

The bare-metal follow-up's dominant failure signature (99.2% of failures,
guest-side ConnectionResetError on the 1025 connect() itself) matched this
project's own documented Firecracker behavior for "nobody was listening
yet": start_host_listener backgrounds a python3 process and returns as soon
as it is backgrounded, not once that process has actually reached
srv.listen(). At N=128 concurrent restores, forking and execing 128 python3
interpreters in close succession creates real variance in exactly when each
one's listener is bound, independent of host compute - a guest whose
connect() lands in that window gets RST, correctly, because nothing was
listening yet.

Fix: the python3 listener script now writes a marker file the instant its
own listen() call returns, before accept(); start_host_listener polls for
that marker (5s budget, dies loudly rather than hanging if it's never
written) before returning control to its caller. No caller can trigger the
guest's connect() until the host side is genuinely ready. A fixed sleep was
deliberately not used - under the exact concurrency this exists to survive,
a fixed delay is either too short (races again) or adds latency to every
one of 128 concurrent probes for no reason on the common path.

Confirmed on the same bare-metal host, golden snapshot, and rung C@128 the
diagnosis was built from: 9.83% -> 0.059% failure rate (167.8x), 37/40
iterations completely clean vs. 0/80 before, and the guest-side
ConnectionResetError signature goes to exactly zero across 5,120 post-fix
VM-attempts while the small, unrelated read:EOF/dial-fail/handshake-ack-EOF
background rate is unchanged - fixing exactly this mechanism removed
exactly this failure signature, and nothing else moved.

e12-vsock-egress-probe.sh's own contract test (including its behavioral
host-listener check), shellcheck, and make lint all pass unchanged. Rung
A/B/D call start_host_listener identically and are unaffected - the fix
only changes when the function returns, not what it does. EXPERIMENTS.md's
E13 section carries the full before/after comparison and a revised "Effect
on PR #268 and P4.1" reflecting the confirmed fix rather than a hypothesis.

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

Copy link
Copy Markdown
Member Author

Fixed the race and confirmed it (`b203e38`).

The fix: start_host_listener now waits for its Python listener process to actually signal readiness (a marker file written the instant listen() succeeds, before accept()) instead of returning as soon as the process is merely backgrounded. No caller can trigger the guest's connect() until the host side is genuinely bound and listening.

Confirmed on the same bare-metal host, same golden snapshot, same rung C@128:

Run Iterations Failure rate Clean iterations Guest-side ConnectionResetError count
Before 80 9.83% 0/80 999/1,007 failures (99.2%)
After 40 0.059% 37/40 0 / 5,120 VM-attempts

167.8x reduction. The 3 residual failures across 5,120 VM-attempts are all the other, unrelated failure family (read: EOF, handshake-ack EOF, a dial failure) — none are the signature the fix targeted. Fixing exactly this mechanism removed exactly this failure signature and nothing else moved, which is about as clean a confirmation as this kind of diagnosis gets.

Existing contract test (including its behavioral host-listener check), shellcheck, and make lint all pass unchanged — rungs A/B/D call the same function and are unaffected, since the fix only changes when it returns, not what it does.

EXPERIMENTS.md's E13 section now carries the full before/after table and a revised closing section reflecting a confirmed fix rather than a hypothesis.

The metal confirmation showed the fix works where the race was 99.2% of
failures. Ran it again on nested-m8i, where the same signature was only
~0.119% of pre-fix attempts (37/31,104) - a much rarer baseline, so the
confirmation run needed sizing to actually detect its disappearance rather
than just running for a while. Used a Poisson-style threshold (n > -ln(a)/p)
to size it: 99% confidence needs >3,866 VM-attempts (~31 iterations at
N=128); ran 57 iterations (7,296 VM-attempts) to clear that with margin.

Result: zero occurrences of the guest-side ConnectionResetError across all
7,296 post-fix VM-attempts (p ~ 0.017% under "the rate didn't actually
change" - not an ambiguous null stretched positive). The bimodal fast/slow
duration pattern and its iowait correlation are unchanged (r=0.622/0.689/
0.504 vs. the pre-fix run's own 0.788/0.582/0.41 - consistent given the
smaller sample, not a different relationship), because this fix was never
meant to touch that separate, unrelated mechanism. Overall failure rate
(7.07%) sits within that mechanism's own already-documented wide swings,
exactly as predicted going in - the fix's contribution to the overall rate
was never going to be resolvable at this scale, and detecting the specific
signature's disappearance (not the overall rate) was the point of sizing
the run the way this commit's message explains.

Effect on PR #268 revised to say the fix is confirmed on both substrates
tested, not just the one where the race was easiest to see. Rig left clean
throughout (snapshot digest sha256:833401a1... unchanged, no live processes
or leftover mounts/jails afterward).

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

Copy link
Copy Markdown
Member Author

Confirmed the fix on nested-m8i too (e289536), sized properly for it this time.

The listener race was only ~0.119% of pre-fix failures there (37/31,104) — nowhere near metal's 99.2%, so a short run risks a false "no change" just from not seeing the rare signature at all. Sized this one with an actual threshold: for 99% confidence that observing zero occurrences means the rate really dropped (not luck), you need n > -ln(0.01)/p ≈ 3,866 VM-attempts at that baseline rate. Ran 57 iterations (7,296 VM-attempts) to clear that with real margin.

Result: zero occurrences of the ConnectionResetError signature across all 7,296 post-fix attempts — p ≈ 0.017% under "the rate didn't actually change," so this isn't an ambiguous null stretched into a positive result. The bimodal fast/slow duration pattern and its iowait correlation are unchanged (r=0.622/0.689/0.504, consistent with the pre-fix run's own 0.788/0.582/0.41 given the smaller sample) — expected, since this fix was never meant to touch that separate mechanism. Overall failure rate (7.07%) sits inside that mechanism's own already-documented swings, exactly as predicted going in.

So: the fix is now confirmed on both substrates tested, at the rate each one actually needed to detect it — 40 iterations was enough on metal where the effect was overwhelming; nested-m8i needed the larger, properly-sized run because the effect there is real but much rarer. EXPERIMENTS.md and the closing PR #268 section are both updated.

…tion

Integrates main (through #292) so this branch can target main directly and
carry E12 + E13 as one landing: #273's branch already contains every commit
of #272, so retargeting its base collapses the stack rather than dropping
any of it. #272 is closed as superseded, not discarded.

EXPERIMENTS.md was the only conflict, and it was a pure insertion clash --
main added its "Issue #266 -- the metal/nested ratio" section at the same
point this branch added E12 and E13. Both sides kept, #266 first since it
continues the E10/E11 material it ratios against.

Three prose amendments to the E12 section, so main never carries a claim
this branch already knows is wrong. E13 established that C@128's failures
were this probe's own listener startup race -- a control at the same N=128
over the existing Exec path came back clean, memory and the OOM killer were
ruled out directly, and the fix in b203e38 drove the dominant failure
signature to zero on both substrates. E12's section previously attributed
those failures to host resource or scheduling contention:

- A dated caveat under the E12 heading names what is superseded and what
  still stands (rungs A, B, D, C@8, both witnesses, T1's support). The
  numbers stay, as the record of what the pre-fix probe produced.
- Sealed prediction 6 is re-scored. Its falsifier still fires, but on the
  residual failure family rather than the race: 37 of 40 post-fix metal
  iterations clean, 3 failures across 5,120 VM-attempts, none of them the
  signature the fix removed. Verdict unchanged, substance changed.
- E12's "Effect on PR #268" paragraph now points at E13's revised
  recommendations rather than standing as current.

No script, test or prediction file changed in this merge.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
@pdettori
pdettori changed the base branch from feat/e12-vsock-egress-probe to main September 18, 2026 14:31
@pdettori pdettori changed the title E13: root-cause PR #272's rung C@128 dropped connections E12 + E13: guest-initiated vsock across snapshot restore, and the root cause of rung C@128's dropped connections (#271, #280) Sep 18, 2026

@esnible esnible 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.

Reviewed the combined E12+E13 landing. Rather than take the write-up's numbers on faith, I re-derived the checkable ones:

  • Pinned prediction digest — computed SHA-256 of predictions.json on PR HEAD independently: 3f78094…59c68b7, matching the pin in microvm-predictions.test.ts exactly. All 7 predictions carry a falsifiedBy, and the 5 pre-existing entries are byte-identical, so the append-only claim holds.
  • Statistical adequacy of the nested confirmation run — the claim is n > -ln(0.01)/p ≈ 3,866 at p = 37/31,104. Recomputed: p = 0.119%, n = 3,871, against 7,296 VM-attempts actually run (57 × 128). Genuinely adequate rather than asserted. (The headline 167.8x computes to ~166.6x from the rounded table values — rounding, not an error.)
  • The race fix itself (b203e38) — mechanism is right: the marker is written after listen() returns and before accept(), and the caller polls with a bounded 5s timeout that kills the child and dies loudly instead of hanging. Polling rather than a fixed sleep is well-justified for the N=128 case it exists to survive.
  • set -uo pipefail without -e — deliberate, consistent with the existing e11-density.sh driver on main, and pinned by the test suite's own check "does not set -e".
  • Security — no secrets (the token-shaped grep hits are STOP/MANDATORY string assertions in tests). The eval uses are confined to test harnesses extracting single functions from the driver for isolated unit testing, each with a shellcheck-disable comment explaining why. No workflow or Action changes, no new dependencies.

Per the large-PR guidance I concentrated on security, design and conventions rather than nit-hunting the 2,397-line plan document.

Worth flagging for other reviewers: sealed prediction 6 is re-scored as still firing, not reinterpreted. The write-up states plainly that the earlier "concurrency ceiling" reading "was wrong" and that the recorded tension "was partly a tension with this probe's own defect rather than with the mechanism," while leaving the pre-fix numbers standing as the record of what the pre-fix probe produced. Correcting a predecessor's headline attribution in place, without editing the sealed falsifier to fit, is the falsifiability discipline working as designed. Collapsing #272 into this PR is right for the stated reason too — merging it alone would land a driver with a known race alongside a write-up this PR refutes.

One nit inline on e13-correlate.py; not blocking.

Areas reviewed: Shell, Python, Go, Docs, Tests, Security, config
Agent/IDE config (.claude/.vscode): none — supply-chain gate clean (checked both +++ b/ and rename to forms)
Commits: 27 commits, all signed-off: yes (27/27)
CI status: passing (13/13)
Tests: 107 check assertions across 3 new test scripts plus 3 vitest prediction tests; no skips or disabled tests introduced (the shellcheck not installed branch is a local-dev convenience — CI's dedicated shellcheck job covers it and passed)

Minor housekeeping: the test plan's last box — "Full CI on the combined diff against main" — is still unchecked, but CI has since gone green on all 13 checks.

Comment thread deploy/microvm/e13-correlate.py Outdated
line = line.strip()
if not line:
continue
ts, avail = line.split()

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: ts, avail = line.split() raises ValueError on any line that does not have exactly two whitespace-separated fields.

Safe against its own producer — e13-mem-telemetry.sh writes exactly f"{time.time():.3f} {avail}\n" and flushes per sample, so a normal timeline always parses. But this script is documented as a pure function of operator-supplied paths (--mem-timeline is a required arg), and a sampler killed mid-write can leave a partial final line. That would surface as a bare traceback rather than the kind of message the rest of this script is careful to give.

A two-line guard would keep the failure legible:

parts = line.split()
if len(parts) != 2:
    continue  # or: raise SystemExit(f"{path}:{lineno}: expected 'epoch bytes', got {line!r}")

Non-blocking — the happy path is correct and the unit test covers the well-formed fixture.

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 8e79070, taking the second of your two options rather than the first.

continue would be wrong for this file specifically: the mem timeline is the sole evidence for E13's memory hypothesis, and a silently dropped sample understates memory pressure in exactly the direction that makes that hypothesis look falsified. That is the same class of defect as #291's post-load host signals — an instrument reporting nothing while looking like it reported something. So a malformed line now refuses with path:lineno and the offending text, and writes no summary.

With one exception, since a bare refusal would break on the shape your comment correctly identifies as realistic: a torn final line from a sampler killed mid-write is tolerated, flagged as mem_timeline_torn_final_line in the summary, and announced on stderr.

One thing worth flagging, because it means the guard had to be stricter than either of us framed it: the test for a torn line is the missing \n, not a parse failure, and the line is discarded even when it parses. A truncated write can leave a well-formed line carrying a truncated integer — 101.0 8 where 101.0 8589934592 was intended — which a continue guard, a try/except ValueError, and the original code all accept as a genuine 8-byte MemAvailable reading. That single fake sample would manufacture the memory pressure this script exists to test for. I verified it against the pre-fix parser, which returns (101.0, 8) for that line without complaint. A complete sample always ends in \n, so an unterminated last line can't be trusted on its face.

Nine new checks in tests/e13-correlate.test.sh pin both branches, and the torn fixture is deliberately one that parses so the truncated-integer case is pinned rather than merely described. Also added mem_samples_total to the summary, so a timeline that parsed fewer samples than expected is visible without re-reading the raw file.

Also ticked the test-plan box you flagged — CI was green (13/13) by the time you reviewed and I'd left it unchecked.

On the two arithmetic re-derivations: agreed on both. n = 3,871 is the exact figure (I rounded to 3,866 from a slightly different p), still far under the 7,296 actually run; and 167.8x is computed from the unrounded rates, which is why it doesn't reproduce from the rounded table values.

…ample

Addresses the review nit on e13-correlate.py:31, where `ts, avail =
line.split()` raised a bare ValueError on any line without exactly two
fields. The nit offered two remedies -- skip the line, or refuse with
position. Refusing is the right one here: the mem timeline is the sole
evidence for E13's memory hypothesis, and a silently dropped sample is the
same class of defect as issue #291's post-load host signals, an instrument
reporting nothing while looking like it reported something. A skipped sample
would understate memory pressure in precisely the direction that makes the
hypothesis look falsified.

One shape is legitimately malformed and is tolerated: a torn FINAL line,
which e13-mem-telemetry.sh's own sampler can leave when the wrapper's EXIT
trap kills it mid-write. That is recorded as mem_timeline_torn_final_line in
the summary and announced on stderr, never absorbed.

The test for the torn line is the missing "\n", NOT a parse failure, and the
line is discarded even when it parses. This closes a hole neither the nit's
`continue` nor a plain try/except would have caught: a truncated write can
leave a well-formed line carrying a truncated integer -- "101.0 8" where
"101.0 8589934592" was intended -- which enters the timeline as a real
8-byte MemAvailable reading and manufactures the memory pressure this script
exists to test for. Verified against the pre-fix parser, which accepts that
line as (101.0, 8). A complete sample always ends in "\n", so an
unterminated last line cannot be trusted on its face.

Also adds mem_samples_total to the summary, so a timeline that parsed fewer
samples than expected is visible without re-reading the raw file.

Nine new checks in tests/e13-correlate.test.sh cover both branches: a
malformed interior line exits nonzero, names path:lineno, and writes no
summary; a torn final line exits zero, is flagged, keeps every complete
sample, and is announced. The torn fixture is deliberately one that parses,
so the truncated-integer case is pinned rather than described. Confirmed the
pre-fix parser fails these: it accepts the truncated sample and gives a bare
ValueError with no position.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
@pdettori
pdettori merged commit b86021d into main Sep 18, 2026
17 of 18 checks passed
@pdettori
pdettori deleted the feat/e13-vsock-restore-capacity-diagnosis branch September 18, 2026 15:27
pdettori added a commit to pdettori/moca that referenced this pull request Sep 22, 2026
Addresses all four review comments on rossoctl#268. The PR sat from 09-15 while E12
actually ran, so the spec's live text still gated on an open question.

The staleness, in the two places a planner reads first:

  - §9's preamble said "Build nothing before E12 answers". rossoctl#271 is closed
    COMPLETED and rossoctl#273 is merged, so that hold is discharged, not merely
    stale. A status note at the head of §9 now records the answer -- yes, T1
    stands -- with what EXPERIMENTS.md establishes (rungs A, B, D and C@8,
    two independent witnesses, pristine-snapshot check intact) and what
    C@128's failures were actually traced to: start_host_listener returning
    when the listener was backgrounded rather than when it had reached
    listen(), so a guest CONNECT could land before anything was listening and
    get a correct RST. Fixed in b203e38.
  - §12's preamble repeated the same gate. §12 exists precisely so a fresh
    session does not have to guess, which makes it the line most likely to be
    taken at face value and stop work that is unblocked. It now states the
    gate is discharged and notes that remote-worker/cmd/e12-guest-client is
    already on main.

The in-body gating sentence is kept rather than deleted -- it is the record of
what was sealed before the run -- but marked discharged inline, so a reader
skimming to the bold text cannot mistake it for live guidance. E13 and E14 are
still open and the surrounding text still governs them.

E12's sealed prediction is now scored rather than left reading as a clean pass.
"Works for all N" did not hold on first pass: the authoritative pre-fix combined
run gave 76/128 at N=128 and ok=false in e12-answer.json. It holds only after
the probe's own startup-ordering defect was corrected, which cut the failure
rate 167.8x on metal and took the guest-side-reset signature to zero across
5,120 VM-attempts, and to zero on nested as well -- with a residual,
iowait-correlated failure mode remaining on nested that is unrelated to the
vsock mechanism. This repo seals predictions before the first rung so they
cannot be quietly reinterpreted afterwards, and a prediction that needed the rig
fixed before it passed is a different record from a first-pass hit. The
reasoning behind it -- "strictly less to reset than in the direction already
known to work" -- was right, and is kept, because that is the part the spec
depends on.

The rootfs digest is now quoted at the same truncation the repo records
(sha256:668af589..., EXPERIMENTS.md:1610). §9.1's whole argument is that the
E10/E11 numbers were legitimised by that digest being verified identical, so
citing it more precisely than anything committed supports undercut the point it
was making.

pre-commit run --files <spec>: all hooks pass, including the pinned Prettier.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
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.

E12: does guest-initiated vsock on a second port survive snapshot restore? (gates P4.1 / PR #268)

3 participants