Commit Graph

288 Commits

Author SHA1 Message Date
Teknium
0911d094ea test(webapp): the Webapp attach spec expects the machine owner as the turn's principal
#145598 (8497ce9318) made every login, a loopback Webapp tab's session token
included, act as the host owner's OS subject (uid:<n>), the identity native
Desktop uses. The core-lane spec still expected the old
auth:v1 session-token principal, so 'the gateway serves the Webapp and runs every
turn its browser sends' has been red on main since that merge; the Desktop core
lane is path-gated and did not run on #145598.

Assert the owner subject instead. Locally (real `hermes webapp` gateway +
Chromium + scripted provider): unmodified spec red 2/2 on main 72ffcb9788 with
received ["uid:1000"]; this spec green, whole file 8/8 across 2 repeats.
2026-10-28 20:35:00 -07:00
Teknium
5cd94853ba fix(desktop): a re-attach page that already holds the reply keeps one bubble
Switching back to a chat whose turn is still streaming re-activates it and
reads the newest transcript page over REST, while the turn's events keep
arriving on the socket. When the turn stores its final row while that read
is in flight, the page resolves with the whole reply (folded with the turn's
narration and tools) before message.complete reaches the still-pending live
row. overlayConcurrentMessageChanges then saw the live row as a concurrent
change and appended it beside the committed bubble, so the reply drew twice
until the completion retired the live row. representedOnPage only matched
settled live rows; a pending one is excluded on purpose because mid-turn
pages carry the narration row and the turn is still running.

A pending live row now takes the committed bubble's place
(pageReplyCommittingLiveRow) when the page added that bubble after the live
row's own prompt and it ends in a reply covering the live text (the existing
committedReplyCovers rule: a mid-turn commit ends on a tool call). The live
row is kept rather than dropped: its late deltas and the completion still
find it by id, and a dropped row would be re-seeded by the next delta.
isStrictAnswerTextExtension, replyAfterLastTool and committedReplyCovers
move into the new committed-reply.ts sibling (utils.ts is over the size cap).

The transcript-oracle sampler now records the last bubble layouts (row id =
markers) and shows the tail of what it read, so a transient-duplicate red
names the rows that drew the copy and what the view held just before.

Repro: hold the session.resume (activate) request 150-250 ms at the steer
step's switch-back in the core reattach spec, so the backend answers after
the reply is stored but before message.complete is processed: origin/main
6/6 red, same signature as the 1-in-6 CI-shape red (stored "-19-assistant"
plus "assistant-stream-*" both carrying A6i+A6). With the fix: green.
2026-10-27 15:36:04 -07:00
Teknium
bd7a8a3de7 test(desktop): keep a screenshot of the reply after the reconnect 2026-10-27 15:35:32 -07:00
Teknium
1f4b6ff893 test(desktop): e2e for a reply committed between the reconnect replay and resume
Forces the window deterministically: after the socket drop the spec holds
the reconnect's session.resume for 1.5 s, releases the reply's tail as soon
as the replay (session.events.since) is answered, and lets the turn finish
while the resume is still held. The full reply must render within 10 s;
main keeps it on its first chunk until a periodic session sweep 20-50 s
later, or never.

provider.ts gains holdBeforeFinish (the same hunk #144899 adds).
2026-10-27 15:35:32 -07:00
Willy Morin
c3d5d4eca6 fix(desktop): scope version label to the active connection/profile
The preload getVersion bridge dropped the {connectionId, profile} scope the
renderer passes (lost in merge b3bfc3afe5), so the version label always
reported the primary gateway. Forward the scope, re-fetch on any
connection/profile scope change with a stale-reply guard, and scope the
native About panel to the focused window.

Fixes #139333
2026-10-27 13:23:31 -07:00
Teknium
14084e9f99 fix(desktop): a long chat keeps following its bottom when a turn settles
Each settled turn re-reads the newest stored page and the view could stop
following the bottom: the next turns streamed below the fold behind a
"N messages" pill, and older turns filled the screen. The tail-resync
steered spec saw it as turn 7's rows missing (innerText skips the
off-screen content-visibility rows) with the view parked on seed turns.

Two row-height jumps, both off screen, clamp scrollTop; the next frame's
content-visibility pass restores the height, so the ResizeObserver sees no
net change and use-stick-to-bottom reads the clamp as a user scroll-up and
escapes the lock:

- TurnRow declared contain-intrinsic-size:auto only together with
  content-visibility:auto, and the browser records a remembered size only
  while the declaration is present. Every row that left the live tail off
  screen dropped from its real height (766px) to the 37.5rem placeholder.
  The declaration now sits on every row.
- TurnRow was keyed by the message id, and a stored row's id carries its
  position in the page it was read from (`<ts>-<index>-<role>`). Every
  re-read that slid the 120-row window re-keyed and remounted every row in
  it, dropping each one's remembered size. Rows are now keyed by the
  durable row id (metadata.custom.rowId) when they have one.

Instrumented runs (scroll/RO/escape timeline): on 9e7ef274 every run
escaped the lock at the steered settle with a 320px shrink and no RO
delivery; with the fix only the newest optimistic-to-stored row remounts,
virtualized rows keep their size, 0 escapes. The spec now also reports a
view more than 64px off its bottom on two samples in a row: 2/2 red on
9e7ef274 (offBottom=320px), green with the fix.
2026-10-27 11:50:16 -07:00
Teknium
0ab6e17dee test(desktop): the core reload step checks the reply is one bubble before the turn completes
The reattach spec's reload step only caught the split reply when its
transient-duplicate sampler happened to land in the ~20 ms between
message.complete and the post-turn refresh (1-3 of 10 runs). The scripted
provider can now hold a step after its last text chunk (holdBeforeFinish), and
the reload step asserts, with the turn still open, that the bubble holding the
answer streamed after the reload also holds the reply's first chunk, then
screenshots that frame (reload-mid-turn.png).

Live (Electron core harness, real hermes serve, scripted provider, Xvnc):
PR head + l1e/l1h (35c0bfaefafe) FIRES 10/10 (the post-reload text sits in a
second bubble, "answer across a reload" without "A4-"); with 4d803ee87cc1
10/10 pass.
2026-10-27 11:50:16 -07:00
Teknium
911a536e8b fix(desktop): a stopped turn binds its receipt identity
Stop marks the session interrupted, and the interrupted `message.complete`
then settled the bubble and returned before any receipt binding ran. Every
row of the stopped turn stayed an unstored live row (`user-<submission>`,
`assistant-stream-*`), so once a long chat's refresh fell through to the
stored-id merge, the page's stored copy and the live copy both rendered:
the whole turn, prompt included, twice (#139741, whose reporter stopped a
turn and resent it).

The interrupted completion now binds the turn's user bubbles to the stored
rows its receipt names (`bindReceiptUserRows`, the same pairing the normal
completion uses) and gives the turn's last reply bubble the receipt, so the
receipt rule from the previous commit can recognise the turn the page holds.

NOT live-verified: tail-resync-merge.spec.ts "stopped turn" fires on the PR
head and still fired in 2 of 3 runs with this commit (U7, A7i1, A7 twice).
The unit contract is green; the live path that still duplicates is open.
2026-10-27 11:50:16 -07:00
Teknium
ee4539b5b1 fix(desktop): a refreshed page that holds a live turn whole draws it once
A long chat's newest page (120 rows) starts inside an older tool turn, so the
refresh graft falls through to the stored-id merge. That merge kept every
window row without a stored id beside the stored copies the page brings. A
steered turn reaches it with a receipt that is not `complete` and a sealed
narration bubble that never had a stored id, so the turn's narration and its
answer rendered a second time under the stored fold (#141771's layout once
the duplicate final collapses).

The turn's `message.complete.persisted_turn` receipt names every stored row
of the turn and its own prompt (`submission_id`, `user_row_id(s)`). The page
is one contiguous run of the newest stored rows, so a page that holds the
turn's first row and reaches its last row holds the whole turn: the window's
rows from that prompt to the receipt bubble are dropped and the page's copy
is drawn. Identity only: a row with a stored id outside the turn aborts the
drop, and a page that does not reach the turn's last row keeps today's merge.

Live (Electron core e2e, real `hermes serve` + scripted provider):
tail-resync-merge.spec.ts "steered tool turn" fires on the PR head (A9i1,
A9i2, A9, A10i1, A10 each rendered twice for the whole observation window)
and passes here; the narrated control passes on both.
2026-10-27 11:50:16 -07:00
Teknium
fffccf56eb fix(desktop): a reply settled during a reconnect's resume keeps its whole text
A socket drop mid-answer re-runs resumeSession for the open chat. The
backend cuts that snapshot while the turn still runs, but the new socket is
already attached, so the turn's message.complete can land first. The resume
then reconciled its older inputs (the in-flight projection, a REST page read
before the reply was stored) over the settled reply and rewound it to the
partial the snapshot caught, usually the first chunk. Fires on origin/main
too (core e2e socket-drop step: 1/10 on base, 1/10 on the PR head before
this change); the stream segment cursor is not involved (no stamped frame
reaches the renderer after the reconnect in any failing run).

message.complete now notes when a runtime settled a turn
(use-session-actions/settled-turns.ts), and a same-session resume that
started before that keeps the live transcript instead of the snapshot
(resume-reconcile.ts; durable row identity arrives with the next transcript
refresh). The resume reconcile helpers move into that sibling so
use-session-actions/index.ts shrinks.

The core spec's socket-drop step settles on the view (Stop gone) instead of
a message.complete frame the lossy wire may drop, and the replay spec holds
the answer to screenshot the turn mid-flight with the re-sent narration in.
2026-10-27 11:50:16 -07:00
Teknium
1f0f2cecd1 fix(desktop): a re-sent reply segment upserts by its wire identity
A turn's message.* frames can reach the renderer twice: a reconnect
replay under new seqs, a superseded attempt that re-streams the segment
it already sent (#144609), a second socket. They carried no identity, so
the renderer could only append, and the copy painted beside the original:
inside the live bubble after its tool row, or as a second bubble.

The backend now stamps a prompt turn's frames (tui_gateway/
stream_segments.py): message.start carries the turn's turn_id; every
message.delta adds its segment (interim seals before it) and its offset
in UTF-16 code units inside that segment; every message.interim the
segment it seals. The contract and generated TS types carry the fields.

The renderer keeps a per-session cursor of how far the turn's reply has
been applied (use-message-stream/segment-identity.ts). A delta it has
already applied is dropped (an overlap keeps only the unseen tail), a
seal of a segment already sealed is a no-op, and a message.start whose
turn_id is the session's current turn is not a new occurrence. Frames
without a stamp (older backends, non-prompt emitters) take the old path,
and text the agent genuinely repeats in a later segment still renders:
identity, not content, decides.

The core e2e spec gains the reload-mid-answer step back and the replay
spec (start + narration re-sent when the tool starts).
2026-10-27 11:50:16 -07:00
Teknium
fe75921073 fix(desktop): a stored prompt delivered twice is one turn
A user row whose stored row id an earlier user row already carries is the
same prompt twice; drop it so its turn joins the earlier one and the reply
copies under it fold. Adds the redelivered tool.complete (#140397), steer
then re-attach, and reconnect mid-tool-turn steps to the core e2e spec.
2026-10-27 11:50:16 -07:00
Teknium
43c66b85bb fix(desktop): one reply renders once per turn, whichever path delivered it
A turn's reply reaches the renderer as live stream events, as the row the
backend commits before each tool round, and again through every history
read (re-attach to a running turn, reload, switch-back, reconnect replay,
the in-flight journal). Each merge path decided on its own whether two
bubbles were the same reply, so every path that decided wrong painted the
reply twice while state.db held one row; eleven per-path fixes later the
reports continue.

Fold duplicates once, at the render boundary the main chat and every tile
share (useRuntimeMessageRepository), keyed on the content a bubble shows in
order (text, tool calls by name + id + arguments, other parts; reasoning
ignored) within one user turn:

- a bubble whose content another bubble of the turn already shows is the
  same reply twice; the committed copy wins, then the one that carries the
  turn footer, then the earlier one;
- a bubble that starts with an earlier bubble's content including a tool
  call is a live segment re-drawn after a re-attach; only its new remainder
  renders (#127288).

Text alone never trims a bubble that adds something new, so commentary
authored twice across tool rounds still renders twice, as hydration does.
The store is untouched.

Adds reattach-running-turn.spec.ts to the core e2e lane.
2026-10-27 11:50:16 -07:00
Teknium
16672947ff test(desktop): prove the sticky-prompt clip does not inherit into the turn
Loads the built renderer stylesheet in real Electron and checks computed
style: the host still clips, and a descendant reads the registered initial
value instead of the host's per-frame write. Red on the unregistered
property (child reads 24px), green with the @property block.
2026-10-26 16:18:49 -04:00
Teknium
9b26e63d9d fix(desktop-e2e): the reaper unit test reaps only its own fixtures
The test called the host-wide reaper, so running it also stopped the
backends and deleted the roots of any other abandoned Playwright run on the
machine, and `toContain` let those extra reaps pass. `reapAbandonedRuns`
takes an optional scope (runs whose root lies under it); the runner keeps
the host-wide default. The test plants an abandoned run outside its scope
and asserts the reap returns exactly its own dead root and leaves the
outside run's backend and root alone (red on 8627d097833: the outside root
was reaped).
2026-10-25 07:53:33 -07:00
Teknium
29d13bd134 fix(desktop-e2e): stop the gateways Playwright runs leave behind, including a killed run's
Desktop dials its backend through `hermes gateway ensure`, a detached
`gateway run` that outlives the app on purpose. The main suite's sandbox
cleanup only closed the app and removed the sandbox, so EVERY spec launch,
clean runs included, left its gateway running (~300 MB each), and the orphan
rewrote its sandbox HERMES_HOME right after the rmSync, so the run's pw-*
root reappeared. A SIGKILLed runner (agent/CI timeout) additionally left its
Electron main process.

Three layers, each covering a teardown the previous one cannot reach:
- per sandbox: the main suite's cleanup now stops the daemons its
  gateway.lock files record (the core lane's existing helper, moved to the
  shared e2e/run-tmp-reaper.ts; every platform);
- per run, at runner exit: every process whose environment names this run's
  root (a fixture that never returned, profile gateways off the lock homes);
- per host, at the next runner's start: every process left under a run root
  whose recorded runner (pid + kernel start time) is dead.
The run-level layers read /proc (Linux) and only signal a process carrying
both HERMES_E2E_RUN_TMP=<root> and a HERMES_HOME under that root; a root
whose runner is alive or unrecorded is never touched.
2026-10-25 07:53:33 -07:00
emozilla
1c76a86f42 test(webapp): a tab opened on a named profile runs and reads that profile, end to end 2026-10-25 03:22:43 -07:00
Teknium
e5ebf04f3a test(webapp): assert the sign-out summary the gateway prints now
a175a3db reworded the summary `hermes webapp --sign-out` prints behind the sign-in gate; the
Desktop core e2e spec still looked for the old sentence and failed in dispatch run 40003439648
right after the sockets had closed, so the rest of the sign-out check never ran.
2026-10-25 03:22:35 -07:00
emozilla
482d609c51 test(webapp): a browser end to end signs in behind the gate and is signed out
The Webapp journey spec signed out only a tab that the loopback launch link signed in. It now
also covers a Webapp behind the sign-in gate (a loopback bind with a public URL and the bundled
password provider). Chromium signs in with the password and loads the Webapp, and `hermes webapp
--sign-out` then has to close the tab's socket, report the closed connection and that browsers
behind sign-in must sign in again, refuse the API, and send a reload to the sign-in page. Signing
in again restores access.

The gate settings are named in one helper, so moving them to another config key changes one
place. Linux CI only, like the rest of the spec.
2026-10-25 03:22:25 -07:00
emozilla
5ac3588948 test(webapp): answer and stop turns across the Webapp and Electron
Electron attaches to the gateway serving a Webapp and answers the approval a Webapp turn raised,
exactly once; then the Webapp's Stop ends a turn Electron started.
2026-10-25 03:22:20 -07:00
emozilla
f0fe081b95 test(webapp): drive the gateway-served Webapp end to end
The e2e spec starts the gateway through hermes webapp, runs a turn from a
real browser, keeps the tab signed in across a gateway restart, and checks
that sign-out cuts it off. The smoke script targets the Webapp's port.

Co-authored-by: Bear Huddleston <bear@bearhuddleston.dev>
2026-10-25 03:22:17 -07:00
Teknium
fab9b01c91 test(desktop-e2e): the reconnect Stop-settle check records its own timeline
reconnect-turn-state.spec.ts:177 goes red intermittently on CI only
("a turn indicator (Stop) is still showing after the turn settled"; rc.1
v0.22.5 run 39867334090 and the Oct 19 dispatch 39330962543). The CI trace
shows the indicator at 0 (toHaveCount passed at +10795 ms), back at 1 by
+11054 ms, and idle again by the failure screenshot: a transient re-arm
after the settle, not an early assertion. Eleven local runs (eight pinned
to two cores) never re-armed, and the CI artifact carried no frame or DOM
timeline to name which path re-armed it.

On a settle failure the spec now attaches stop-timeline.txt to the test's
output dir (uploaded by CI): every non-delta gateway frame on the primary
socket (event type, seq, running; RPC results with running and the replay
window), merged with every Stop-button transition from an in-page
MutationObserver (no polling load), on one clock. Assertions and waits are
unchanged.
2026-10-22 22:33:50 -07:00
Teknium
7c0905a008 test(desktop-e2e): a reloaded document's sockets stop counting as live
The transcript oracle's "live sockets to the one host backend" check
intermittently saw two native_dial sockets on two ports: the current
socket through the test's loopback proxy, plus the direct socket the
renderer held BEFORE the `reload` step.

Root cause: Playwright forgets a page's WebSockets when a new main-frame
document commits (frameManager._clearWebSockets) without emitting their
'close', so recordWebSockets kept the pre-reload socket at closed=false
whenever its close event lost the race against the reload's commit.
The renderer held one socket; the recorder held a dead one.

recordWebSockets now retires every recorded socket at a new-document
commit (a main-frame navigation request followed by framenavigated).
Hash navigations issue no navigation request, so they never retire a
live socket, and any socket the new document dials (a real duplicate to
the host backend, #120006) is still counted.

Evidence: a standalone Playwright 1.62.1 + Electron 44.9.3 probe (page
with one WebSocket, 10 reloads with a hash navigation between each)
left 9/10 pre-reload sockets "live" in the old recorder while the server
saw exactly one open; the retire-on-commit recorder reported 1 live on
10/10. Local run of the full spec was not possible on this host
(electron.launch of the app dies on connect here).
2026-10-22 15:45:25 -07:00
Teknium
cd897884d9 test(desktop-update-e2e): find the packaged app by its install dir, not its environment
Electron 44's Chromium zeroes /proc/<pid>/environ in the browser process
and every child it execs right after start (Electron 40.10.2 kept it
readable: same headless probe, PROBE_MARK=1 on 40, 0 on 44.9.3). The
update suite's install census matched processes by HERMES_HOME in that
environment, so after the Electron 44 upgrade (#142727) it stopped seeing
the installed Desktop app at all:

- app-update: "the app to relaunch itself" picked a short-lived process
  instead of the relaunched app, the SIGTERM missed the app, the
  "quits cleanly" poll passed on an empty census, and the next launch hit
  "another Hermes Desktop instance holds the single-instance lock".
- build-fail and app-update: session.close() SIGKILLs installProcesses();
  the relaunched app survived it with live connections to the spec's
  provider/edge servers, and the Playwright worker hung 300 s on stop.

The app itself is fine: the relaunched Electron 44 app quits within 1 s
of SIGTERM at every point of its boot (0.2 s to 10 s, source build).

installProcesses now adds every process whose /proc/<pid>/exe lies under
the install's release dir (install-specific, readable whatever the
environment shows), and desktopMainProcesses reads that set directly,
dropping a candidate whose parent is a candidate (a child between fork
and exec still shows the main's exe and argv).
2026-10-22 15:45:25 -07:00
Teknium
81d936ab4f test(desktop): boot-lifecycle teardown interrupts the live turn it leaves running
The "quit mid-turn with a running tool child" step quits Desktop while a
turn and its terminal tool child are still running, then tears the sandbox
down with `hermes gateway stop`. Since stop refuses while sessions are live
(9248d847d0), that call exits 1 with "Refusing to stop the gateway: 1 live
session(s) would be interrupted", failing Desktop core E2E (Linux) on the
v0.22.3 release attempt (run 39451568405, job 118727873439).

The refusal is the intended behaviour. This step means to interrupt the turn,
so stopSandboxGateway gains an `interrupt` option that passes `--yes`, and only
this teardown uses it. Every other stop in the Desktop e2e suites runs with no
live turn and keeps the plain stop, so they still prove the default path.
2026-10-20 11:22:46 -07:00
Teknium
e6f57427c1 Merge pull request #140701 from NousResearch/fix/pkg9-windows-live
test(windows): live Windows proof for W3 and W4, plus a Windows packaging fix
2026-10-17 12:16:10 -07:00
Teknium
e268ccba29 test(desktop-e2e): Desktop attaches to a local gateway that was already running, on Windows
New core spec apps/desktop/e2e/core/local-gateway-attach.spec.ts. It starts
`hermes gateway run` first (detached, windowless, as a login item or console
leaves it). Then it opens Desktop twice and checks each launch:

- it attaches through Electron main's real path: `hermes gateway ensure`,
  then the ticket mint (the SID-checked named pipe through the runtime
  helper on Windows, the private control socket elsewhere);
- the connection descriptor is local loopback;
- gateway_state.json and the process census name the pre-started pid and
  only it;
- a turn completes against the scripted provider and passes the transcript
  oracle (launch 2 resumes the session and adds a turn);
- Electron main exits on quit and the gateway it did not start keeps
  running.

`hermes gateway stop` then ends it. HERMES_E2E_PACKAGED_EXE runs the same spec
against a packaged build.

.github/workflows/windows-desktop-attach-e2e.yml runs it on
blacksmith-32vcpu-windows-2025 (workflow_dispatch, or a push to
wine2e-desktop/**, which nothing else listens to): first on the dev tree,
then on `electron-builder --dir --win` output of the same commit.

Verified locally on Linux (Xvnc), both census modes (procfs and
HERMES_E2E_PROC_CENSUS=ps, the path Windows takes): 1 passed each.

Refs #134889 (W3)
Refs #140337
2026-10-17 11:33:15 -07:00
Teknium
d2c6ca2300 test(desktop): E2E guard for turn state after a lost connection
apps/desktop/e2e/core/reconnect-turn-state.spec.ts, real Electron + real
gateway, only the LLM scripted:

1. primary socket blocked mid-turn (loopback proxy that resets and refuses);
   the turn finishes on the gateway while disconnected; after the redial the
   reply renders exactly once (transcript oracle) and no Stop/spinner stays.
2. socket drop while a held turn runs, then a Control+Enter follow-up right
   after the redial: both turns run in order, oracle holds, nothing spins.
3. gateway SIGKILL mid-turn: supervisor brings a new owner up, recovery
   fences the turn `unknown`; the lost-turn card + Discard are on screen
   with "1 Queued — paused"; a follow-up is queued ("2 Queued — paused")
   and does not run ahead; Discard lets it run; oracle holds.

The classifier now routes the queue panel to the core lane, since the
lost-turn card lives there.

Refs #134889 (NF2)
Refs #140337
2026-10-17 11:33:13 -07:00
Eddo Jansen
5d8cd4d56f fix(desktop): restore pending clarify cards on session re-entry
(cherry picked from commit d81494733ae7da7514af0d487226a027d9655813)
2026-10-16 19:21:02 -07:00
Teknium
0715474bfd Merge origin/main into feat/unified-gateway-runtime
375 commits from main (0e427d788d). 24 files conflicted; the resolutions that carry a decision:

- /initiate-setup: main removed the command (25bf722063). Its gateway rewrite, CLI handler and the
  Desktop kickoff go with main; this branch's command-layer admission of it is dropped too
  (gateway/session_commands.py _PROMPT_COMMANDS, its slash.exec test row, the parity doc row), and
  the Desktop slash dispatcher loses the `hidden` option that only the kickoff used.
- Code this branch moved out of its old file, carrying main's edits to the moved copy:
  first-contact notes (gateway/run_turn.py -> run_turn_prepare.py: no message/setup_command),
  the TUI agent factory (tui_gateway/server.py -> agent_factory.py: onboarding toolsets at build,
  setup_beat/set_theme lifecycle cards, no cli platform extras on a coding selection), the serve
  lifespan (web_server.py -> web_server_app.py standalone_lifespan: first-install probe before the
  state.db reconcile, onboarding due answer after the setup bootstrap), and the compression child
  publish (the shared _publish_compression_child_on_conn reads the parent's model_config).
- agent/auxiliary_client.py: both import changes (_route_key from main; this branch's move of
  _without_structured_output_format).
- Desktop: main's onboarding run (decideOnboarding, OnboardingEnd, card-waiting Send) replaces the
  kickoff; this branch's prepared-submission slash path, request_id on session.create and
  PreparedImageRecovery stay. Pool-limits imports are dropped (this branch removed the pool).
  createBackendSessionForSend takes main's (preview, overrides) signature.
- ci.yaml detect job: main's `ref: inputs.commit` plus this branch's sparse checkout.
- package.json / lock: main's vitest 4.1.11 plus this branch's ws 8.21.1.
- Generated: gateway-contract.openrpc.json regenerated; parity doc regenerated.
2026-10-14 05:52:49 -07:00
unsupportedpastels
9efe00981d test(desktop): e2e sandboxes use canonical paths so the gateway sweep finds its own backend
The backend resolves HERMES_HOME before spawning the detached gateway, but createSandbox kept os.tmpdir()'s path as given. Under a symlinked tmpdir (macOS /var -> /private/var, a symlinked scratch dir) legacy-desktop-history's teardown compared the unresolved sandbox path against the gateway's resolved HERMES_HOME, matched nothing, and left one detached gateway running per local run. The sandbox root is now realpath'd, and the sweep compares resolved paths.
2026-10-14 11:54:47 +00:00
Teknium
e06df9c2ea fix(desktop-e2e): the core onboarding spec covers provider setup without the trial
With guests allowed, a fresh sandbox now opens the first-run onboarding
chat on the free trial instead of the provider setup overlay the spec
drives (#137522, #137807), and once a provider is configured the due
onboarding starts on the next launch, which replaced the session the
reload step expects. The spec turns guests off and records onboarding
as done; it tests provider setup and plain first chats. Failed on v0.22.0
attempt rc.1 (Desktop core E2E, Linux); passes locally under Xvnc.
2026-10-13 15:07:03 -07:00
Teknium
35447d99c9 refactor(desktop): split the cross-profile project merge and the legacy-history probes under the CC cap
`mergeProfileProjectTrees` (CC 21) and the API-probe block of
e2e/legacy-desktop-history.spec.ts (CC 23) came in over the code-health target of 20 and
block `scripts/check` against main, so every push to the branch was refused.

- mergeProjectInto(): the per-folder fold (repos/groups by id, totals, newest activity and
  previews) moves out of the loop unchanged.
- The spec's ten try/catch probe blocks become one table of (name, request, shape) run
  through a single `probe` helper; every probe name, request and result shape is the same.

No behaviour change. Checks: apps/desktop typecheck, electron/profile-session-routing.test.ts
(51 passed), eslint on both files, scripts/check --only health vs main 0 blocking.
2026-10-12 21:29:27 -07:00
unsupportedpastels
fd71031264 fix(desktop): mint a session write's grant for the profile its body names
The Bots plugin hides and unhides a bot's sessions with
PATCH /api/sessions/<id>, naming the owning profile only in the JSON
body. Main minted the native grant from the URL alone, so a write to
another profile's session carried the window's own grant and the
gateway, which checks the body's `profile` too, answered 403
profile_scope_mismatch.

When the URL names no profile, the grant is now minted for the body's
`profile`. A URL selector still wins; the gateway refuses a body that
disagrees with it either way.

The e2e spec seeds a cron job in each profile and checks the
all-profiles cron list on both routes, and sends the Bots hide write for
the developer profile's session from a window on default. Both fail on
the previous head (ENOENT, 403 profile_scope_mismatch) and pass here
with multiplex off and on.
2026-10-13 02:52:24 +00:00
unsupportedpastels
8a773c27a3 fix: load the all-profiles Projects view and PR badges over native grants
The gateway refused /api/profiles/projects/tree and
/api/profiles/sessions/pull-requests for every native grant, because
both scan every profile and a grant names one. The all-profiles
Projects view answered 403 profile_scope_mismatch on every refresh and
the PR scan could not run.

Gateway: both routes take a `profile` that limits the scan to that
profile, and the native grant check treats them like the session lists:
the selector is required and must be the grant's own profile, so `all`,
another profile, or no selector is still refused. Without a selector the
routes scan every profile as before, so token-authenticated clients are
unchanged. Each project now reports the folder key it was merged by.

Desktop: main assembles both reads from one request per profile, each
with that profile's own grant, and merges them the way the gateway does:
one group per folder, a declared project over an auto entry, summed
totals and the newest previews. A profile that cannot be read is
reported in `errors`, and the PR scan only settles ids it could read.
2026-10-13 02:40:47 +00:00
unsupportedpastels
69fdc833fc fix(desktop): keep the all-profiles sidebar whole on the registry route
On the registry route main adds the route's own `profile` to the path.
The per-profile sidebar fan-out rewrote `recents_profile` and minted that
profile's grant but kept the inherited `profile=default`, and the gateway
checks every selector, so each other profile answered 403
profile_scope_mismatch and the all-profiles view showed only default.
Each per-profile read now names only the profile it reads.

The e2e spec now also drives the rail's home pill (default, all
profiles, default again), probes the all-profiles read the way the
renderer sends it on the registry route, and requires every legacy row,
Nous-stamped included, to resume without error.
2026-10-13 02:27:15 +00:00
unsupportedpastels
105b098dac fix(desktop): list every profile's sessions over native per-profile grants
A native HTTP grant names one profile and the gateway refuses any other
selector, including `all`. Two Desktop routes still sent one grant for
many profiles, so the sidebar dropped whole profiles of history:

- The batched sidebar names its owner in `recents_profile`, but the grant
  was minted from `profile`, i.e. for the window's own profile. Any other
  profile's sidebar, and the all-profiles sidebar, answered 403
  profile_scope_mismatch.
- `/api/profiles/sessions?profile=all` minted a grant for a home named
  `profiles/all`, which fails with ENOENT before the request is sent.

Mint the sidebar grant from `recents_profile`, and assemble the two
all-profiles lists in main from one read per profile, each carrying that
profile's own grant. The merge mirrors the backend's own scan: recency
order, pinned back-fill, per-profile totals, and an unreadable profile
reported as a failed profile rather than an empty one.

The e2e spec seeds pre-cutover Desktop rows on default plus a named
profile and opens each from the real sidebar; it fails on the previous
head (403/ENOENT, named profile's sessions missing) and passes here with
multiplex off and on.
2026-10-13 02:27:15 +00:00
Teknium
5d2f94b92c Merge origin/main (#37: 15 commits to 1f711b275f) into feat/unified-gateway-runtime
No conflicts. Brings in #136276 (update e2e sandboxes pinned to the main channel; the
source hand-off fixture installs its loopback transport once).
2026-10-10 14:30:21 -07:00
Teknium
1c9135d5c2 test(e2e): the Desktop update harness keeps the seed's channel record
configureProvider() rewrote config.yaml from scratch for every spec, after
the seed had pinned `update.installs.<id>: main`, so the three Desktop update
specs still saw the stable default (release run 38078988253: the update check
answered {"channel":"stable","error":"release-unavailable"}). It now carries
the seed's top-level `update:` block into the provider config it writes.
2026-10-10 14:29:51 -07:00
Teknium
3a4b4b6f83 test(e2e): update sandboxes follow the main channel, not the stable default
#135847 made an official-origin source checkout default to the stable channel,
which resolves only from GitHub's latest published release. The upgrade-network,
Windows install+update and Desktop update harnesses keep the official URL as
origin, publish commits on main and never a release, so every update in them
stopped at the stable default:

- e2e-upgrade (network): "Could not resolve the stable source channel: No
  published stable release could be verified" (9 failed)
- Windows install + update E2E: "Release: stable v0.21.6; this checkout is
  newer and waits for the next release", checkout never moved (12 failed)
- Desktop update E2E (app-update, update-concurrency, build-fail): the update
  check answered {"channel":"stable","error":"release-unavailable"}

These suites test moving between commits, so each seeded install now records
`hermes update --set-channel main` right after its installer (new
_install_helpers.pin_main_channel; Windows Machine.install). Stable resolution
keeps its own coverage: test_release_channel_records sets stable explicitly on
the same seeded install, and tests/hermes_cli/test_source_release_channels.py.

Local: tests/e2e/core/upgrade/network on main plus this change, 21 passed
(4 failed in test_offline_and_flaky.py on main before it).
2026-10-10 14:29:51 -07:00
Teknium
ab9633b0af fix(desktop): E2E and harness launches leave the OS hermes:// handler alone
Every Electron launch calls app.setAsDefaultProtocolClient, which on Windows
rewrites HKCU\Software\Classes\hermes. An unpackaged checkout registers
`electron.exe <checkout>`, so running the Desktop E2E suite on a dev box
repointed the user's installed hermes:// handler at the test checkout (base
and head alike).

registerDeepLinkProtocol moves to electron/deep-link-protocol.ts (main.ts is
at its size cap) and skips the OS registration when
HERMES_DESKTOP_SKIP_PROTOCOL_REGISTRATION=1. The core, mock-backend and
update harnesses set it. Deep links that arrive through argv /
second-instance still route as before; production launches are unchanged.

Test: deep-link-protocol.test.ts (skipped with the env, registered with the
dev exec path / bare otherwise).

Review: https://github.com/NousResearch/hermes-agent/pull/106742#issuecomment-6073624820
(cherry picked from commit 8e72f6460aa00e084a842b6c30b0309a24bfc4f7)
2026-10-09 02:10:49 -07:00
Teknium
f12e19697a test(desktop-e2e): the core lane's process census and tool paths work off Linux
On Windows the core lane failed 7 specs the same way on base and head
(jquesnelle's Windows 11 run): the process census read /proc (no procfs, so
readdirSync('/proc') threw and every backend/orphan count was wrong), and the
scripted terminal commands interpolated sandbox paths unquoted (`rm -rf
${victim}`, `touch ${ready}`), which a path with spaces (C:\Users\First Last\...)
splits into several arguments.

- e2e/core/process-census.ts owns the census. Linux keeps the /proc
  environment match (orphans reparented to init included). Elsewhere a
  sandbox's processes are the tree under every gateway pid its gateway.lock
  files have recorded (remembered, so a stopped gateway's orphans are still
  counted), listed with `ps` or Win32_Process. HERMES_E2E_PROC_CENSUS=ps
  forces the tree census on Linux, which is how it is exercised here.
- shellQuote() single-quotes each path (MSYS form on Windows, for Git Bash);
  interactive-prompts and reply-settle-paths use it.
- stopSandboxGateway reads a quoted argv[0]; the update harness's zombie
  check only consults /proc where it exists.

Verified: process-census.unit.test.ts (real processes, a path with a space
and a quote; procfs and ps modes) 3 passed; live Linux Electron runs of
interactive-prompts, boot-lifecycle, reply-settle-paths and boot-lifecycle
with HERMES_E2E_PROC_CENSUS=ps all pass. Not run on Windows here.

Review: https://github.com/NousResearch/hermes-agent/pull/106742#issuecomment-6073624820
(cherry picked from commit c5d2945c9f7a002b2e36759ee942908b1c59f45c)
2026-10-09 02:10:48 -07:00
Teknium
65bec86e37 Merge origin/main (#27: 19 commits to 517b5e10fe) into feat/unified-gateway-runtime
45 conflicts, all from #135177 (lefthook + `ruff check --fix` over 2,366 files). No other main commit
touches a conflicted file. Resolution: the branch side of each file, then main's exact autofix
(ruff 0.15.10, `--config ./ruff.strict.toml --fix`) on it — rewrites only (typing generics, noqa
drops, import forms), no import removed. tests/cron/test_bot_chat_cli_home.py stays deleted
(1cc9cb9199 retired its lane).
2026-10-08 12:09:24 -07:00
Maciej Lisiewski
d76cce4f11 ci: apply all automatic linter fixes available 2026-10-08 17:22:54 +02:00
Teknium
0a25fab6cf Merge origin/main (#23: 34 commits to dde8800ed9) into feat/unified-gateway-runtime
Conflicts:
- gateway/run_turn.py: the branch moved the block to run_turn_prepare; main's b1a39a1b1b
  restore_session_yolo call ported there.
- Desktop pool (main 167e9fdb84 no-idle-reap): the branch removed the local backend pool;
  pool-retire.{ts,test.ts} and pool-limits-setting.tsx stay deleted, main.ts keeps no pool.
  main's MSIX relaunch-waiter logging (bdb8f92f3b) auto-merged.
- e2e/core/no-idle-reap.spec.ts rewritten for the single local gateway: a profile dial stays on
  the same gateway pids and descriptor past the old pool idle window (1 passed, 3.6m).

One /yolo contract: gateway-owned sessions (session_busy_controls.yolo_config -> toggle_session_yolo)
and managed workers (restore_session_yolo) use main's tools/approval_yolo.py; the launch --yolo seed
(apply_launch_yolo) moved there and is skipped under a process-wide --yolo.
2026-10-08 02:00:21 -07:00
Teknium
167e9fdb84 fix(desktop): never idle-reap a local profile backend (#134942)
* fix(desktop): never idle-reap a local profile backend

Support f502bc6f: with a remote primary, a "This device" profile's local
`hermes serve` child was SIGTERM'd by the pool idle reaper after 60 min with
nothing streamed (the #105239 pinned-tier TTL), leaving "This device ·
Backend offline" while the user still had the chat open.

A local backend runs its profile's cron jobs and bot chats with nobody
watching, so idleness is not a reason to kill it. The idle reaper now only
reclaims connection descriptors (remote routes: no child, no slot). Local
children are still bounded by the maxBackends slot cap and foreground
reclaim (activeTurn vetoed), unchanged. Removes POOL_PINNED_IDLE_MS.

The Backend Idle Timeout setting description now says it applies to remote
connections only.

E2E no-idle-reap.spec.ts: a pooled local profile backend survives two reaper
ticks past both idle windows. Fails on main (backend reaped), passes here.

* chore(desktop): drop the dead pinned-tier idle policy (retireIdle, lastStreamedAt)

Greptile P2 on #134942: with local children no longer idle-reaped, retireIdle
has no production caller and lastStreamedAt no reader. Removes both, the stamp
write in touchPoolBackend, and the pinned-tier test. The shared retirement
safeguards stay covered through evictTo (identity, admission permit, activeTurn
veto).
2026-10-08 00:54:37 -07:00
Teknium
1bb22926ee Merge origin/main (#20: 54 commits to c538ec5f40) into feat/unified-gateway-runtime
No conflicts.
2026-10-07 15:22:46 -07:00
unsupportedpastels
75dfe26cea fix(desktop): default UI Scale to 100% and keep chat text at 110%
Fresh installs opened at 90% window zoom, and View > Actual Size (Ctrl/Cmd+0) reset to 90% rather than actual size. Ship 100% as the default UI Scale; Chat Text Size keeps its 110% default.
2026-10-07 14:18:18 -05:00
Teknium
b178d9098c Merge origin/main (#18: 76 commits to 3569fba6a6) into feat/unified-gateway-runtime
No conflicts. Overlapping auto-merges: agent/conversation_loop.py, agent/credential_pool.py,
cron/{executions,jobs,scheduler}.py, hermes_cli/{main,update_cmd}.py, Desktop i18n en/types,
locales/_keys.desktop.json, tests/fixtures/resolution_allowlist.json, cron docs.
2026-10-07 07:33:34 -07:00
Teknium
ca38632fc0 Merge origin/main (#17: 454 commits to e6757f2029) into feat/unified-gateway-runtime
12 conflicted files, resolved in three lanes:
- gateway/run.py: take the branch split; main's tirith removal and spool-replay
  ordering ported into run_runtime_init.py / run_bootstrap.py.
- config migrations: main keeps v50 (tirith); the branch's bot-chat timeout removal
  becomes v51 (_config_version 51, template + test updated).
- hermes_state_usage.py: main's voice_chat task route threaded through the branch's
  owner transaction; worker.persist usage allowlist accepts task.
- tui_gateway/server.py: branch side; main's edits applied where the code now lives
  (agent_factory, session_registry). Desktop sessions get the catalog toolset on the
  authority path; daemon-run finite CLI turns are not watched turns; lazy session info
  reports nous/welcome on the free tier.
- Desktop/Ink: one branch-child spinner fix (main's route-token check); main's
  uninstall i18n keys kept, pool keys stay removed; voice_turn forwarded and accepted
  by the authority submit (surface_v1.voice_turn).
- chat_ws / PTY keepalive test: main's stricter test kept.
2026-10-07 06:48:09 -07:00