Skip to content

Fix session renaming - add ondblclick handler and guard#1465

Merged
1 commit merged intonesquena:masterfrom
AlexeyDsov:2026-05-02-fix-rename-session
May 2, 2026
Merged

Fix session renaming - add ondblclick handler and guard#1465
1 commit merged intonesquena:masterfrom
AlexeyDsov:2026-05-02-fix-rename-session

Conversation

@AlexeyDsov
Copy link
Copy Markdown
Contributor

Fix session renaming functionality

Problem

Rename session interface wouldn't open due to issues.

Changes

  • Added guard to prevent renaming loading sessions
  • Added ondblclick handler for reliable double-click detection

AI

Generated with AI assistance.

@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Thanks for the PR, but I think this overlaps with code that already exists, and the guard logic looks inverted. Worth a look before this gets merged.

1. Manual double-tap detection already exists

static/sessions.js lines ~1733-1797 already implements double-click → rename via a pointerup-based handler with _lastTapTime tracking. Quoting the comment in the existing code:

// Use pointerup + manual double-tap detection instead of onclick/ondblclick.
// onclick/ondblclick are unreliable on touch devices (iPad Safari especially):
// hover-triggered layout shifts, ghost clicks, and 300ms delay all break
// single-tap navigation. pointerup fires immediately on both mouse & touch.

That handler calls startRename() on the second pointerup within 350ms. Adding el.ondblclick on top of it means on a desktop double-click both handlers fire — the second pointerup calls startRename() first, sets _renamingSid, then dblclick arrives and short-circuits on the if(_renamingSid) return; guard. Functionally that "works" but it's two parallel mechanisms doing the same job.

What specific failure mode were you seeing where the existing pointerup-based double-tap was not opening the rename UI? On which platform/browser? If the existing handler is broken on some path, fixing that handler is probably better than layering a second handler on top.

2. The _loadingSessionId guard reads inverted

if (_loadingSessionId && _loadingSessionId !== s.session_id) return;

This blocks rename when _loadingSessionId is set and the session being renamed is not the one loading. So if session B is currently loading, you can't rename session A while you wait — but you can rename session B (the one that's actually mid-load).

I think the intent was the opposite: prevent renaming a session whose load is still in progress, while letting the user rename other sidebar items freely. That would be:

if (_loadingSessionId === s.session_id) return;

Is the inverted form intentional? The PR description says "prevent renaming loading sessions" which matches what I'd expect, but the code does the opposite.

3. Test coverage

This touches the rename gating logic which is exercised by tests/test_session_rename.py and adjacent tests — worth running pytest tests/test_session_rename.py -q and ideally adding a regression test for whatever specific scenario you hit (e.g. "rename UI opens on dblclick when X" so we don't regress later).

I'd hold off on merging until (1) is clarified — if the existing pointerup detection is indeed broken on some platform, the right fix is probably patching that handler, not adding a parallel ondblclick. (2) looks like a real bug regardless.

@nesquena-hermes nesquena-hermes closed this pull request by merging all changes into nesquena:master in 5650d11 May 2, 2026
Thanatos-Z pushed a commit to Thanatos-Z/hermes-webui that referenced this pull request May 2, 2026
Thanatos-Z pushed a commit to Thanatos-Z/hermes-webui that referenced this pull request May 2, 2026
…w-up

- CHANGELOG.md: v0.50.267 entry detailing nesquena#1454/nesquena#1474/nesquena#1461/nesquena#1465/nesquena#1467/nesquena#1460/nesquena#1473
  + Opus advisor SHOULD-FIX trailing-empty guard for _norm_model_id
- ROADMAP.md: bump to v0.50.267, 3776 tests collected
- TESTING.md: bump header + total to 3776
- api/config.py: trailing-empty fallback in _norm_model_id (parts[-1] or s)
- static/ui.js: mirror trailing-empty fallback in _normalizeConfiguredModelKey
- tests/test_norm_model_id_trailing_empty_guard.py: 5 regression tests
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