HERMES-GIELIE/static
ai-ag2026 7707ea1d2a fix(webui): stop password managers autofilling the search box, and keep unsaved sessions startable
Two independent defects that chain into "new conversations cannot be started":
every POST /api/session/draft and /api/chat/start 404s a few seconds after
POST /api/session/new returned 200.

1. Search inputs are parsed as username fields.

index.html contains no <form> at all, but does contain password inputs (the
Settings "Access Password" panel). Chromium therefore groups the document's
unowned fields into one synthetic password form and picks the first text input
in the DOM — #sessionSearch, the sidebar conversation filter — as that form's
username field, then autofills the saved account name into it on load.
autocomplete="off" was already present; it is ignored for credential
heuristics.

The autofill fires oninput -> filterSessions() -> GET /api/sessions/search
?content=1&depth=5: a full content search the user never asked for, repeated
on every page load.

Fix: give the four search inputs type="search" plus the per-manager opt-outs
(data-1p-ignore / data-lpignore / data-bwignore / data-form-type), and give the
Settings password inputs a real <form> owner with proper autocomplete tokens so
Chromium scopes the credential form to them instead of to the whole document.
The form uses display:contents, so layout is unchanged. CSS suppresses WebKit's
native search clear button, since these fields ship their own
(#sessionSearchClear).

2. A never-persisted session is treated as evictable.

new_session() intentionally keeps a session in RAM until its first message
(#1171), so the SESSIONS cache is its only copy. _session_is_evictable()
(#4765) short-circuited on zero messages, reasoning that an empty shell "is
recreated on next access". It is not: get_session() has no recreate path and
raises KeyError, so both routes 404 and the session can never be started.

The content search from (1) pulls every hit through get_session(), which blows
past sessions_cache_max (default 300) and evicts the session being composed.
That is why this reproduces within seconds on an install with ~1700 sessions,
and why it grew worse as the session count rose.

Fix: require proof of persistence before evicting, for empty sessions too —
which is what the function's own docstring already promised ("Its full state is
already persisted to the JSON sidecar"). The zero-message branch was the single
path that bypassed it. #4765's memory bound is unaffected: sessions loaded from
disk remain evictable, and its existing tests still pass.

Trade-off: an unsaved empty session now stays resident for the process
lifetime (one per "New Conversation" click, an empty object each). That is a
deliberate application of the function's stated invariant — "slightly more RAM
for a session we are unsure about is strictly better than evicting an unsaved
session". Bounding it by age instead would also work if maintainers prefer.

Validation:
  pytest tests/test_issue4765_sessions_lru_eviction.py  ->  9 passed
  The added regression test fails on the unpatched predicate (verified by
  reverting api/models.py alone) and passes with the fix.

Note: (1) fixes what triggers the churn, (2) fixes what turns that churn into
an unstartable session. Either fix alone leaves a real defect in place, so
they are submitted together.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-15 10:06:41 +02:00
..
vendor fix: protect pipes inside backtick code spans in renderMd tables 2026-06-25 08:25:58 +00:00
apple-touch-icon.png Swap brand to new cyan caduceus: favicon family, titlebar + empty-state logo (theme-safe navy badge), remove per-skin titlebar fill overrides 2026-06-28 07:44:16 +00:00
assistant_turn_anchors.js feat(chat): add final answer only activity display mode (#5706, picker grid fixed) 2026-07-07 14:38:08 +00:00
boot.js feat(sessions): honor the agent's worktree config default in /api/session/new 2026-07-14 04:35:06 +00:00
commands.js fix(sessions): guard all auto-mint paths + strict config/body parsing (gate review) 2026-07-14 04:35:06 +00:00
extension_settings.js fix(extensions): prune malformed browser overrides (#5094) 2026-06-28 18:31:43 -04:00
favicon-32.png Swap brand to new cyan caduceus: favicon family, titlebar + empty-state logo (theme-safe navy badge), remove per-skin titlebar fill overrides 2026-06-28 07:44:16 +00:00
favicon-192.png Swap brand to new cyan caduceus: favicon family, titlebar + empty-state logo (theme-safe navy badge), remove per-skin titlebar fill overrides 2026-06-28 07:44:16 +00:00
favicon-512.png Swap brand to new cyan caduceus: favicon family, titlebar + empty-state logo (theme-safe navy badge), remove per-skin titlebar fill overrides 2026-06-28 07:44:16 +00:00
favicon-512.svg Swap brand to new cyan caduceus: favicon family, titlebar + empty-state logo (theme-safe navy badge), remove per-skin titlebar fill overrides 2026-06-28 07:44:16 +00:00
favicon.ico Swap brand to new cyan caduceus: favicon family, titlebar + empty-state logo (theme-safe navy badge), remove per-skin titlebar fill overrides 2026-06-28 07:44:16 +00:00
favicon.svg Swap brand to new cyan caduceus: favicon family, titlebar + empty-state logo (theme-safe navy badge), remove per-skin titlebar fill overrides 2026-06-28 07:44:16 +00:00
i18n.js refine(#2147): drop confusing Binding row, keep localization + Example 2026-07-14 04:04:39 +00:00
icons.js stage #4581 onto master (v0.51.556) — surface escape-target symlinks as display-only workspace rows 2026-06-21 09:15:22 +00:00
index.html fix(webui): stop password managers autofilling the search box, and keep unsaved sessions startable 2026-07-15 10:06:41 +02:00
login.js Fix login connectivity retry cleanup: clearInterval not clearTimeout 2026-07-09 03:41:42 +00:00
manifest.json
messages.js fix(chat): key reasoning fallback to exact anchor row 2026-07-15 06:58:02 +08:00
onboarding.js feat(sessions): honor the agent's worktree config default in /api/session/new 2026-07-14 04:35:06 +00:00
outline.js
panels.js fix(sessions): guard all auto-mint paths + strict config/body parsing (gate review) 2026-07-14 04:35:06 +00:00
pwa-startup.js
sessions.js fix(sessions): cascade delegated subagents on parent deletion 2026-07-14 18:10:03 +08:00
share.html Rebase #5337 (public read-only conversation sharing) onto master 2026-07-11 01:39:42 +00:00
share.js Rebase #5337 (public read-only conversation sharing) onto master 2026-07-11 01:39:42 +00:00
style.css fix(webui): stop password managers autofilling the search box, and keep unsaved sessions startable 2026-07-15 10:06:41 +02:00
sw.js fix: focus the existing chat tab when a notification is clicked instead of opening a new tab 2026-06-13 14:42:41 -07:00
terminal.js Handle terminal output EventSource transport errors 2026-07-09 02:26:20 +00:00
ui.js fix(chat): align reasoning fallback identity key 2026-07-15 07:10:02 +08:00
workspace.js Release: fix workspace image previews + downloads under subpath mounts (#5830) (#5856) 2026-07-09 14:38:53 -07:00