feat(sessions): kickoff prompts, resume-on-respawn, and full CLI parity#144
Open
defangdevs wants to merge 1 commit into
Open
Conversation
defangdevs
force-pushed
the
fix/remote-control-name-empty-host
branch
from
July 22, 2026 14:30
4dbffab to
121a7fc
Compare
Let a main/interactive session spin up work in sibling sessions and reach
everything the settings UI can do, without the web UI or a rebuild.
Sessions (agent-box-session / settings page / seed) gain:
- initialPrompt: a kickoff task handed to the harness on the FIRST spawn
only (its positional prompt arg). The supervisor consumes it (mark_started
sets hasRun, records boxSessionId, clears initialPrompt) so a respawn never
redoes the task.
- Resume-on-respawn: every later spawn (crash, reboot, Spot stop->restart —
all of which keep the on-disk transcript, since /home is the persistent
root EBS volume) resumes the prior transcript instead. boxSessionId is the
stable id we own across respawns:
* Claude consumes it directly as --session-id (first spawn) / --resume
(respawn, when a transcript exists; else a fresh --session-id) — exact,
so concurrent sessions never cross.
* Codex mints its own id, so we stamp "[agent-box session <id>]" into the
kickoff prompt and locate the exact rollout by that marker
(grep -> newest -> trailing-36-char UUID) -> codex resume <uuid>. No
match -> start fresh; never `resume --last`, which could grab a sibling
session's transcript in a shared cwd.
resumePrompt overrides the built-in steer (continue unfinished work, or
stop if already done).
CLI (agent-box-session) reaches UI parity:
- add --prompt / --resume-prompt
- env ls | set KEY VALUE | rm KEY (writes the same ~/.config/agent-box/env
the settings page manages and the env-exec wrapper reads; ls shows keys
only, never values)
- restart --all
Settings page: add-session forms gain an optional kickoff-prompt field.
Seeded AGENTS.md documents --prompt, resume semantics, env, restart --all so
every harness discovers them.
Adds sessions.nix regression coverage: kickoff deliver-once + resume state,
env set/ls/rm, restart --all, and the web-form prompt.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wx9PVLmDbzS35JCN5N85i6
defangdevs
force-pushed
the
feat/session-kickoff-prompt-and-resume
branch
from
July 22, 2026 14:42
79cadc6 to
1825f2a
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.
Motivation
From a main/interactive agent-box session (Claude or Codex, on the phone via Remote Control) you should be able to kick off work in sibling sessions — possibly on a different harness — and reach everything the settings UI can do, without opening the web UI or doing a rebuild. Sessions already had UI/CLI CRUD over the same on-disk
sessions.json; this fills the gaps.What this adds
Kickoff prompt (first spawn only). New
initialPromptis handed to the harness as its positional prompt argument on the first spawn; the supervisor then consumes it (mark_startedsetshasRun, recordsboxSessionId, clearsinitialPrompt) so a respawn never redoes the task.Resume-on-respawn. Every later spawn — crash, reboot, Spot stop→restart, all of which keep the transcript because
/homeis the persistent root EBS volume — resumes the prior transcript instead of redoing or idling.boxSessionIdis the stable id we own across respawns:--session-id(first spawn) /--resume(respawn, when a transcript exists; otherwise a fresh--session-id) — exact, so concurrent sessions never cross.[agent-box session <id>]into the kickoff prompt and locate the exact rollout by that marker (grep→ newest → trailing-36-char UUID) →codex resume <uuid>. No match → start fresh; neverresume --last, which could grab a sibling session's transcript in a shared cwd.resumePromptoverrides the built-in steer (continue unfinished work, or stop if already done).CLI parity (
agent-box-session):add … --prompt "TASK" [--resume-prompt "…"]env ls | set KEY VALUE | rm KEY— writes the same~/.config/agent-box/envthe settings page manages and the env-exec wrapper reads (lsshows keys only, never values)restart NAME | --allSettings page: add-session forms gain an optional kickoff-prompt field wired to
initialPrompt.Discoverability: seeded AGENTS.md documents
--prompt, resume semantics,env, andrestart --all.User-visible / security effects
envwrites the existing user-owned0600file with the sameKEY_REcharset as the settings daemon and the env-exec wrapper; values are never surfaced byls.printf %q, same injection-safe path asextraArgs.Checks run
nix-instantiate --parse modules/agent-box.nix— OKnix build .#checks.x86_64-linux.module-single-fileand.multi-user— evaluate cleanly (.drvproduced; x86_64 build and VM tests couldn't run on the aarch64 dev box without/dev/kvm).env_rewriteset -esafety.--session-id/--resume/positional prompt; Codexresume [id] [PROMPT]+ bypass flag on the subcommand).Needs CI (KVM): the new
tests/sessions.nixsubtests (kickoff deliver-once + resume state,env,restart --all, web-form prompt).Not verified headlessly: that a positional prompt injects as a real first turn in a live
--remote-controlinteractive launch, and that--session-idcomposes with--remote-control— needs a real attach on a deployed box.🤖 Generated with Claude Code