Skip to content

feat(conversations): take queued messages into a running Claude or Codex turn - #15

Merged
blakeandrewwood merged 3 commits into
mainfrom
feat/conversations-mid-turn-queue
Sep 25, 2026
Merged

blakeandrewwood merged 3 commits into
mainfrom
feat/conversations-mid-turn-queue

Conversation

@blakeandrewwood

@blakeandrewwood blakeandrewwood commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Messages sent while a run is in flight still go to the queue. Now a run whose provider can take input mid-turn takes them in at a tool boundary, instead of only after the turn ends.

  • Claude: chat turns take the prompt on stdin (--input-format stream-json --replay-user-messages), and stdin stays open for the whole turn. Queued messages are written as user lines, and the replayed echo confirms each one was taken in.
  • Codex: chat turns run codex app-server over stdio instead of codex exec; agent runs keep exec. Setup is initialize, then thread/start or thread/resume. The prompt and each queued message go as turn/start, which joins the active turn when there is one. On a first turn the prompt waits for the thread id from thread/started. A userMessage item confirms each message was taken in. Existing exec thread ids resume fine.
  • Engine: while a tool is running, the run pops the queue and writes each message into the turn. A message queued when no tool is running stays queued, and it goes as the next turn as before. When a message enters, the reply so far and the user message are saved in order, and a new ConvEvent.user tells clients to refetch. The run keeps reading until every message it wrote has been answered, then closes stdin.
  • OpenCode: unchanged, since it queues until the run ends. Steering there needs a long-running opencode serve.

Checked against the real CLIs (Claude 2.1.281, Codex 0.154.0) by hand, and end to end in e2e tests with mock-claude standing in for both providers.

🤖 Generated with Claude Code

@blakeandrewwood blakeandrewwood changed the title feat(conversations): take queued messages into a Claude run at tool boundaries feat(conversations): take queued messages into a running Claude or Codex turn Sep 24, 2026
@blakeandrewwood
blakeandrewwood merged commit 82e87b5 into main Sep 25, 2026
2 checks passed
@blakeandrewwood
blakeandrewwood deleted the feat/conversations-mid-turn-queue branch September 25, 2026 21:41
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.

1 participant