Chat: edit a queued prompt before its turn starts (#557) #564
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #564"
general
weight: 0.35
Giton22
What and why
A typo in a queued prompt couldn't be fixed. The only way to change one was to wait for it to run, then rewind. Now a queued prompt has Edit: long-press it on a phone, or use the pencil or right-click on desktop. Edit puts the prompt in the composer under an "Editing a queued message" banner, and Send changes it in the queue. Cancel leaves it as it was.
The gateway holds the queue, and Kyllene sends a queued prompt at once, so the edit is a gateway call:
prompt.replace_queued. Like Hermes, it moves the edited prompt to the back of the queue. The banner says so.If the prompt's turn starts while you are editing, the prompt runs as it was. Your edit stays in the composer with a notice, so you can send it as a new message. This applies whether the turn starts before you tap Send (Kyllene sees
message.startfor that admission) or while the call is in flight (the gateway answersadmission_started).closes #557
Gateway
prompt.replace_queuedin hermes-agentgateway/session_queued_controls.py. It is on the session authority only, from v0.22.3. Kyllene sends exactlysession_id,admission_id,submission_idandtext, and no optional keys.- The gateway cancels the old admission and admits the edit as a new one at the back of the FIFO.
- An exact retry with the same
submission_idis idempotent.pending(fromsession.infoand thesession.resumesnapshot) lists"replace"incontrols. Owners older than the verb list no controls, so they get no Edit and no call.-
-32601orunsupported_control: Edit is hidden for that prompt and the user sees an "Update Hermes" error.-
admission_startedornot_found: the "turn already started" path.- Anything else: an error, and the prompt keeps its text. On a network failure editing resumes, so Send can retry.
hermes dashboard/ tui_gateway): no version has the method, so Edit never appears and nothing new is sent. Legacy rejects unknown keys with 4000; this PR adds no params to existing calls.message.complete(outcome: "cancelled", noexecution_generation), from_settle_cancelledingateway/session_authority.py. Kyllene had treated it as the running turn ending, which split the streaming reply in two. Such a settlement is now ignored, both in the reducer and inChatSession's generation tracking.| Hermes | Mode | Edit on a queued prompt |
|---|---|---|
| v0.22.0–v0.22.2 | legacy / authority | hidden (no verb, no
controls) || v0.22.3–v0.22.5 | legacy (Kyllene can't reach a remote authority before v0.22.6) | hidden |
| v0.22.6–v0.23.4 | authority | offered |
| any | legacy | hidden |
How I tested it
-
QueuedEditTest(core, 16 tests): parsingcontrols; moving the prompt behind the last queued one; an admission that already started;message.startovertaking the edit; a cancelled settlement that ends no turn while the running turn's own completion still does.-
QueuedEditTestgateway tests with a fake gateway: the exact request keys;admission_started;unsupported_control;-32601; an authority withoutcontrols, which sends nothing; legacy, which sends nothing.-
ChatViewModelTest(4 new): edit and send; cancel; a turn that starts mid-edit; a prompt the gateway doesn't offer.- v0.22.7 and v0.23.4 authority: replace OK, with a new admission at the tail and
controls: ["steer","replace"].- An exact retry gave the same admission.
- The old admission again gave 4001
admission_started.- After its turn started, it gave
admission_started.- The queue ran first, then the edited prompt.
- v0.22.0–v0.22.2 and legacy: checked in the source; no such method.
- Long-press on a queued prompt shows Copy, Comment and Edit.
- The edit banner shows and Send stays enabled mid-turn.
- After Send, the prompt moved behind the other queued one and ran last. The running reply kept streaming, and the saved transcript has the edited text.
- The overtaken case shows the notice, and the edit stays in the composer.
- Legacy on the emulator: the test dashboard wouldn't take the test sign-in. The legacy path is covered by the unit tests above.
- The desktop UI: it builds, but I didn't run it.
- 360 dp and dark theme.
lintDebugand:desktopApp:compileKotlinJvmpassed. All tests pass exceptLinuxClientCertificatesTest, which can't run on Windows (POSIX permissions) and isn't touched here.Screenshots
All from the local test gateway and fake model.
| Edit on a queued prompt | Editing | Sent: moved to the back |
|---|---|---|
| !Long-press menu on a queued prompt: Copy, Comment, Edit | !Banner "Editing a queued message", the edited text in the composer, Send enabled mid-turn | !The edited prompt now waits behind the other queued prompt |
| Run order | Turn started mid-edit |
|---|---|
| !The queued prompt ran first, then the edited one | !Notice: its turn started before your edit went; the edit is in the composer |
Checklist
master, and the command under "Tests" in CONTRIBUTING.md passes (except the Windows-only failure above)./gradlew :desktopApp:compileKotlinJvm)Created with Claude Opus 5.5 in Claude Code.