Commit Graph

790 Commits

Author SHA1 Message Date
Jordan SkyLF 90c2ee7e04 Split What's New summaries by target 2026-05-13 15:53:01 -07:00
Jordan SkyLF cae007b069 Refine What's New summary sections 2026-05-13 15:53:01 -07:00
Jordan SkyLF 623dfef499 Stabilize What's New summaries 2026-05-13 15:53:01 -07:00
Jordan SkyLF bec21eafa0 Add What's New summary toggle 2026-05-13 15:53:01 -07:00
Jordan SkyLF cfc0f68d23 fix: show update whats-new links for webui and agent 2026-05-13 15:53:01 -07:00
Hermes Agent 7209e89ef4 stage-350: apply Opus SHOULD-FIX — tighten _partial_already_present dedup scope
Opus flagged that PR #2151's cancel-handler partial-dedup loop used a
substring check that was too broad: any short prior assistant reply
('OK', 'Here is the answer:') would dedup a longer new partial containing
it, silently dropping the partial and resurrecting the #893 data-loss bug.

Tightened to only dedup against actual prior _partial=True markers with
exact (whitespace-stripped) content match. Three new regression tests
added (short-non-partial-prefix-does-not-dedup, exact-partial-match-still-
dedups, same-content-non-partial-does-not-dedup).

10/10 partial-cancel tests pass after the fix. Also updated CHANGELOG with
the conflict-resolution notes for #2151 vs #2136 and the #2178 test-fix.
2026-05-13 21:11:01 +00:00
Hermes Agent 3f851051cf Merge pull request #2151 into stage-350
fix: clarify cancelled chat turn status (Jordan-SkyLF)

Conflict resolution on api/streaming.py:4549-4567 (the cancel-handler
ownership guard). Both this PR and the already-shipped PR #2136 add a
guard at the same site against stale stream writebacks, from different
angles:

  - PR #2136 (HEAD): _stream_writeback_is_current(_cs, stream_id) — strictly
    dominates by checking the active_stream_id token equality.
  - PR #2151: 'worker won the race' check via (active_stream_id != stream_id
    and not pending_user_message), with _emit_cancel_event = False to suppress
    the terminal cancel event.

Resolution merges both: keep #2136's strictly-stronger condition for skip
detection, and adopt #2151's _emit_cancel_event = False semantic so the
cancel event isn't emitted in addition to skipping the writeback (when
client may have already received the successful done payload).

55/55 tests pass across cancelled-turn-status + stale-stream-writeback +
the four cancel/data-loss sibling test files.
2026-05-13 20:44:44 +00:00
Hermes Agent 5f8b834833 Merge pull request #2193 into stage-350
fix(auth) 3/3: full HMAC digest with upgrade migration bridge + restore Secure cookie heuristic (lucasrc)
2026-05-13 20:41:38 +00:00
Hermes Agent ca82f60144 Merge pull request #2191 into stage-350
fix(auth) 1/3: thread-safe login rate limiter + PBKDF2 key separation + transparent migration (lucasrc)
2026-05-13 20:41:36 +00:00
Hermes Agent f94314e164 Merge pull request #2204 into stage-350
Fix opencode-go custom provider overlap routing (Michaelyklam, closes #1894)
2026-05-13 20:41:33 +00:00
Michael Lam 1e17760a04 Fix opencode-go provider overlap routing
Closes #1894
2026-05-13 12:13:37 -07:00
Hermes Agent 7150e9fe70 Merge pull request #2202 into stage-349
feat: show early session titles on chat start (Jordan-SkyLF)
2026-05-13 19:03:03 +00:00
Jordan SkyLF 0381294f1c feat: add early session provisional titles 2026-05-13 11:37:11 -07:00
MrFant 520795fdd2 fix: preserve reasoning_content in API message whitelist
Providers like Xiaomi MiMo, DeepSeek, and Kimi require reasoning_content
to be echoed back on every assistant message in multi-turn conversations
with tool calls. Omitting it causes HTTP 400: 'The reasoning_content in
the thinking mode must be passed back to the API.'

The WebUI's _sanitize_messages_for_api() strips all fields not in
_API_SAFE_MSG_KEYS before sending conversation history to the LLM API.
reasoning_content was not in this whitelist, so it was silently dropped.

The CLI path (run_agent.py) is unaffected because it has its own
_copy_reasoning_content_for_api() logic that operates on raw message
dicts without going through this filter. This is why the same session
works from CLI but fails from WebUI with HTTP 400.

The fix adds 'reasoning_content' to _API_SAFE_MSG_KEYS so the field
passes through sanitization intact.
2026-05-14 02:29:17 +08:00
Lucas Coutinho 7e6f7372d5 fix(auth): add type hint to verify_session() 2026-05-13 14:18:47 -03:00
Lucas Coutinho 9921bbb412 docs(auth): add X-Forwarded-Proto trust warning to _is_secure_context() 2026-05-13 14:18:47 -03:00
Lucas Coutinho 07a5fe0838 fix(auth): HMAC length migration bridge and restore Secure cookie heuristic
HMAC length: create_session() now emits a full 64-char HMAC-SHA256 hex
digest instead of the truncated 32-char form. verify_session() accepts
both lengths during a transition window so existing sessions survive the
upgrade without a forced global logout. The legacy 32-char branch can be
removed once the default 30-day session TTL has elapsed.

Secure flag: introduce _is_secure_context(handler) to encapsulate the
env-var override and heuristic. Restores the getpeercert / X-Forwarded-Proto
heuristic that was present before this refactor, keeping the env-var
override (HERMES_WEBUI_SECURE) on top for proxy deployments that need
explicit control. The bare `return False` stub that the previous commit
left in place silently broke Secure-cookie delivery for all reverse-proxy
users who never set the env var.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 14:18:47 -03:00
Lucas Coutinho 2bcf411519 fix(auth): invalidate password hash cache in save_settings() on password change 2026-05-13 14:08:37 -03:00
Hermes Agent 7c2b2785e7 stage-348: apply Opus SHOULD-FIX-pre-merge — add '://' to _SENSITIVE_LOWER_MARKERS
Opus advisor flagged that PR #2171's credential prefilter only listed
specific DB scheme prefixes and form keys, letting OAuth callback URLs,
URL userinfo, signed-URL query params bypass the hard agent redactor.

Adding the generic '://' marker restores the WebUI-as-hard-safety-boundary
contract. Plain URLs without sensitive substrings still pass through
unchanged because the redactor itself only mutates sensitive substrings.

Regression-pinned with 5 new parametric cases in test_security_redaction.py
plus 1 negative-case companion. Verified test FAILS without the fix and
PASSES with it.
2026-05-13 16:54:36 +00:00
Hermes Agent 39df1a1ef3 Merge pull request #2171 into stage-348
Trim session tail response overhead (franksong2702)
2026-05-13 16:34:43 +00:00
Hermes Agent ef042ad8c2 Merge pull request #2188 into stage-348
fix: refresh context ring after compression (LumenYoung)
2026-05-13 16:34:42 +00:00
Lucas Coutinho 978dbc15d8 fix(auth): correct misleading cache invalidation comment in verify_password() 2026-05-13 12:48:35 -03:00
Lucas Coutinho 8ca29618fe fix(auth): tighten except to OSError, add type hints, fix test imports 2026-05-13 12:27:27 -03:00
Lucas Coutinho 720e69cb83 fix(auth): cache signing and PBKDF2 keys in memory, remove migration side-effect call 2026-05-13 11:13:23 -03:00
Lucas Coutinho e6e91e4973 fix(auth): thread-safe login rate limiter, PBKDF2 key separation, and migration path
Concurrent failed logins raced on _login_attempts because no lock guarded
the dict. Add _LOGIN_ATTEMPTS_LOCK and wrap both _check_login_rate() and
_record_login_attempt() with it.

Extract _load_key() to de-duplicate key file I/O. Add _pbkdf2_key() that
loads .pbkdf2_key (separate from .signing_key) so PBKDF2 and HMAC signing
no longer share a key — key reuse across cryptographic primitives is unsafe.

Update _hash_password() to use _pbkdf2_key() as its default salt, with an
optional *salt* kwarg so verify_password() can try the legacy .signing_key
salt during transparent migration. When the old hash matches, save_settings()
re-hashes with _pbkdf2_key() and _invalidate_password_hash_cache() ensures
the next request sees the upgraded hash without a restart.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 10:40:23 -03:00
Lumen Yang 3289c44fb6 fix: refresh context ring after compression 2026-05-13 14:02:28 +02:00
Frank Song da73c00f06 Harden session tail redaction prefilter 2026-05-13 18:58:49 +08:00
fxd-jason 9e45de463d fix: prevent 404 on /api/session/compress/status during session switch
Two-part fix:
- Backend: handle_get returns True (not None from j()) for compress/status
  route, preventing edge-case 404 fallback in do_GET
- Frontend: resumeManualCompressionForSession silently returns on 404
  instead of showing "Compression failed: not found" toast

Includes 6 regression tests covering backend return value, idle/empty
session responses, and frontend 404 guard presence.
2026-05-13 18:56:55 +08:00
Frank Song b7ac5a8b88 Trim session tail response overhead 2026-05-13 15:57:29 +08:00
Hermes Agent 8060b2ba3a Merge pull request #2179 into stage-347
fix(config): preserve nvidia/ prefix on NVIDIA NIM (closes #2177)

Self-built. nesquena APPROVED with extensive end-to-end trace including
cross-tool agent CLI verification and 12-shape behavioural harness.
2026-05-13 07:33:45 +00:00
nesquena-hermes 9b1d786459 fix(config): preserve nvidia/ prefix on NVIDIA NIM (closes #2177)
Move the `_PORTAL_PROVIDERS` guard in `resolve_model_provider()` to run
BEFORE the `prefix == config_provider` strip branch. The guard was added
for NVIDIA (along with the Nous portal cases in #854 / #894) but was
placed after the strip, so it never fired when `config_provider == "nvidia"`
and the model id started with `nvidia/`.

For `model_id="nvidia/nemotron-3-super-120b-a12b"`,
`config_provider="nvidia"`:
  - prefix = "nvidia", bare = "nemotron-3-super-120b-a12b"
  - prefix == config_provider → True → strip branch returned bare name
  - `_PORTAL_PROVIDERS` guard never reached
  - bare "nemotron-3-super-120b-a12b" sent to NVIDIA NIM → HTTP 404

NIM requires the full namespaced path. The fix moves the portal guard
to run first, so all portal providers (Nous, OpenCode-Zen, OpenCode-Go,
NVIDIA NIM) always preserve the full `provider/model` id regardless of
whether the prefix happens to equal the provider name.

This also closes a latent symmetric bug for the Nous case if a
`nous/<model>` id ever existed in the catalog.

Test plan:
- New `tests/test_issue2177_nvidia_prefix_preservation.py` covers:
  - nvidia/nemotron-... under nvidia (the reported case)
  - cross-namespace qwen/ and meta/ under nvidia (regression pin)
  - every static nvidia model in `_PROVIDER_MODELS` resolves to itself
  - latent nous/<model> under nous (structural ordering pin)
  - non-portal providers (anthropic) still strip — fix doesn't over-correct
- Existing portal-routing suites (test_nous_portal_routing.py,
  test_issue895_894_nous_prefix.py) continue to pass.
- Full test suite: 5320 passed, 4 skipped, 3 xpassed.

Reported on Discord by @vishnu (Nathan forwarded as #2177).
2026-05-13 07:05:57 +00:00
Hermes Agent afe42b96c1 Merge pull request #2156 into stage-346
Issue #2057 Slice 2: Add guarded worktree remove action
2026-05-13 06:56:25 +00:00
Hermes Agent 2a9d011022 Merge pull request #2160 into stage-346
Add CSP report collector endpoint (closes #2095)
2026-05-13 06:56:22 +00:00
Hermes Agent 4109394cdf Merge pull request #2159 into stage-346
Fix stale stream state in session list (closes #2157)

# Conflicts:
#	CHANGELOG.md
2026-05-13 06:56:21 +00:00
Hermes Agent 7b866df79a Merge pull request #2170 into stage-346
Skip CLI metadata lookup for native session loads

# Conflicts:
#	CHANGELOG.md
2026-05-13 06:56:20 +00:00
Hermes Agent 129e42873c Merge pull request #2158 into stage-346
Fix stale stream exception writeback guards (closes #2154)

# Conflicts:
#	CHANGELOG.md
2026-05-13 06:56:17 +00:00
MrFant a4417d11f9 fix: handle dict model entries in provider models list
When a provider's 'models' config contains dicts (e.g. {"id": "x", "label": "y"})
instead of plain strings, _apply_provider_prefix() crashes with:
  AttributeError: 'dict' object has no attribute 'startswith'

This happens because the list comprehension at line 3505 passes the raw dict
as the model ID. The fix extracts 'id' and 'label' from dict entries while
keeping string entries as-is.

Fixes the /api/models and /api/onboarding/status 500 errors.
2026-05-13 13:49:40 +08:00
Frank Song e78945e7ca Skip CLI metadata lookup for native sessions 2026-05-13 12:35:12 +08:00
Lucas Coutinho bc3f4e54a6 Cache PBKDF2 password hash to eliminate ~1s overhead on every HTTP request
get_password_hash() computes PBKDF2-SHA256 with 600k iterations to
hash the HERMES_WEBUI_PASSWORD env var.  This is called on nearly every
HTTP request via check_auth -> is_auth_enabled -> get_password_hash.

Before: ~1s of PBKDF2 per request, regardless of how many times the
same env-var value has already been hashed.  A page load hitting 5+
API endpoints would burn 5+ seconds purely on password hashing.

After: compute once on first call, cache the hex result in a module-
level variable.  Subsequent calls are a single global-variable read
(~50ns).  The env var is immutable for the process lifetime, so there
is nothing to invalidate.

Thread-safe: double-checked locking ensures that under a burst of
concurrent requests only one thread computes PBKDF2, while the fast
path (after initialisation) requires zero locks.

Security analysis: zero regression.  The hash is derived from a static
env var and a static signing key — both already readable from process
memory.  Caching does not introduce any new disclosure or replay
vector.  PBKDF2 is still used for the initial computation and for
verify_password() on login.

AI: deepseek/deepseek-v4-flash
2026-05-13 00:25:41 -03:00
Frank Song 57ee0ce069 Add CSP report collector endpoint 2026-05-13 10:52:59 +08:00
Frank Song 5ae63ddd13 Fix stale stream state in session list 2026-05-13 10:28:12 +08:00
Frank Song 9ea4f1145d Fix stale stream exception writeback guards 2026-05-13 10:23:03 +08:00
Frank Song 46c62851ad Harden worktree removal safeguards 2026-05-13 09:49:15 +08:00
Frank Song 93b7d35bfa Issue #2057 Slice 2: Add worktree remove action
Backend:
- POST /api/session/worktree/remove — removes a session's git worktree
- Guards: stream/terminal lock, dirty/untracked without force
- remove_worktree_for_session() in api/worktrees.py

Frontend:
- 'Remove Worktree' context menu item + confirm modal
- i18n keys for all 11 locales

Tests:
- 5 tests: clean remove, missing worktree, no-path, route success, 404
2026-05-13 09:11:55 +08:00
Hermes Agent 20717a0d0a Merge pull request #2136 into stage-345
fix: guard stale stream writebacks (LumenYoung)

Prevents stale WebUI stream workers from writing old results into a session
after that session has already moved on to another stream. Adds new helper
_stream_writeback_is_current() (a token equality check against the session's
active_stream_id) and short-circuits the two finalize/cancel paths when the
worker no longer owns the session writeback.
2026-05-12 23:11:48 +00:00
Jordan SkyLF 112eadc209 fix: address cancelled turn review feedback
- classify string-only CancelledError payloads as cancelled
- centralize cancel marker substring matching
- add targeted regression coverage
2026-05-12 15:43:36 -07:00
Lumen Yang 4b57b202a0 fix: guard stale stream writebacks 2026-05-13 00:05:09 +02:00
Jordan SkyLF e4d16e93c7 fix: clarify cancelled chat turn status 2026-05-12 13:26:49 -07:00
Hermes Agent 2def05f385 stage-344: apply Opus SHOULD-FIX #1+#2 — #2128 multi-tab race + stale-done re-emit
(1) compress/status no longer pops the job entry on first read of `done` payload.
    Second open tab no longer sees `idle` and a stale-job toast.
(2) compress/start no longer short-circuits to a stale `done` payload when
    re-invoked within the 10-minute TTL. Re-running /compress always starts
    fresh, so closing-and-reopening a tab mid-compress works correctly.

Third SHOULD-FIX (#2135 cfg["model"] fallback tightening when no custom_providers
entry matches) deferred to follow-up — strictly no-worse-than-master behavior.

tests/test_sprint46.py 10/10 still passes.
2026-05-12 16:37:37 +00:00
Hermes Agent 7116c680df stage-344: maintainer fix for #2142 fr locale — add LOCALES tuple entries + _LOGIN_LOCALE block
#2142 (legeantbleu) added the fr locale to static/i18n.js but didn't update:
1. tests/test_issue1488_composer_voice_buttons.py: two TestComposerVoiceButtonI18n + TestVoiceModePreferenceGate LOCALES tuples needed 'fr'
2. api/routes.py: _LOGIN_LOCALE needed an 'fr' block so the login page localizes for French users (issue #1442 parity contract)
3. tests/test_login_locale_parity.py: the test asserting 'fr' falls-back-to-'en' is inverted — fr now resolves to fr, with sibling assertions for fr-FR and fr-CA

Mirrors the stage-340 fix for the it locale (PR #2067 → maintainer adds tuple entries). 46/46 i18n tests pass after fix.
2026-05-12 16:14:47 +00:00