Skip to content

feat(daemon): /agentd restart [binary path] (#145)#156

Merged
edwin-zvs merged 1 commit into
mainfrom
restart-binary-path
May 23, 2026
Merged

feat(daemon): /agentd restart [binary path] (#145)#156
edwin-zvs merged 1 commit into
mainfrom
restart-binary-path

Conversation

@edwin-zvs

Copy link
Copy Markdown
Contributor

Closes #145.

/agentd restart now accepts an optional binary path and execs that binary instead of the daemon's own — e.g. hot-swap into a freshly-built worktree binary without killing the fleet. With no argument it behaves exactly as before (in-place re-exec to pick up an upgraded binary at the same path).

How

  • daemon.restart IPC gains an optional exe param (DaemonRestartParams). Older clients send null and still get the in-place restart (back-compatible).
  • Validated before tear-down. The supplied path is canonicalized and must exist, be a regular file, and be executable. A bad path returns a JSON-RPC error and the daemon stays running — it never exec()s a missing binary and fails to come back. Original args (run --socket …) are preserved, so the new binary serves the same socket.
  • TUI: /agentd restart [path] splits off the optional path; client.daemon_restart(exe) carries it.

Tests

  • validate_restart_exe_accepts_executable_rejects_bad_paths — accepts an executable file (returns the canonical absolute path), rejects missing path / directory / non-executable file.
  • e2e restart callers updated to the new signature; the 3 restart e2e tests pass.
  • Verified end-to-end against a live daemon: daemon.restart {exe:"/no/such/binary"} → error + daemon still alive; daemon.restart {exe:<copy>} → daemon re-execs into the copy and comes back serving the same socket.

(The one failing workspace test is the pre-existing debug-only timing flake many_pinned_sessions_resize_within_budget.)

🤖 Generated with Claude Code

`/agentd restart` can now take an optional binary path and exec that
instead of the daemon's own binary — e.g. hot-swap into a freshly-built
worktree binary without killing the fleet. `/agentd restart` with no
argument keeps the existing in-place re-exec.

- `daemon.restart` IPC gains an optional `exe` param (DaemonRestartParams);
  older clients send `null` and still get the in-place restart.
- The path is validated daemon-side BEFORE tearing down — canonicalized,
  must exist, be a regular file, and be executable — so a typo returns an
  error and the daemon stays up rather than exec()ing a missing binary
  and never coming back. Original args are preserved, so the new binary
  serves the same socket.
- TUI slash parses `restart [path]`; `client.daemon_restart(exe)`.

Tests: `validate_restart_exe` (accepts an executable, rejects missing /
directory / non-executable); e2e restart callers updated. Verified
end-to-end: bad path → error + daemon alive; valid path → daemon
re-execs into it and comes back on the same socket.
@edwin-zvs
edwin-zvs merged commit 22132b6 into main May 23, 2026
1 check passed
@edwin-zvs
edwin-zvs deleted the restart-binary-path branch May 23, 2026 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'/agentd restart [optional binary path]'

1 participant