Skip to content

No detached run mode: --local-agent binds the agent worker to the invoking terminal #534

Description

@khaliqgant

Problem

There is no way to start a run and walk away. The flag set is:

flows run [--json] [--no-spawn] [--no-observer-link] [--data-dir <dir>] [--local-agent] [--reuse-from <run-id>] <flow>

No --detach, no --background.

This is specifically awkward because the engine is already built for
durability. relayflowd is a daemon and it owns run state: on one machine we
found 35 daemons alive, several for 3+ days, holding 106 completed and 44
failed runs. The run survives a closed terminal today.

What does not survive is the --local-agent worker, which lives in the
invoking process. Close the window and the worker dies mid-step; the run parks
again with no worker is attached for step type "agent".

So the durability story is half-built: the journal is detached from the
terminal, the worker is not.

Why the workarounds are unsatisfying

  • nohup flows run --local-agent ... & works, but gives no handle for
    inspecting or steering the run afterwards.
  • tmux new -d -s flows '...' works and is what we settled on — but on macOS
    it has to be started from a GUI session, because a tmux server started over
    ssh inherits the ssh session's security context and the agent CLI then cannot
    reach the login keychain. That is a real constraint a user has to discover by
    hitting it.
  • --cloud exists but is a different execution surface with its own setup.

None of these are discoverable from flows run --help.

Proposals

  1. flows run --detach — start the run, print the run id, exit 0. The
    daemon already owns the journal; this needs the local worker to be
    supervised rather than inline.
  2. A supervised local worker, so --local-agent does not imply
    "tied to this tty". Something like flows worker start [--data-dir <dir>]
    that registers a worker the daemon can hand agent steps to, and
    flows worker stop. Then flows run needs no worker flag at all and a
    parked run resumes the moment a worker appears.
  3. At minimum, make the park message actionable. It currently says to
    re-run with --local-agent. It could also say that the worker will be bound
    to that terminal, and point at whatever the detached option is.

(2) is the real fix: it separates "who executes agent steps" from "who typed
the command", which is the same separation the daemon already made for run
state.

Impact

Any flow with agent steps that runs longer than someone wants to babysit a
terminal — which is most of them. This is the third time one campaign has hit
the local-agent binding.

Activity

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

    garden-readyScoped and ready for an agent to pick up

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions