Skip to content

fix: hot-apply compact tool activity setting#1590

Merged
1 commit merged intonesquena:masterfrom
Michaelyklam:fix/hot-apply-compact-tool-activity
May 4, 2026
Merged

fix: hot-apply compact tool activity setting#1590
1 commit merged intonesquena:masterfrom
Michaelyklam:fix/hot-apply-compact-tool-activity

Conversation

@Michaelyklam
Copy link
Copy Markdown
Contributor

Thinking Path

  • Hermes WebUI settings should take effect in the current tab without requiring a browser refresh.
  • Compact tool activity changes the assistant-turn render path, so persisting the checkbox is not enough by itself.
  • The autosave preferences path saved simplified_tool_calling but did not update the live renderer flag or invalidate cached transcript HTML.
  • This PR keeps the fix small: hot-apply only the compact tool activity setting after autosave returns the saved server value.
  • Users can toggle compact/verbose activity rendering and immediately see the existing transcript rerender in the selected mode.

What Changed

  • Updated static/panels.js so preferences autosave captures the saved settings response.
  • When simplified_tool_calling is part of the autosaved payload, the open tab now updates window._simplifiedToolCalling, clears the message render cache, and rerenders messages immediately.
  • Added a focused regression test in tests/test_ui_tool_call_cleanup.py proving the autosave path hot-applies the renderer mode.

Why It Matters

A settings checkbox that silently waits for a refresh feels broken. Compact tool activity is especially noticeable because it changes transcript structure, not just a stored preference. Hot-applying the runtime flag and rerendering keeps settings behavior consistent with user expectations: save/toggle means visible now.

Verification

/home/michael/.hermes/hermes-agent/venv/bin/python -m pytest tests/test_ui_tool_call_cleanup.py::TestToolCallGroupingStatic::test_simplified_tool_calling_autosave_hot_applies_renderer_mode -q
/home/michael/.hermes/hermes-agent/venv/bin/python -m pytest tests/test_ui_tool_call_cleanup.py tests/test_simplified_tool_calling_setting.py tests/test_1003_preferences_autosave.py -q
node --check static/panels.js
git diff --check

Result:

1 passed
24 passed
node --check static/panels.js passed
git diff --check passed

UI media, if applicable:

  • Not attached. This is a tiny interaction-path fix with source-level regression coverage; reviewers may still want a short before/after clip showing the toggle rerendering without refresh.

Risks / Follow-ups

  • This rerenders the visible transcript when the Compact tool activity checkbox autosaves. That is intentional, but active streaming edge cases may need separate live-stream-specific polish if reviewers want toggles to transform in-flight partial rows too.
  • Other settings should follow the same persist → update runtime state → invalidate cache → rerender affected UI pattern where applicable.

Model Used

AI assisted.

  • Provider: OpenAI Codex
  • Model: gpt-5.5
  • Notable tool use: Hermes file tools, terminal/git, pytest, node syntax check, GitHub CLI

@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Thanks @Michaelyklam — small, targeted, and exactly the right kind of polish. Settings that silently wait for a refresh feel broken, and Compact tool activity is especially noticeable because it changes the transcript structure (Activity row vs individual tool cards), not just a stored boolean.

Pulled and ran:

tests/test_ui_tool_call_cleanup.py::TestToolCallGroupingStatic::test_simplified_tool_calling_autosave_hot_applies_renderer_mode → 1 passed
tests/test_ui_tool_call_cleanup.py + simplified_tool_calling + 1003_preferences_autosave → 24 passed
node --check static/panels.js → ok

Full sweep across panels / settings / preferences / autosave-tagged tests: 89 passed, no regressions surfaced.

A few notes on the change

  1. Saved-server-value vs payload-value. You correctly use the response from /api/settings:

    const saved=await api('/api/settings',{method:'POST',body:JSON.stringify(payload)});
    if(payload&&payload.simplified_tool_calling!==undefined){
      window._simplifiedToolCalling=(saved&&saved.simplified_tool_calling!==false);
      ...
    }

    This is the right call — the server is the source of truth for what was actually persisted, and the gate on payload.simplified_tool_calling!==undefined means we only re-apply when this specific setting was part of the autosave batch. Two settings dirtied at once still works correctly because the post returns the merged saved settings.

  2. saved&&saved.simplified_tool_calling!==false is interesting. This treats missing and true the same way (both → _simplifiedToolCalling = true), and only treats explicit false as off. That matches the broader Hermes WebUI default-on pattern for this setting (the global _simplifiedToolCalling is initialized true in boot.js, and the legacy default behaved as compact). If you want to be paranoid against a server that returned a partial response without this key, this is the safe direction. Worth a quick comment though, since !== false reads slightly less clearly than the equivalent === true || saved.simplified_tool_calling === undefined.

  3. Cache invalidation + rerender. clearMessageRenderCache() followed by renderMessages() is the correct order — without the cache clear, renderMessages could reuse stale per-message HTML that was rendered under the previous mode and the toggle would do nothing visible. Test asserts both, good.

  4. Active-stream edge case. Your "Risks / Follow-ups" calls this out: in-flight partial rows during a live stream may not transform cleanly under a mid-stream mode toggle. I think this is fine — toggling Compact tool activity mid-stream is rare enough that "settles correctly on the next render tick" is acceptable, and the live-stream path has its own renderer flow. If a user reports a glitch with mid-stream toggling we can add explicit handling, but I wouldn't preemptively widen scope.

  5. Single-setting hot-apply pattern. The PR description mentions "Other settings should follow the same persist → update runtime state → invalidate cache → rerender affected UI pattern where applicable." Agreed — there are at least three other settings I can think of that have similar "needs refresh to take effect" complaints (font_size, language, theme/skin in some paths). Not in scope for this PR, but worth a follow-up issue. I can file one if you'd like, or you can if you'd prefer — let me know.

One small worth-checking item

The test asserts the strings window._simplifiedToolCalling, clearMessageRenderCache(), and renderMessages() appear in the function body. That's a reasonable static check, but it doesn't catch the case where someone refactors clearMessageRenderCache to be called after renderMessages (which would defeat the cache-invalidation goal). If you wanted a slightly stricter test you could check ordering — but the substring test is fine as a regression smoke check, and the runtime suite covers behavior elsewhere.

Verdict

Tight diff, solid coverage, sensible scope. Will queue for stage review.

nesquena-hermes pushed a commit that referenced this pull request May 4, 2026
… — 4094→4111 tests

- #1586 (Michaelyklam): login asset SW cache exemption
- #1590 (Michaelyklam): hot-apply compact tool activity setting
- #1591 (Michaelyklam): first-turn sidebar visibility (optimistic upserts)
- #1592 (Michaelyklam): turn duration display (Done in 1m 12s) + Opus follow-up (truthy-check on _pending_started_at)
- #1464 (JKJameson, maintainer-augmented): workspace dropdown sort+search+chip-sync (rebased + ternary fix + regression test)

Maintainer-side test fixes in stage:
- tests/test_465_session_branching.py: widen compact() search window 1500→3000
- tests/test_regressions.py: anchor on api('/api/chat/start' instead of comment line

Browser API sanity: 11/11 passed. Live UX verification: vision-confirmed dropdown sort+search+empty-state on test server. Opus advisor: SHIP AS-IS.
@nesquena-hermes nesquena-hermes closed this pull request by merging all changes into nesquena:master in 4559163 May 4, 2026
pull Bot pushed a commit to JamesWilliam1977/hermes-webui that referenced this pull request May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants