Skip to content

feat(vmpool): the always-on vmpool: exec line carries start_ms and dur_ms - #983

Merged
pdettori merged 1 commit into
rossoctl:mainfrom
webchang:pr/vmpool-exec-timing
Nov 23, 2026
Merged

pdettori merged 1 commit into
rossoctl:mainfrom
webchang:pr/vmpool-exec-timing

Conversation

@webchang

Copy link
Copy Markdown
Member

Closes #982

The always-on vmpool: exec line now ends with start_ms (epoch ms) and dur_ms, so per-Exec timing no longer needs SH_EXEC_TIMING=1.

  • The same values as exec-timing: both come from one time.Since(start) in Runner.Run.
  • Appended after err=: a reader matching the existing prefix still matches.
  • exec-timing is unchanged: still opt-in, and it still adds the phases and the VM's CPU.
  • The container worker (internal/exec) has no always-on per-Exec line, only its opt-in exec-timing, so there's nothing to match there.
  • Docs: the microVM tier guide's sample lines show the fields, and kind=, which they had been missing.

Tests: TestRunnerExecLogCarriesTheExecTimingOfTheOptInLine (internal/vmpool) checks that the line's start_ms and dur_ms equal the exec-timing line's, that start_ms falls within the call, and that dur_ms covers the run. It fails without the change. go vet ./... and go test ./... in remote-worker pass, and so does deploy/microvm/tests/p4-turn-smoke.test.sh.

Assisted-By: Claude Code

…r_ms

Per-Exec timing on the microVM worker needed SH_EXEC_TIMING=1: the always-on line named the
workspace, kind and VM but no time, so a reader had only the journal's whole-second stamp. The line
now ends with start_ms (epoch ms) and dur_ms, the same values the opt-in exec-timing line writes
(one time.Since, shared by both). The fields are appended, so a reader matching the existing prefix
still matches; exec-timing is unchanged and still adds the phases and CPU. The container worker has
no always-on per-Exec line (only its opt-in exec-timing), so there is nothing to match there. The
microVM tier guide's sample lines show the fields.

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

@clawgenti clawgenti left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

The line gains exactly what the body promises, in the format the opt-in line already uses, and the two cannot drift: both now read the same start and the same dur (logExecTiming(..., start, dur, ...)), so start_ms/dur_ms are byte-identical between the always-on line and exec-timing. Appending after err=%v keeps p4-turn-smoke.sh:286's grep -cE 'vmpool: exec .*vm=vm-' matching.

Verified at bf01043:

  • go vet ./internal/vmpool/... clean; go test ./internal/vmpool -run 'TestRunnerLogs|TestRunnerExecLogCarries' passes.
  • Mutation check: with runner.go reverted to main (the new test kept) it fails — exec log start_ms = "", want the exec-timing line's "1795441183472" — and passes at head, so the test pins the change.
  • One nit inline.

Author: webchang (MEMBER — maintainer)
Areas reviewed: Go (remote-worker/internal/vmpool), docs (docs/operate/harness/microvm-tier.md), the smoke-test fixture
Agent/IDE config (.claude/.vscode): none
Commits: 1, all signed off: yes
CI status: passing (k8s-kind-e2e, lint, microvm-gates, proto, shellcheck, trivy-scan)

Generated by RepoMan github-pr-review@235a7f7 (https://github.com/rossoctl/agent-skills/blob/235a7f7620139ee3e4ab0872b8439591fe52e8c1/skills/github-pr-review/SKILL.md).

}
execLog("vmpool: exec req=%d workspace_key=%q kind=%s vm=%s cold=%q exit=%d err=%v",
s.ReqID, s.WorkspaceKey, logKind, ph.VMID, string(ph.Cold), res.ExitCode, err)
execLog("vmpool: exec req=%d workspace_key=%q kind=%s vm=%s cold=%q exit=%d err=%v start_ms=%d dur_ms=%.1f",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit — the smoke test's stand-in journal line no longer looks like a real one. deploy/microvm/tests/p4-turn-smoke.test.sh:98 writes vmpool: exec req=$n workspace_key=... vm=vm-$n cold="" exit=0 err=<nil>; it was already missing kind= and now also lacks start_ms/dur_ms. The test only needs the vmpool: exec .*vm=vm- match, so nothing fails today — but the fixture is what a future reader will copy when they add a field-dependent assertion.

Suggested fix: append kind=command start_ms=0 dur_ms=0.0 (or …) to that echo, so the fixture tracks the line it stands in for.

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review — vmpool exec timing

Approving. The always-on vmpool: exec line now ends with start_ms (epoch ms) and dur_ms, both from the same time.Since(start) that feeds the opt-in exec-timing line; logExecTiming formats them identically, so the new test's field-for-field comparison is meaningful. Appending after err=%v keeps the existing prefix match, and the docs sample matches the format string.

Verified the test pins equality with the opt-in line, that start_ms falls inside the call, and that dur_ms covers the 5 ms run. CI 18/18; DCO signed; MEMBER author; no .claude//.vscode/ changes; no injection content.

@pdettori
pdettori merged commit 263d8a6 into rossoctl:main Nov 23, 2026
18 checks passed
webchang added a commit to webchang/moca that referenced this pull request Nov 23, 2026
Upstream rossoctl#972, rossoctl#977, rossoctl#978, rossoctl#979, rossoctl#981, rossoctl#983, rossoctl#985, rossoctl#988 and rossoctl#990 (44 commits past 49cce28). No conflict.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

microVM worker: per-Exec timing needs SH_EXEC_TIMING=1

4 participants