Commit Graph

22471 Commits

Author SHA1 Message Date
Olympusbuildz 801fd0b3d8 fix(desktop): interrupt-first after Stop so edit/resend avoids session-busy
Stop clears frontend busy immediately while the gateway may still wind
down. Edit/restore then passed interruptFirst=false and raced 4009
session busy. Keep a short per-session cooldown after cancel so rewind
still interrupt-first, and expire the submit-in-flight lock so a hung
submit cannot block the session forever.

Fixes #83855

Co-authored-by: Olympusbuildz <Olympus.roots@outlook.com>
Signed-off-by: Olympusbuildz <Olympus.roots@outlook.com>
2026-08-14 20:24:15 -07:00
Teknium 4ac12d53fb fix(tui_gateway): keep steer-mode fall-through bursts queued instead of interrupting
Desktop/TUI busy-input `steer` mode escalated any fall-through message
(steer() rejected, raised, or a non-steerable multimodal payload) into a
hard interrupt of the live turn. AIAgent.interrupt() also clears the
pending steer buffer, so a burst of user messages sent while the agent
was busy could be silently destroyed: earlier successfully-steered
messages were dropped from the buffer and the live turn was killed.

Steer-mode fall-throughs now keep pure queue semantics: preserved FIFO
in queued_prompt/queued_prompts and drained on turn end, per the
existing steer contract. Only explicit `interrupt` mode still fires
_interrupt_busy_session. No synthetic user messages are injected
mid-loop; accepted steers continue through the sanctioned OOB
steer-marker path.

Regression tests cover: rejected steer queues without interrupting,
steer exception falls back to queue, multimodal payload queues, a mixed
burst preserves accepted steers plus the queued fall-through, and a
fall-through burst drains all texts FIFO after turn end.

Fixes #86134
2026-08-14 20:24:06 -07:00
StanleyStetson 3995fd434c fix(tui_gateway): stop replaying live-turn user text after redirect
A mid-turn correction (Desktop session.redirect / busy-input interrupt redirect)
must not leave a server-queue self-copy of the live inflight user prompt.
Otherwise post-turn _drain_queued_prompt restarts that original text as a
fresh agent turn after Q completes (#84417).

Scrub text-only self-duplicates of inflight_turn.user on successful
redirect/steer, refuse admitting them in _enqueue_prompt, rewrite merged
"{P}\n\n{Q}" slots to Q-only, bump _queued_prompt_generation on compression
session rotation, and restore the claimed queue envelope when generation
cancels mid-drain. Stabilize profile-scoped agent-build unit tests under CI load.

Fixes #84417
2026-08-14 20:24:06 -07:00
Teknium b9482484f7 chore: map contributor email for attribution audit 2026-08-14 20:23:57 -07:00
Teknium 1c80085f04 fix(desktop): widen terminal-status handling to sibling sites
Two sibling sites still treated only 'completed'/'failed' as terminal:

- delegate-model.ts settled result rows as 'completed' for ANY status other
  than 'failed', so a delegate result row with status 'timeout' or 'error'
  (the statuses tools/delegate_tool.py actually emits on child timeout or
  crash) rendered behind a green check. Settled rows now map ok/completed
  to completed and everything else to failed.
- subagents.ts asStatus accepted a literal 'queued' payload status even on
  a subagent.complete event, leaving the row active forever. The fail-closed
  branch now runs before the queued fallback, so completion events always
  settle.
2026-08-14 20:23:57 -07:00
Michael Gannotti e3c3d0895d test(desktop): late progress events must not revive a timed-out subagent row
Folded-in coverage from PR #80045 (gannotti, #80018): after a terminal
subagent.complete, a stray late 'running' progress event must not restart
the spinner — the upsert guard keeps the settled failed status.
2026-08-14 20:23:57 -07:00
Sebastian Mause a01c7bb43b test(desktop): completion events with still-active payload statuses settle as failed
Folded-in coverage from PR #85995 (smause): a subagent.complete event whose
payload still says 'running' or 'queued' must settle the row as failed —
the completion event itself is the source of truth that the child is done.
2026-08-14 20:23:57 -07:00
David Metcalfe d3fee89993 fix(desktop): prefer synthesized timeout summary over stale progress text
Review feedback: prev?.summary could shadow the 'Timed out after Xs'
reason when a live event had populated it. timeoutSummary() now wins for
raw timeout status; add coverage for the missing-duration placeholder.
2026-08-14 20:23:57 -07:00
David Metcalfe 09b1726a1d fix(desktop): fail closed on unrecognized subagent.complete statuses; surface timeout reason
Follow-up to the #73728 normalization fix (supersedes the event-agnostic
fallback the maintainers flagged as incomplete):

- subagent.complete is terminal by definition — an unrecognized status on
  it now renders as 'failed' instead of falling through to 'running',
  which would recreate the immortal false-active row for any future
  backend status (the keep_open request on #73859).
- Live events keep the lenient 'running' fallback.
- Synthesize a 'Timed out after Xs' summary from duration_seconds when
  the backend completes with status 'timeout' and no summary, so the
  failed row explains itself.
- Tests: timeout reason synthesis + pruning, event-aware fail-closed vs
  lenient live fallback (13 total).
2026-08-14 20:23:57 -07:00
RelaxJonh a351c17d4a fix(desktop): normalise timeout/error subagent statuses to terminal (#73728)
The backend emits terminal statuses including 'timeout' and 'error' in
subagent.complete payloads, but asStatus() only recognised 'completed',
'failed', 'interrupted', and 'queued'. Unrecognised values fell through
to 'running', making timed-out subagents immortal in the active status
stack.

Fix: map timeout/error to 'failed', cancelled/canceled to 'interrupted'.
Nonterminal unknown statuses still default to 'running' for forward
compatibility.

Fixes #73728
2026-08-14 20:23:57 -07:00
Teknium 4faf12b9ce chore: map salvaged contributor emails (75day, KBANTH) 2026-08-14 20:23:47 -07:00
KBANTH f9f5c14f9a fix(desktop): keep live gateway across profile switches 2026-08-14 20:23:47 -07:00
Trevor Nash-Keller 077c04755e fix(desktop): sync active profile after reconnect 2026-08-14 20:23:47 -07:00
A9 8edb4626ca fix(desktop): refresh sessions on profile switch
Re-run the foreground session-list refresh whenever the active gateway profile changes, preventing rows from the previously selected profile from persisting in the sidebar.
2026-08-14 20:23:47 -07:00
Jakub Wolniewicz 21b57c61f4 fix(desktop): page remote profile session reads 2026-08-14 20:23:47 -07:00
Teknium 5a23ab513c chore: map salvage contributor emails to GitHub usernames 2026-08-14 20:23:18 -07:00
Guilherme Aguiar 01e542b764 fix(desktop): address transcript refresh review feedback 2026-08-14 20:23:18 -07:00
Guilherme Aguiar 1a2b0ca8cb fix(desktop): refresh active transcript on session changes 2026-08-14 20:23:18 -07:00
chelsealong f0748b451c fix(desktop): stop empty REST transcript refresh from wiping a warm resume
session.activate's persisted-transcript refresh reconciled unconditionally
against getLatestSessionMessages, so a transient empty REST page (e.g. a
backend respawn racing its own state.db read after a wake/reconnect) wiped
a transcript the activate response had just restored. Guard it the same way
the activate payload itself already is guarded a few lines above: an empty
authoritative page never overrides a non-empty cached transcript.
2026-08-14 20:23:18 -07:00
spfcraze 9cc428cff8 fix(desktop): keep responsePreviewed settle gated on the boundary flag
Sweeper review on #76583: dropping interimBoundaryPending from the
previewed settle path let a previewed final arriving after a
message.start reset OVERWRITE a distinct interim instead of appending
(interim('old') → message.start → complete({response_previewed: true,
text: 'new'}) destroyed 'old'). responsePreviewed may rewrite the final
with no prefix guarantee, so it must stay flag-gated; only
finalContinuesInterim (prefix-either-way continuity, which can only hold
for the same message) settles flag-free. New test: distinct previewed
final after a reset appends its own bubble. Production ordering cited in
the test: compaction-resume events exclude message.start
(gateway-event.ts), and the TUI gateway emits message.complete before
goal-followup starts (tui_gateway/server.py).

74/74 use-message-stream tests pass.
2026-08-14 20:23:18 -07:00
spfcraze 71a98f69ee fix(desktop): settle final reply onto interim even after message.start reset the boundary flag
completeAssistantMessage merged a turn's final text onto its sealed interim
bubble only when the session's volatile interimBoundaryPending flag was still
true. A subsequent message.start (chained turn, follow-up, or mid-turn
compaction) resets that flag to false; when it landed between the same turn's
message.interim and message.complete, the flag-based gate fell through and the
UI appended a duplicate bubble.

Key the merge on the message's OWN durable interim state instead of the
session flag. finalContinuesInterim already requires existing.interim plus
prefix continuity, so distinct replies (which don't continue the interim) are
still appended as their own bubble.

Adds a regression test: interim + message.start + completing final that
continues the interim must yield one bubble, not two.
2026-08-14 20:23:18 -07:00
李灵航 cf63b79467 fix(desktop): drop pending stream rows whose reply the transcript already carries
A still-pending assistant stream row (id `assistant-stream-*`) whose reply
the authoritative transcript already committed used to fall through to
`preserved.push` when ordinal pairing missed it — the commit shifted the
row's ordinal under compaction/history rewrites, so `nextByRoleOrdinal`
returned nothing and the local copy was appended to the tail, rendering the
same answer twice (reported as A B C D E C D tail duplication).

The #70209 guard only covers SETTLED local rows (`pending !== true`);
pending rows were unprotected. Match pending rows against SETTLED
authoritative rows before appending:

- identical answer text            -> authoritative already carries it
- authoritative extends local text -> authoritative is the settled final
  version of the still-streaming local copy
- local extends authoritative text -> replace the committed row with the
  richer local body instead of appending

Live projection shells (still-pending candidates) never match, so the
traces-only local row keeps replacing the empty shell.
2026-08-14 20:23:18 -07:00
Teknium 56121e528d chore: map contributor email (audit_pr_attribution) 2026-08-14 20:23:07 -07:00
Aleks Clark 62eefff697 perf(desktop): bound long-running app resource use
Persist backend ownership for reliable cleanup, park inactive panes, and
evict unreferenced transcripts so Desktop stays responsive over long sessions.

💘 Generated with Crush

Assisted-by: Crush:gpt-5.6
2026-08-14 20:23:07 -07:00
AlexDev_ 4712721033 perf(desktop): pause decorative animations when unfocused 2026-08-14 20:23:07 -07:00
LemonSchneid d7e95315f7 fix(desktop): expand HUD transcript when resized
Use the available HUD window height for non-empty transcript scrollback instead of a fixed glance-band cap. This makes the corner resize affordance reveal additional conversation content while preserving the compact empty HUD state.
2026-08-14 20:22:56 -07:00
Jakub Wolniewicz b55677077f fix(desktop): keep completion selection visible 2026-08-14 20:22:56 -07:00
nanami7777777 957a7c20cd fix(desktop): keep text navigation keys in composer 2026-08-14 20:22:56 -07:00
LemonSchneid 0611f9f856 fix(desktop): retain HUD composer focus
Keep the native HUD window mouse-solid while focus is inside the rich composer. On Windows this prevents click-through from reactivating the app beneath the HUD, stealing the caret, and collapsing the transcript.
2026-08-14 20:22:56 -07:00
Jakub Wolniewicz 23954e3e31 fix(desktop): prevent navigation from stealing focus 2026-08-14 20:22:56 -07:00
kshitij cb47f59ffa fix: standardize media-group CancelledError to raise
Pre-existing inconsistency: _flush_media_group_event used return
in CancelledError while _flush_text_batch and _flush_photo_batch
used raise. Changed to raise for consistency and to properly
propagate task cancellation. Made more visible by the hold-queue
changes in #83878.
2026-08-15 07:09:52 +05:30
Daniel V. Baecker 42dc17ec97 fix(telegram): close hold-lifecycle gaps on permanent fatal and connected drain
Address review on #83878:

- Permanent fatal fences all hold producers and discards pending maps on
  teardown instead of re-populating a queue that can never drain.
- Any hold created while connected schedules a tracked redispatch (cancel-
  after-pop no longer orphans until a future reconnect).
- Redispatch failures re-hold current + remainder without tight-looping.

Regression coverage for the three residual paths, plus the interaction
with OOF-156's connect-failure classification: the retryable network
path (telegram_connect_error) must NOT clear the hold queue — reconnect
is precisely what drains it; only non-retryable fatals discard.
2026-08-15 07:09:52 +05:30
Daniel V. Baecker b4da6b15e1 fix(telegram): hold inbound messages across disconnect instead of destroying them
The disconnect drop-guard (#55971) correctly prevents dispatch into a
torn-down session. Destroying the event was wrong: by enqueue/flush time
python-telegram-bot has already acked the update and advanced the polling
offset, so Telegram never redelivers. Result: silent permanent loss, no
log, no error.

Hold inbound events (text/photo/media-group) when the drop-guard fires,
salvage pending batch maps on teardown, cancel+await the redispatch task
in the delivery cancel map (lifecycle-tracked), and redispatch from
_mark_connected after reconnect. Cap the hold queue (default 64), dedupe
by object identity, discard on non-retryable fatal. Cancel-after-pop in
flush paths also holds.

Distinct from #72037 (cancel-after-pop during follow-up supersession) and
#81528 (boundary discard). Tests use delay=0 and entered/release Events —
no wall-clock races; includes production terminal-step coverage.
2026-08-15 07:09:52 +05:30
Adolanium ed4f50de51 fix(send_message): hand unresolved cron and react targets to the adapter again
Restores pass-through behavior for cron delivery and react/unreact that
was lost when d409f6748 routed them through resolve_send_target. Stored
cron job targets the channel directory doesn't recognize (e.g.
telegram:ops-room on a fresh install, photon group GUIDs) used to go to
the adapter verbatim; after d409f6748 they were silently dropped. Same
for react on platform-native ids.

Adds an opt-in pass_unresolved_references flag to resolve_send_target,
passed only by cron and react. Model-facing send tool stays strict.
Plugin platforms with a parser stay strict for all callers. The optional
validator still has the final say over passed-through ids.

Follow-up fixes on salvage:
- Update test_cron_relay_delivery_guards.py mock lambdas to accept **kw
  (file added to main after PR branch point; lambdas didn't accept the
  new keyword argument)
- Consolidate duplicated pass-through blocks into _pass_through_unresolved
  local helper

Fixes #85128

Co-authored-by: Adolanium <Adolanium@users.noreply.github.com>
2026-08-15 07:07:40 +05:30
hermes-seaeye[bot] b9fa46b5a5 fmt(js): npm run fix on merge (#86559)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-08-15 00:39:34 +00:00
Teknium b6726d57e4 feat(desktop): per-profile scope selector in the Capabilities view (#86548)
* feat(desktop): per-profile scope selector in the Capabilities view

Adds a 'Configuring:' profile selector above the Tools and MCP tabs in the
Capabilities (Skills) view, so a user can configure ANY profile's toolsets
and MCP servers without switching the whole app into that profile.

- hermes.ts: every capability fetcher (getToolsets, setToolsetEnabled,
  getToolsetConfig/Models, selectToolsetModel/Provider, runToolsetPostSetup,
  getMcpCatalog, installMcpCatalogEntry, testMcpServer, saveMcpServers,
  auth/oauth flow, setEnvVar/deleteEnvVar/revealEnvVar, startOAuthLogin/
  pollOAuthSession, getActionStatus, getHermesConfigRecord) takes an optional
  trailing profile? that forwards to profileScoped(profile). Omitting it
  preserves exact app-wide behavior (profileScoped(undefined) → _apiProfile).
- use-config-record.ts: hermesConfigKey(profile)/useHermesConfigRecord(profile)/
  hermesConfigCacheWriter(profile) — per-profile RQ keys (scope-in-key).
- toolset-config-panel.tsx + mcp-tab.tsx: thread profile through every fetch
  and their nested children (EnvVarField, PostSetupRunner, ModelCatalogPicker),
  keyed/remounted per selected profile so switching never shows stale state.
- skills/index.tsx: the selector (seeded from profiles.list, default→'Hermes',
  shown only with >1 profile), defaulting to ; toolsets
  query + toggles keyed and scoped to the selection; McpTab/ToolsetDetail
  remounted per scope.
- i18n: skills.configuringProfile (en + zh; others fall back).

When the selected profile equals the active one (the default), behavior is
identical to before — the selector is a pure override layered on top.

Tests: index.test.tsx — new case asserts picking a non-active profile in the
selector refetches toolsets scoped to that profile; existing single-profile
cases still pass (selector hidden with one profile). 5/5. Full-project tsc clean.

* Fix CI: command-palette getHermesConfigRecord call, panel test mock, lint

- command-palette/index.tsx: getHermesConfigRecord now takes an optional
  profile; passing the bare fn as queryFn fed it react-query's context object
  (TS2769 + mcp_servers on {}). Wrap in an arrow.
- toolset-config-panel.test.tsx: use-config-record now imports normalizeProfileKey
  from @/store/profile, which calls setApiRequestProfile at module-init; the
  full-replacement @/hermes mock must provide it (+ getApiRequestProfile).
- index.test.tsx selector test: stub Element.prototype.scrollIntoView (Radix
  Select calls it on open; jsdom lacks it).
- toolset-config-panel.tsx: PostSetupRunner useCallback missing 'profile' dep
  (stale-closure correctness); jsx-prop sort order.

Verified in a full-dep checkout: tsc 0 errors, eslint clean, panel 28/28 + skills 5/5.

---------

Co-authored-by: Teknium <teknium1@users.noreply.github.com>
2026-08-14 17:33:49 -07:00
hermes-seaeye[bot] bab9a85b67 fmt(js): npm run fix on merge (#86533)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-08-15 00:07:02 +00:00
Brooklyn Nicholson c83061ba3d test(desktop): cover the context gauge fetching before a turn runs 2026-08-14 19:01:15 -05:00
Brooklyn Nicholson 25d1c8d740 fix(desktop): context gauge reads the session it is on, not the last turn
The statusbar gauge painted only what the backend reported as measured
occupancy, which a session has none of until a turn runs in this process.
Turning the gauge on mid-conversation, or resuming a chat, therefore showed
nothing until the next message.

Fetch session.context_breakdown as soon as the gauge is on screen instead of
when its popover opens. It is the same read-only estimate the popover already
used (chars/4 over the live prompt, tools and transcript — no provider call),
and it reports the measured figure once the backend has one. The popover
becomes presentational and reads the gauge s merged usage, so the bar and the
panel cannot disagree.
2026-08-14 19:01:15 -05:00
Teknium 50d98fc1f3 feat(delegation): raise subagent iteration cap default 50 -> 250 (+migration) (#86506)
delegation.max_iterations is the per-subagent tool-call budget. The old
default of 50 truncated substantial delegated work: leaf agents spend
~15-20 turns on reconnaissance before producing output, then ran out of
budget mid-task and returned 'completed but unfinished' summaries. 250
gives real delegated work room to finish.

Changes:
- config_defaults.py: delegation.max_iterations 50 -> 250; _config_version 35 -> 36
- tools/delegate_tool.py: DEFAULT_MAX_ITERATIONS fallback 50 -> 250 (kept in
  sync with the shipped default to prevent drift)
- config_migrations.py: _migrate_to_36 lifts configs still pinned at exactly
  the OLD default 50 -> 250 on update, so existing installs inherit the new
  headroom. Any other explicit value (deliberate override) is preserved;
  unset inherits 250 at read time.
- cli-config.yaml.example: doc the new default

The cap is per-child and children run concurrently (max_concurrent_children
default 3), so this raises worst-case fan-out cost; delegation.child_timeout_seconds
(default 0 = off) remains available as a wall-clock guardrail, and users can
still pin a lower max_iterations explicitly.

Verified: migration lifts 50->250, preserves a deliberate 120, leaves unset
untouched (3/3); DEFAULT_CONFIG reads version=36, max_iterations=250, fallback=250.
2026-08-14 16:50:30 -07:00
Justin Bennington 832eb56b77 chore: map contributor email 2026-08-14 16:43:37 -07:00
Justin Bennington 167dd48b40 fix(models): trust certifi for credentialed catalogs (E-1002) 2026-08-14 16:43:37 -07:00
pierrenode 90253cc0a0 fix(providers): route Actual's fetch_models through the credential-redirect guard
ActualProfile.fetch_models() overrides ProviderProfile's default
implementation with its own Actual-specific base_url resolution
(ACTUAL_BASE_URL env var, hosted-vs-local normalization), but called raw
urllib.request.urlopen(req, timeout=timeout) directly instead of the base
class's open_credentialed_url(). Every other provider either uses the
base class default or forwards to it via super() and gets
SafeCredentialRedirectHandler for free — Actual is the only provider that
attaches a Bearer token to its own Request object and opens it with the
stdlib's default redirect handling, which forwards every header,
including Authorization, across a cross-origin redirect.

Actual's own feature surface makes the trigger realistic: ACTUAL_BASE_URL
is a first-class, documented way to point this provider at a self-hosted
or local-offline endpoint (see the local-loopback no-auth path already
handled elsewhere in this provider), so a misconfigured or compromised
endpoint 302-ing to another host leaks ACTUAL_API_KEY to it.

Fix: import and call the same open_credentialed_url() the base class
uses, keeping Actual's own URL-resolution logic unchanged.

Adds an end-to-end regression test using two real local HTTP servers (no
mocking of the security module itself) — one redirects, the other
records the Authorization header it receives — mirroring
test_urllib_security.py's own redirect tests. Also repoints the existing
fetch_models test's mock from urllib.request.urlopen to
hermes_cli.urllib_security.open_credentialed_url, since fetch_models no
longer calls the former. Mutation-verified: the new redirect test fails
on pre-fix code with the Authorization header observed at the redirect
target.
2026-08-14 16:43:37 -07:00
Teknium 2eda1292f6 chore: map contributor email for #56522 salvage 2026-08-14 16:40:02 -07:00
beiyesi b55dd04711 fix(streaming): adapt provider errors to relay 2026-08-14 16:40:02 -07:00
beiyesi 04bc5321c9 fix: preserve non-JSON provider stream errors 2026-08-14 16:40:02 -07:00
beiyesi 5cbc645d09 fix: require terminal signal for streamed errors 2026-08-14 16:40:02 -07:00
beiyesi 0fcebb29f4 fix streaming bare data error payloads 2026-08-14 16:40:02 -07:00
beiyesi 661a4c4f88 fix streaming provider error events 2026-08-14 16:40:02 -07:00
SHL0MS 44d580617f test(providers): tolerate stream kwarg in metadata probe mock
Upstream added stream=True to the /models metadata probe; widen the
fake_get signature so the captured verify assertion still runs.
2026-08-14 16:37:36 -07:00