Commit graph

6379 commits

Author SHA1 Message Date
nesquena-hermes
f8c9f9e08c harden #5511: providers: scan honors active-provider ownership guard
Codex 2nd CORE: the new providers: scan didn't honor the _skip_custom_providers
active/default ownership guard (config.py:2535) that the custom_providers scan
uses. So with an active provider (e.g. ai-gateway) + model.default=gpt-5 AND a
providers.openai.models.gpt-5 entry, the scan hijacked gpt-5 to openai instead of
the active ai-gateway path. Fix: when _skip_custom_providers is true, the
providers: scan only considers the active provider's own canonical slug (skip all
other slugs). Regression tests: active-provider-owns-default not hijacked (fails
without fix); active provider's OWN providers: entry still matches.

Co-authored-by: akay64 <akay64@users.noreply.github.com>
2026-07-04 07:10:47 +00:00
nesquena-hermes
cca3b6c279 release #5511: exclude Copilot from providers: routing scan + regression tests + CHANGELOG
Gate-cert (nesquena-hermes) + Codex found 1 CORE: akay64's new providers: scan in
resolve_model_provider() iterated ALL providers.<slug>.models INCLUDING
providers.copilot.models — but that key is a documented per-model SETTINGS map
(reasoning_effort/limits), NOT a routing allowlist (config.py exception). So a
Copilot per-model settings entry hijacked that model's routing to Copilot
(Codex reproduced gpt-5 -> copilot). Fix (Codex-exact): skip copilot in the scan.

Added the regression tests the PR shipped 0 of: user-defined allowlist routes;
active-openai + providers.copilot.models (dict + list shapes) stays openai
(both verified to fail without the exclusion).

Co-authored-by: akay64 <akay64@users.noreply.github.com>
2026-07-04 07:06:05 +00:00
nesquena-hermes
ec9f77c319 Merge commit '87404d76f036' into release/stage-5511 2026-07-04 06:57:54 +00:00
nesquena-hermes
8e26cc03d0
Merge pull request #5520 from nesquena/release/stage-p1
Release — session SSE contract RFC (#5513, addresses #4812)
2026-07-03 23:55:45 -07:00
nesquena-hermes
a94dacb679 release #5513: fix live-emission anchor + source-validate all run-journal anchors
Codex re-gate finding: line 83 cited api/routes.py:15703-15762 for live SSE id:
emission, but that range is replay/helper code — the actual _sse_with_id() call
sites are 15918 (live /api/chat/stream), 15811 (runner-observe), 15721/15734
(journal replay). Corrected the bullet with the real, distinct anchors.

Also extended the test (test_rfc_run_journal_anchors_land_on_real_source) to
validate each named-symbol anchor (_parse_run_journal_event_id/_after_seq,
_runner_event_id, _replay_run_journal) + the live-emission anchor against the
actual source token, so no stale line number can silently pass.

Co-authored-by: rodboev <rodboev@users.noreply.github.com>
2026-07-04 06:48:35 +00:00
nesquena-hermes
6182ae044b release #5513: correct RFC source anchors + self-validating test
Codex Phase-1 gate found the RFC cited stale/wrong source anchors (docs-only, but
actively misleading to future implementers): /api/sessions/events is routed at
routes.py:12345-12346 (RFC said 12320-12321 = /api/chat/cancel);
_handle_session_events_stream at 16177 (RFC said 16142 = a gateway-sse comment);
replay reads after_event_id/after_seq QUERY PARAMS (RFC said Last-Event-ID header
— that's the *proposed* new-endpoint contract, not current). Corrected all six
routes.py anchors + the replay-mechanism description, verified each against master.

The accompanying test asserted the WRONG anchors and passed (codifying the error).
Rewrote test_rfc_cites_current_global_endpoint_source to parse every routes.py
anchor from the RFC and verify it lands on the real /api/sessions/events route +
_handle_session_events_stream definition — so it now catches drift instead of
locking in a stale number.

Co-authored-by: rodboev <rodboev@users.noreply.github.com>
2026-07-04 06:37:18 +00:00
nesquena-hermes
174dec88eb Merge commit 'dcaf5a69aa84' into release/stage-p1 2026-07-04 06:25:00 +00:00
nesquena-hermes
46b630db52
Merge pull request #5518 from nesquena/release/stage-5516
Release — transcript re-pin when composer grows (#5516, closes #5514/#5515)
2026-07-03 23:20:18 -07:00
nesquena-hermes
947fa2b92d release #5516: fix stale test docstring (#composerWrap not textarea) 2026-07-04 06:15:42 +00:00
nesquena-hermes
c77f4cf014 release #5516: composer-grow re-pin — hot-path optimization + CHANGELOG
Addresses Greptile P2 nit: autoResize() now only calls the re-pin when the
composer actually grew (offsetHeight before/after compare), skipping the DOM
read on a no-height-change keystroke. The #composerWrap ResizeObserver remains
the safety net for growth paths that bypass autoResize. Test tightened to assert
the grow-guard. CHANGELOG entry added (self-built, release owns changelog).
2026-07-04 06:06:05 +00:00
nesquena-hermes
042d7f3ec7 Merge commit '7e7e71f6953f' into release/stage-5516 2026-07-04 05:59:19 +00:00
nesquena-hermes
259729bb0a
Merge pull request #5517 from nesquena/release/stage-5504
Release — deleted-session ghost fix (#5504, closes #5498)
2026-07-03 22:52:28 -07:00
nesquena-hermes
7e7e71f695 fix(chat): widen composer re-pin observer to #composerWrap (Fable #5516 finding)
Fable senior review (COMMENT, no blockers) + DRY nit:

- Widen the ResizeObserver from #msg to the whole #composerWrap so growth from the
  attachment tray / selection chips (not just textarea rows) also re-pins a bottom-
  pinned reader. Fable flagged tray/chip growth as a likely REMAINING #5515 trigger
  — same viewport-shrink physics, now covered by the same guarded re-pin at one seam.
  #composerWrap contains #msg, so the textarea path is still covered.
- DRY: _repinMessagesAfterComposerResize() now reuses _messageBottomDistance()
  instead of re-implementing the bottom-distance expression inline.

Re-verified live (composer grow -> bottomDist stays 0) + 524 scroll/composer
regression tests green + 6 issue tests green.
2026-07-04 05:52:14 +00:00
Rod Boev
dcaf5a69aa test(docs): harden heartbeat rfc contract guard (#4812) 2026-07-04 01:49:24 -04:00
nesquena-hermes
dde008748e fix(chat): re-pin transcript to bottom when the composer grows (#5514, #5515)
#5514 (deterministic): with the chat pinned to the bottom, growing the composer
past one row (multi-line typing, Shift+Enter, a multi-line / WisprFlow paste)
shrinks the flex:1 .messages viewport by the same delta. scrollTop is unchanged
but max-scrollTop rose by delta, so the reader is stranded delta-px above the
bottom — the transcript 'scrolls up one row per composer row.' autoResize()
resized the textarea and called updateSendBtn() but never re-pinned the transcript.
Reproduced live: composer 176px -> viewport shrank 745->613 -> transcript stranded
132px above bottom while _scrollPinned stayed true.

#5515 (intermittent 'random scroll up'): the same viewport-shrink from composer
growth via paths that don't route through input->autoResize (paste, draft restore,
programmatic value set, reflow) reads to the user as a random upward jump. Covered
by a ResizeObserver seam (below).

Fix: new _repinMessagesAfterComposerResize() (static/ui.js) re-pins to the bottom
ONLY when the reader is genuinely still pinned (honors _messageUserUnpinned /
_scrollPinned — never yanks a reader who scrolled away; verified live). Called from:
 (a) autoResize() after the height write, and
 (b) a ResizeObserver on the #msg textarea that re-pins on GROW only, catching
     every composer height-change path (not just the typed-input seam).

Verified live on a 40-message seeded session: pinned reader stays at bottomDist=0
after a 4-line composer grow; an unpinned (scrolled-up) reader is NOT moved.

Tests: tests/test_issue5514_composer_grow_scroll_pin.py (3 static wiring + 3 node-vm
behavioral). 524 scroll/composer regression tests across 39 files still green.

NOTE on #5515: this resolves the composer-growth cause (which the reporter's
WisprFlow-paste symptom points at). If a purely non-composer intermittent jump
persists, the remaining suspect is touch-device overflow-anchor:auto on content-
above height change — that path has no repro yet and is tracked as needinfo on
#5515.
2026-07-04 05:41:33 +00:00
nesquena-hermes
6c88c0360c harden #5504: dedup audit tombstone item when .bak + state.db row both survive
Codex v4 SILENT finding: my audit Finding-2 fix made the orphan-.bak branch emit
a state_db_deleted_webui_tombstone item, but the state_db_missing_rows loop still
emitted the same sid/kind again when both a surviving .json.bak AND a state.db row
exist for one deleted session — double-counting unsafe_to_repair, violating the
no-double-classification invariant. Fix: track _bak_tombstoned_ids from the .bak
branch and skip them in the state.db loop. Regression test
test_audit_no_double_count_when_bak_and_state_db_row_both_survive (verified fails
without the dedup).

Co-authored-by: rodboev <rodboev@users.noreply.github.com>
2026-07-04 05:38:49 +00:00
nesquena-hermes
63d0c00f8d harden #5504 on rodboev's latest head: complete the tombstone wiring + CHANGELOG
@rodboev independently pushed fixes for messaging-tombstone (matches ours) and an
audit orphan-.bak skip — but the audit skip used _marks_deleted_webui_session
(index heuristic), which re-introduces the crash-suppression bug, and the other 4
resurrection/recovery paths were still open. Rebuilt the stage on rodboev's new
head (fc21c3f3, attribution preserved) and applied the complete superset:

- routes.py claim path: tombstone 404 gated on _state_db_session_source in
  ('','webui','fork') so foreign-source rows always materialize (finding B)
- models.py sidebar projection: skip tombstoned source='webui' rows w/ no live
  sidecar so a deleted session can't resurface in /api/sessions (finding C)
- session_recovery.py orphan-.bak startup: skip restore when durable tombstone
  present, durable-only (finding D)
- session_recovery.py audit orphan-.bak: durable-only classify as
  deleted_session_skipped (corrects rodboev's index-heuristic version)
- session_recovery.py _read_state_db_missing_sidecar_rows: durable-tombstone-only
  so a genuine crash (index intact, no durable tombstone) still repairs (finding F)

Regression tests (all verified fail-without-fix): sidebar-projection, orphan-.bak
startup skip, messaging-not-tombstoned, index-only-crash-repairable. Both advisors
(Codex SAFE TO SHIP + Opus ship-with-fixes) cleared the prior stage; this rebuild
carries the same fixes onto the contributor's latest work.

Co-authored-by: rodboev <rodboev@users.noreply.github.com>
2026-07-04 05:32:51 +00:00
nesquena-hermes
06217c93b8 Merge commit 'fc21c3f38e56' into release/stage-5504 2026-07-04 05:25:04 +00:00
Rod Boev
55ca782c31 docs(#4812): keep session sse rfc citations current 2026-07-04 01:21:52 -04:00
akay64
87404d76f0 fix: scan providers: in resolve_model_provider() for user-defined provider matching
Mirrors the existing custom_providers: scan immediately above. User-defined
providers declared under config.yaml's providers: section with explicit
models: lists were invisible to model-to-provider resolution — bare model
IDs fell through to the stale config_provider, routing through the wrong
endpoint.

The insertion site sits after custom_providers: (unchanged) and before
all heuristics (@provider:model, slash, fallback — all unchanged).
2026-07-04 08:59:21 +04:00
Rod Boev
fc21c3f38e fix(#5498): keep tombstoned backups out of repair audit 2026-07-04 00:53:03 -04:00
Rod Boev
c17ed6371e fix(#5498): preserve messaging sessions outside WebUI tombstones 2026-07-04 00:42:07 -04:00
nesquena-hermes
43f989eaa5
Merge pull request #5509 from nesquena/release/stage-b2
Release — session-switch stray-pointerup guard (#5487) + IPv4-first extension gallery (#5458)
2026-07-03 21:02:30 -07:00
nesquena-hermes
4f8bd1ef38 docs(changelog): #5487 stray-pointerup session-switch guard + #5458 IPv4-first gallery 2026-07-04 03:54:11 +00:00
nesquena-hermes
fe30f1ff00 Merge PR #5458 from rumotoshino: prefer IPv4 for extension gallery downloads 2026-07-04 03:39:19 +00:00
nesquena-hermes
fcd3de7d8f Merge PR #5487 from webtecnica: prevent unintended session switch on stray pointerup (#5462) 2026-07-04 03:39:18 +00:00
nesquena-hermes
98a3b0718c
Merge pull request #5507 from nesquena/release/stage-5460
Release — replace cross-profile empty sessions on profile switch (#5460)
2026-07-03 20:37:57 -07:00
Rod Boev
308041c269 fix(#5498): remove unreachable tombstone recovery branch 2026-07-03 23:36:10 -04:00
nesquena-hermes
e874fc4149 docs(changelog): #5460 replace cross-profile empty sessions on profile switch 2026-07-04 03:33:06 +00:00
Rod Boev
433f2a860e fix(#5498): skip durable delete tombstones in recovery audit 2026-07-03 23:27:48 -04:00
Rod Boev
f566dc1d01 docs(#4812): add session sse contract rfc 2026-07-03 23:16:16 -04:00
nesquena-hermes
dbf3c9d3c0 Merge PR #5460 from ruizanthony: replace cross-profile empty sessions on profile switch 2026-07-04 03:05:45 +00:00
Rod Boev
9e13ec9e03 fix(#5498): prevent deleted WebUI sessions from resurrecting from state.db 2026-07-03 23:05:44 -04:00
nesquena-hermes
843e7748cc
Merge pull request #5503 from nesquena/release/stage-5496
Release — refresh dictation recognition.lang after locale change (#5496)
2026-07-03 19:48:30 -07:00
nesquena-hermes
8b6ababf8c docs(changelog): #5496 refresh dictation recognition.lang after locale change (#5483) 2026-07-04 02:42:56 +00:00
nesquena-hermes
091103cf6d Merge PR #5496 from webtecnica: refresh recognition.lang before dictation start (#5483) 2026-07-04 02:41:01 +00:00
nesquena-hermes
5e0d4d1e3d
Merge pull request #5495 from nesquena/release/stage-5480
Release — stale WebUI client recovery banner (#5480)
2026-07-03 18:32:52 -07:00
root
fe4e2851f7 fix: refresh recognition.lang before dictation start
After a runtime locale change (setLocale from Settings), the cached
recognition object retains its boot-time lang, causing dictation to
run in the wrong language. Set lang immediately before .start() at
the plain dictation path in _startMicCapture, matching the pattern
already used in _ensureSpeechRecognition().

Closes #5483
2026-07-03 22:28:35 -03:00
nesquena-hermes
378548b566 docs(changelog): #5480 stale WebUI client recovery banner (#5428) 2026-07-04 01:28:02 +00:00
nesquena-hermes
568d5c4b0e gate-fix #5480: suppress 'unknown' server version (case-insensitive) to prevent false banner
Codex gate: _normalizeWebUIVersion suppressed empty/__WEBUI_VERSION__/'not detected'
but NOT 'unknown' — api/updates.py emits WEBUI_VERSION='unknown' on git-describe
failure (Docker/CI images), so a real client version would falsely fire the
stale-client banner against server='unknown'. Suppress 'unknown' (+ case-insensitive
for all sentinels). + regression test asserting unknown/UNKNOWN/Unknown don't fire.
2026-07-04 01:15:26 +00:00
nesquena-hermes
b04f0387c4 Merge PR #5480 from rodboev: surface stale WebUI client recovery (#5428) 2026-07-04 01:09:14 +00:00
nesquena-hermes
f38cf44569
Merge pull request #5492 from nesquena/release/stage-5452
Release — fit fullscreen Mermaid diagrams to the lightbox (#5452)
2026-07-03 17:21:26 -07:00
nesquena-hermes
8b1109a079 docs(changelog): #5452 fit fullscreen Mermaid to lightbox (#5413) 2026-07-04 00:17:07 +00:00
nesquena-hermes
0eb80f6197 Merge PR #5452 from rodboev: fit fullscreen Mermaid diagrams to the lightbox (#5413) 2026-07-04 00:07:04 +00:00
nesquena-hermes
7a700b96db
Merge pull request #5489 from nesquena/release/stage-5467
Release v0.51.842 — sidebar render-skip on idle polls (#5467)
2026-07-03 16:48:46 -07:00
nesquena-hermes
8d9d37c118 Merge remote-tracking branch 'origin/master' into release/stage-5467
# Conflicts:
#	CHANGELOG.md
2026-07-03 23:44:49 +00:00
nesquena-hermes
f217f76862
Merge pull request #5491 from nesquena/release/stage-5488
Release v0.51.843 — failed-send draft restore hardening (#5488)
2026-07-03 16:40:00 -07:00
nesquena-hermes
ed508ff6ef Merge remote-tracking branch 'origin/master' into release/stage-5467
# Conflicts:
#	CHANGELOG.md
2026-07-03 23:39:31 +00:00
nesquena-hermes
1e4c5ee101 docs(changelog): #5488 hardening for #5472 failed-send draft restore 2026-07-03 23:36:53 +00:00
nesquena-hermes
5c54fd598c
fix(#5472): order draft re-persist after clear + honest happy-path test (#5488)
* fix(#5472): harden failed-send draft restore — order persist after clear, honest test

Two NIT-level follow-ups from the Opus review of #5484 (both on already-shipped
v0.51.842 code; neither is a functional break):

1. Draft clear/save ordering. send() fires an unawaited _clearComposerDraft POST
   (text:'') at send time, and the failed-send restore fired a separate
   _saveComposerDraftNow POST (text:<draft>). Under HTTP/2 multiplexing those two
   same-origin writes can be reordered, leaving the SERVER draft empty after a
   reload (the in-memory composer restore was always fine). send() now captures
   the clear POST's promise and passes it to the restore helper, which chains the
   re-persist after the clear resolves (falls back to immediate persist if the
   promise is absent/rejects).

2. Honest happy-path test. test_send_still_clears_composer_on_the_happy_path
   asserted a bare $('msg').value='' string that matches ~13 sites, so it would
   pass even if the MAIN-path clear were removed. It now anchors to the unique
   main-path _clearComposerDraft line and window-checks the composer wipe
   immediately precedes it.

Tests: +2 (promise-ordering behavioral via node-vm microtask ordering; absent-promise
fallback), signature/call assertions updated. 14 in the #5472 file, 93 across the
related composer/send/draft/upload surface — all green.

* fix(#5472): make deferred draft persist stale-aware (Codex #5488 catch)

The promise-ordering fix introduced a regression: the deferred _persist saved the
CAPTURED snapshot and its _saveComposerDraftNow clearTimeout cancelled any newer
debounced save. So if the user edited the restored composer before the clear POST
settled, the delayed persist overwrote their edit with the stale original text
(lost on reload).

Restructure the helper so the deferred persist is stale-aware at FIRE time:
- If the failed session is still visible, re-read the LIVE composer (.value
  + current S.pendingFiles) instead of the captured snapshot — a post-restore edit
  is captured, not clobbered.
- If we restored the visible session but the user has since switched away, SKIP the
  stale write entirely (the session-switch save path already saved that session).
- Background failure (sid never visible): persist the captured snapshot, since
  there's no live composer to read — it's the only copy.

The visible-composer restore + session guard are unchanged in behavior (moved above
the persist). Helper now returns whether it restored the VISIBLE composer.

Tests: +3 regression cases (post-restore edit captured; switch-away skip; background
snapshot persist), signature/guard assertions updated. 17 in the #5472 file, 87
across the related surface — all green.
2026-07-03 16:36:21 -07:00