fix: isolate profile cookie per webui instance#1756
fix: isolate profile cookie per webui instance#1756ng-technology-llc wants to merge 1 commit intonesquena:masterfrom
Conversation
|
Reading A couple of small edges worth tightening before merge: Empty-string env var slips through
def get_profile_cookie_name() -> str:
return os.getenv('WEBUI_PROFILE_COOKIE_NAME', PROFILE_COOKIE_NAME)That feeds def get_profile_cookie_name() -> str:
name = os.getenv('WEBUI_PROFILE_COOKIE_NAME', '').strip()
return name or PROFILE_COOKIE_NAMEOne extra test asserting "empty env var falls back to No validation of cookie-name shapeRFC 6265 cookie names can't contain whitespace,
Option 1 is more honest — a misconfigured cookie name is an operator error, not something to paper over. Either way it's worth at least one test exercising the invalid-name path so the behaviour is pinned. Cookie clearing pathI don't see a corresponding "clear cookie" / "logout" path in the diff that would need updating, and the existing tests in Cross-port cookie scope is the right framingThe PR description correctly identifies the underlying browser behaviour. For operators who want shared profile state across instances on the same host, the existing default keeps working; for operators who want isolation, the env var gives them an opt-in escape hatch without breaking any existing deployment. That's the right shape for this change. VerdictLGTM in principle — the two edges above (empty-string fallback, invalid-name handling) are worth addressing before merge but neither is large. Test coverage is in the right place and reads cleanly against the existing |
ab2c2b5 to
8385f90
Compare
|
Thanks @ng-technology-llc — this shipped in v0.51.14 (commit GitHub didn't auto-close because the merge commit only references the squash-merged stage branch, not your fork's commit directly — closing manually for hygiene. Live now on existing installs after Release notes: https://github.com/nesquena/hermes-webui/releases/tag/v0.51.14 |
nesquena#1757, nesquena#1760, nesquena#1761) Constituent PRs: - nesquena#1760 (@ai-ag2026) preserve pending user turn on stream errors. Closes nesquena#1361. - nesquena#1761 (@dso2ng) scope terminal stream cleanup to owner session. Refs nesquena#1694. AUTO-FIX applied: restored !INFLIGHT[S.session.session_id] disjunct in _setActivePaneIdleIfOwner (regression introduced by helper centralization). - nesquena#1756 (@ng-technology-llc) isolate profile cookie per webui instance. Closes nesquena#803. - nesquena#1757 (@skspade) tri-state gateway status (alive: True/False/None). Tests: 4642 → 4662 collected (+20). 4649 passed, 9 skipped (test-isolation prong-2 noise), 3 xpassed, 0 failed in 152s. Pre-release verification: - All 4 PRs CI-green or rebased clean (nesquena#1757 had stale base; CHANGELOG conflict auto-resolved by dropping the PR's redundant entry). - node -c clean on static/messages.js + static/panels.js. - 11/11 browser API endpoints PASS. - Pre-stamp re-fetch: all PR heads match local rebases. - Opus advisor: SHIP, all 5 verification questions clean, 0 MUST-FIX, 0 SHOULD-FIX. - Two NICE-TO-HAVE coverage gaps absorbed in-release: (1) test_sprint36.py asserts !INFLIGHT[...] disjunct in helper body (2) test_issue1361_cancel_data_loss.py adds structural-grep test to pin _materialize_pending_user_turn_before_error call sites at error branches. Closes nesquena#803, nesquena#1361, nesquena#1694.
Summary
WEBUI_PROFILE_COOKIE_NAMEso multi-instance WebUI deployments can isolate the active-profile cookie per process.hermes_profilefor backwards compatibility.Why
Browsers share cookies across ports on the same host. When multiple Hermes WebUI instances run on the same hostname but different ports, a profile switch in one instance can send the same
hermes_profilecookie to another instance. That other instance may then treat the foreign profile name as active and initialize profile-scoped state under the wrong Hermes home.This keeps the existing per-client cookie + thread-local profile isolation model, but lets operators choose a distinct profile cookie name per WebUI process.
Test plan
python -m pytest tests/test_issue803.py::TestProfileCookieHelpers -qpython -m pytest tests/test_issue803.py tests/test_issue798.py tests/test_issue1611_session_profile_filtering.py -qpython -m pytest tests/test_sprint31.py tests/test_settings_navigation_and_detail_refresh.py -q