fix: run verb #66
No reviewers
Labels
No labels
epic
in-review
ready-for-agent
ready-for-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
weiwen/evie!66
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-59"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Run Verb — daemon-spawned scripts with
EVIE_*env, fire-and-forgetCloses #59 (parent #55). Adds the
rundelivery Verb: the Daemon spawns a local script/command with evie's env context populated and does not deliver its output anywhere. Because the daemon (not the CLI) spawns the process, immediate and (later) scheduledrunwill behave identically, matching the argv-wrap-replay design in ADR 0006 and leavingEVIE_SCHEDULE_NAME/EVIE_SCHEDULE_TIMEfor the scheduling slice.What changed
Control plane (
src/control_plane.rs)ControlRequest::Run { chat_id, argv }in the JSON-lines enum.argv[0]is the script path; the rest are its arguments.chat_idis optional andskip_serializing_if = "Option::is_none".ControlPlanenow owns its boundsocket_path(injected asEVIE_SOCKET), sorun(&socket_path)becamerun();new/new_with_deliverertakesocket_path. All existing tests andmain.rsupdated to the new signatures.handle_run: resolves the target chat (any resolved chat accepted;api-targets just name the env context), spawns the child synchronously so a missing executable is reported to the caller (run failed to spawn: …), then detachesawait_and_log_runand returnsokimmediately — fire-and-forget, nothing delivered to the chat.spawn_run_child:tokio::process::CommandwithEVIE_CHAT_ID+EVIE_SOCKETenv, null stdin, piped stdout/stderr,kill_on_drop(true)so a detached run never orphans a child.run_script(#[cfg(test)]): the transport-agnostic, awaitable dispatch-core seam returningExitStatus;handle_runwraps it with chat resolution + fire-and-forget semantics.CLI (
src/main.rs)evie run <script> [args…]with--chat <CHAT_ID>; buildsargv(script+args) and sendsControlRequest::Runover the socket via the existingrun_cli_verbpath. The--chathelp documents the$EVIE_CHAT_ID/sole-chat fallback and that the script callsevie senditself to message back.Tests (11 new)
Deserialization (with/without
chat_id, argv shape); env injection (EVIE_CHAT_ID/EVIE_SOCKETreach the script); argv passing (args after the script path reach$*); zero exit returns success status; non-zero exit returns the status (not an error — fire-and-forget); missing executable →NotFoundspawn error; over-the-socket verb returnsokwith no response; emptyargvrejected; missing executable reported to caller; and an end-to-end callback test where a run script'sEVIE_SOCKETequals the daemon's bound socket and a concurrentSendover that path is delivered to the chat — provingevie send "$EVIE_CHAT_ID" …round-trips through the injected env with no config.Acceptance criteria
evie run <script> [args…]spawned by the daemon withEVIE_CHAT_ID+EVIE_SOCKET.evie send) via the injected env.evieinterface, fire-and-forget delivery verb).Verification
cargo testis green (165 passed, 0 failed across repeated full-suite runs);cargo test run_covers the new verb.Known caveat
The write-then-exec tests occasionally hit
ETXTBSY("Text file busy") on the freshly written script under heavy parallel load (seen once, then 3/3 clean full-suite runs; passes reliably in isolation).spawn_run_childdoes not retry onETXTBSY. The product path is unaffected — real scripts are not written-then-exec'd in the same syscall window — but a retry-on-ETXTBSY(or async/small delay in the test helper) would harden the suite.Closes #59