mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4004] [GUI] Let users interject mid-turn without stopping the agent #1725
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#1725
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?
Originally created by @xvcezrqpbxtpzblrt on GitHub (Oct 24, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4004
Area
[GUI] (the desktop app)
What do you want to do?
When the agent is working for a long time (generating, thinking, or running a tool), I want to type a short correction or extra instruction and have it take effect immediately, without pressing Stop and losing the work already done.
Today the only choices are to wait for the turn to finish or to stop and start over. A message sent in the default queue mode is not delivered until the current turn ends, so a long generation or a long tool call can delay it by minutes.
What do you do today instead?
Current behaviour
The harness already has a durable inbox with two targets,
next-turnandnext-step(dsh-agent-loop/src/inbox.ts:20-24,82-95).steer()andinject()both append tonext-step(dsh-agent-loop/src/agent.ts:167-173). The inbox is claimed only in the pre-step path (agent.ts:267-288, claim at271). A pendingnext-stepitem is claimed at the next pre-step; at the end of a turn it keeps the driver in the same turn for another step (agent.ts:361-366), and the turn-stopping hook can add steering before the turn closes (dsh-agent/src/runtime-types.ts:364-381).So a message can be inserted "before the next step", but not during a step. While the model is streaming a long answer, or a tool is running, the message waits. The current cancel path aborts the whole turn (
agent.ts:175-181); it can keep the visible prefix as an interrupted assistant message (agent.ts:465-482), but it ends the turn and aborts running tools, so a tool can stop mid-operation. There is no operation that stops only the current model stream and continues the same turn with the new message.Proposed behaviour: soft interrupt
Add an "interject now" delivery mode with these semantics:
cutAfterTools, let the current tool finish, keep its result, and do not start another tool call before the new step.Why append at the end
The engine reuses a cached prefix only when the new prompt starts with exactly the cached tokens and images; checkpoints are taken at the start of each assistant turn and every 16K prompt tokens (
docs/DETAILS.md:1135-1141). Appending the interjection after the partial assistant message keeps that prefix intact, so the next request re-reads only the partial assistant text plus the new message. Inserting into the middle, or replacing an earlier message, moves the divergence point backwards and invalidates the whole suffix. A live token injection would break the prefix at the injection point.Implementation
Protocol:
delivery: "cut"to the existingmode: "steer"prompt request. The default remains"boundary", so current behaviour is unchanged.Harness (about 100 lines, inference: not measured):
cancel()already haskeepInbox(dsh-agent/src/runtime-types.ts:37-45); add aresumeAfterAbort-style soft path that aborts only the current attempt.interject(message)appends tonext-step, aborts the attempt signal while streaming, and setscutAfterToolswhile a tool is running.assistant/message { interrupted: true }, drop reasoning and tool-call blocks, append a short developer note, and return to the step loop. Becausenext-stepis non-empty, the driver runs another step instead of closing the turn (agent.ts:361-366).UI:
delivery: "cut".Edge cases
keepInbox.Acceptance criteria
These are targets, not measurements.
Alternatives considered
Scope
Harness, host, and UI. The engine needs no change for this proposal (inference: not measured). The change is additive and opt-in through the new delivery mode; the default path is untouched. The estimate of about 100 harness lines is an inference, not a measurement.
@Niko1221 commented on GitHub (Oct 27, 2026):
Thank you, a clear request. In 0.2.7 the web chat page has the setting "When you send while it is answering": Wait (the default), Send after, or Interrupt. Interrupt stops the stream, keeps the text written so far (marked as interrupted), waits for a running tool, then sends. One waiting message at a time; Take back removes it.
Release: https://github.com/Niko1221/Strata/releases/tag/v0.2.7
@vittorioromeo commented on GitHub (Oct 28, 2026):
@Niko1221 I am not able to find this setting in the Windows desktop app, where is it located?
@xvcezrqpbxtpzblrt commented on GitHub (Oct 31, 2026):
@vittorioromeo Answering your question, since it has had no reply: there is no such setting in the Windows desktop app. The 0.2.7 change went into the web chat page, and the desktop window loads a different UI. Checked on tag
v0.2.8:apps/host—apps/desktop/src-tauri/tauri.conf.json→build.frontendDist: "../../host/dist". Wait / Send after / Interrupt live inserve/web:index.html:297-298(the three radio buttons in the drawer) andapp.js:1102-1131(parksWhileBusy(),park(),requestCut()— it stops the answer by aborting its own request) and:1175-1184.whileBusyappears nowhere inapps/host/src, andapps/host/src/screens/Settings.tsxhas no line for it.Chat.tsx:595:streaming ? Stop : Send), and Enter bounces the text back into the box with "The assistant is still answering — Send your message when it has finished." (Chat.tsx:372-382), because/api/chat/queueanswers 409 unless a goal run is in flight (server/agent/agent-bridge.mjs:1104'queue-idle', mapped atserver/index.mjs:1912-1914).Tracked in #4783 with the references and with the pieces the desktop already owns (
/api/chat/stopatlib/store.ts:1422-1435, the queued-message cards atcomponents/PlanCard.tsx:93-97), so this looks like UI wiring rather than an engine change.