Skip to content

session-detached-host journey leaves its runner and agent alive after the run #552

Closed

Description

@barelyworkingcode

Problem

After a devboxverify run of the session-detached-host journey, the runner it started is still running. The test host showed three runner.sh processes (one runner and two helpers) under ~/.relay/agents/<session>/g1/, parent pid 1, about 1.5 hours after the run. The agent command is the journey's ~/.local/state/devboxverify/grant-detached-<id>.sh stand-in, and the prompt in sent/ is the journey's Count from 1 to 150 message.

Root cause

Not confirmed. The runner is built to outlive its caller (relay#528), so the journey has to stop the session itself. The journey either does not stop it on PASS, or does not on FAIL or abort.

Fix

Stop the session (relay session stop) and remove its ~/.relay/agents/<session> directory in the journey's cleanup, on every exit path. Add a check that no runner.sh for the journey's session remains.

Found while working relay#525. Reported by the owner, who did not start the processes.

Contract

Coordinator contract, 2026-10-20. Child of the session-adoption epic (#525); the PR targets epic/525-session-adoption. The owner added it to the test-health batch.
Files: cmd/devboxverify/journey_detached_host.go, cmd/devboxverify/README.md.

  • One cleanup runs on every return path of the journey after a session id exists, including sessions started and abandoned by the start retry loop.
  • The cleanup runs relay session stop, ends the agent's process group, ends every process whose command line names the session's run directory, and removes ~/.relay/agents/<session>.
  • After the cleanup, the journey reads the process table. A process that names the session's run directory turns the result into FAIL, with the pids in the detail.
  • The cleanup touches only processes and directories of sessions this run started.
    Proof: a stack run with a failure injected after the session starts. On the epic head's cleanup a runner remains; with the change none remains. Then a clean stack run passes.
    Waits: process exit after a signal is polled, bounded; no event exists for it.
    Budget: two fix attempts.
    Amendment, 2026-10-20: the root cause is shown. A SIGTERM to devboxverify while this journey runs leaves the runner, two helpers and the run folder, as in the owner report. The journey catches SIGINT and SIGTERM while it runs, runs its cleanup, then ends the process with the same signal.

Activity

  1. barelyworkingcode commented on Oct 21, 2026

    @barelyworkingcode
    OwnerAuthor

    Done by #555, merged into epic/525-session-adoption. Verified on the epic head b6f530d (see #532).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions