feat(monitor): mid-flight steering — inject user messages into a running agent #224
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks#224
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
User story
As an operator, I want to interrupt a running agent mid-turn and send it a redirect message ("no, don't touch sessions.ts, focus on db.ts") without killing the task and losing its context. Today the only recourse is
/cancel+ re-dispatch, which wastes the accumulated reasoning and costs a full re-prompt.Acceptance criteria
SDK integration
agent-runner.tsfrom one-shotquery()to the streaming input variant of@anthropic-ai/claude-agent-sdkso new user messages can be pushed into a live conversation. Existing session-chain + resume semantics remain intact.task_id. The SDK iterator drains from this queue each turn boundary.Steer endpoint
POST /task/:id/steerwith body{ message: string }. Auth-gated (M18-8). Returns202when the message is queued;409 Conflictif the task has settled;413 Payload Too Largeif the body exceeds a sane cap (suggest 8 KB).userrole message so the agent treats it as operator input, not as tool output.steer_queued/steer_deliveredenvelope emits on/eventsso the Monitor UI can show the message appearing in the transcript with a distinct visual.Interrupt-and-steer UI wiring
POST /task/:id/steer; the panel flips to a pending state until the service echoessteer_delivered.--color-role-operator, add to tokens if missing) so agent vs. operator turns are distinguishable.Safety rails
429 Too Many Requests. Prevents a runaway loop of chained steers from overloading the SDK./foreman/chat; steering would be a confusing second channel. Return400with a hint pointing at the Planner page.Verification
apps/server/src/agent-runner.test.ts— mocked SDK with streaming input, verify a posted steer message lands in the next iterator yield.usermessage and the agent's nextassistantturn references it.Dependencies
Out of scope
References
@anthropic-ai/claude-agent-sdk— streaming input mode.apps/server/src/agent-runner.ts— current one-shot query invocation.apps/server/src/worker.ts— task lifecycle + abort signal wiring.packages/shared/src/sse.ts— SSE envelope shapes (addsteer_queued/steer_delivered).