Commit Graph

979 Commits

Author SHA1 Message Date
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
Hermes Agent 5f33901b6a Merge pull request #2150 into stage-345
feat: add manual provider usage refresh (Jordan-SkyLF)

Adds a 'Refresh usage' button on the Provider quota card in Settings → Providers,
with cache: 'no-store' fetch + browser cache-bust query string. Pure browser-side
cache-busting; the server-side /api/provider/quota endpoint has no cache layer
yet (refresh=1 query param is currently a no-op server-side; the win is bypassing
browser/proxy/SW caches).
2026-05-12 23:11:49 +00: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 062ef74ec0 fix: guard provider quota refresh fallback button state 2026-05-12 15:41:19 -07:00
Lumen Yang 4b57b202a0 fix: guard stale stream writebacks 2026-05-13 00:05:09 +02:00
Jordan SkyLF b1f752ad3f feat: add provider quota refresh control 2026-05-12 13:17:27 -07: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
Hermes Agent c677c19a8f Merge pull request #2128 into stage-344
Fix manual compression proxy timeouts (closes #2087)

# Conflicts:
#	CHANGELOG.md
2026-05-12 16:13:01 +00:00
Hermes Agent 1ee8627acb Merge pull request #2135 into stage-344
Fix custom live model scoping (closes #2126, refs #2131)

# Conflicts:
#	CHANGELOG.md
2026-05-12 16:13:00 +00:00
Hermes Agent aa85bd2e7c Merge pull request #2138 into stage-344
fix: recover from stale deleted workspaces
2026-05-12 16:12:58 +00:00
Hermes Agent 23425b23c8 Merge pull request #2129 into stage-344
fix: purge missing inflight sessions (closes #2092)
2026-05-12 16:12:57 +00:00
Hermes Agent 8dd0b4ec31 Merge pull request #2139 into stage-344
fix: audit turn journal terminal collisions
2026-05-12 16:12:56 +00:00
Hermes Agent a06952ab00 Merge pull request #2140 into stage-344
Preserve fallback provider credential hints (closes #2133)

# Conflicts:
#	CHANGELOG.md
2026-05-12 16:12:54 +00:00
Hermes Agent 4c5a246647 Merge pull request #2125 into stage-344
docs: clarify compression anchor helpers (closes #2093)
2026-05-12 16:12:53 +00:00
Hermes Agent 8520755bd2 Merge pull request #2130 into stage-344
feat: load full lineage segments on demand
2026-05-12 16:12:52 +00:00
Hermes Agent 13c3646c55 Merge pull request #2121 into stage-344
fix: stack analytics usage cards on mobile (refs #2104) — TEST CONFLICT EXPECTED

# Conflicts:
#	tests/test_insights.py
2026-05-12 16:12:40 +00:00
Hermes Agent 2cccb8abcc Merge pull request #2120 into stage-344
fix: bucket long-range daily token charts (closes #2103)
2026-05-12 16:12:11 +00:00
Hermes Agent 56032151f7 Merge pull request #2143 into stage-344
Fix iPhone PWA chat bottom scroll stutter
2026-05-12 16:12:09 +00:00
Hermes Agent 45ac810a37 Merge pull request #2141 into stage-344
Fix Settings System mobile version wrapping (closes #2102)

# Conflicts:
#	CHANGELOG.md
2026-05-12 16:11:55 +00:00
Hermes Agent 76cf06a1a1 Merge pull request #2137 into stage-344
Fix login health probe credentials (closes #2122)
2026-05-12 16:11:42 +00:00
dobby-d-elf 099fdaf012 fix(ui): stabilize chat bottom scrolling on iPhone PWA 2026-05-12 07:47:21 -06:00
Frank Song 76e611d49f Preserve fallback provider credential hints 2026-05-12 20:42:55 +08:00
Frank Song b3f8bee96f Fix settings system mobile version wrapping 2026-05-12 20:42:55 +08:00
dobby-d-elf 516d942d6a refactor: reduce stale workspace recovery fix 2026-05-12 06:28:35 -06:00
Michael Lam f5f59a5813 fix: audit turn journal terminal collisions 2026-05-12 05:20:06 -07:00
Frank Song b718220077 Fix login health probe credentials 2026-05-12 20:09:54 +08:00
Frank Song b7c5ba640c Fix custom live model scoping 2026-05-12 20:05:28 +08:00
dobby-d-elf e03c197cdf fix: recover from stale deleted workspaces 2026-05-12 05:52:16 -06:00
Dennis Soong f1b2a21bd4 feat: lazy-load full lineage segments 2026-05-12 18:02:49 +08:00
Michael Lam dd543e4175 fix: purge missing inflight sessions 2026-05-12 02:57:37 -07:00
Frank Song 8fa92c680f Fix manual compression proxy timeouts 2026-05-12 17:33:59 +08:00
Michael Lam 265496782a docs: clarify compression anchor helpers 2026-05-12 01:43:16 -07:00
Michael Lam 7a16d09f10 fix: add Portuguese session management i18n 2026-05-11 23:23:41 -07:00
Michael Lam a41b4d5afc fix: stack analytics usage cards on mobile 2026-05-11 23:07:35 -07:00
Michael Lam 245288c00d fix: bucket long-range daily token charts 2026-05-11 23:01:13 -07:00
Hermes Agent 8b8fa0b885 stage-343: add bash 3.2 compat regression tests + CHANGELOG
- New tests/test_ctl_bash32_compat.py (5 static-pattern assertions):
  * strict-mode is enabled (set -euo pipefail)
  * preserved[@] iteration is length-guarded (PR #2117)
  * CTL_BOOTSTRAP_ARGS[@] uses +alt expansion (commit 025f137f)
  * defense-in-depth: catch any future raw "${arr[@]}" w/o whitelist
  * denylist of bash 4+ features (declare -A, mapfile, [[ -v ]], etc.)
- Verified test fails when fix reverted, passes when restored.
- CHANGELOG: close v0.51.49, open Unreleased for #2117.
2026-05-12 05:36:31 +00:00
Hermes Agent 4d64f6eee9 Merge pull request #2116 from starship-s/fix/codex-quota-pool-usage
fix(providers): load Codex quota from credential pool
2026-05-12 05:10:23 +00:00
Hermes Agent 1c659f374f Merge pull request #2109 from franksong2702/issue-2057-worktree-status
Add read-only worktree status endpoint (refs #2057)
2026-05-12 05:10:18 +00:00
dobby-d-elf ff0830de4d fix(ui): smooth iPhone PWA bottom-edge bounce in chat 2026-05-11 22:08:32 -06:00
starship-s 573fc25f96 fix(providers): load Codex quota from credential pool 2026-05-11 21:46:24 -06:00
Frank Song 4e8899592d Prefer worktree retention responses in session UI 2026-05-12 10:17:12 +08:00
Frank Song 6e1e9fafbe Add worktree status endpoint 2026-05-12 10:08:01 +08:00
Frank Song 2da4f108c5 Clarify worktree session archive/delete semantics
(cherry picked from commit f5c8fb58d1)
2026-05-12 00:05:05 +00:00
nesquena-hermes e20eb2c784 fix: skip budget-doubling title retry for reasoning-only responses (#2083)
Reasoning models (Qwen3-thinking via LM Studio, DeepSeek-R1, Kimi-K2,
etc.) can burn their entire output budget on hidden reasoning tokens and
emit no visible content. The previous title-generation retry path
classified that as llm_length and doubled the budget — but the second
call produces the same shape, so the retry only doubled the GPU/credit
burn. Repeated across the two prompts in _title_prompts() this came to
~3000 reasoning tokens of GPU work per new chat. On local LM Studio
servers behind a custom: provider (where is_lmstudio=False means
reasoning_effort: none never reaches the model) it manifested as the GPU
never going idle after a prompt.

Fix:
  - _extract_title_response: classify reasoning-bearing empty responses
    as llm_empty_reasoning regardless of finish_reason. The presence of
    reasoning_content is the diagnostic signal, not finish_reason.
  - _title_retry_status: drop llm_empty_reasoning from the retry set.
    Length-truncated responses WITHOUT reasoning still retry (those are
    legitimately recoverable by a larger budget).
  - Add _title_should_skip_remaining_attempts() and break out of the
    prompt-iteration loop on empty-reasoning. A second prompt against
    the same model would produce the same shape.
  - Falls through to _fallback_title_from_exchange for a local-summary
    title.

Tests updated to invert the previous reasoning-retry assertions:
  - test_aux_short_circuits_on_empty_reasoning_without_retrying
  - test_aux_still_retries_finish_length_without_reasoning
  - test_agent_route_short_circuits_on_empty_reasoning_without_retrying
  - test_agent_route_still_retries_finish_length_without_reasoning

Companion agent-side work (LM Studio classifier for custom: providers)
is tracked separately on the hermes-agent side; this WebUI fix is the
belt-and-braces guard so the loop stops regardless of agent classifier
state.

Reported by @darkopetrovic. Closes #2083.

Co-authored-by: darkopetrovic <darkopetrovic@users.noreply.github.com>
(cherry picked from commit efeae4a86e)
2026-05-12 00:04:11 +00:00
nesquena-hermes 02ecc5aeea fix(tests): provide LOCALES on TestVoiceModePreferenceGate
PR #2067 made TestVoiceModePreferenceGate.test_settings_pane_has_voice_mode_i18n_keys
adaptive via self.LOCALES but only defined LOCALES on the sibling class
TestComposerVoiceButtonI18n. AttributeError on CI.

Mirror the tuple to TestVoiceModePreferenceGate so the count assert resolves
to 10 with Italian present.

Co-authored-by: Samuel Gudi <samuel.gudi.official@gmail.com>
2026-05-11 23:14:20 +00:00
Samuel Gudi 23a2ad818f fix(tests): update hardcoded locale counts for Italian (it)
6 test files had hardcoded locale counts/lists that broke when
the Italian locale block was added:

- test_issue1488_composer_voice_buttons.py: added 'it' to LOCALES,
  replaced assert count == 9 with len(self.LOCALES)
- test_issue1560_password_env_var_lock.py: added 'it' to LOCALES
- test_1560_password_env_var_no_op.py: added 'it' to EXPECTED_LOCALES
- test_login_locale_parity.py: bumped floor from 9 to 10, added 'it'
- test_stage268_opus_followups.py: bumped floor from 9 to 10

(cherry picked from commit f5e42cec9b)
2026-05-11 23:13:55 +00:00
ai-ag2026 98c9a3de72 test: tighten CI and console hygiene
(cherry picked from commit bd9e6df71c)
2026-05-11 23:13:16 +00:00
Lumen Yang e37c69cf57 fix(agent-health): treat stale running gateway as unknown
(cherry picked from commit 4be346fece)
2026-05-11 23:13:09 +00:00
ai-ag2026 52fedbc783 feat: add per-cron toast notification toggle 2026-05-11 21:58:35 +02:00
nesquena-hermes 96ca83bf53 fix(security): drop unsafe-eval + add jsdelivr to CSP, sanitize plugin error
Opus stage-339 review SHOULD-FIX items:

1. server.py: drop 'unsafe-eval' from CSP report-only policy.
   Verified by grepping all production JS — zero matches for eval(),
   new Function(), or string-form setTimeout/setInterval. Keeping it
   was a gratuitous privilege.

2. server.py: add https://cdn.jsdelivr.net to script-src + style-src.
   index.html loads Prism/xterm/katex from this CDN with SRI hashes —
   without the allowance every page load fires known-good CSP violations
   that drown out real signal once a collector is wired.

3. api/commands.py: sanitize plugin command error. Previously returned
   f'Plugin command error: {exc}' which would leak paths/env from
   FileNotFoundError('/etc/something/secret.key') etc. Now returns only
   the exception type name; full traceback goes to server log.

Test asserts updated to match the new policy shape.

Co-authored-by: Opus advisor <opus-advisor@hermes.local>
2026-05-11 17:53:02 +00:00