Commit Graph

283 Commits

Author SHA1 Message Date
Teknium
a4593d8d6d fix(shared): forget a session's replay epoch with the cursor it numbers
JsonRpcGatewayClient kept replayEpochBySession forever: an entry was
added for every session whose events carried a replay_epoch and never
removed, even when the authority answered `snapshot_required` and the
client dropped that session's cursor. A long-lived Desktop or TUI
socket that cycles through many sessions (Bot Chats, cron, sidebar
browsing) accumulated one entry per session ever observed.

The per-session epoch only qualifies its lastSeenSeq cursor, so the
snapshot_required path now drops both together; the re-resumed
session's next live frame re-establishes them. The process-epoch reset
already keyed its "keep canonical cursors" rule on this map, which is
unchanged for sessions that still hold a cursor.

Review: https://github.com/NousResearch/hermes-agent/pull/106742#pullrequestreview-5462648005
2026-10-08 19:09:48 -07:00
Teknium
3187905d07 fix: explicit TUI attach negotiates the canonical wire when the endpoint has an authority
HERMES_TUI_GATEWAY_URL attach returned before the canonical adapter:
isCanonical stayed false, runtime.describe was never read, and Ink sent the
legacy session.create {cols, model} without `source: tui`. A gateway-hosted
dashboard's /api/ws is authority-backed, so that create is refused. Live
probe (real gateway, fake HOME, real Ink GatewayClient with an explicit
URL): session.create -> invalid_params (fields: ['cols']).

The WS listener's ready frame now advertises `session_authority: true`
when the connection is bound to a session authority (contract + generated
TS/OpenRPC updated). On that frame the client switches the connection to
the canonical adapter exactly like a local grant: runtime.describe, then a
single client-local gateway.ready that keeps the listener's skin, and every
request goes through canonicalRequest/canonicalResult. Endpoints without an
authority (standalone dashboard / serve) advertise nothing and keep the
legacy wire. Each explicit connection renegotiates on reconnect. Probe
after: canonical=true, session.create -> a `tui`-source session.

Review: https://github.com/NousResearch/hermes-agent/pull/106742#pullrequestreview-5460639040
2026-10-08 19:09:43 -07:00
Teknium
ae2fd61c50 fix: owner refuses config.set key=model with use_session_mutation_model
The Desktop composer picker (and Ink's legacy non-canonical path) still send
config.set {key:'model', value:'<model> --provider <p> [--session]',
confirm_expensive_model?}. On the canonical authority that verb only owns
the session busy/verbose/yolo preferences, so a probe on r6-base got a bare
invalid_params (fields: key, confirm_expensive_model): the client cannot
tell "you used the wrong verb" from a malformed value.

A model pick on the owner is session.mutate operation=model: revision
fenced, retry idempotent and now selection-guarded. Mapping config.set onto
it would need a revision/generation/request_id the legacy shape does not
carry, so the authority does not translate it; it refuses it with the
actionable reason use_session_mutation_model before authorization or any
read, writing and deferring nothing. The canonical contract names the key
(and the picker's confirm_expensive_model flag) so the refusal is the
handler's, not a schema rejection; generated TS/OpenRPC regenerated.

Existing tests pinned the old bare invalid_params for this exact request;
they now assert the specific reason (the request is still refused, only the
reason became actionable), plus the picker's full legacy shape.

Review: https://github.com/NousResearch/hermes-agent/pull/106742#issuecomment-6067585232
2026-10-08 19:09:35 -07:00
Teknium
b6c58a7254 fix(cli): store finite -q / -z gateway runs as oneshot
On main, HERMES_SINGLE_QUERY_SESSION made agent/session_source.py label finite
non-interactive runs `oneshot`, which keeps scripted `hermes chat -q`, `-Q`,
`--oneshot` and `hermes -z` runs out of the TUI, Desktop and dashboard
pickers while `hermes -c` / `sessions list` still see them (sessions.md).
Through the gateway the client always created `source='cli'`, and the owner
did not accept `oneshot`, so every scripted run surfaced as a resumable chat.

- The client creates finite runs (the same `oneshot` predicate the view uses
  to wait for one admission) with `source='oneshot'`; an explicit `--source`
  still wins, and a gateway that does not advertise `oneshot` gets `cli`.
- The owner maps `oneshot` to the CLI surface (SURFACES, create contract,
  generated TS/OpenRPC); the frozen label survives the per-turn peer refresh
  (previous commit), so the row stays `oneshot`.
- Every owner-side picker path skips it: session.list (previous commit, via
  INTERNAL_LISTING_SOURCES) and the profiles.list `last_session` roster
  preview. Desktop's sidebar (SIDEBAR_EXCLUDED_SOURCES) and the dashboard /
  console / TUI listings already exclude `oneshot` and now see it.
- Managed workers / worker delegation treat `oneshot` as a CLI session.

Live: real `hermes chat -q` and `hermes -z` through a fake-home gateway and a
loopback stub are stored as `oneshot` in state.db and absent from
session.list, the console filter and the Desktop sidebar filter;
`chat -q --source tui` (an explicit label) stays visible.

Review: https://github.com/NousResearch/hermes-agent/pull/106742#pullrequestreview-5456384314
2026-10-08 09:10:49 -07:00
Teknium
5a5e1570ae fix(gateway): accept hermes chat --source tool and keep the label stored
`hermes chat -q --source tool` exited 1 with "Gateway does not support source
'tool'": runtime.describe advertised only cli/tui/gui/acp, and build_policy
refused any other label. The parser help and sessions.md still document
`--source tool` for third-party integrations, which main stored as `tool` and
kept out of every human session picker.

- session_policy.SURFACES maps `tool` to the CLI surface; describe now
  advertises SURFACES, and the canonical create contract (+ generated TS /
  OpenRPC) admits it.
- The per-turn peer refresh (`_record_gateway_session_peer` ->
  session_a2a.storage_source) rewrote every LOCAL row's source to the transport
  name `local`, so even a frozen `tool` (or cron / kanban / bot_room) label
  was lost after the first turn. Producer labels from the frozen receipt now
  survive; interactive cli/tui/gui/acp rows keep `local` as before.
- session.list (TUI switcher feed) skips INTERNAL_LISTING_SOURCES, like the
  TUI/console/dashboard listings on main.
- `tool` sessions behave as CLI ones elsewhere: managed-worker opt-in checks
  the CLI platform, the worker builds a `cli` agent, worker delegation accepts
  the row.

Live: real `hermes chat -q --source tool` through a fake-home gateway and a
loopback stub now exits 0 and state.db stores `tool`; the row is absent from
session.list and the console/Desktop-sidebar filters.

Review: https://github.com/NousResearch/hermes-agent/pull/106742#pullrequestreview-5456384314
2026-10-08 09:10:47 -07:00
Teknium
2ee1cd1ebb fix(gateway): accept -s/--checkpoints/--pass-session-id/--accept-hooks as session creation policy
These four launch options had no working path on the canonical gateway. Classic
`hermes chat` refused them and pointed users at `hermes --tui ...`. The Ink TUI sent
them in session.create, but CREATE_FIELDS rejected them (4001 invalid_params at the
canonical contract), and canonicalRequest threw before the session existed.
localCreationOptions read the documented, exported HERMES_ACCEPT_HOOKS=1, so with
that variable set no TUI session could be created at all. HERMES_TUI_PASS_SESSION_ID
was read by nothing and was silently dropped. On main the in-process TUI gateway and
cli.py applied all four, and tests/hermes_cli/test_cli_preloaded_skills.py covered
the -s preload. That test was deleted on the branch with no replacement.

All four options are now creation fields of the session that names them, applied
by the owner:

- skills: rendered once with build_preloaded_skills_prompt (off the owner loop,
  only for a new session; a retried request_id resumes the frozen route) and stored
  in the frozen LocalSessionPolicy.skills_prompt. The in-process turn appends it to
  the ephemeral prompt and the managed worker passes it as ephemeral_system_prompt,
  matching the CLI/TUI startup preload. A typo among good names is logged and
  skipped, as on main. When no name resolves, creation is refused with unknown_skill.
  A bypass (--safe-mode / --ignore-user-config) launch refuses -s because it must
  not read the profile.
- checkpoints: folded into the frozen config's checkpoints.enabled, which the
  in-process agent already reads through _checkpoint_agent_kwargs(policy config).
  The managed worker now passes it too.
- pass_session_id: frozen in the request and passed to AIAgent (in-process and
  managed), so "Session ID: <id>" rides the system prompt.
- accept_hooks: consents to the profile's configured shell hooks (per-user
  allowlist, off-loop) and registers them on the owner, like the in-process
  --accept-hooks. It is a no-op on a bypass launch, so an exported
  HERMES_ACCEPT_HOOKS=1 cannot brick --safe-mode.

Classic `hermes chat` is a gateway client too: it forwards the same fields, plus
HERMES_ACCEPT_HOOKS=1 when that variable is exported, instead of refusing them.
The Ink TUI maps HERMES_TUI_SKILLS to a list and the flags to booleans, and the
pipe bootstrap stops leaking HERMES_TUI_CHECKPOINTS/HERMES_TUI_PASS_SESSION_ID into a
spawned daemon. The canonical contract (CanonicalCreateParams plus the generated
TS/OpenRPC) advertises the new fields.

Live proof: a real `python -m gateway.run` daemon on a fake home, a real WS
session.create per field, the real Ink mapping via tsx with HERMES_ACCEPT_HOOKS=1
exported, and a real turn against a loopback model. The skill body and
"Session ID: <id>" reach the model's system prompt, a write snapshots into the
checkpoint store (no snapshot without the flag), and the hook command lands in
the allowlist. A real `hermes chat -Q -q ... -s X --checkpoints --pass-session-id
--accept-hooks` exits 0 with the skill in its prompt. On the base, all of these
were refused with invalid_params, Ink threw, and classic chat exited 2.

Review: https://github.com/NousResearch/hermes-agent/pull/106742#pullrequestreview-5456384314
2026-10-08 09:10:37 -07:00
David Dudok de Wit
4d959d8726 fix(gateway): validate canonical shared-method wire contracts
Canonical RPC names shared with standalone serve currently inherit incompatible parameter/result models. Declare transport-specific overrides, validate successful canonical replies, and regenerate the separate canonical catalogs without widening the legacy wire.

Validation: seven canonical/gateway/generated-contract suites (20 passed); shared TypeScript typecheck passed. Tested directly on 0b815190 with this fix alone.

Reported-by: greptile-apps[bot] (https://github.com/NousResearch/hermes-agent/pull/106742#issuecomment-6041818267)
(cherry picked from commit 5683290e0b1984e48ef5fe7a1dad9754f6787b6f)
2026-10-08 09:10:26 -07:00
Teknium
302894a2cd Merge origin/main (#25: 63 commits to 8f463316fd) into feat/unified-gateway-runtime
Conflicts (dacb06ea93 on_session_finalize messages):
- gateway/run_shutdown.py: both imports (managed-turn shutdown + GatewaySessionEndMixin).
- ui-tui useSessionLifecycle: main's deferred finalize messages kept; the branch's rule that a
  canonical (gateway-owned) session is detached, never closed, still gates session.close.
2026-10-08 04:19:43 -07:00
teknium1
dacb06ea93 feat(plugins): show on_session_finalize return messages to the user
A plugin's on_session_finalize hook can now return a str or {"message": str}
and Hermes shows it at the session boundary without starting a turn or
rewriting the model reply:

- CLI /new: printed before the new session; CLI quit: printed above the
  exit summary; one-shot -q/-z: printed to stderr (stdout stays the answer)
- TUI: session.close returns the messages; /new shows them as system lines
- Gateway /new and shutdown: sent to the owning chat via the adapter, while
  adapters are still connected

on_session_end stays observer-only: it fires after every turn, not at a
session boundary. Gateway finalize dispatch moves to
gateway/run_shutdown_session_end.py.
2026-10-08 04:11:24 -07:00
Teknium
a03c71c31a fix(gateway): canonical RPCs are declared in the generated wire contract
The session authority's dispatcher (gateway/session_controls.py::AuthorityConnection.dispatch)
answered twenty verbs that had no declaration in tui_gateway/contracts and no type in the
generated TypeScript/OpenRPC: session.mutate, session.info, session.detach, runtime.describe,
prompt.receipt / cancel / resolve_unknown, clarify.respond, cron.submit/status/cancel/recover,
kanban.run, a2a.forward, worker.register/adopt/persist and groups.discard /
groups.attachment.upload / download. Their param sets lived only in handwritten set(params)
checks (some handlers only .get() their keys, so a misspelled key was silently ignored) and every
client (Desktop canonical-protocol.ts, Ink canonicalGateway/useQueue, hermes chat, ACP, cron,
kanban, managed workers) hand-copied the shape: a second, unchecked contract.

- contracts/canonical.py declares Params + Result models for every canonical-only verb through a
  new registry table, CANONICAL_METHODS (canonical_method()). It is a sibling of METHODS because
  METHODS is held 1:1 against the sidecar's register_method table; a name both dispatchers serve
  keeps its single METHODS entry, and a name cannot be declared in both.
- scripts/gen_gateway_contracts.py renders the table as CanonicalRpcMethods /
  CANONICAL_RPC_METHODS in gateway-contract.generated.ts and x-canonical-methods in the OpenRPC
  document (regenerated; RpcMethods is unchanged, so no consumer type moves).
- dispatch() checks a declared verb's params against its model before the handler runs: an
  unknown or missing key is the same 4001 invalid_params it already returned, now with the
  offending field paths. Value checks stay in the handlers (their domain reasons are unchanged);
  the existing set() checks are kept. The handler table moved verbatim into
  AuthorityConnection.handlers() so the coverage invariant reads the real table.
- tests/gateway/test_canonical_wire_contract.py: every name a real AuthorityConnection serves is
  declared (METHODS or CANONICAL_METHODS) and no canonical declaration is orphaned; unknown and
  missing keys are refused before the handler with the field named, a well-formed mutate still
  commits and matches its declared result.

Review: https://github.com/NousResearch/hermes-agent/pull/106742#discussion_r4209144926
2026-10-07 23:44:55 -07:00
Teknium
b09c202d9e Merge origin/main (#21: 191 commits to e675225af2) into feat/unified-gateway-runtime
Brings #134209 onboarding (setup chat, /initiate-setup, setup_choose/start_chat cards) and
889eddcd86 (/yolo survives a gateway restart).

Conflicts (6):
- gateway/run_turn.py, tui_gateway/server.py: the branch moved these blocks into siblings;
  main's edits ported there (run_turn_prepare: first-contact `message`/setup_command, the
  _restore_session_yolo call after _hmwa_open_session; agent_factory: coding_selection
  session-platform toolsets, setup_choose/start_chat lifecycle tools; session_registry:
  _lazy_resume_info default route).
- tests/gateway/test_yolo_command.py: both tests kept.
- Desktop composer submit / slash / wiring: main's parked-card answering and submitWhileBusy
  with the branch's busy-input policy in its steer branch; slash `hidden` folds into the
  prepared-submission journal; wiring keeps main's onboarding chain without the removed pool.

Semantic fixes:
- gateway/session_busy_controls.yolo_config writes main's persisted SessionEntry.yolo before
  the live flag, so an owner `/yolo` OFF is not revived by _restore_session_yolo next turn
  (new test test_owner_yolo_off_is_not_revived_by_the_persisted_restore).
- wiring runKickoffSlash awaits the branch's Promise<boolean> slash dispatcher.
- de/es/fr/ja/zh-hant: translate the branch's composer keys main's overlay-completeness test
  now requires.
2026-10-07 17:09:40 -07:00
Teknium
811f134a59 refactor(shared): extract replay epoch adoption from fetchSessionReplay
Clears code-health CC finding: JsonRpcGatewayClient.fetchSessionReplay (23,
main 17) via applyReplayEpochs.

Pure extraction, no behaviour change.

(cherry picked from commit 0a47820a53ee707e11f29b812d40379117f1c7e3)
2026-10-07 10:57:35 -07:00
alt-glitch
2c8df45ee5 Merge remote-tracking branch 'origin/main' into sid/onboarding
# Conflicts:
#	agent/conversation_loop.py
#	tui_gateway/prompt_turn.py
2026-10-07 19:29:35 +05:30
Teknium
ca38632fc0 Merge origin/main (#17: 454 commits to e6757f2029) into feat/unified-gateway-runtime
12 conflicted files, resolved in three lanes:
- gateway/run.py: take the branch split; main's tirith removal and spool-replay
  ordering ported into run_runtime_init.py / run_bootstrap.py.
- config migrations: main keeps v50 (tirith); the branch's bot-chat timeout removal
  becomes v51 (_config_version 51, template + test updated).
- hermes_state_usage.py: main's voice_chat task route threaded through the branch's
  owner transaction; worker.persist usage allowlist accepts task.
- tui_gateway/server.py: branch side; main's edits applied where the code now lives
  (agent_factory, session_registry). Desktop sessions get the catalog toolset on the
  authority path; daemon-run finite CLI turns are not watched turns; lazy session info
  reports nous/welcome on the free tier.
- Desktop/Ink: one branch-child spinner fix (main's route-token check); main's
  uninstall i18n keys kept, pool keys stay removed; voice_turn forwarded and accepted
  by the authority submit (surface_v1.voice_turn).
- chat_ws / PTY keepalive test: main's stricter test kept.
2026-10-07 06:48:09 -07:00
Teknium
933adf2d9f fix(gateway): the turn receipt names every user row and the authority's submission
Main binds an optimistic prompt to its stored row from the prompt.submit ack
(`user_row_id`). The session authority acknowledges a queued admission before
the user row exists, and a steer/redirect writes its user row mid-turn, so no
ack can name them; the completion receipt named only the first user row and
only `complete` receipts (one user row) were usable. Steered turns therefore
never bound their bubbles, and once replies were row-keyed a later stored-page
read painted each prompt twice (core e2e relay-managed-steer and
reply-settle-paths "steer" red in both full-suite runs on the prior head).

PersistedTurn gains two optional fields (contract + regenerated TS/OpenRPC):
- `user_row_ids`: every rendered user row of the turn in order, published only
  when all of them committed (a gap would shift every later pairing);
- `submission_id`: set by the session authority from the admission's
  request_id, so the sending viewer finds its own `user-<submission_id>` bubble.
2026-10-07 03:46:20 -07:00
Teknium
6cc1efd8f9 feat(voice): auxiliary.voice_chat routes spoken voice turns to their own model
Voice replies had to come from the session's main model, so a heavy model made every spoken
answer slow (#83894). A new auxiliary slot, voice_chat, picks the model for voice turns:

- CLI/TUI voice mode, the Desktop voice conversation (prompt.submit voice_turn) and messaging
  voice notes mark the turn; agent/voice_turn_route.py binds the route after the prompt, row and
  preflight compaction were settled against the main model and undoes it before memory sync and
  background review, so the next typed turn and the review run on the main model.
- A turn larger than the voice model's compression threshold stays on the main model with a
  one-time notice: switching to voice never compacts the conversation.
- Usage lands in session_model_usage under task voice_chat; it never rewrites the session's
  recorded model/route, so resume keeps the model the user picked.
- Slot appears in Desktop Settings -> Models, the dashboard, and `hermes model`; GPT-Live
  delegations keep using the session model.
2026-10-07 01:35:11 -07:00
alt-glitch
995bc1c0e7 feat(free-tier): offer sign-in after finished tasks, backing off
A free-tier user is offered sign-in 3 minutes after their first finished
task, whether or not they send another prompt. Later offers each need
another finished task after the previous one, come 3 minutes after that
task, and never sooner than 1h, 4h, then 24h after the previous offer, so
a user who keeps saying "Not now" hears it less often.

- hermes_cli/free_tier_offer.py: the policy. One install-wide record
  (<default root>/free_tier/sign_in_offer.json, file lock + atomic write);
  claim_offer() is compare-and-set so two windows never both show it.
  Nothing is due off the free tier.
- tui_gateway/free_tier_task_done.py: a "finished task" is a completed
  turn with a reply, on the free-tier agent, not a crash resume, and with
  no steer/redirect/interrupt/busy-typing while it ran. Called from
  prompt_turn after a complete turn, before message.complete goes out, so
  a status read prompted by that event already sees the record. Intervention is reported by the agent
  (result["user_intervened"], reset per turn) and marked on the session by
  the steer/redirect/interrupt RPCs and busy submits.
- Wire: free_tier.status gains nudge_due_in (seconds, 0 = now, absent when
  none is pending); new free_tier.claim_nudge -> {claimed}.
2026-10-07 12:26:42 +05:30
alt-glitch
cfc17affe8 refactor(onboarding): drop profiles.remember_onboarding
The old renderer handoff was the RPC's only caller; the setup flow hands
off through start_chat and writes no memory. Removes the writer module,
the handler and its contract models; the TypeScript contract is
regenerated.
2026-10-07 11:38:21 +05:30
alt-glitch
8b89b68fb4 Merge origin/main into sid/onboarding
Brings the onboarding branch up to main 0c2ff854a5. Where a Wave A PR
already landed a reviewed version of a piece of this branch (free tier
#134049, keyless web #134048, app resolver #134050, bundle and uninstall
#134051, catalog card and toolsets #134052, built-in tour #134054, stdin
guard #134055, retired key #126146), main's version wins. The PM long-path
files also take main's version: that work lands through #130430.

Kept from the branch on top of main:
- the setup and start_chat toolsets, declared with main's platforms key
  (desktop only), and the setup_choose server request contract;
- the setup-profile marker file (.setup-profile.json) instead of the
  profile.yaml role, as c3f85bc54f decided;
- the first-contact note's message argument beside main's internal flag;
- the setup-profile gate on the shared-metrics consent dialog;
- window sizing (window-growth) in place of chat-onboarding-window.

Desktop i18n follows main's per-section sibling files. The onboarding
strings go into them (modelMenu.localSetup, handoffTour.localTitle and
localText) and setupChoose/startChat stay in en.ts. guidedGreeting is
gone. The shared-metrics copy uses the branch's rewrite in English, with
the pre-opt-in sentence corrected for the fresh-install note
(d3674513c8); locales keep main's translations, with installId and
consentWindow folded into the new sending key.

The built-in tour reads local-model eligibility from the local-setup
offer store, the one place that rule lives on this branch. The gateway
contract and the onboarding skill docs pages are regenerated.
2026-10-07 03:27:01 +05:30
alt-glitch
1590669243 onboarding: leave MEDIA and the Store bundle env out of this PR
MEDIA (2f1fabd4bf, the backend MEDIA: parser and attachment parts) is
deferred to its own PR. Its 53 MEDIA-only files go back to the merge-base,
so they take main's version; the 10 files it shares with onboarding keep only
their onboarding hunks (setup_choose and start_chat cards, the start_chat
contracts, the scripted prelude, the first-contact note, the local-setup
turn report, intro_resends, visible_text, the bigger chat headings). The
generated gateway contract is regenerated after the merge with main.

The Store variant's HERMES_GUEST_ONBOARDING bundle env (39af862aec) is
reverted here; it ships through Ari's bundle work.
2026-10-07 03:07:33 +05:30
Teknium
1e500ebce2 Merge origin/main (#16: 4,465 commits to 9dcab1e440) into feat/unified-gateway-runtime
99 conflicted files resolved in nine area lanes (Desktop composer, Desktop renderer/shared
client, Electron main, Ink, tui_gateway, gateway, state, CLI/config, cron/tools/CI). The
unified runtime's architecture wins where it deliberately replaced a mechanism (pool,
fallback lanes, claim poller, renderer queue); every orthogonal main change is kept, ported
into the <stem>_<topic> sibling that now owns relocated code.

Notable ports and repairs in this merge:
- tui_gateway/server.py relocated regions: atomic _attach_built_agent (#49852), slash ranking
  registry names, minted-key helpers methods_session.py calls, request_overrides, service tier.
- gateway/run_turn*.py: i18n accessors for the removed reply constants, first-contact
  internal/DM rule, rotated-compression persist, fast-mode tiers, prompt-pin rehydration.
- webhook: route_from_chat_id decodes main's opaque webhook:v2 chat ids (old ids still read).
- ws.py: main's per-connection dispatch queue with authority-first dispatch inside it.
- state: schema event for runtime revision renumbered to 31; worker mirrors updated for
  main's message uid/merge fields, on_contended lease arg, compression columns.
- config: branch's bot_chat_delivery_timeout removal renumbered v47 -> v50.
- Electron: primary-profile pin, redirect header scoping, remote fetchJsonForBackend, SSH
  teardown on profile delete, held-update dial gate restored (lost in earlier merges).
- Desktop: canonical clarify.request mapped to main's questions[] card; replay truncation vs
  snapshot_required; periodic secondary prune tick restored; DELETE already_absent restored.
- cron/tools: diagnostic category on cron failure notices restored; owner_holds_delivery
  ported onto the authority; admitted receipts can no longer be cancelled locally.
2026-10-06 14:24:24 -07:00
Sanjay Santhanam
1212a7f18c fix(gateway): preserve session lineage in the session.list RPC
The session.list projection dropped the durable lineage root returned by
SessionDB, so RPC consumers could not group a compressed conversation
with its continuation — REST (/api/sessions) already projected it, and
the desktop store keys pinning and lineage dedup on the field
(apps/desktop/src/store/session.ts::sessionPinId).

Forward `_lineage_root_id` through `_session_row_summary`, declare it on
the `SessionListRow` wire contract, and regenerate the TS/OpenRPC
artifacts so every consumer sees it.

Fixes #66663
Salvaged from #66675 by @Sanjays2402 (authorship preserved); adapted to
methods_session.py and extended with the wire contract + regenerated
artifacts.
2026-10-06 17:03:26 -04:00
Teknium
00adf69d92 feat(stt): live transcription while you speak on CLI, TUI and Desktop (stt.streaming)
Voice input was record-then-upload on every surface: nothing showed while the user
talked, and the transcript arrived only after the whole take uploaded. With
`stt.streaming: true` the openai, xai and elevenlabs providers now stream microphone
PCM to their realtime endpoints while the user speaks. Partial text renders live and
the final transcript is ready at end of speech.

- tools/transcription_streaming.py: one session API (push_audio / end_audio /
  finalize / cancel, an on_partial callback, a worker thread that owns the socket)
  with three wires, all verified live: the OpenAI Realtime `type: transcription`
  session (gpt-live-transcribe, 16->24 kHz resample since the endpoint refuses
  < 24 kHz), xAI wss /v1/stt with interim results, and ElevenLabs Scribe v2
  realtime. Plugin providers opt in through
  TranscriptionProvider.streaming_capable / open_stream_session.
- tools/voice_mode.py: AudioRecorder taps its capture callback into the session and
  parks it under the WAV path. transcribe_recording uses the live transcript and
  falls back to the file on any failure or empty result, so CLI push-to-talk, the
  continuous VAD loop and the TUI gateway gain streaming with no call-site changes.
- Classic CLI and Ink TUI show partial text in the input placeholder while recording
  (new `voice.partial` gateway event, contract regenerated). Desktop dictation
  streams PCM to the new /api/audio/transcribe-stream socket (provider keys stay on
  the host, and the host resamples) and shows partial text in the dictation pill.
  The recorded blob stays the fallback.

The plugin streaming contract (streaming_capable / open_stream_session /
TranscriptionStreamSession) and the transcribe-stream socket shape come from #103173.

Co-authored-by: Vinicius <timelord1025@gmail.com>
2026-10-06 12:50:31 -07:00
alt-glitch
bf81f4b2c9 fix(tour): built-in tour no longer opens over a chat the user switched to (review)
Re-check the active chat after the local-model wait and answer 'Tours only run in the session the user is looking at.' when it changed.
Move TourPreset to tools/tour_presets.py so importing the wire contracts no longer registers gui_tour.
2026-10-07 01:02:34 +05:30
alt-glitch
890976c224 feat(tour): gui_tour start with no steps runs the app's built-in tour
A general look around the desktop app is now one tool call. Before, the
model ran a targets scan and wrote its own steps from raw DOM labels: two
round trips, English-only copy.

- gui_tour action='start' without steps runs the built-in tour on
  surface='app' (refused on 'preview'). preset 'quick' shows four stops:
  chats list, composer, new session, model picker. 'full' (the default)
  adds what the interface mode puts on screen. A stop that is not on
  screen is skipped. The model stop adds a line when this computer can
  run a local model (the local-setup tip's fit check, capped at 2 s).
- TourPreset is defined once, in tools/tour_tool.py. The wire contract
  types tour.preset with it, so the renderer uses the generated
  TourPreset type. Contracts regenerated.
- The stop copy lives in i18n (appTour, en_app_tour.ts); other locales
  fall back to English until the translations PR.
- engine.ts: one shared teardown for every driver exit, which now tells
  the host. The app host clears a reactive $tourActive flag, so the
  usage-stats consent dialog waits until no tour is on screen. A closed
  one-off highlight also clears it.
- en.ts and types.ts are over the size cap, so the existing handoffTour
  copy and type move unchanged into the same siblings to offset appTour.

test_start_validates_its_steps: a bare start is no longer an error; it is
the built-in tour, and start on surface='preview' without steps is.
2026-10-07 01:02:34 +05:30
alt-glitch
901da1cb6a fix(catalog): sessions off the desktop no longer see manage_catalog through tool_search (review)
An agent stores its session platform's gated toolsets in disabled_toolsets at load, so the tool_search listing, the bridge's search, MCP refreshes and delegate children drop manage_catalog too.
InstallPhase moves to the leaf hermes_cli/plugin_install_phase.py; the gateway contracts no longer import the installer.
The per-home enable lock moves from the plugins_cmd facade to plugins_cmd_install._enable_placed.
Reusing an installed catalog tree reads the install record through catalog_install_record, so older top-level catalog_name records match.
A failed row no longer redacts the Advanced choices (profile name, commit); only credentials are redacted.
The profiles.py role comment no longer says a role grants the setup toolset.
2026-10-07 01:01:14 +05:30
alt-glitch
c2b13dc3d8 feat(desktop): every desktop chat can install catalog plugins; tools gated by session platform
Toolsets that exist only for one kind of session now say so on their spec:
`platforms=frozenset({"desktop"})`. `TOOLSET_SESSION_PLATFORMS` is derived
from the specs that carry the key, `all` / `*` / no selection skip those
toolsets, and `toolsets.agent_tool_drops(agent)` removes their tools from any
agent whose own session platform is not listed. `agent_init._load_tools` and
`tools/mcp_tool_agent.py` (MCP refresh and prefix restore) call that one
helper. `tool_search._DIRECT_SURFACE_TOOLSETS` is derived from
`CLIENT_SURFACE_TOOLSETS` and `TOOLSET_SESSION_PLATFORMS`.

This replaces the profile-role gate: `profile_role_toolsets`, the role code in
`_with_session_toolsets` and the explicit-pin branch, the strip step in
`_select_tool_names`, and main's `setup` toolset (whose only tool moves out)
are deleted. `manage_catalog` moves into a new `catalog` toolset, which the
desktop client folds into every desktop chat like `project` and `desktop_ui`.
It is deferred behind tool_search by default (`config_defaults` defer list).
The shared-metrics schemas' toolset enum follows (`setup` out, `catalog` in).

The install card works outside the setup chat (#129650, with review fixes):
- Parallel installs: `_set_plugin_enabled` holds a per-home lock around the
  read-then-admit section, so rows enabled at once no longer refuse each other.
- A catalog plugin already on disk and not enabled is enabled in place, so Try
  again after a refused enable can finish.
- A failed catalog row counts as resolved (`contract.resolves`), so it no longer
  holds the turn to the 300 s deadline. The snapshot carries `resolved`, and the
  card reads it instead of a hand copy of the backend's rule.
- Each card draws its own operation by op id, because models reuse call ids.
- The row carries the approved non-secret choices (`approved`: force, enable,
  ref) and the chosen profile, so Try again after the card settled repeats them.
- Install phases are ids (`InstallPhase`, wire `CatalogInstallPhase`) and the
  installed-row notes are fields (`enabled`, `missing_env`, `server_errors`,
  `already_installed`, `requires_hermes`); the card words them in English
  strings (translations follow later). Failure reasons stay raw text, and
  `detail` keeps the English notes for the model.
- Installs and search target the calling chat's own home, carried as a path;
  the row's profile name is only a label, with no `'default'` fallback in
  Python or TypeScript.
- `dashboard_install_plugin` is split into `_resolve_source`, `_place_tree` and
  `_enable_placed`.

Desktop English strings for the card move to `en_catalog_install.ts` /
`types_catalog_install.ts`, which offsets the growth of `en.ts` and `types.ts`.
2026-10-07 01:01:14 +05:30
Robin Fernandes
90ff655c81 feat(free-tier): browser challenge primitive for the anonymous token exchange
NAS may answer POST /api/anonymous/token with 428 challenge_required and a
portal URL. Hermes implements the one `browser-v1` primitive: open the URL
(hidden where it can), poll /api/anonymous/challenge/status, exchange again.
Everything the page does (BotID, in-browser proof of work, an interactive
Turnstile fallback, its copy) belongs to the portal and changes without a
Hermes release. The mint stays authoritative throughout.

Python (hermes_cli/anon_challenge.py)
- the exchange reports surface (desktop / cli / gateway), version and the
  browser-v1 capability; a UA of the documented shape goes on every call
- the wait runs outside the auth-store and shared-store locks, under a
  per-profile work lock; only a caller someone is waiting on waits — the
  keepalive tick and a status paint announce the challenge and return
- 403 signin_required / access_denied and any 428 this version has no
  primitive for become a terminal sign-in error, scoped to the token
  exchange; sign-up and the promotion endpoints keep their previous verdicts
- status-poll 429 / 5xx / transport are blips; a 4xx is a verdict (the
  credential is gone); a second 428 starts a fail-fast cooldown so a boot
  burst of token readers does not each re-mint and reopen a window
- the pending challenge is published as the free_tier.challenge event and
  on free_tier.status for a client that connects later; the desktop reports
  how each window ended (free_tier.challenge_result) so the waiter re-mints
  promptly, and an attempt counter lets a fresh foreground attempt reopen a
  window the user closed without a status replay reopening it
- terminal: print the link, open a graphical browser once per ticket; a
  gateway process never opens one; control characters never reach the tty
- challenge URLs are only ever opened on the portal origin the exchange hit

Desktop (apps/desktop/electron/challenge-window.ts)
- the page loads in a hidden, sandboxed window of its own partition, pinned
  to the portal origin (will-navigate, will-redirect, off-origin commits end
  the run); a phase is read only from a main-frame portal URL fragment
- #interactive reveals the window (never for an optional challenge), #done
  and #failed close it; an HTTP error commit, a load failure and a crashed
  renderer are retryable, a closed window is not; timers are bounded
- the renderer relays the event and the status read to one window per
  attempt and reports the outcome once; a backend without the RPC is fine
2026-10-06 23:14:10 +05:30
Teknium
f640a6274f fix: Desktop backend update names owed work on partial and receipt-proven runs
The backend-apply store consulted the receipt's owed steps only on exit 0. A
partial run (record_user_action turns a committed success into partial / exit
1, e.g. a stash whose restore conflicted) fell through to "Backend update
failed." and a receipt-proven partial after the restart to "did not come back
online", dropping the exact recovery instruction; and the success branch read
followups from whatever receipt the status route attached, which is the
latest receipt when this action has none.

Add @hermes/shared updateDebt(receipt, actionId): the debt of a committed
(success|partial) run, only when the receipt's action_id is the id the start
request returned. The store composes it on success and failure: follow-ups
keep the rerun remedy, a user action shows the producer's instruction verbatim
(a rerun does not restore a parked stash). The existing owed-success spec's
receipt gains the matching action_id the real route emits.
2026-10-06 03:44:49 -07:00
Teknium
b5025017d5 feat(telemetry): ask once more where a "No thanks" may never have been seen
Before the type-ahead fix, an Enter pressed while `hermes chat` started
could save "No thanks" before the offer was on screen, and every surface
then treated the profile as answered. Every answer now also writes
`telemetry.shared_metrics.offer_version`. An "off" answer without it reads
as `reask`: undecided, so the CLI, Desktop strip and dashboard banner offer
it once more with a one-line reason. Any response settles it, including
Esc in the terminal and the banner close, which keep "No thanks", so
nobody is asked a third time. Opt-in answers were always deliberate picks
and are never re-asked.
2026-10-06 00:40:30 -07:00
Teknium
1dfef400a7 fix(shared): a hidden Desktop window no longer drops its own healthy gateway socket
The gateway.ping heartbeat failed the transport when the newest inbound
frame was older than the 45 s deadline. A hidden or minimized Chromium
window runs the 15 s heartbeat interval once a minute (intensive wake-up
throttling), so at every tick the previous ping's pong is ~60 s old even
though the backend answered it within milliseconds. Every idle hidden
window closed a healthy socket, redialed, and the renderer recorded
hermes.desktop.friction kind=backend_disconnect detail=network for it.

Judge silence only when the newest ping we sent is still unanswered
(lastPingAt > lastLivenessAt). A dead transport still fails one tick
after its first unanswered ping, throttled or not; an answered one is
never dropped for timer spacing. This also covers the suspended-process
shape (OS sleep, WebView freezer, SIGSTOP): the pre-suspend ping was
answered, so the first tick after resume pings instead of failing.
2026-10-05 15:37:47 -07:00
Brooklyn Nicholson
d0e40fff3c feat(usage): report credential-pool usage per account 2026-10-05 14:02:38 -05:00
Brooklyn Nicholson
38d19b92e8 feat(desktop): a progress chip warns before a subscription hits its usage wall
The provider heading's status slot now shows a fuel gauge for the
tightest usage window: hidden while there's room, "17% left · resets
3:00 PM" at 20% or less (amber from 10%), with a bar along its bottom
edge for what's left, then the existing "Limited until" once the login
is out. Hovering lists every window (5-hour, weekly, per-family).

model.options attaches `usage: { windows }` from a per-profile cache in
agent/account_usage_cache.py and refreshes it in the background, so the
picker never waits on a usage API. Every fetch_account_usage call lands
in that cache, including the one session.usage runs after each turn, so
the chip is at most a turn or two minutes behind. Covers the built-in
fetchers (Anthropic, Codex, OpenRouter) and any provider plugin's usage
hook.

Both pickers now render one ProviderStatusChip instead of separate
limit badges.
2026-10-05 12:21:38 -05:00
Brooklyn Nicholson
8ab6d64043 feat(desktop): a rate-limited provider says why and until when in the model pickers
model.options now attaches `limit` to a row whose credential pool is
rate-limited: `account` (every live entry benched credential-wide, e.g. a
Claude Pro/Max 5-hour window) with the pool's own reset time, or `models`
(only those models are cooling down, each until its own time). Read from a
new read-only CredentialPool.limit_state; entitlement benches aren't reset
windows and stay out.

Desktop renders it in both pickers: an amber "Limited until 4:30 PM" badge
on the provider heading with its models dimmed but still selectable, or a
"resets 4:30 PM" badge on just the cooled-down row so its siblings read as
the way to keep working. A limit whose reset has passed drops on its own.
2026-10-05 12:10:01 -05:00
ethernet
3724ace0c8 Merge remote-tracking branch 'origin/main' into feat/store-guest-onboarding
# Conflicts:
#	apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/message-stream.ts
#	apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/types.ts
#	apps/desktop/src/app/session/hooks/use-message-stream/index.ts
2026-10-05 11:46:27 -04:00
kshitijk4poor
f33d817404 fix(agent): name a final that reuses an already-delivered response
When the model answers beside a housekeeping tool call (memory, todo_list,
skill_manage, session_search) and the follow-up is empty, the turn ends on
that pre-tool answer (fallback_prior_turn_content, since #10472). The final
then repeats text the client already streamed before the tool, but nothing on
the wire says so: message.complete looks like a new response.

Record the reuse where it happens (the housekeeping fallback and the
budget-exhaustion reuse of a previewed verification candidate), report
response_reused only when the final still equals that text (a footer or
explanation appended later drops it), and carry it on message.complete.
Never inferred from equal text: "Done." / tool / "Done." are two responses.
2026-10-04 18:04:17 -07:00
ethernet
4efdfb6d84 Merge remote-tracking branch 'origin/onboarding/next' into feat/store-guest-onboarding
# Conflicts:
#	apps/desktop/electron/window-focus-policy.ts
#	apps/desktop/src/components/assistant-ui/inline-preview-directive.tsx
#	apps/desktop/src/lib/chat-messages/parts.ts
#	apps/desktop/src/plugins/hermes-bots/types.ts
#	apps/desktop/src/sdk/index.ts
#	hermes_cli/plugins_cmd_install.py
#	hermes_cli/profile_distribution.py
#	plugins/web/keyless_mcp.py
#	tui_gateway/methods_profiles.py
#	tui_gateway/server.py
#	website/docs/developer-guide/relay-shared-metrics.md
#	website/docs/user-guide/features/web-search.md
2026-10-03 17:41:14 -04:00
FroRaut
3778021382 feat(desktop): exact subscription speed tiers (Standard / Fast / Ultrafast)
Ultrafast collapsed into ordinary Fast across the stack: the catalog only
reported `fast`, presets and drafts stored a boolean, session.create took
only `fast`, and Settings had a single Fast switch, so an Ultrafast default
read as Fast and a new chat could lose it.

- Inventory reports `ultrafast` per model from the same route-aware
  resolver that builds the request; Daybreak aliases offer no accelerated
  speed (their priority request is ignored).
- session.create accepts an exact `service_tier` that wins over the legacy
  `fast` flag; unknown tiers are rejected.
- Desktop keeps the exact tier through presets, draft creation, session
  options and labels; an unsupported remembered tier falls back to
  Standard, and failed edits reconcile to the confirmed state.
- Settings → Model → Main model offers one Speed choice (Standard / Fast /
  Ultrafast) on models that support Ultrafast; others keep the Fast switch.

Split out of #129251 (which keeps Daybreak).

(cherry picked from commit 4e332fb850c989ef9f34bd70aaca174042beecc6)
2026-10-04 02:12:57 +05:30
alt-glitch
f1c79255fe feat(plugins): requires.gpu gates a plugin server on the host's GPU vendor
A portable plugin can now declare `requires: {gpu: nvidia}` for an MCP
server. On a host without an NVIDIA GPU, Hermes then refuses the
install, hides the server's tools, and the catalog card says "needs an
NVIDIA GPU". The check is the existing
`hermes_platform.host.facts.gpu_class()` read.

The requirement is independent of `app:`. The RTX Remix Toolkit is the
first consumer: it is a package the user unpacks anywhere, so there is
no install location to check, but it needs an NVIDIA GPU.

An unreadable GPU (`unknown`) passes, so a failed registry or sysfs
read does not lock out a machine that has the GPU. Only `nvidia` is
accepted: gpu_class() reports the highest-priority vendor, which
answers the question exactly for NVIDIA and not for AMD or Intel.

A registered server on such a host reports the new `unsupported_gpu`
state, carried through the gateway contract and the Plugins tab, with
a sentence that names the GPU instead of "Install <app>".
2026-10-03 10:26:12 -07:00
kshitijk4poor
370b3a91c8 fix(tui_gateway): type cron last_delivery_unverified as a list of targets
The scheduler persists last_delivery_unverified as a list of unconfirmed
platform:chat_id[:thread_id] targets and cron.manage passes it through, but
CronJobRow typed it bool | None, so contract validation rejected any job
with an unconfirmed delivery. Regenerate the TS/OpenRPC contract.
2026-10-03 22:23:27 +05:30
teknium1
c55a6e3d9f feat(desktop): identity-attribution traces for multi-connection bot rosters
Change-only desktop.log / agent.log lines that name which writer moved a
bot identity when two connections share a profile name:

- [gateway-route] per (connection, profile): via=primary|secondary and the
  window primary; `active` on every active-scope change (key, socket
  connection, profile) and `published` on every published-connection
  change, so a socket/label disagreement shows up side by side.
- [bot-roster] each Bots-pane snapshot: the install that ANSWERED
  profiles.list vs the install expected for activeConnectionId;
  MISROUTED when they differ.
- [bot-relay] rows per connection with the answering install; MISROUTED
  when two connections answer from the same install.
- [bot-meta] every $botMeta title change per scoped key.
- backend: bot_relay.roster.sync and ui_meta['hermes-bots'].title writes.

profiles.list now echoes install_id (same value as /api/status) so a
client can prove which machine answered a routed list. Additive field;
older clients ignore it. Plugins reach the tracer through
host.traceIdentityChange?.() so wholesale SDK mocks stay valid.
2026-10-02 21:11:01 -07:00
teknium1
83097ba008 fix(desktop): keep the hermes://skill/install deep link through the catalog revert
The plugin deep link (hermes://plugin/install?catalog=) and the skill
deep link are separate features: one per kind. Reverting #119381's card
catalog should not leave skills without a link, so this restores the
skill route on its own:

- Desktop: skill-deeplink-install store, the skill route in
  deeplink-routes, its use-desktop-integrations wiring, and the
  confirm-store onConfirm/details/busy/done phases its dialog uses
  (restored from main with their tests). Its nine strings move from the
  deleted catalog.* namespace to skillDeepLink.* (en + the six locales
  that translated them).
- Website: Skills Hub "Install in Hermes" button, plus the
  source-qualified installIdentifier from extract-skills.py so the link,
  the embedded picker and the CLI command all name the exact skill
  (apps/shared/src/catalog-install.ts keeps only the skill helpers).
- Docs: skills.md "Install from the website" section, desktop.md pointer.

The card catalog UI stays reverted.
2026-10-02 10:29:28 -07:00
teknium1
6cb7a64e59 revert: Skills and Plugins card catalog browser, third landing (reverts #119381)
Reverts all seven commits of #119381 (59c54c78..476ff4dd), which
re-landed the native card-based Skills/Plugins catalog browser after it
was reverted twice (#113037 reverting #112669, #115787 reverting
#113128). Capabilities -> Skills and Plugins return to the list/detail
tabs with the embedded catalog picker they had before #119381.

Removed with it:
- Desktop catalog/ module (browser, cards, detail dialog, filters,
  reels/masonry, install switch) and skill deep-link install
  (hermes://skill/install); skills/embedded-hub-picker.tsx comes back.
- apps/shared catalog-browse.ts and catalog-install.ts.
- The `catalog` i18n namespace in every locale (+ regenerated
  locales/_keys.desktop.json); the two i18n pack tests and the keys
  test now exercise connectorsPage.searchPlaceholder instead.
- Website /skills "Open in Hermes Desktop" skill links and the
  extract-skills install identifiers; docs return to the pre-#119381 text.
- Later fixes that only patched the reverted catalog code go with it:
  5832a6eb93 + 7aba2cbbe9 (catalog download deadline),
  9e63cdc4b8 (catalog lookalike rows), c756986db2 (catalog counts),
  the catalog half of c13232e90c / f265273347.

Kept on purpose (later work that depends on code #119381 introduced):
- DialogContent `chrome` / `overlayClassName` / nested-dialog layering
  (the image lightbox uses them).
- vitest.setup.ts / src/test/jsdom.ts stubs (other suites rely on them).
- Kanban toolset wiring on the Plugins Desktop switch (cd30fdadf6,
  7ca2f5665f) and its tests, the `hermes_not_connected` server tone,
  the SearchField flex-1 fix, skill provenance helpers. SkillDetail shows
  a provenance pill only for agent/hub skills, since the pre-#119381
  labels have no `external` entry.
2026-10-02 10:29:28 -07:00
Brooklyn Nicholson
5654863ccd fix(desktop,tui): /browser use [off] works outside the CLI
The Desktop and TUI subcommand pickers offer /browser use (it is in the
registry's subcommands), but both handlers only knew connect, disconnect
and status, so picking it printed the usage line.

browser.manage gains a use action (enabled: bool) that writes the session
profile's browser.backend through the same set_browser_use_mode helper the
CLI now calls, and status/use report browser_use. The handler is profile
scoped, so a worker session writes its own profile. A live agent keeps its
tools (prompt cache), so Desktop and TUI say the switch applies to new
chats instead of swapping tools mid-conversation. use and status also run
on remote backends; connect/disconnect stay local-only.
2026-10-02 11:24:58 -05:00
teknium1
eb049af69c Revert "feat(desktop): copy and Bot Mode group turns follow no-deadline prompts"
This reverts commit 0ea07255e0.
2026-10-01 13:23:12 -07:00
Austin Pickett
666b9f04c4 fix(shared): never dispatch a truncated reconnect replay tail
session.events.since reports truncated=true when the ring evicted events
between the client's watermark and its oldest retained seq. The client
ignored the flag and dispatched the retained tail as a gap-free replay,
painting responses missing their prefix, tool state or terminal event.

On truncation, skip the window up to the server's head without
dispatching it. The session's replay barrier still resolves true, so the
reconnect backstop's history read (#94779) resyncs from the stored
transcript; parked live frames newer than the head still dispatch.

Covers the client half of #100122; the server-side session-eviction
seq reset is #124587.
2026-10-01 09:36:23 -04:00
Brooklyn Nicholson
c579be967f fix(tui_gateway,desktop): every branch create accepts the idempotency key, and a branch_stored hit keeps its messages off the wire
The retry notification added in this PR re-invokes forkBranch with the same
key, but forkBranch stamps idempotency_key into the params of EVERY branch
flavor — including session.branch_stored, whose params contract is
extra=forbid and did not declare the key. The desktop's right-click branch
(that spec's exact path) answered 4000 'idempotency_key: Extra inputs are
not permitted', no child row was created, and e2e/core/lineage-sidebar.spec.ts
failed at 'the branch created a session row' (0 rows, 60s poll).

- SessionBranchStoredParams: accept idempotency_key (optional; an older
  client that omits it is unchanged).
- session.branch / session.branch_whole: accept idempotency_key and dedupe
  via the same _idempotency_keys registry as session.create, so a
  lost-response retry of a LIVE branch also returns the SAME child instead
  of a duplicate (the desktop retry covers those flavors too, but the key
  never reached the backend).
- _build_branch_agent records parent_session_id/branch_title on the child
  runtime so the idempotent hit answers the same parent/title as the fresh
  reply, without a DB round-trip.
- The session.create idempotent-hit early return now honors
  copy_parent_history: a retried session.branch_stored answers
  messages_omitted=true and never puts the copied transcript on the wire
  (its result contract forbids 'messages', and re-serializing the parent
  transcript through the renderer is what branch_stored exists to avoid).
- Regenerated gateway-contract artifacts; two use-session-actions tests
  updated to expect the (opaque) key in branch params.

Red on main: tests/tui_gateway/test_protocol.py::
test_session_branch_stored_accepts_idempotency_key fails with the exact
4000 the e2e saw. Green with the fix, plus
test_session_branch_idempotency_key_dedupes_retry (server suite).
e2e lineage-sidebar passes locally on macOS (14-19s; CI PR run failed at 1.2m).
2026-10-01 05:54:49 -05:00
jinglun010-cpu
4d8c5922eb fix: address sweeper review on #65411 — notifyError path + idempotent retry
Two issues from the hermes-sweeper review:

1. Notification bypassed readableError normalization. The catch block
   called notify() with raw err.message, skipping wrapper stripping,
   detail extraction, and the >180-char long-message fallback. Switch
   to notifyError(err, fallback, action) so the retry action rides the
   established normalization path. notifyError gains an optional third
   action parameter (backward compatible).

2. Retry was unsafe against a lost response. tui_gateway/server.py
   session.create generates a fresh UUID per call; if the first create
   committed but its response was lost in transit, the user's retry
   would spawn a duplicate child session. Add optional idempotency_key
   support: the server dedupes on (key, live session), returning the
   original sid for a retry, falling through to a fresh create if the
   original session was closed in between. forkBranch generates a
   stable key per logical branch attempt and passes it through the
   retry action so both attempts share it.

Tests:
- tests/tui_gateway/test_protocol.py: 3 new tests cover dedupe, no-key
  backward compat, and key expiry when the session is closed. Full
  protocol file: 86/86 passed.
- use-session-actions.test.tsx: 2 new tests cover key reuse across
  retry and readableError normalization on the failure notification.
  Full file: 21/21 passed. tsc --noEmit: 0 errors.
- scripts/check-windows-footguns.py on changed files: clean.
2026-10-01 05:54:49 -05:00
Brooklyn Nicholson
0ea07255e0 feat(desktop): copy and Bot Mode group turns follow no-deadline prompts
A Bot Mode group turn blocked on the user's clarify/approval answer pushes its
runaway hard cap out instead of expiring the card under the room; the offline
toast and the Settings description stop promising an approval timeout; the
approval.respond deadline comments describe what it bounds now.
2026-10-01 03:50:55 -05:00
Siddharth Balyan
a2065efd51 fix(setup): each setup card answers only its own call (#130062)
One Skip broke a tester's whole onboarding. The provider named every
tool call "call_0", and the desktop bound each setup card to its
request by call id alone. After the apps card was skipped, every later
card with "call_0" showed that old "Skipped" answer instead of its
picker. Composer text was also saved as a pick, so "hey" became a
plugin and a complaint became the layout.

- The agent renames a tool call whose id is already used earlier in
  the session (call_0 -> call_0_d2), before the call is stored or run.
  Ids already in history never change, so the prompt cache holds.
- The card's request binding is keyed by session, message and call id.
- Composer text on a card with fixed rows counts as a pick only when it
  names a row by id or label. Otherwise setup_choose returns
  outcome "typed" with the words in `said`, records no card facts, and
  tells the model to reply and send the card again. The settled card
  shows the typed words.
2026-10-01 12:44:40 +05:30