feat(daemon): zot-rpc spawn driver + binary-aware autospawn args (#143) #157

Merged
clawdie merged 1 commit from zot-rpc-spawn-driver into main 2026-06-24 00:36:15 +02:00
Owner

Implements the colibri#143 zot-rpc driver (Path B) so zot can be a real, board-integrated OOTB autospawn agent.

Problem

The spawner spawned every agent with stdin(Stdio::null()) and read stdout only — it could only host self-driving emitters (pi --mode json). But zot's only structured persistent mode is zot rpc, a request/response peer that blocks on stdin, so it could never autospawn (confirmed against the v0.2.42 source: --print/--json are one-shot, --rpc needs stdin, and there is no --mode flag). 0.12.0 made this worse by defaulting COLIBRI_AUTOSPAWN_BINARY=zot while args defaulted to --mode json — invalid for zot → OOTB spawns a broken/no agent.

Change

  • AgentSpawnConfig.rpc_stdin — when set, the spawner pipes stdin and keeps the writer; otherwise stdin stays null (pi path unchanged).
  • cmd_spawn_agent auto-detects rpc mode from argv (rpc/--rpc).
  • AgentHandle → cloneable RpcSender (Arc-backed) so prompts are written without holding the agent-registry (DashMap) lock across the async write. build_rpc_prompt emits zot's exact wire format {"id","type":"prompt","message"} (matches docs/ZOT-RPC-TRANSCRIPT.md).
  • Binary-aware autospawn default argv: zot → rpc, pi → --mode json (fixes the invalid default). Optional one-time bootstrap prompt via COLIBRI_AUTOSPAWN_RPC_PROMPT (default boot spends no tokens). Log strings de-pi-fied.

Tests

  • New unit tests: RPC prompt framing + quote/newline escaping, rpc_stdin default false, sender presence by mode.
  • Full workspace: 250 tests, 0 failures (Linux, rustc 1.95.0).
  • Live zot rpc smoke pending — the build host couldn't fetch Go modules in this session; the request shape is byte-identical to the recorded real-key transcript.

Scope / follow-ups

This lands the spawn-side driver + ready rpc peer. Routing board tasks to an rpc agent's stdin (via RpcSender) is the next increment. zot now comes up correctly under autospawn instead of crashing on --mode json.

Stacks on #156 (0.12.0 compile + lock fix) — this branch includes those commits. Merge #156 first for a clean diff, or merge this (covers both).

🤖 Generated with Claude Code

Implements the **colibri#143 zot-rpc driver** (Path B) so zot can be a real, board-integrated OOTB autospawn agent. ## Problem The spawner spawned every agent with `stdin(Stdio::null())` and read stdout only — it could only host **self-driving emitters** (`pi --mode json`). But zot's only structured persistent mode is **`zot rpc`**, a request/response peer that **blocks on stdin**, so it could never autospawn (confirmed against the v0.2.42 source: `--print`/`--json` are one-shot, `--rpc` needs stdin, and there is **no `--mode` flag**). 0.12.0 made this worse by defaulting `COLIBRI_AUTOSPAWN_BINARY=zot` while args defaulted to `--mode json` — invalid for zot → OOTB spawns a broken/no agent. ## Change - **`AgentSpawnConfig.rpc_stdin`** — when set, the spawner pipes stdin and keeps the writer; otherwise stdin stays null (pi path unchanged). - **`cmd_spawn_agent`** auto-detects rpc mode from argv (`rpc`/`--rpc`). - **`AgentHandle` → cloneable `RpcSender`** (Arc-backed) so prompts are written without holding the agent-registry (`DashMap`) lock across the async write. `build_rpc_prompt` emits zot's exact wire format `{"id","type":"prompt","message"}` (matches `docs/ZOT-RPC-TRANSCRIPT.md`). - **Binary-aware autospawn default argv**: zot → `rpc`, pi → `--mode json` (fixes the invalid default). Optional one-time bootstrap prompt via `COLIBRI_AUTOSPAWN_RPC_PROMPT` (default boot spends no tokens). Log strings de-pi-fied. ## Tests - New unit tests: RPC prompt framing + quote/newline escaping, `rpc_stdin` default false, sender presence by mode. - **Full workspace: 250 tests, 0 failures** (Linux, rustc 1.95.0). - Live `zot rpc` smoke pending — the build host couldn't fetch Go modules in this session; the request shape is byte-identical to the recorded real-key transcript. ## Scope / follow-ups This lands the **spawn-side driver + ready rpc peer**. Routing board *tasks* to an rpc agent's stdin (via `RpcSender`) is the next increment. zot now comes up correctly under autospawn instead of crashing on `--mode json`. > Stacks on **#156** (0.12.0 compile + lock fix) — this branch includes those commits. Merge #156 first for a clean diff, or merge this (covers both). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
clawdie added 2 commits 2026-06-23 17:45:52 +02:00
fix: colibri 0.12.0 build — stale pi_binary refs + Cargo.lock sync
Some checks failed
CI / rust (pull_request) Has been cancelled
CI / markdown (pull_request) Has been cancelled
CI / port (pull_request) Has been cancelled
CI / agent-jail-pkgs (pull_request) Has been cancelled
a9d0aed89e
The harness-neutral rename (COLIBRI_AUTOSPAWN_PI → COLIBRI_AUTOSPAWN,
pi_binary → agent_binary) left two references to the old pi_binary name in
autospawn_agent_if_configured, so colibri-daemon failed to compile:

  error[E0425]: cannot find value `pi_binary` — socket.rs:449, 493

Rename both to agent_binary. Also refresh Cargo.lock: workspace members were
still pinned 0.11.0 while the manifests are 0.12.0, so --locked builds (used
for release staging) refused the tree.

Verified: full workspace builds clean and the entire test suite passes
(~230 tests, 0 failures); cargo metadata --locked is back in sync.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat(daemon): zot-rpc spawn driver + binary-aware autospawn args (colibri#143)
Some checks failed
CI / rust (pull_request) Has been cancelled
CI / markdown (pull_request) Has been cancelled
CI / port (pull_request) Has been cancelled
CI / agent-jail-pkgs (pull_request) Has been cancelled
0e9b16456b
The spawner spawned every agent with stdin(Stdio::null()) and read stdout
only, so it could only host self-driving emitters (pi --mode json). zot's
only structured persistent mode is `zot rpc`, which is a request/response
peer that blocks on stdin — so it could never autospawn. Worse, 0.12.0
defaulted COLIBRI_AUTOSPAWN_BINARY=zot while args defaulted to --mode json,
which is not a zot flag, so the OOTB image would spawn a broken/no agent.

Add a stdin RPC driver:
- AgentSpawnConfig.rpc_stdin: when set, the spawner pipes stdin and keeps the
  writer; otherwise stdin stays null (unchanged path for pi).
- cmd_spawn_agent auto-detects rpc mode from argv (`rpc`/`--rpc`).
- AgentHandle gains a cloneable RpcSender (Arc-backed) so prompts can be sent
  without holding the agent-registry lock across the async write.
  build_rpc_prompt emits zot's wire format: {"id","type":"prompt","message"}.
- Autospawn picks default argv per harness: zot -> `rpc`, pi -> `--mode json`
  (corrects the invalid --mode-json-for-zot default), and optionally sends a
  one-time bootstrap prompt when COLIBRI_AUTOSPAWN_RPC_PROMPT is set (default
  boot spends no tokens). Log strings de-pi-fied (autospawn-pi -> autospawn).

Tests: build_rpc_prompt framing + escaping, rpc_stdin default, sender presence
by mode. Full workspace: 250 tests, 0 failures. Live zot rpc smoke pending
(wire format matches docs/ZOT-RPC-TRANSCRIPT.md real-key capture).

Stacks on the 0.12.0 compile/lock fix (PR #156).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
clawdie merged commit 42c13285eb into main 2026-06-24 00:36:15 +02:00
clawdie deleted branch zot-rpc-spawn-driver 2026-06-24 00:36:16 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: clawdie/colibri#157
No description provided.