Skip to content

[feat] canvas: insert a message into the reply that is already running - #403

Draft
wtz2333 wants to merge 3 commits into
ThinkFlowLab:mainfrom
wtz2333:feat/midturn-steer-ui
Draft

wtz2333 wants to merge 3 commits into
ThinkFlowLab:mainfrom
wtz2333:feat/midturn-steer-ui

Conversation

@wtz2333

@wtz2333 wtz2333 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Summary

While a reply runs, the composer now offers both deliveries that were missing:

  • Enter / send button → insert: the text is handed to the reply that is executing, so the model keeps the work it has already done. The inserted message appears in the conversation where it was sent — before the reply it joined — and is labelled as inserted.
  • Queue button → queue: the text waits and runs after the current reply, exactly as before; the button next to Stop keeps that choice reachable.

Runtimes without a native steering channel keep the queue-only behaviour: the send button still queues and the hint says so, instead of offering an action the server would refuse.

Depends on #402 (the socket-backed insert endpoint and the Codex app-server transport), which in turn depends on #381 (the chain and the queue). Please merge them in that order; I will rebase this branch onto main afterwards.

Refs #379

Test plan

  • node --test tests/*.test.ts → 838 passed, including two new cases: the insert request carries delivery: "insert" to /assistant/messages and returns the inserted message; a refused insert surfaces the server's reason.
  • node scripts/check-i18n.mjs → 3049 keys, 0 problems, 165 Chinese source lines (baseline 168).
  • ./node_modules/.bin/tsc --noEmit → clean.
  • ./node_modules/.bin/vite build → built in 11.27s.
  • Browser journeys need an isolated API and Vite server, so they stay in CI; the live check on the demo instance is done separately on the server.

Evidence

The composer has three actions while a reply runs (insert, queue, stop) and the inserted message carries its own status line. A screenshot from the running demo is attached in the conversation on the issue.

Provider usage

No provider call in this change; the copy and the request shape are covered by the unit tests above.

Bilingual

New copy ships in zh-CN and en-US in the same commit: insert, insertHint, inserted, insertWhileRunning, queueShort.

Labels

I cannot add labels (no write permission on the upstream repository). This needs type:feat, area:canvas, area:agent.

While a reply streams, the composer kept the draft but replaced Send with
Stop and Enter returned without a word, so a supplement could only be
typed in and lost. It is sent now: the server answers 202 with the queued
message, the log shows it as queued, and the same stream keeps feeding the
replies that follow until the chain ends.

Refs ThinkFlowLab#379
A message waiting behind the running reply showed its position but offered
no way to take it back, and a queue left behind by a failure or a restart
had no way to start again without retyping it.

A queued bubble now carries Withdraw, which removes it from the thread
under the same lock the chain takes when it picks the next message up. A
queue with nothing draining it shows a banner with the count and Continue,
which starts the oldest message and reads its reply from the usual stream.
A cancelled message offers Edit again, which puts it back in the composer so
it is sent deliberately rather than silently.

Refs ThinkFlowLab#379
While a reply runs the composer now offers both deliveries: Enter (or the send
button) hands the text to that reply through the runtime's own channel, and a
Queue button waits for it to end. The inserted message is shown where it was
sent, before the reply it joined.
@github-actions github-actions Bot added area:agent Agent runtime, assistant chat and tools area:canvas Canvas, nodes and direct manipulation type:feat New capability or behaviour labels Nov 19, 2026
@wtz2333
wtz2333 marked this pull request as draft November 19, 2026 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent runtime, assistant chat and tools area:canvas Canvas, nodes and direct manipulation type:feat New capability or behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant