extensions: add agent_spawn tool for bounded dev-agent startup#188
extensions: add agent_spawn tool for bounded dev-agent startup#188benvinegar merged 2 commits intomainfrom
Conversation
Greptile SummaryThis PR introduces a new Key observations:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant C as Control Agent
participant T as agent_spawn tool
participant X as pi.exec (tmux)
participant FS as ~/.pi/session-control/
participant S as Unix Socket
C->>T: execute(session_name, cwd, skill_path, model, ready_timeout_sec)
T->>T: Validate inputs (session_name, ready_alias, model, cwd, skill_path)
T->>X: tmux new-session -d -s <session_name> <command>
X-->>T: {code: 0}
loop Poll every 200ms until deadline
T->>FS: existsSync(<alias>.alias)
alt alias exists
T->>FS: readlinkSync → resolve socket path
T->>FS: existsSync(<socket>.sock)
alt socket exists
T->>S: net.createConnection (probe, 300ms timeout)
S-->>T: connect / error / timeout
end
end
end
alt Ready
T-->>C: {ready: true, spawned: true, socket_path, alias_path}
else Timeout
T-->>C: {isError: true, ready: false, error: "readiness_timeout", session/logs intact}
end
Last reviewed commit: 1ada492 |
Additional Comments (1)
The PR's stated goal is to require Consider migrating the sentry-agent spawn to an Prompt To Fix With AIThis is a comment left during a code review.
Path: pi/skills/control-agent/SKILL.md
Line: 332
Comment:
**Sentry-agent still uses raw `tmux new-session` spawn**
The PR's stated goal is to require `agent_spawn` for worker startup and forbid ad-hoc shell spawn patterns. The dev-agent section has been updated accordingly, but the sentry-agent spawn on this line still uses the old raw `tmux new-session` incantation with inline `export PATH=...`. This means the sentry-agent bypasses the bounded readiness check and validated inputs that `agent_spawn` provides, and creates an inconsistency that the runbook guard tests don't catch (the guard only asserts the string `agent_spawn` appears somewhere in the file).
Consider migrating the sentry-agent spawn to an `agent_spawn` tool call block, matching the pattern used for dev-agents above.
How can I resolve this? If you propose a fix, please make it concise. |
|
Addressed the additional runbook concern in d324512: the sentry-agent section now uses the |
Summary
agent_spawnextension tool that launches a tmux-backed pi session with validated inputs and bounded timeouts~/.pi/session-control/<alias>.alias+ socket probe and return structured stage/error detailsagent_spawnfor worker startup and forbid invalid/fragile spawn patternsmemory.test.mjsand include new test file in test configTesting
npm run test:jsnpm run typechecknpm run lint:js(existing unrelated warning remains inslack-bridge/broker-bridge.mjsfor unusederr)Refs #185