Repository navigation
Let exec steps start a helper that lives until the run ends - #169
Merged
Merged
Conversation
bitomule
force-pushed
the
worktree-t-mav-149-exec-helper-process
branch
from
December 2, 2026 23:50
154dd41 to
10bc1c2
Compare
bitomule
force-pushed
the
worktree-t-mav-149-exec-helper-process
branch
2 times, most recently
from
December 3, 2026 10:02
c767172 to
cc2fb9d
Compare
A background exec (background: true, name) starts a helper in its own process group that stays up across later steps. exec.stop stops it, and the run stops whatever is left when it passes, fails or is interrupted. A watchdog outside the group stops it if mav is SIGKILLed. contains and port wait for readiness. The registry is a Go API network mocking (#150) can start a mock server with. Closes #149
bitomule
force-pushed
the
worktree-t-mav-149-exec-helper-process
branch
from
December 3, 2026 10:28
cc2fb9d to
f20212a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #149.
What changes
A flow can now start a helper process that stays up across later steps, and MAV owns its whole lifetime:
exec_NN_<name>.out/.errin the run directory (no pipes MAV has to drain).containswaits for text in its output,portfor a TCP address that accepts. A helper that exits before it is ready (exec_background_exited, with its exit code) or never gets ready (exec_background_not_ready) fails the step and is stopped before the step returns.${exec.mock.pid},${exec.mock.stdout},${exec.mock.stderr}are bound for later steps.exec.stopsends SIGTERM to the whole group (so a wrapper'snohup … &children go too), then SIGKILL after the grace period. Stopping a helper that already died on its own fails withexec_background_exited, since the steps since then ran without it.runFlowdefers a cleanup that stops every helper still running, newest first, when the run passes, fails, or is interrupted (SIGINT/SIGTERM cancel the run context). Each is recorded incommands.jsonlasmav exec.stop <name> (run end).Plain
execsteps are unchanged: they still reap their whole group when the step ends (#121).For #150 (network mocking)
The lifecycle is a small Go API in
internal/mav/exec_background.go, not just a YAML feature: anetwork.mockstep can build abackgroundSpec(command, log paths,ReadyAddr/ReadyContains) and callc.background.Start(ctx, spec). It gets the same readiness wait, the same graceful SIGTERM stop (which lets mitmdump flush a recording), and the same run-end, failure and SIGKILL cleanup with no extra code.Footprint
cli.gochanges by 15 lines: one CLI field, the deferred cleanup inrunFlow, and three dispatch lines. Everything else is in the newexec_background.go, plus the payload flag and theexec.stopaction inflow.go, two lint checks inflow_lint.go, and docs inREADME.mdandskills/mav/SKILL.md.Tests
internal/mav/exec_background_test.go:nohup … &and exits) is still alive in later steps, and is gone once the run passes without anexec.stop;exec.stopstops the whole group, and${exec.NAME.pid}binds;mav runchild process is killed and the helper goes with it;containsand byport; a helper that exits before it is ready fails fast with its exit code; a readiness timeout stops the helper; with no readiness check, a command that cannot start (exit 127) still fails the step;outwith background, unknown name, name already running, helper already exited),allow_shellrequired, parsing (exec.stop: mockscalar form), and lint.Proof the tests test the fix
With the deferred run-end cleanup removed from
runFlow:With the watchdog not started:
With the fix in place, all of them pass,
go test -racepasses on the new tests, andmake checkpasses.