Review follow-ups on the phone tab picker:
- A row decides whether it has a menu when the picker opens (PickerRow
mounts then). The rows used to be built with the picker's last render,
so the main tab stayed without its menu after it gained a session until
something else re-rendered the zone.
- The tab menu hangs off an inert anchor, so a plain close (Escape, a
non-dialog verb) now hands focus back to the picker button; a dialog the
menu opened keeps it.
- Tests cover the main tab (none on a fresh draft, targets the selected
session once it has one) and the focus hand-back.
Refs #145774
On a narrow touch viewport the tab strip gives way to CompactTabPicker,
which only offered switch / close-current / +. A session tab's menu
(rename, archive, delete, ...) lived only on the strip's right-click, so a
phone could never archive, delete or rename a session.
Each picker row now carries a 44px "..." button that opens that tab's own
menu: a new PaneChrome.tabActions renders the SAME session verb set the
right-click menu uses (one useSessionTabActions source feeding both
SessionContextMenu and SessionActionsMenu), delete still behind its
confirm dialog. The menu stays mounted after it closes so the rename and
delete dialogs it opened survive. The wide-viewport strip is unchanged.
Fixes#145774
Refs #144648
#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.
The existing case ends with a finger still down, so the touchend guard alone kept it green.
Both fingers are now down during the move and the editor finger ends last with no touches
left: removing the touchmove cancellation turns this red. (Greptile P2 on #145838.)
The touch tap-focus handlers only looked at the first finger. A second
finger that lands outside the editor never fires touchstart on it, so a
gesture that started with one finger in the editor, added a second
elsewhere, moved the first under 10 px and lifted it while the second
stayed down still counted as a tap and focused the composer (opening the
iPhone keyboard mid-pinch).
touchmove now cancels the tap whenever more than one finger is on the
screen, and touchend does nothing while any finger remains.
Reported by @unsupportedpastels in the review of #145569.
Refs #145166
In the browser-hosted Desktop a URL preview renders in a sandboxed iframe that
no page reader can ever register for, so desktop_preview read answered "The page
has not finished loading — retry in a moment." forever (after an 8 s wait on a
pop-out that cannot exist there). It now answers at once with surface: "iframe"
and a note pointing at web_extract / browser_exec.
read_window_below in a browser tab got an empty answer, which the tool reported
as "the desktop app did not answer". The renderer now answers the documented
{error, platform} shape saying a browser tab cannot see OS windows.
Electron behaviour is unchanged (gated on hostHas capabilities).
With several profiles and no chats, projects, threads or jobs anywhere,
the sidebar fell back to the blank state and hid the empty profile
sections the grouping had built. Two or more profile groups now keep the
session area; a lone empty profile still shows the blank state.
Grouped by profile (All profiles), a profile with no chats had no section,
so a new or quiet profile vanished from the sidebar. Profile groups now
also come from the profile list the profile picker reads ($profiles),
added empty under the owner that list was read from (the request
connection, `local` in a Webapp tab, the untagged primary pool natively).
An empty section shows its header, new-chat action and a muted
"No sessions yet" row. Filtered, archived and failed-load views stay as
they were. Shared by the Webapp and native Desktop sidebar.
Every Webapp row now carries connection_id 'local', and the sidebar's
usage selector refused any group with a connection id, so per-profile
cost/token totals vanished in the Webapp. A browser-hosted tab's `local`
groups are the serving host's own profiles, the gateway the totals were
read from; native registry gateways keep the guard.
The session-owner stamp doc said `local` is never stamped; the Webapp
REST door now tags every listed row `local`, so the doc names that
exception. A Webapp resume already routed through `local` (the tab's
connection is mode remote, connectionId local), so the tag changes no
dial: it only stops the remembered-owner hint write, and the row's
detail read is tagged the same.
New vitest: a row listed through the Webapp bridge (gateway local,
profile work) resumes on the tab's own socket with profile work, reads
work's transcript through (local, work), builds no second socket, and a
later open without the listing (no hint) routes the same. Fails with
the bridge's tag removed (checked).
The Webapp's new chats name their owner `local` (the bridge's only source), but
the session rows it lists came back untagged: Electron's main process stamps
each source's rows with their connection, and the browser bridge had no
equivalent. Grouped by profile, one gateway then split into an unowned
top-level `default` group plus a `local` gateway section holding `default`
again. The bridge's REST door now tags listed rows like Electron does, and a
`local` section no registry lists reads "Hermes host" instead of its raw id.
Found on Hermes Cloud staging.
Maintainer ruling: Desktop and the Webapp must keep installing private
plugins. The https-only source rule this branch added
(guiInstallSourceRefusal in the native install IPC, gui_install_source_refusal
in plugins.manage install and POST /api/dashboard/agent-plugins/install)
refused git@/ssh:// private repos, http:// and file:// local folders. It
goes, with its tests, and the user guide says Install from Git takes any
git source `hermes plugins install` accepts.
The symlink / plain-tree / 64 MB refusal in publishDesktopTree, the
reconcile refusal report in the install dialog and the forced-reinstall
fix stay.
installDesktopPluginFromGit removed the existing folder as soon as Force
was set, before publishDesktopTree checked the new tree. A replacement
the plain-tree check refuses (a symbolic link in it, over 64 MB) then
left the user with no plugin at all. The early removal goes:
publishDesktopTree already replaces the folder after the check, the
staged copy and the marker succeed, under the same root-writer lock.
The reconcile walks every profile and the first one to publish a name
owns the root copy; a same-named package refused in an earlier home no
longer surfaces as the install dialog's failure.
A combined package's desktop half is published by the reconcile pass,
and a half that pass refuses (a symlink in its tree, over 64 MB) was only
logged. The reconcile IPC returned the published paths alone, so the
dialog toasted "Desktop plugin <name> installed" for a half that was
never copied.
The reconcile IPC now answers { published, refused: [{ name, reason }] }.
The preload keeps reconcileDesktopPlugins() returning the published paths
for its existing callers and adds reconcileDesktopPluginsReport(); the
install run reads it and puts the refusal reason in the dialog for the
package it just installed. The agent half's success toast is unchanged.
The symlink refusal and 64 MB cap ran only in the git installer, so a
combined agent+desktop package (agent half installed, desktop half copied
by the reconcile pass) still published a link inside its desktop/ folder.
publishDesktopTree now takes the tree's containing package and checks it
before staging; only a package folder the user symlinked in by hand (a
development checkout) is copied as it stands.
The Install button in native Desktop (hermes:plugin:installDesktop) accepted
file://, ssh://, git@ and http:// sources and copied the desktop/ tree with
fs.cp, which publishes symlinks (and copies through a symlinked desktop/
folder), so a repository could publish files from this machine as plugin
files. The IPC door now refuses any non-https source before cloning, and the
installer refuses a desktop tree with a symlink on the way to or inside it,
plus a 64 MB cap, the same policy as the Webapp's host-side desktop install.
`hermes plugins install` keeps every scheme it documents.
The existing test only checked that noteTurnSettled skips an off-screen
settle. These two drive the real useSessionActions resume with the real
message.complete handler, fired while session.resume is in flight and the
hook's own view binding is null, and assert what the user sees: the
whole reply, not its first chunk.
- main window: the prefetch page lacks the reply, the idle resume omits
its snapshot, and the barrier re-read must win over the stale view.
- watch window: no prefetch; the resume's own snapshot must win.
Both fail on origin/main's message-stream/settled-turns/resume-reconcile
sources with ['A1firstanswer', 'A2inarratingA2'] and pass on this head.
A socket drop while the answer after a tool call streams re-runs the cold
resume of the open chat, which unbinds the view from its runtime until the
resume RPC answers. When the turn's message.complete lands in that window it
settles only the runtime's state; the view still shows the first chunk.
The settle tracker (settled-turns.ts) recorded that complete anyway, so
liveTurnSettledDuringResume told the resume "the live transcript on screen is
newer than your inputs" and it kept the view, throwing away the page the
idle-resume barrier had just re-read (rereadPageAfterResumeBarrier, #145612)
with the whole committed reply. The view stayed truncated until a periodic
session sweep or a reload.
A settle now counts only when the view was bound to that runtime as it landed.
An off-screen settle clears the mark, so the resume reconciles its
post-barrier page as #145612 intended. A settle the view painted keeps the
live transcript exactly as before.
Evidence: core e2e reply-tail-after-reconnect (instrumented: complete arrives
with the view unbound, the runtime state and the re-read page both hold the
full reply, the shortcut picks the stale view).
A reviewed catalog pick kept Install enabled while the post-refusal
catalog lookup was still running; a click then waited for it and
installed the new pin unseen. Install now stays off until the re-read
inspection and pin are on screen, and the request is captured at the
click.
Three follow-ups to the install dialog holding an install to the commit it showed.
- Catalog picks. The backend reloads the live catalog entry at Install, so a
re-pin between the dialog's inspection and the click installed (and, through
the one checkout, published the desktop half of) a tree nobody reviewed;
the renderer sent no inspected_sha for catalog sources and neither the
catalog install nor reuse of a disabled tree read it. Now the catalog
install compares the commit it actually checked out with the inspected sha
peeled through the clone (annotated-tag pins still install), a disabled tree
is reused only at that commit (or its recorded tag pin), and catalog dialogs
send it: the backend's inspect sha in the Webapp, the shown reviewed pin on
native Desktop (whose Electron probe reads the branch tip). After a re-pin
refusal the native dialog re-reads the catalog for the new pin. The record
stays the catalog's pinned record. Electron's desktop clone uses the same
reviewed commit and peels a tag pin.
- Older backends. A backend that refuses inspected_sha at admission is no
longer retried without it behind the user's back: the dialog explains that
this backend cannot guarantee the reviewed version is what gets installed
(update it for that guarantee) and installs only on an explicit
"Install anyway" (profile kept); Cancel installs nothing.
- Partial installs. Native Desktop on a remote backend could install the agent
half at commit A, fail the desktop half (source moved), re-review to B and
let a second Install put the desktop half down at B beside the agent half at
A. That is now reported as a partial install (agent half in at A, desktop
half not); Install stays disabled until Force reinstall, which replaces both
halves with the version shown.
Two follow-ups to the install dialog holding an install to the commit it
inspected.
- An install is resent without `inspected_sha` only for an older backend's
admission refusal: a JsonRpcGatewayError with code 4000 whose message
opens with `validate_params`' prefix. Matching the text anywhere also
matched a 5026 install failure that forwards a git server's clone error,
so that server could get the reviewed commit dropped.
- A refusal because the source moved past the reviewed commit now carries a
structured marker: the backend raises PluginSourceMoved and
`plugins.manage` answers 5026 with `data.reason == "source_moved"` (agent
install and `install_desktop`); Electron's desktop install returns
`sourceMoved: true` when the reviewed commit cannot be checked out. The
dialog answers it by dropping its inspection, reading the source again
and naming the new commit; Install waits for it. Retry used to resend the
old commit and fail the same way every time. A pin the user typed is not
re-reviewed, and nothing from the stale review installs (the desktop half
is skipped when the agent half was refused).
A newer native Desktop on an older SSH/URL/Cloud backend had every custom-source
install refused at admission ("invalid params for plugins.manage: inspected_sha:
... out of sync"). Resend once without the field on exactly that refusal (the
handler never ran), the same drop-and-resend session.create uses for fields older
backends lack. Current backends still get inspected_sha and refuse a moved branch;
Electron's own desktop-half install keeps its exact-commit check.
The dialog inspects a source and shows its commit, but the agent half
cloned the branch tip at Install time: a branch that moved in between put
down a tree nobody reviewed, and the desktop half copied out of that
checkout followed it. Native Electron's probe returned no commit at all, so
its desktop clone had the same gap.
- plugins.manage install takes `inspected_sha` (custom sources without a
pin). The clone stays an ordinary branch checkout and is refused when its
tip is not that commit: "The source changed since you reviewed it ...
Re-open the install dialog". Not `ref`, which records a pin that refuses
every later `update`; not a detached checkout at the old commit, which
`git pull` cannot update. Catalog picks keep their pin.
- That install drops inspect's kept answer for the source, so re-opening
the dialog reads the moved branch instead of the stale commit.
- Electron: probePluginRepo returns the commit it read; installDesktopPlugin
takes it and installs exactly that tree (fetch + verify) or refuses.
- A dev checkout linked at plugins/<name> with a root plugin.js: Electron's
publish copied the link itself (fs.cp keeps a top-level link), so the
"copy" was the checkout, the marker was written into it, and the prune
(which skipped linked folders) left a ghost after the link went. Copy from
the resolved folder; never keep or stamp a link at <root>/<name>; the prune
follows links and drops only the link. The host twin gets the same
link-target and prune handling (its copytree already copied the files).
- The install dialog decided desktop success from the reconcile's touched
list, which also names folders the pass deleted: a force reinstall whose
new tree dropped its desktop entry read as installed. Read the folder
(Electron fs bridge, or the host's /api/desktop-plugins) instead.
- Re-pin consent: the desktop half is a presence surface, so moving it
between plugin.js and desktop/plugin.js widens nothing.
A mixed package with plugin.yaml + __init__.py and a ROOT plugin.js is
reported by the install probe as carrying both halves, so a browser tab
(and native Desktop on a local backend) installs the agent half alone and
leaves the desktop half to the reconcile pass. Both reconcilers (the host's
desktop_plugin_halves.py and Electron's desktop-plugins-root.ts) only read
desktop/plugin.js, so nothing was copied while the dialog still said
"Desktop plugin <name> installed".
- One entry rule for every reader: desktop_source / desktopHalfSource (root
plugin.js wins, else desktop/plugin.js), used by both reconcilers, the
Webapp installer, findDesktopEntry, plugins.manage list's has_desktop_half
and the plugin doctor's stale-copy check.
- A root-layout half publishes the package root as the installers do,
without .git and __pycache__, held to the installer's plain-tree rule
(no links, 64 MB cap); a refused tree is logged and not copied. The
marker's source is the package root, so the prune follows it.
- The install dialog reports the desktop half only when the reconcile
copied it or <root>/<name>/plugin.js is already there; an agent install
that left no desktop half reports "Desktop plugin install failed".
Review follow-ups on the Webapp desktop-plugin install:
- A package with an agent half was cloned twice from a browser tab: the agent
install, then a second install_desktop clone into the folder the host's
5-second scan also copies that package's desktop half into, so the clone
could answer "already exists" or the two copies could be different commits.
A tab's backend is the host that serves it, so the package lands where the
tab's plugins load from: the desktop half now comes out of that one checkout
through the host's reconcile, as native Desktop does with a local backend.
install_desktop stays for desktop-only repositories.
- A catalog pin naming an annotated tag never matched the commit inspect
reports. The clone now fetches the catalog's own pin (as the agent installer
does) and requires HEAD to be the commit the dialog reviewed.
- The published folder no longer carries the clone's .git (nothing reads it),
and removal / force replacement use rmtree_readonly, so a folder holding Git's
read-only objects (a native or hand install) can be deleted on Windows.
Hardening on top of the contributor's Webapp install path (salvage #146132). A browser tab asks the
serving host to clone code onto it, so the host now decides what lands, not the tab:
- `ref` is required: the 40-hex commit the dialog showed (or the user's pin). The clone is checked
out at exactly that commit and the halves are read from that checkout, instead of re-using a
ten-minute inspection cache and installing whatever it named; a catalog install whose pin moved is
refused. `forget_inspection` goes away with the cache dependency.
- https only: `file://` would copy any folder of the host, `ssh`/`git@` spends the host's keys,
`http://` can be rewritten in transit. Native Desktop keeps those for a user at their own machine.
- The published tree may hold no symbolic link (a `desktop -> /anywhere` link in a repository
published that host folder) and is capped at 64 MB.
- A standalone plugin's in-tree `.hermes-package.json` is dropped as Electron's installer drops it:
only an installer writes the marker that pairs a folder with an agent package.
- `desktop_plugin_halves`: the helpers the installer shares become public names instead of
wrapper functions around private ones.
- Renderer sends `ref: plan.ref ?? plan.probe.sha`.
- Tests: the contributor's installer/RPC/route cases now run through an https identifier at a real
commit (only the clone's network leg points at the local repository); RPC cases folded into one
round trip; two added invariants (https only, link escape), each proven red with its guard removed.
In the browser-hosted app, installing a desktop plugin dead-ended: the install dialog could inspect a
repository through the gateway (`plugins.manage inspect`, #145770) but had nothing to install with.
A desktop-only package answered "This package has nothing to install here." and the desktop half of a
mixed one was skipped with a toast, because the only clone lived in Electron
(`installDesktopPluginFromGit`). Since #145072 the Webapp *loads* whatever sits in
`<root>/desktop-plugins/`, so the last mile was missing: no way to put it there from the UI.
This adds `plugins.manage` `install_desktop` / `remove_desktop` — the backend half of that install —
and points the dialog at them when it is not running in Electron.
- `hermes_cli/desktop_plugin_install.py`: clones a repository's desktop half into the app-level
`desktop-plugins/` root. Same resolution, folder name and package-marker rules as Electron, and the
same staged-copy-then-rename publication under the root's writer lock, so a reconcile pass cannot
copy a folder underneath it. The clone is held to the commit the inspection read, so a repository
that moves after review cannot install a tree nobody looked at; `force` re-inspects (a forced
reinstall means the repository moved). `remove_desktop_plugin` refuses a package's own half unless
forced, and refuses a linked folder it would only half-delete.
- `plugins_cmd_inspect.forget_inspection`: drops the ten-minute answer cache, used by a forced
reinstall.
- `desktop_plugin_halves`: `ROOT_WRITER` and `publish_desktop_tree`/`read_package_marker`/`mtime_ms`
go public (the installer shares the root's lock), a standalone plugin publishes with no marker, and
the Webapp's read router imports the root from the one place that defines it.
- `plugins.manage install_desktop|remove_desktop` + contract (`tools_mcp_plugins`), regenerated.
- Renderer: `desktopInstallSupported()` is also true in a browser-hosted tab, `cloneDesktopHalf` falls
back to the gateway, and a backend that predates the action keeps the old "unavailable in this
environment" wording. Uninstalling a disk plugin uses the same fallback.
- Docs: the Webapp install/remove paragraph now describes the working path.
Tests: 10 installer (real local clones: standalone vs package marker, force, sha pinning, path-shaped
names, linked folder, removal rules), 6 gateway RPC (incl. contract validation), 3 browser-modal cases
(desktop-only, both halves, old backend) beside the 6 existing ones, and one route test that installs
through the backend and then reads the plugin back over `/api/desktop-plugins/*` — the whole trip the
browser makes.
/api/status is public, so the sign-in gate never refreshes on it: a signed-in
Webapp tab whose access token expired since its last gated request reads the
trimmed signed-out body until its next gated request rotates the cookies.
Every Desktop reader took that body as a real answer:
- browser-served-profiles read() saw no gateway_shared_with, took it for an
older backend and reset the served set to "everything served", so the
unserved-profile guard in both profile switchers stopped working until the
next read. It now keeps the last set and re-reads on the next inventory read.
- the statusbar snapshot dropped most fields and dismissed the shared-profile
warning; it now keeps the last snapshot.
- the Command Center system panel keeps its last full status.
- the shared-gateway restart confirm saw no served set and restarted the
multiplexer without asking; it now makes one gated request (/api/auth/me,
which rotates the cookies) and re-reads.
isSignedOutStatus() detects the trimmed shape: auth_required true with neither
active_sessions nor install_id, which the full body always carries.
peek_session stays side-effect free.
The notice now leads with the HERMES AGENT wordmark in the bundled
Collapse face, as an empty chat does, and uses the theme's accent for the
wordmark and a primary Reload button. The face loads through FontFace;
if it fails, the lettering falls back to bold system uppercase.
applyTheme stores the colours as one snapshot (background, foreground,
accent, accent ink) beside the pre-paint keys, so a failed write never
pairs one theme's background with another's ink. It stores none when a
colour is an unresolved var(), which means nothing without the app, and
drops a stale snapshot when the write fails. With a snapshot the notice
paints its own background too, so the pair holds whether or not the app's
stylesheet painted the page; without one it inherits the page's colours
and keeps an outlined button, as before.
The writer lives with the theme code (themes/boot-palette.ts) and the
notice keeps its own small reader, so the renderer entry imports no new
chunk: it must not need another request before it can show the notice.
A test round-trips the two.
Since 3d8dafc729 the renderer loads the whole app through one dynamic
import, and in the production build every app stylesheet is a
dependency of it. When one of them, or the app chunk, fails to load once
(a dropped request), the import rejects, `void` discards the rejection
and React never mounts: the page stays blank with nothing to click.
The entry now logs the cause and, while #root is still empty, shows a
short notice with a Reload button. Transparent windows (the pet overlay,
the wake indicator) only log: they are click-through or too small for a
notice, which would only paint over the desktop. Their list moves into a
small module that the entry and main.tsx share. It never reloads on its own, as the
dashboard's chunk recovery settled for a failure on the same build
(#145357), and as native Desktop treats a failed page load.
GET /api/webapp-access/status ran access_status() inside _scoped ->
_profile_scope, holding the process-wide _SKILLS_PROFILE_LOCK across the
gateway control-socket round trip. The pane polls it every 10 s, so each
poll stalled every config, skills and tools request for the gateway's
answer time (the full timeout when it is slow or mid-restart). Resolve the
gateway with _scoped, then query through _in_gateway_home, as _restart does.
The pane's status query also takes staleTime: 0, so reopening it reads at
once instead of showing the shared client's cached answer until the next
poll tick.
Review suggestions from @kshitijk4poor.
Covers the other half of the draft sync: a refetch that leaves the saved
config as it was must keep the LAN/own-URL choice and URL the user is
typing (review finding).
Refs #144648
The pane read its status once when it opened (the app's query client
turns focus refetch off), so a `webapp:` change made with `hermes config
set` or another window stayed invisible until the pane was reopened.
Re-read the status when the window regains focus (react-query's own focus
refetch follows visibilitychange only, which a native window losing focus
to a terminal never fires), when it comes back into view, and on a 10 s
poll while visible. The LAN/own-URL choice follows the saved config when
a refetch changes it, and an unsaved choice survives refetches that leave
it as it was.
Found by @kshitijk4poor in the Webapp live checks on main.
Refs #144648
The body zone menu's accessible name stringified the pane's live tab
label, which is a React element for locale-following panes (terminal,
files, review, sessions): screen readers announced "Zone options for
[object Object]". Use the string twin (`tabTitleText`, else the
registered title) the drag ghost and Show/Hide rows already read.
Found by @kshitijk4poor in the Webapp live checks on main.
Refs #144648
A plugin.yaml alone does not make an agent half: desktop-only catalog
plugins (agent-log, githermes, deepseek-whale) ship one beside
desktop/plugin.js as metadata, and the previous commit's rule would plan
an agent install for them that loads nothing. The old __init__.py
requirement was what kept them desktop-only.
Both inspectors now call a plugin.yaml folder an agent half when it has
an agent payload beside the manifest: __init__.py, a dashboard tab or
backend (dashboard/manifest.json), or a manifest-only language pack
(provides_locales plus locales/, the loader's own rule). plugin.json
stays an agent half on its own. The shared detection fixture gains the
cron-bulletin shape, a dashboard-only package, the desktop-only shape and
three language-pack cases; its existing cases are unchanged.
Co-authored-by: dandacompany <128420625+dandacompany@users.noreply.github.com>
`detectPluginComponents` (Electron) and `detect_components` (gateway) required
`plugin.yaml` AND `__init__.py` before calling a folder an agent half. Catalog
plugins that ship a `dashboard/plugin_api.py` backend and no `register(ctx)` —
hermes-cron-bulletin, iowap-hermes-integration and other unified packages — were
therefore reported as desktop-only:
- the install dialog planned the desktop half alone, so `installAgentHalf` never
ran: nothing landed on the backend (local or a remote gateway) and every
`ctx.rest` call answered 404 while the pane sat in the sidebar;
- a manifest-only package with no `desktop/plugin.js` was refused outright with
"No agent or desktop plugin artifacts found", although `hermes plugins
validate` admits it ("manifest-only plugin") and `hermes plugins install`
installs it.
A manifest is enough to mean "this folder is the agent-side package". Update both
inspectors and the fixture they share, and cover the Electron case.
Dispatch each guest load on the outer iframe as its own marked load
event, so onLoad gets a real React event and ancestors see guest loads.
The shell's own load is taken in the document's capture phase, before
React or any consumer handler, and the document is sent from there, also
while an Activity or Suspense boundary hides the frame; a frame mounted
hidden starts when first shown. Inside a shadow root, where a load never
reaches the document, the frame's own handler takes the shell load. Guest loads are routed by the shell's
window, so they arrive while hidden too.
Relay nested transferables both ways with an iterative walk, retry plain
once, and close ports when a message cannot be delivered, including one
that arrives before the guest frame exists.
Remount the shell when sanitized sandbox tokens change.
Mark a document sent only once it reached a shell, and send it again
only when it changed.
Covers a Windows CODEX_PROGRESS.md path and www.-prefixed local paths, and
asserts window.hermesDesktop.fetchLinkTitle is never called for filename or
explicit-URL errors.
EXPLICIT_URL_RE accepted `www.` anywhere, so /tmp/www.config and
C:\Users\...\www.config still became https://www.config links in tool
errors and system messages. Require that `www.` not continue a path or word.
When the second deep confirm of a stale-target retry was declined, or
accepted after the edited turn moved, the retry rolled its busy arm back
unconditionally: busy, awaitingResponse, turnLive and the turn clock on
the session, and the foreground flags. If another window or a queued
follow-up had started a turn in the same session while the dialog was
open, that turn was shown idle while it ran. The moved case is exactly
when a newer user turn landed, so it is the likely one.
The edit's own optimistic arm never sets turnLive, and the backend
sets it only for a turn it accepted. When the session shows turnLive by
the time the retry gives up, it now leaves the session's flags and
transcript to that turn.
The new cases start a live turn while the second dialog is open, then
decline or accept a moved plan, and check the busy flags survive. Both
fail without this change.
The regenerate-after-switch case only checked that nothing was sent,
which also holds when the reload returns before asking. It now asserts
the one confirm was shown.
Formatting only otherwise (prettier and blank lines on test lines added
earlier in this PR).
runRewindSubmit sent confirm_deep_truncate again on every later send of
the same submit. On a backend that predates the field, a deep cut that
met a busy session (retried every 150 ms for up to 6 s) or a resumed
runtime paid one rejected round trip before each real attempt, roughly
doubling the prompt.submit calls.
The first rejection now sets a flag in runRewindSubmit's scope and later
sends leave the field out, so an older backend costs one extra call per
user action. Nothing is cached across submits: a backend upgraded while
Desktop runs is asked again on the next one.
The new case rejects the field, answers busy, then accepts, and checks
the third submit has no confirm_deep_truncate; it fails without the flag.
The fallback retries without confirm_deep_truncate only when the error
is a JsonRpcGatewayError with code 4000, the submit carried the field,
and the message starts with the backend's admission prefix for it. The
one negative case named a different field, so dropping the code check,
the in-params check or the exact prefix all stayed green.
Three cases now cover them: the same message under another code, a 4000
that only mentions the field, and a submit that never sent it. Each
condition, removed on its own, fails its case.
A stale-target retry that sends nothing (the second confirm declined,
answered after a switch, or the edited turn moved) kept whatever
history the session held, on the grounds that the refresh had already
replaced the optimistic edit. The refresh only runs when there is a
stored session to resume. Without one the session still showed the
optimistic, cut-down timeline with the unsent edit, and before this
series the failure path restored the original history.
retryStaleEdit now restores the pre-edit history when it had nothing to
refresh from, and keeps the refreshed one otherwise. The new case runs
the retry with no stored session and a slice that carries the
optimistic edit, as the real cache does; it fails without this change.
rollBackEdit cleared the foreground busy flags only while the edited
runtime was still the active one. A submit that finds its runtime gone
resumes the stored session under a new runtime id and moves the active
session to it, so when the resent submit then failed (a generation
error, or a stale target reported unavailable) the composer stayed busy
and awaiting a response. Main clears them unconditionally.
The ownership check now applies only where it is needed: a stale-target
retry whose second confirm was answered after the user switched to
another session. rollBackEdit takes that as an explicit ownsForeground
argument, and runEdit's failure path clears the flags as before.
The new cases recover the runtime, fail the resent submit, and assert
the composer is idle. Both fail without this change.
The harness's updateSessionState read a private stateRef that the mocked
resume never updated, so 'messages is not the seed' passed even when the
refreshed turns were lost.
The harness now exposes replaceSessionMessages, which does what a real
resume does to the session slice, and the cancel cases assert ids and row
ids exactly:
- decline and session switch keep the refreshed history;
- a turn that grew while the dialog was open keeps the grown one.
Rolling back to the pre-refresh snapshot fails three of the four cases.
Rolling back to the refreshed history, which drops the turn that grew
while the dialog was open, fails the moved case.
If the edited turn moves while an accepted second confirm is open, the
retry now shows the same warning runEdit shows. If the resume rebinds
the runtime, it now returns 'unavailable', so runEdit reports the turn
unavailable instead of dropping the edit silently. A plain decline
stays silent. Each new test case goes red when its fix is reverted.