Commit graph

6944 commits

Author SHA1 Message Date
Frank Song
4bbce7bc45 Persist restored wakeup pause after streaming cancel 2026-07-10 05:43:44 +08:00
Frank Song
d9e45f1d07 Merge remote-tracking branch 'origin/master' into paperclip/pr-5732 2026-07-10 05:27:46 +08:00
nesquena-hermes
a0067b0b24
Release: classify external_agent imports as CLI to match client render (#5846, #5831) (#5855)
Fixes the #5831 brick: "WebUI sessions (N)" chip showed a count but an empty list.
Server is_cli_session_row classified read-only external_agent imports (Claude Code,
Codex) with a real title as non-CLI (counted under webui_session_count), while the
client _isCliSession filed them in the CLI bucket -> mismatch. Server now classifies
external_agent/external-agent as CLI, matching the client. WebUI/messaging/subagent
unaffected (their exclusions precede the new branch); external_agent imports stay read-only.

Self-built (nesquena-hermes); independent nesquena review APPROVED on this head (17:28);
gate-pass (Codex SAFE, no over-capture, caller audit clean), 14 own + 180 regression green.

Co-authored-by: t <a@b>
Co-authored-by: nesquena-hermes <nesquena-hermes@users.noreply.github.com>
2026-07-09 14:20:20 -07:00
nesquena-hermes
f449ff21c6
Release: hard-prune post-compression tool context (#5667) (#5852)
WebUI hard token-cap on protected-tail tool-result payloads in the MODEL CONTEXT
only, applied once after a confirmed compression event, to prevent post-compression
context blowup. Deep-copy content-replace only (no message removal/reorder → no
orphaned tool_result); visible transcript (s.messages) untouched.

Deep-review re-gate: Codex SAFE (pairing-safety + context-only + idempotent verified
by reproduction), 65 own + 992 regression tests green. Crown-jewel streaming path.

Co-authored-by: t <a@b>
Co-authored-by: franksong2702 <franksong2702@users.noreply.github.com>
2026-07-09 13:41:31 -07:00
nesquena-hermes
46720a39dd
Release: Copy conversation link copies an openable URL (#5478) (#5851)
Was copying the internal session:// reference (not browser-openable); now copies
an absolute origin + /session/<id> URL (verified single-origin, no doubling —
_sessionUrlForSid returns a relative path, the caller prepends origin once),
tracking params stripped. Product/UX parity with major chat apps (Anchor C).

Nathan-approved. 17 copy-link regression tests green.

Co-authored-by: t <a@b>
Co-authored-by: djsavvy <djsavvy@users.noreply.github.com>
2026-07-09 13:24:45 -07:00
Frank Song
819e9d629d Merge remote-tracking branch 'origin/master' into paperclip/pr-5732 2026-07-10 04:03:57 +08:00
Frank Song
4efab593fe Preserve wakeup pause on cancelled gateway recovery 2026-07-10 04:03:40 +08:00
nesquena-hermes
8cc2d6f881
Release: model-picker Selected badge + Transparent Stream dupe-prefix suppression (#5757, #5758) (#5850)
Two visible render PRs, gate-passed (deep-review round), Nathan-approved to ship.

- #5757 (rodboev): mark active model with a Selected badge + open its provider group (#5748).
  Screenshot-verified (badge clear + correctly placed on active row).
- #5758 (rodboev): suppress the live-token prose row that is a strict prefix of the final
  answer (#5749). Provenance-gated (live-prose:* token rows after last tool row only) so it
  can't eat legitimate narration; reproduction test proves the dupe is gone.

Codex SAFE + full regression green (1576 render tests). 18 own tests pass together.

Co-authored-by: t <a@b>
Co-authored-by: rodboev <rodboev@users.noreply.github.com>
2026-07-09 12:51:18 -07:00
Frank Song
4af5334ebb Merge remote-tracking branch 'origin/master' into paperclip/pr-5732 2026-07-10 03:33:07 +08:00
nesquena-hermes
2b457f1646
Release: cap StreamChannel offline replay buffer (#5788) (#5849)
Bounded deque(maxlen) drop-oldest so a disconnect-without-cancel can't grow the
per-turn offline replay buffer unbounded (per-abandoned-turn OOM risk, #4633 family).
Dropped frames recovered via run-journal last_event_id replay path.

Deep-review gate: Codex SAFE (journal-recovery verified end-to-end), 20 own + 1106
regression tests green. Crown-jewel streaming path.

Co-authored-by: t <a@b>
Co-authored-by: ai-ag2026 <ai-ag2026@users.noreply.github.com>
2026-07-09 12:26:05 -07:00
Frank Song
2547ec98d1 Merge remote-tracking branch 'origin/master' into paperclip/pr-5732 2026-07-10 02:02:04 +08:00
nesquena-hermes
d6e5dc302d
Release Batch D: terminal resource-leak fix + fsync atomic writers (#5835, #5843) (#5848)
Phase 2 backend reliability/data-integrity batch. Each byte-verified vs PR head,
Codex SAFE, 20 own + 355 regression tests pass, disjoint files.

- #5835 (ai-ag2026): stop leaking fd + reader thread + shell on client/shell exit (#4633 family)
- #5843 (ai-ag2026): fsync atomic JSON writers (oauth/passkeys/discoverability) + thread-safe temp

Co-authored-by: t <a@b>
Co-authored-by: ai-ag2026 <ai-ag2026@users.noreply.github.com>
2026-07-09 10:54:06 -07:00
Frank Song
fe656a48ce Merge remote-tracking branch 'origin/master' into paperclip/pr-5732 2026-07-10 01:42:11 +08:00
nesquena-hermes
7a1a122e6e
Release Batch C: hidden-tab dashboard poll + SSE write-deadline + rate-limit map bound (#5840, #5841, #5842) (#5847)
Phase 2 low-risk backend/perf batch (ai-ag2026 reliability cluster). Each byte-verified
vs PR head, Codex SAFE, 33 own + 720 regression tests pass, disjoint routes.py regions.

- #5840: skip dashboard status poll while tab hidden (perf; forced polls unaffected)
- #5841: arm write deadline on session-events invalidation SSE (stuck-client teardown)
- #5842: bound client rate-limit maps by sweeping stale keys (long-uptime memory)

Co-authored-by: t <a@b>
Co-authored-by: ai-ag2026 <ai-ag2026@users.noreply.github.com>
2026-07-09 10:38:47 -07:00
Frank Song
a9ba8d8368 Merge remote-tracking branch 'origin/master' into paperclip/pr-5732 2026-07-10 01:07:49 +08:00
nesquena-hermes
1e275d04ed
Release: queue gateway-owned steer fallback (#5823) (#5845)
Steering a live gateway-owned run had no process-local agent in SESSION_AGENT_CACHE,
so it errored with "No agent cached" and dropped the typed text. Now detects the live
gateway ACTIVE_RUNS stream and queues the steer as the next turn (model/provider/profile
snapshotted first), updates the queue badge, clears the draft, shows a toast — without
cancelling the stream. Gateway sibling of the shipped #5597 fallback.

Codex SAFE + Fable SHIP-UX; byte-identical to PR head; 66 steer/busy-input tests pass;
Nathan visual-approved (desktop + mobile screenshots).

Co-authored-by: t <a@b>
Co-authored-by: rodboev <rodboev@users.noreply.github.com>
2026-07-09 10:04:21 -07:00
Frank Song
3a0c00c880 Merge remote-tracking branch 'origin/master' into paperclip/pr-5732 2026-07-10 00:22:56 +08:00
nesquena-hermes
91606a15e0
Release Batch B: OPTIONS preflight framing + session-index bytes-parse (#5828, #5834) (#5838)
Phase 1 low-risk backend batch (on top of Batch A). Both byte-verified vs PR head,
Codex SAFE, 64 own + 749 regression tests pass, coexists with Batch A's #5833.

- #5828 (ai-ag2026): frame CORS OPTIONS preflight with Content-Length: 0 (keep-alive hang fix)
- #5834 (ai-ag2026): parse session _index.json from bytes not decoded str (all 10 sites)

Co-authored-by: t <a@b>
Co-authored-by: ai-ag2026 <ai-ag2026@users.noreply.github.com>
2026-07-09 09:19:14 -07:00
Frank Song
61d32671ed Merge remote-tracking branch 'origin/master' into paperclip/pr-5732 2026-07-10 00:07:14 +08:00
nesquena-hermes
0d3ee7de9f
Release Batch A: worktree cli-shadow + atomic settings.json + state.db read-only (#5832, #5829, #5833) (#5837)
Phase 1 low-risk backend reliability batch. Three independent contributor fixes
on distinct files, each byte-identical to its PR head, Codex SAFE, 691+16 tests pass.

- #5832 (silent-reader-cn): importlib-load agent cli.py by absolute path so a
  shadowing cli/ namespace package can't brick worktree creation
- #5829 (ai-ag2026): atomic settings.json writes (temp+fsync+os.replace, mode-preserving)
- #5833 (ai-ag2026): open the remaining 8 state.db read projections read-only

Co-authored-by: t <a@b>
Co-authored-by: silent-reader-cn <silent-reader-cn@users.noreply.github.com>
Co-authored-by: ai-ag2026 <ai-ag2026@users.noreply.github.com>
2026-07-09 09:04:59 -07:00
Frank Song
de9d3306af Merge remote-tracking branch 'origin/master' into paperclip/pr-5732 2026-07-09 16:22:06 +08:00
nesquena-hermes
819949fd8c
Merge pull request #5825 from nesquena/release/stage-5789
Release: gateway SSE terminal idle-timeout, honor Stop (#5789)
2026-07-09 01:10:12 -07:00
nesquena-hermes
898f46dd3d docs(changelog): #5789 gateway SSE terminal idle-timeout 2026-07-09 08:04:03 +00:00
nesquena-hermes
dfd9b57183 fix(gateway): keep 600s read-timeout default (gate finding — 120s would kill legit long silent tool calls)
Co-authored-by: ai-ag2026 <ai-ag2026@users.noreply.github.com>
2026-07-09 08:03:02 +00:00
ai-ag2026
fcb135a133 fix(streaming): bound gateway SSE read-inactivity, honor Stop terminally (#2476)
Both gateway SSE read loops used urlopen(timeout=600) and re-checked cancel only
BETWEEN lines, so a half-open gateway (TCP open, zero bytes) pinned the worker
for the full 10 minutes and ignored Stop.

Route raw-line iteration through _iter_sse_lines_cancellable and bound the socket
to a byte-silence budget (_gateway_read_timeout_secs, default 120s, env
HERMES_WEBUI_GATEWAY_READ_TIMEOUT). A read timeout is TERMINAL — CPython's
socket.makefile latches _timeout_occurred on the first socket.timeout, after
which every read raises a bare OSError, so the connection can't be resumed. On a
read timeout (or that poisoned-socket OSError) the generator surfaces the user's
Stop (yield b"" -> caller emits cancel) or re-raises so the caller reports the
stall. A stream that keeps emitting bytes within the window never trips it, so a
genuinely alive (if slow) turn is untouched; only >budget of total byte-silence
is treated as a dead gateway. Both loops (runs-API + legacy) changed identically.

The test fake now models the timeout-poison latch (a bare OSError after the first
timeout) so it reflects real socket semantics; the previous stateless re-raise
had made a multi-window "recovery" path look green that cannot occur in
production.

Refs #2476
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 08:03:02 +00:00
Frank Song
96af63a95e Merge remote-tracking branch 'origin/master' into paperclip/pr-5732 2026-07-09 14:41:48 +08:00
nesquena-hermes
531525269e
Merge pull request #5824 from nesquena/release/stage-5557
Release: centralize WebUI static asset resolution (#5557)
2026-07-08 23:37:35 -07:00
nesquena-hermes
087d469ee8 docs(changelog): #5557 centralize static-asset resolution 2026-07-09 06:29:01 +00:00
t
5a3b4146b8 Merge branch 'pr-5557' into release/stage-5557 2026-07-09 06:28:22 +00:00
Frank Song
bdb66d8ed5 Merge remote-tracking branch 'origin/master' into paperclip/pr-5732 2026-07-09 14:13:47 +08:00
g
9a1fdabfda Merge remote-tracking branch 'origin/master' into pr-5557 2026-07-09 06:12:41 +00:00
nesquena-hermes
66d3b6476d
Merge pull request #5822 from nesquena/release/stage-5803
Release: session-load latency perf (#5803)
2026-07-08 23:10:54 -07:00
nesquena-hermes
1c70f7b987 docs(changelog): #5803 session-load perf 2026-07-09 06:06:43 +00:00
t
c81463a30d Merge branch 'pr-5803' into release/stage-5803 2026-07-09 06:05:44 +00:00
Nathan Esquenazi
264a9eab29
Update the screenshot (#5816) 2026-07-08 23:03:20 -07:00
Frank Song
0cef502329 Merge remote-tracking branch 'origin/master' into paperclip/pr-5732 2026-07-09 14:02:13 +08:00
g
9da97c3c78 Merge remote-tracking branch 'origin/master' into pr-5803 2026-07-09 05:56:20 +00:00
nesquena-hermes
216eb77ade
Merge pull request #5821 from nesquena/release/stage-5800
Release: document lock-free GIL contract for STREAM_* buffers (#5800)
2026-07-08 22:55:01 -07:00
nesquena-hermes
e34afa58b8 docs(changelog): #5800 streaming lock-free contract doc 2026-07-09 05:50:54 +00:00
ai-ag2026
c88d89903a Document intentional lock-free GIL-atomic contract for STREAM_* buffers
The per-token hot path mirrors partial text, reasoning, and live tool
calls into STREAM_PARTIAL_TEXT / STREAM_REASONING_TEXT /
STREAM_LIVE_TOOL_CALLS without holding STREAMS_LOCK, while snapshot
readers (_snapshot_and_append_partial_on_error, cancel_stream) read them
under STREAMS_LOCK. This is safe under the CPython GIL for two reasons —
NOT because `+=` is one bytecode (it is not: `d[k] += s` compiles to
load / add / STORE_SUBSCR):

  1. Single writer — only the streaming thread ever writes a given
     stream_id's buffers, so there is no writer/writer race to tear.
  2. Reader/writer atomicity — `+=` builds a complete new immutable str,
     then the final STORE_SUBSCR binding it into the dict is a single
     atomic bytecode, so a concurrent reader's dict.get returns either
     the old or new *complete* string (strings are immutable), never a
     half-built one. list.append / single-key dict writes are atomic too.

So a reader sees a complete-but-possibly-stale value, never a torn one,
and the snapshot is a best-effort partial reconciled by later journal/SSE
events.

Chose documentation over locking: pulling the writes under STREAMS_LOCK
would add per-token contention against readers copying large buffers and
entangle the documented LOCK -> STREAMS_LOCK ordering (deadlock risk) for
only a recoverable staleness window. Make the assumption explicit at the
write sites and the reader instead. No behaviour change.

Rollback: revert this commit (comments only).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 05:50:17 +00:00
Frank Song
590fec43aa fix(gateway): preserve completed webui turns on late cancel 2026-07-09 13:24:48 +08:00
Frank Song
00af71f651 Merge remote-tracking branch 'origin/master' into paperclip/pr-5732 2026-07-09 12:41:31 +08:00
nesquena-hermes
0c49ed832f
Merge pull request #5820 from nesquena/release/stage-5768
Release: localize process wakeup label (#5768)
2026-07-08 21:40:10 -07:00
nesquena-hermes
264e733fce docs(changelog): #5768 localize background-wakeup label 2026-07-09 04:36:32 +00:00
Isla-Liu
cd12abf3c5 test: harden wakeup label locale coverage 2026-07-09 04:36:06 +00:00
Isla-Liu
db082e8d92 fix: localize process wakeup label 2026-07-09 04:36:06 +00:00
Konstantin M
e96318d2e5 perf(webui/session-load-latency) tier4: fix CI failures — lint B009/B905 + _emit_slow format args
Three fixes for the CI failures (lint + test shard 1):

1. B009 lint fix (api/routes.py:6281): Replace getattr(session, 'profile')
   with session.profile — the guard on line 6275 already ensures it exists.

2. B905 lint fix (api/routes.py:13843): Add strict=True to zip() of
   _draft_stages slices. Both sides are always the same length (shifted
   by one), so strict=True is correct.

3. _emit_slow format-arg fix (api/request_diagnostics.py:186-195):
   Keep the prefix in the format string and pass the JSON payload as a
   separate positional argument. The test at
   test_issue1855_request_diagnostics.py:33 does
   json.loads(caplog.records[0].args[0]) and the old code embedded the
   prefix in the payload string, breaking the JSON parse. Now
   self.logger.warning("%s %s", prefix, payload) — wait, actually
   self.logger.warning(f"{prefix} %s", payload) — so args[0] is the
   raw JSON string, same as the pre-_emit_slow code.
2026-07-09 04:22:21 +00:00
Frank Song
5d0dfe4b52 Merge remote-tracking branch 'origin/master' into paperclip/pr-5732 2026-07-09 12:01:56 +08:00
nesquena-hermes
d4e80b4549
Merge pull request #5819 from nesquena/release/stage-5798
Release: single-flight remote gateway health probe (#5798)
2026-07-08 20:58:55 -07:00
nesquena-hermes
9b1fb1f3dc docs(changelog): #5798 single-flight health probe 2026-07-09 03:54:39 +00:00