The held trailing Enter decides on a 250 ms timer. When the event loop
stalls past that window with the next paste chunk already in stdin, the
timer ran before the chunk was read and submitted the first line alone:
- Ink: Node runs the timers phase before the poll phase, and
stdin.readableLength cannot see bytes libuv has not read yet. The flush
now hops to setImmediate (after this turn's poll) and runs only if no
read replaced keyParseState in between.
- Classic: a signal handler that interrupts the selector past its deadline
returns no events (PEP 475), so the due call_later ran before the reader.
The settle now runs two call_soon hops later, after the next selector
pass's readers. Text arriving while an Enter is held also keeps the paste
burst alive however late it is read, so the paste's own trailing Enter
stays a newline instead of submitting the joined text.
Paste detection expired BURST_END_QUIET_S after the last pasted newline,
not after input went quiet. A non-bracketed paste delivered in reads
100 ms apart, with newlines only in the first and last read, therefore
treated its trailing Enter as a scripted text+Enter and submitted (and
cleared) the multi-line draft. Any input inside the quiet window now
keeps the paste burst alive, in the classic CLI (note_text_change) and
the Ink parser (pasteBurstAt). One-write text+Enter and a lone Enter
still submit.
A kitty Enter (CSI 13 u) is not held by the parser, so text, Enter and the
next keystroke can share one React batch. The key after Enter was applied to
the submitted draft before the parent's submit response rendered: with fast
echo the forced re-sync then dropped it (`hello\e[13ux` left an empty
composer), and on the Ink path it was appended to the submitted text
(`hellox`).
Keys arriving after a submit now queue until an effect declared after the
value sync replays them, so they edit whatever draft the parent settled on:
`x` after a clearing parent, `hellox` after a parent that keeps its value.
Terminals with the kitty keyboard protocol send Enter as CSI 13 u, which is no
CR, so the burst hold does not apply: the text and the submit land in one React
batch, the parent value ends where it started and the local draft kept the
submitted text. TextInput re-syncs its draft on every submit (restores the
re-sync this PR's review round reverted).
Review round on the one-write text + Enter submit:
- Classic: the provisional newline goes in at the cursor, so settling restores
the exact pre-Enter document (text + cursor) instead of dropping the last
character. A scripted edit inside a draft now submits the whole draft.
- Ink: the decision is kept across stdin reads. A single-line read ending in CR
emits its text and holds the CR in the parser state; App's flush timer
releases it as return after BURST_END_QUIET_MS (250 ms) of no input, and any
read inside the window turns it into paste content. A CR-ending read within
250 ms of a pasted line break stays content. A paste split across reads (both
directions) no longer submits itself. The textInput submit re-sync is no
longer needed (text and return land in separate batches) and is reverted.
- Tests: injected clock (cli_enter_burst.monotonic, also read by
_tui_on_text_changed); the single-write test proves the delayed callback
path; new mid-draft and split-read cases.
Scripted drivers deliver the text and its Enter in ONE read (`tmux send-keys
'text' Enter`, a PTY write of `text\r`). The classic CLI's #10994 guard treats
every Enter within 50 ms of a buffer change as a pasted newline, so the burst
never submitted; the Ink TUI routed the CR-carrying token through the paste path
and dropped it.
Classic: an Enter with more keys of the same read queued, or the tail Enter of a
burst that already held one, stays a newline (unbracketed multi-line paste is
unchanged). The lone Enter that ends a burst inserts a provisional newline and
submits once input stays quiet for 250 ms; input in that window (a paste split
across reads) keeps the newline. New sibling hermes_cli/cli_enter_burst.py.
Ink: a single-line text token ending in CR peels the CR into its own return key;
multi-line tokens keep it as paste content. TextInput re-syncs its local draft on
every submit, since text + submit in one React batch left the parent value
unchanged and the submitted text stuck in the composer.
Review follow-ups on #145566:
- Policy checkpoint: turn.deferred receipts (explicit user retries) are bounded on
their own, so a discussion configured to its full max_rounds no longer stalls when
a deferred turn is retried while it runs.
- Both routes run a member's file preparation through prepare_before_submit: a file
the member can never take (over gateway.max_inbound_media_bytes, unbound, expired)
settles the turn as failed; a transient failure is proven not admitted and is
requeued with backoff. Neither pauses the room as uncertain execution.
- Ink TUI: the backends' "not available on this Hermes backend" answer is no longer
read as version skew; it renders a translated methodUnavailable line. The
invalid-params skew warning and older backends' bare wording are unchanged.
Refs #144648 (WA-20)
Rows the gateway bills to a subscription the account holds (billing_mode:
subscription) keep their free usage level, so a full allowance never dims
them, but the pickers no longer label them "Free": that subscription pays.
The ids ride on plan_usage.subscription_model_ids for Desktop/TUI; CLI and
messaging pickers use usage_tag_levels().
Review finding F1: the channel re-delivers session.resume's open_requests before the reply resolves, but resumeById / activateLiveSession then reset the screen, so a multi-question clarify form vanished while the owner kept waiting. hydrateSharedPrompts, which both callers run after the reset and before settleAttach, now delivers open_requests again under the same request id, so a held request.cancel still closes it.
Refs #143547
The gateway advertises clarify-batch-v1 and the Ink TUI declares clarify_batch
on real prompts when the owner advertises it.
Row TUI-29.
Refs #143547
Co-authored-by: Khwan888 <148256154+Khwan888@users.noreply.github.com>
A plugin that rewrites the final reply with transform_llm_output had its
rewrite stored, but the TUI and desktop app kept showing the raw streamed
reply. A streamed local-viewer turn counts as delivered by the event
stream, so the turn handler returns None and message.complete went out
with text: null next to response_transformed: true. The completion frame
now carries the rewritten final when the stream could not.
The Ink TUI also flushed the raw streamed tail as its own segment before
appending the final, so even with the text present it showed both. A
response_transformed completion now replaces the streamed tail.
A local session never sends a different key than it started with (#139615).
When the config.yaml secret on its route changes and the backend restarts,
every turn and model pick on that chat is refused with
launch_credentials_unavailable. That policy is unchanged. The copy was the bug:
- Turn (every surface): the refusal escaped TurnRunner.run_sync as an
exception into the generic agent-error handler, so the reply read
"Something went wrong ... launch_credentials_unavailable (...). Use /retry
to try again" plus a false "Some actions may already have run" notice.
/retry can never succeed here. run_sync now settles it like the gone-folder
refusal: a failed, never-run turn (api_calls 0) whose text says the key the
chat started with changed, that /retry fails the same way, and that /new
starts a chat on the current key; stamped failure_reason
launch_credentials_unavailable, failure_retryable false. The generic handler
path (a refusal raised later in the turn) uses the same copy and stamp.
- agent/error_surface maps the code to the gateway layer (no Switch provider).
- Desktop: an error card for the code (Start new session, no Retry), and the
model-menu/model-option toast (#143133) shows the card's sentence with a
Start new session button instead of the raw code.
- TUI: describeRpcError rewrites the bare code (model pick refusal) to the
same remedy.
- Classic CLI: refusal_text (/compress, /worktree) and a refused /model print
the remedy instead of the bare code; --api-key on resume that does not match
now says a session never switches keys and to start a new one.
Copy: gateway.errors.launch_credentials_unavailable in all 17 locales,
userMessages.rpc.launchCredentialsChanged in all TUI catalogs, the Desktop
card in all 9 catalogs carrying error codes. The over-cap de/es/fr/ja/zh
Desktop catalogs move their refusal card rows into <lang>_error_codes.ts
siblings (the ru shape), so each shrinks while gaining the entry.
Refs #143133 (its raw toast; the reporter's trigger without a config change is not root-caused here)
A restored or migrated pending-input queue sorts by createdAt. useQueue made
createdAt strictly increasing only within one session's queue, so an input
queued on the old session and one queued on its successor in the same
millisecond tied, and a resume that merged the two queues ordered them by
their random submission UUIDs (readdir order). That is the intermittent
pendingMigrationRenderer red on CI (waiting / already next swapped).
createdAt now comes from one process-wide monotonic clock, so every queue's
inputs stay strictly ordered across sessions.
browser_exec is the only core browser path, so there is no Browser Use /
built-in tools switch to flip and no silent downgrade to announce.
- classic CLI, Ink TUI and the gateway browser.manage RPC lose the `use`
action (contract regenerated: BrowserAction, enabled, browser_use);
- /browser status no longer reports a mode; the Chromium-fallback line for
Lightpanda and the dead "chrome" engine row go with the built-in tools;
- browser_backend_notice leaves the session snapshot, the CLI banner and
the canonical contract.
TUI locale packs and _keys.tui.json drop the five slashCmd.ops.browser
keys whose only caller was `/browser use`.
Resolves hermes_cli/auth_model_picker.py against 7a8569baa9 (the picker
takes a title, public as prompt_model_selection): keeps this branch's
description_lines()/menu_title() split, with menu_title(title=...) and the
title= parameter on _prompt_model_selection carried over from main.
Greptile: "Recovery retries another chat". After accepting the limit
card, the user could open another chat while session.mutate was pending;
switchCanonicalModel skipped /model's stale checks, painted the result
into the newly active chat and called /retry, which reads the current
sid and so rewound and resent the other chat's last prompt.
switchCanonicalModel now reuses /model's guards: the mutation is fenced
on the refused chat's sid (stale after the CAS read and after the reply),
and isSupersededControl (now taking the baseline info) drops a reply an
epoch change or newer turn superseded. A stale reply applies nothing and
does not /retry. The legacy config.set path gets the same sid check.
Greptile: "TUI model recovery is rejected". On a canonical connection the
owner's busy_config (gateway/session_busy_controls.py) refuses config.set
key=model with use_session_mutation_model, so the usage-limit card's
"switch to <model>" printed an error and never re-sent.
On canonical connections the card now uses the same revision-fenced,
session-scoped session.mutate operation=model path as /model
(switchCanonicalModel in canonicalSessionControls.ts, sharing
applyModelResult and the guarded-target confirmation). /retry runs only
once the switch committed; a refusal, a declined ask or a pick deferred
behind a running turn does not re-send. Standalone backends keep the
legacy config.set call.
Latest 4.1.x patch: mocker hardening for manual and redirect mocks
(vitest-dev/vitest#11580 backport to v4). Also bumps @vitest/mocker.
vitest 4.1.12 is 7 days old, below the min-release-age=14d guard, so
.npmrc gains a dated exclude entry (remove when > 2wks old).
A live agent's 'rejected' can follow delivery: Codex turn/steer returns
False on an ACK timeout even when the server already consumed the steer.
The TUI read every same-generation 'rejected' as "never delivered" and
re-sent the words as prompt.submit, so the correction could run twice.
correct() now marks the no-agent refusal with delivered: False (declared
on CanonicalCorrectionAck, contracts regenerated). The TUI re-admits only
that reply plus the three pre-agent error reasons; a plain 'rejected'
settles as refused with the input retained, as on main. The salvaged
gateway tests are trimmed to the no-agent case plus a live-agent refusal
that must carry no marker.
The TUI journal kept a refused session.redirect / session.steer with its
controlMethod and the finished turn's execution_generation, so every
retry was refused again ("queued (N)" forever, never delivered).
A refusal the owner raises before any agent sees the text
(stale_generation, execution_not_ready, unsupported_control) or a
'rejected' reply for that generation now clears the control fields and
re-submits the same row as prompt.submit with its existing submission_id
(queued behind any running turn; the owner's admission dedupes a repeat).
Transport failures stay ambiguous and keep the retain semantics, since a
correction that may already be inside the turn must not be delivered twice.
Fixes#141511
The TUI's config poll re-sent `reload.mcp` for an unacknowledged revision on every 5 s tick. With
one MCP server parked after a gateway restart the gateway refused each one, so every open TUI
produced a WARNING and a full reconcile every 5 s forever (1,897 lines in 52 min with three TUIs).
The salvaged gateway change answers a reload naming the held revision as success; this is the
client half for the reloads that are still refused: the same revision now retries after a doubling
backoff capped at 5 minutes, and a new revision retries at once.
Refs #141769
The release carried an end_reason (cli_close, tui_close), which made the
owner run its viewer close: the session's async delegations were
interrupted, its route refused new ones until a viewer attached again, and
the session ended at idle. On a messaging chat refused with session_busy
that fenced the live chat. The release is now a plain session.detach keyed
by the id the read resolved to, skipped when this viewer already held it
(the shape #141498 introduced).
Refs #134889 (TUI-19)
Carried from #141498 (Teknium), adapted to this branch's clients: the classic
CLI and the Ink picker release the delete's read with a plain detach under
snapshot.session_id, and never release a session this viewer already watches.
Refs #134889 (TUI-19)
The pending-delete guard read React state, which lands on the next render. One
stdin chunk can carry the confirming key and a click on the same row, and the
click then resumed the row the delete was about to hand back. A ref set before
the delete starts now guards keys and clicks.
Refs #134889 (TUI-19)
Keys are held while the picker deletes a row, but a click still resumed it. The
resume shares the delete's revision read attachment (one per viewer), so a
refused delete then detached the session the user had just opened. Row clicks
are ignored until the delete settles, as keys are.
Refs #134889 (TUI-19)
Deleting a stored session reads its revision and generation through
session.resume, which attaches the deleting view. When the owner refused
the delete (stale revision, busy, read-only grant) nothing detached it, so
the closed session sat in the live section until the client exited. Before
the shared gateway the picker deleted with no attach at all.
On a refusal the Ink picker and the classic CLI's gateway session store now
detach the subscription that read made, with the client's close stamp
(tui_close, cli_close). A session the classic CLI was already viewing keeps
its attachment.
Refs #134889 (TUI-19)
A refused session.mutate delete keeps the viewer that session.resume
attached for the revision read, so the closed session returns to the live
list. One test per client: the Ink picker and the classic CLI's gateway
session store. A second classic case pins that a session this CLI is still
viewing keeps its attachment.
Refs #134889 (TUI-19)
Resolves the hermes_cli/cli_tui_mixin.py conflict from #141501 landing: main moved _Panel to
hermes_cli/cli_panel.py and this branch moved the wrap helpers to hermes_cli/cli_tui_wrap.py.
Keep both moves: import _Panel and the wrap helpers, define neither here.
Refs #134889 (N8)
In Ink's interrupt and steer busy modes, text typed during a running turn
goes to session.redirect / session.steer, not prompt.submit. The typed
stop-phrase check only ran in prompt.submit, so a bare "stop" in a LOCAL
voice chat reached the running agent and voice chat stayed on.
The owner's correct() now makes the same _typed_voice_stop decision (attached
submitter, LOCAL session, voice on, bare stop phrase) after authorization and
before the generation fence, and answers {voice_stopped: true}. The canonical
CanonicalCorrectionResult becomes Ack | CanonicalVoiceStopped (generated TS
and OpenRPC regenerated); the dispatch test proves it through the real
contract parse.
Every client settles that reply instead of treating it as a refusal that
re-sends the text as a prompt (which would admit "stop" as a turn):
- Ink: settleControlReply renders the stop-phrase event and settles the
item; the running turn's busy state is untouched.
- Desktop: redirectPrompt drops the optimistic bubble and reports accepted,
so the composer does not re-queue it.
- ACP: /steer reports the stop-phrase notice and does not send a prompt.
Greptile review on #141508.
Refs #134889 (TUI-26)
In queue mode a bare "stop" typed during a long voice turn goes out with
behindTurn. The owner ends the voice chat and answers {voice_stopped: true},
but the reply handler cleared busy and set status ready for the focused
session. The agent turn was still running, so the next input could take
beginOwnedTurn and wipe the live stream buffer.
The reply now releases only the latch this submission took (ownsTurn()), so
a behind-turn stop leaves the running turn's busy and status alone.
Greptile review on #141508.
Refs #134889 (TUI-26)