Commit graph

316 commits

Author SHA1 Message Date
nesquena-hermes
c556d649b7 fix: strip @provider: prefix from auxiliary title_generation model id (#3430, @pamnard)
Manual title regeneration (POST /api/session/title/regenerate) and background
aux title generation failed with 422 / llm_error_aux when
auxiliary.title_generation.model in config.yaml used the WebUI-internal
@provider:model picker format (e.g. @gemini:gemini-3.1-flash-lite) — the raw
@-qualified id was forwarded to the provider API verbatim. Normalize it through
the canonical _split_webui_provider_model_value() helper before the aux call.

Co-authored-by: pamnard <pamnard@users.noreply.github.com>
2026-06-02 21:14:49 +00:00
nesquena-hermes
1630fb8d95 fix(streaming): inject WebUI delivery context via system prompt, not prefill user message (#3324, @aether-agent)
Consecutive user turns (session-context prefill + actual message) made models
with strict chat templates (Mistral, Gemma via llama.cpp) reject the request
with a Jinja 500. Move the platform/delivery context (connected platforms, home
channels, scheduled-task delivery hints) from _webui_session_context_message
(a prefill user message) into _webui_delivery_context_prompt, appended to the
ephemeral system prompt. Session framing stays in _webui_surface_context_prompt.
Context is preserved — just role-alternation-safe. Closes #3276.

Co-authored-by: aether-agent <aether-agent@users.noreply.github.com>
2026-06-02 19:36:25 +00:00
nesquena-hermes
ebfff8e074 fix(stream): preserve repeated identical visible turns in gateway backfill (Codex MUST-FIX on #3300)
_merge_display_messages_after_agent_result shared one _emitted set between
context-backfill rows and the visible-display backbone; _message_identity
ignores timestamps, so a second identical visible user turn was suppressed as
already-emitted. Now the display backbone is always appended in order; a
separate _context_inserted set + the _display_id_set guard dedupe only the
spliced-in context rows. Adds a regression test with two identical visible
user turns + a context-only gap.
2026-06-02 18:43:25 +00:00
nesquena-hermes
952930c10e fix: keep gateway context visible in chat transcripts (#3300, @AJV20)
Backfill model-context turns into the visible transcript before saving the
latest reply while keeping hidden [context compaction] markers out of the
visible transcript, so sidebar/header message counts no longer collapse a
compacted gateway session to a 2-message conversation. Resolves the
transcript-loss regression the v0.51.197 Codex gate flagged on the original.

Co-authored-by: AJV20 <24819659+AJV20@users.noreply.github.com>
2026-06-02 18:28:41 +00:00
nesquena-hermes
546afe8374 feat: add manual session title regeneration (#3223, @AJV20)
Closes #3106. Adds /api/session/title/regenerate endpoint + session-action
menu item. Preserves chronology (touch_updated_at=False), guards read-only
and imported sessions, syncs to state.db when Insights sync enabled.

Maintainer refinement (Opus SHOULD-FIX): scope the is_imported guard to the
regenerate action only instead of broadening the shared _isReadOnlySession()
helper, which also gates rename/pin/archive/move/fork. Matches the backend
403 guard. Test updated to assert the scoped shape.
2026-06-01 21:39:51 +00:00
AJV20
ca99d12e04 fix: keep WebUI reply guidance language-neutral 2026-06-01 04:42:23 +00:00
AJV20
7a1b2bfe72 fix: carry WebUI reply polish into gateway chat 2026-06-01 04:42:23 +00:00
nesquena-hermes
4147e7f3df fix(#3263): provider-aware default-model match (Codex final-gate MUST-FIX)
The default-only context_length guard compared model.default to the session
model with exact string equality. But model.default and the session model can
be stored in equivalent-but-different shapes (bare 'claude-opus-4.8',
provider-prefixed 'anthropic/claude-opus-4.8', or '@anthropic:claude-opus-4.8').
An exact compare wrongly treats the actual default model as non-default and
drops its configured context_length cap for provider-prefixed configs.

Add api/routes._model_matches_configured_default(session_model, cfg_default,
provider) that normalizes all three shapes, and use it at all 6 guard sites
(routes resolver + the 5 api/streaming.py sites: live-usage snapshot, persistence
_skip_cc_cl, persistence fallback _apply_cfg_ctx, SSE-done _dropped_stale_cap_sse,
SSE fallback _apply_cfg_ctx). Imported function-scoped in streaming to avoid the
routes<->streaming module-level circular import. 10 helper unit tests + a
behavioral test that a prefixed default still receives its cap.

Co-authored-by: allenliang2022 <allenliang2022@users.noreply.github.com>
2026-06-01 01:14:22 +00:00
nesquena-hermes
17e7794923 fix(#3263): init _skip_cc_cl/_cc_cl before compressor block (UnboundLocalError on no-compressor path) + relax brittle #1318 source-assertion
The threshold-rescale block runs unconditionally after the fallback and
references _skip_cc_cl/_cc_cl, which were only defined inside 'if _cc_for_save:'.
On the no-compressor path (fresh agent / interrupted stream) that raised
UnboundLocalError (caught by test_issue1857_usage_overwrite). Hoist both inits
above the block (no-op rescale when no compressor). Also widen the #1318
source-assertion test to accept the widened fallback gate (still asserts the
falsy-check invariant).

Co-authored-by: allenliang2022 <allenliang2022@users.noreply.github.com>
2026-06-01 00:14:13 +00:00
nesquena-hermes
18a459726b fix(#3263): apply Codex dual-gate MUST-FIX — recompute persisted stale cap + rescale terminal threshold
Codex regression gate (+Opus, both independently) found the default-only guard
dropped the stale compressor cap but two sibling paths stayed inconsistent:
1. Per-turn persistence: fallback resolver only ran when context_length was
   falsy, so a previously-persisted stale 232K survived forever on non-default
   sessions. Now also runs when _skip_cc_cl, and rescales threshold_tokens to
   the recomputed real cap (or clears it).
2. Terminal SSE 'done' payload: re-emitted the stale compressor threshold, so
   messages.js overwrote S.lastUsage and the indicator reverted on stream end.
   Now rescales threshold to the resolved window when the stale cap was dropped.
Added 3 source-structure regression tests pinning both fixes; bumped the brittle
test_pr1341 distance limit 13000→15000 (+ noted it should become structural).

Co-authored-by: allenliang2022 <allenliang2022@users.noreply.github.com>
2026-06-01 00:09:21 +00:00
allenliang2022
cba69cd415 fix(context): rescale threshold_tokens to real cap in live usage snapshot
The default-only guard corrected context_length to the real per-model cap
(e.g. 1M for claude-opus-4.7-1m) but left threshold_tokens pointing at the
ContextCompressor's stale value (computed from the global 232K cap → 197.2k
@ 85%). UI then showed 'auto-compress at 197.2k / 1M' which is misleading.

Rescale threshold_tokens by the real/orig ratio so the displayed trigger
reflects the actual window (e.g. ~850k @ 1M).

NOTE: this only corrects the SSE display payload. The real auto-compress
trigger lives inside ContextCompressor in hermes-agent (agent_init.py:1446
constructs it with the global cap). A full fix requires a parallel change
upstream — tracked separately.
2026-05-31 23:49:41 +00:00
allenliang2022
1263cf03cf perf(context): cache real per-model context_length in live usage snapshot
_live_usage_snapshot() runs on every metering tick (~10x/sec while streaming).
The #3256 default-only guard recomputed get_model_context_length() there on
every tick for non-default models, which does a config read + potential
metadata/network probe — freezing claude-opus-4.7-1m streams while the default
model (4.8) stayed fast (guard not triggered for it). Resolve the real cap at
most once per stream via _real_ctx_cache. Backend-only, no frontend changes.
2026-05-31 23:49:41 +00:00
allenliang2022
4785aa542a fix(context): re-apply default-only context_length guard after v0.51.185 upgrade
Re-applies cb0065eb + b34311b3 (context_length default-only guard) which were
dropped by the upgrade reset to v0.51.185. Fixes 4.7-1m context window showing
as stale global cap (232K) instead of real 1M metadata. Backend-only: touches
api/routes.py + api/streaming.py, zero frontend/render changes.
2026-05-31 23:49:40 +00:00
AJV20
6ecc32be00 Close evicted cached agents on identity mismatch 2026-05-30 19:25:51 -04:00
nesquena-hermes
22e628be07 Merge #3191: guard session cache ownership across compression
# Conflicts:
#	CHANGELOG.md
2026-05-30 21:57:48 +00:00
nesquena-hermes
bc50e95ec7 Merge #3166: close evicted agents from WebUI cache (commit memory + shutdown provider + close db) 2026-05-30 21:57:13 +00:00
ai-ag2026
9932899b88 fix: guard session cache ownership across compression 2026-05-30 18:19:31 +02:00
ai-ag2026
09d2f4be2f fix: exclude hidden snapshots from pin quota 2026-05-30 11:48:57 +02:00
ai-ag2026
b3483d943c fix: close evicted agents from WebUI cache 2026-05-30 10:43:13 +02:00
nesquena-hermes
11ba36beb9 Merge PR #3135 into stage-batch41
# Conflicts:
#	CHANGELOG.md
#	api/routes.py
2026-05-29 22:15:46 +00:00
AJV20
3c2f98eb23 fix: polish WebUI assistant replies 2026-05-29 13:01:14 -04:00
AJV20
35f89c4e5b fix: harden external notes guardrails 2026-05-29 12:30:04 -04:00
nesquena-hermes
c1a7668bdf Merge PR #3091 2026-05-28 19:51:29 +00:00
nesquena-hermes
6719f35930 Merge PR #3094
# Conflicts:
#	CHANGELOG.md
#	api/streaming.py
2026-05-28 19:51:29 +00:00
nesquena-hermes
20f8bc3290 Merge PR #3090
# Conflicts:
#	CHANGELOG.md
2026-05-28 19:50:10 +00:00
Hermes Agent
b92204a7b7 fix(sidebar): keep newer continuation visible over older snapshot 2026-05-28 13:38:06 -06:00
AJV20
d539d5c079 fix: budget webui prefill context 2026-05-28 15:26:35 -04:00
AJV20
d5b36267f7 Merge remote-tracking branch 'origin/master' into fix/selective-durable-writeback
# Conflicts:
#	CHANGELOG.md
2026-05-28 14:59:12 -04:00
AJV20
c494e41220 Merge remote-tracking branch 'origin/master' into fix/webui-gateway-context-prefill
# Conflicts:
#	CHANGELOG.md
2026-05-28 14:52:15 -04:00
AJV20
00f4b11227 fix: limit webui durable memory guidance 2026-05-28 14:48:30 -04:00
AJV20
609a0c887b fix: carry WebUI context through gateway chat 2026-05-28 14:33:32 -04:00
nesquena-hermes
ad9b38c945 Merge PR #3086
# Conflicts:
#	CHANGELOG.md
2026-05-28 18:27:03 +00:00
ai-ag2026
07aed6b7ff fix(session): preserve subsecond message timestamp order 2026-05-28 19:58:18 +02:00
nesquena-hermes
4412aea9e8 Merge PR #3059
# Conflicts:
#	CHANGELOG.md
2026-05-28 17:47:34 +00:00
nesquena-hermes
921b94a287 Merge PR #3046
# Conflicts:
#	CHANGELOG.md
2026-05-28 17:47:34 +00:00
nesquena-hermes
d446a6c304 Merge PR #3049
# Conflicts:
#	CHANGELOG.md
2026-05-28 16:10:49 +00:00
nesquena-hermes
0fd12b2365 Merge PR #3056
# Conflicts:
#	CHANGELOG.md
2026-05-28 16:10:12 +00:00
Frank Song
9190ab4449 Fix empty partial activity tail recency 2026-05-28 15:30:49 +08:00
ai-ag2026
62efbfb13f fix: use generic title language prompt 2026-05-28 09:14:46 +02:00
ai-ag2026
b046cb42c3 fix: remove German-only fallback title override 2026-05-28 09:09:59 +02:00
ai-ag2026
2aeebf56ac fix: tighten title language detection 2026-05-28 08:21:58 +02:00
ai-ag2026
5f42e87aa9 fix: skip stale repair for compression parents 2026-05-28 08:02:24 +02:00
ai-ag2026
ad564f2cde fix: keep generated titles in conversation language (#2984)
Squash-merged pr-2984 into stage-batch33.
2026-05-28 02:47:40 +00:00
AJV20
2a96b2acc2 fix: wrap WebUI script prefill text as user context 2026-05-27 03:09:01 -04:00
nesquena-hermes
7f66f72514 Merge pull request #2993
# Conflicts:
#	CHANGELOG.md
2026-05-27 03:25:04 +00:00
Frank Song
3a9948d6cf Fix streaming SessionDB profile path 2026-05-27 10:29:31 +08:00
george-andraws
f1b04be8f7 Fix WebUI fallback provider chain merging 2026-05-26 17:51:49 -07:00
nesquena-hermes
aa6cd48318 Merge pull request #2888
# Conflicts:
#	CHANGELOG.md
#	tests/test_webui_prefill_context.py
2026-05-27 00:38:24 +00:00
nesquena-hermes
c2fc390723 Merge pull request #2915 2026-05-25 17:46:56 +00:00
nesquena-hermes
f6dc7aad6f Merge pull request #2907 2026-05-25 17:17:44 +00:00