The tool now answers moved: pending with a note, and the boundary commit is the only move: the turn keeps its folder, and a refused commit leaves nothing to undo.
Desktop chats now run on the gateway session authority (gateway.run, platform=local), but the only
set_project_workspace_callback registration lived in tui_gateway/agent_callbacks.py. On the gateway
path project_tools found no callback, fell back to the profile-global projects.db pointer, and still
returned success: the chat stayed in its old folder and the next pwd proved it.
gateway/local_desktop_ui.py now wraps the callback per local-viewer turn (re-wrapping the TUI
sidecar's, like the connection hook): the tool thread re-points the turn's terminal cwd record so the
same turn's next command runs in the project, and parks the folder on the live session. The drain
commits it at the turn boundary as the user's Move to project (workspace mutation via write_mutation,
beside apply_pending_reasoning): policy cwd, TERMINAL_CWD, terminal drop, session.info.
project_tools reports moved: true/false with not_moved_reason (no callback, no task, callback raised
or found no session) and only then switches the global pointer. Callbacks may return a bool verdict;
None keeps the old meaning (moved). The TUI callback now returns False when it found no session.
The old registration is login persistence only because Task Scheduler starts
it at logon and never again. Require that before leaving it alone: one logon
trigger with no repetition and no restart policy. Compare the wrapper by its
registered file name in the folder this home resolves to, and strip only a
matched pair of quotes, so another name for the same file or a stray quote
keeps the refusal.
Installs from before the wscript launcher registered the Windows logon task
with `schtasks /Create /SC ONLOGON /TR <home>\gateway-service\<task>.cmd`.
Gateway ensure accepts only a wscript.exe action, so on such an install every
Desktop, CLI and TUI start with no gateway running was refused with
service_identity_unverified ("the task runs '...Hermes_Gateway.cmd', not
wscript.exe"), and neither Retry nor Repair install changes the task.
That registration has a logon trigger and no restart policy: it is login
persistence, like a Startup-folder entry. Ensure now recognises exactly this
home's own wrapper path as the whole action, after the principal, run level
and enabled checks have passed, and takes the detached direct spawn that
`hermes gateway start` uses. It never runs the task (that would open a
console window) and never re-registers it from client startup. Any other
action keeps its refusal.
- the served-profile rescan reads the unreadable-signature map with getattr (its callers include
runner stand-ins that never ran the platform reconcile base)
- runner-owned settings publish into the runner's live platform configs only: a primary adapter is
built from that same object, and a served profile's rescan replaces the config the runner reads
- test doubles of gateway.config.load_gateway_config accept the strict keyword the live rescan now
passes (signature only; no assertion changed)
A live platform reconcile read config.yaml with the startup loader, which falls back to .env /
gateway.json when the YAML fails to parse. A half-written config.yaml (`platforms: [`) therefore
read as "no YAML platforms" and the reconcile stopped every YAML-configured adapter.
- every live reconcile read (primary, and a served profile's rescan) loads strictly; on failure the
gateway keeps its adapters, its cached config and os.environ as they were (the .env diff it applied
is undone, the credential print is restored), acknowledges no signature, logs one WARNING per broken
edit and answers applied:false, reason config_unreadable, error naming the YAML failure; the next
readable edit reconciles as usual. `hermes config set` prints that line; Desktop/dashboard show the
error as the save's detail.
- runner-owned platform settings (home_channel) publish into the live config on every reconcile,
before and independently of the adapter plan, so a home-channel-only change takes effect without a
rebuild (delivery router and adapter config share the updated object).
Tests (red on 81a521e0ef41): unreadable primary config keeps the webhook listening and the fixed
config moves it; unreadable named-profile config keeps its LINE adapter; a home-channel-only change
reaches delivery_router.config with no reconnect.
_start_gateway_runtime stays within its complexity cap (one call returns the head-start verdict and
the still-running recovery), and the recovery thread runs under the spawner's contextvars
(spawn_context_thread) so it keeps the launch profile scope.
The standalone reconcile re-read the profile .env the way /reload does, which removes every
known key the file lacks from os.environ. A platform configured only by the process environment
(Docker -e, a unit's Environment=) then read as unwanted at the next reconcile (a plugin loading,
any .env save) and was stopped: in a fresh Docker container api_server went down the moment the
default plugins finished installing, and QQ/Feishu from -e never started.
The reconcile now applies only what changed in the .env since its last read: a key leaves
os.environ only when the .env held it and no longer does.
Test (live gateway, red on 23f00137d594): a platform configured by the launch environment
survives a reconcile.
Credentials saved on a running gateway for a platform whose plugin is not installed did nothing:
the gateway ran its plugin recovery only at start, and `hermes config set` printed only "✓ Set".
A gateway start finished that recovery (a clone, a wait on another installer) before it served
anything.
- The primary's platform reconcile (watcher, reconcile-platforms verb, plugin-loaded) first runs the
gateway-start plugin recovery for the profile when its credential layer (.env) changed, then
starts what the installed plugin registers. The answer lists what it installed; a verb window that
closes mid-install says "installing".
- A gateway start runs that recovery beside the start (daemon thread, 5 s head start): an install
landing within it is in the runner's first config as before; a slower one leaves the ready
platforms serving and the platform is started by a reconcile when it lands.
- `hermes config set` prints what the gateway's recovery reported (installed, or why not plus the
install command), or, when nothing serves a platform that left core and its plugin is missing,
the command that installs it.
Tests (live gateway, red on 23f00137d594): a slow plugin install never holds the start back;
credentials set on a running gateway for a missing plugin say how it arrives.
A real multiplexed gateway serving profile b (LINE, credential claim from config.token) restarts the
adapter on a settings-only .env change and it comes back connected; with the retired adapter's claim
left in the rescan's map it is refused as a duplicate of itself ("unavailable").
`hermes config set model x` (any key no platform reads) queried the gateway control socket with a
15 s timeout. Only a platforms.*/gateway.* path, or an env setting a messaging platform owns (declared
by an adapter, or under a platform's env prefixes: what its build print reads), contacts the gateway.
A connect longer than the verb window answered {applied, pending} and config set printed nothing; the
pending answer now names the in-flight plan (starting/restarting/stopping) and config set prints one
line for it ("Running gateway is starting telegram (still connecting)").
A platform enabled before its credentials existed answered applied:false, and both UIs kept a sticky
"Restart the messaging gateway" banner even after the save that added the credentials came up live.
The save verdict (web_routers/messaging.py::_apply_platform_live) now answers applied:true,
state not_configured ("needs <env>") when the gateway's own configured check says the platform lacks
credentials, since a restart would not start it either. Desktop and the dashboard keep a per-platform
restart set: a later applied save for that platform clears it, and not_configured renders as needs setup.
Installing or enabling a plugin force-reloads plugins, which unregisters every plugin platform first
and re-registers each as it loads. A reconcile reading the registry in that window hashed a live
platform as "no longer registered" and restarted it: enabling Yuanbao logged
restart=['qqbot', 'feishu']. platform_build_print now reads registrations under the plugin discovery
lock (hermes_cli.plugins.settled_plugin_registrations), so a print only changes when that platform's
own inputs do.
`hermes config set` printed "applied it now: started feishu" and "feishu could not start" together.
It now reports each platform once, from the gateway's verdict: what it serves now, then what it tried
and could not bring up (with the gateway's reason when it gave one).
Every primary build attempt (boot and mid-run share one prepare path now) and every secondary
build records a BuildPrint: typed PlatformConfig settings, extra, plugin registration, and the
.env values the platform owns by prefix (minus runner-read gates/home channel). The reconcile
starts what was never attempted, rebuilds what was built from other inputs, and stops only
adapters a build attempt owns, so the runtime LOCAL session adapter is never torn down by a
config.yaml edit (CI: test_session_mutation_compress storage_unavailable).
- env-only credentials (SLACK_APP_TOKEN) and typed settings (reply_to_mode) now restart
- under multiplex the primary's mid-run create/connect runs in the default profile's scope
- an in-flight primary/secondary reconnect for a retired slot discards what it built
- a secondary rebuild drops the retired adapter's claims (no self-duplicate refusal); a
cancelled reconnect that outlives the wait triggers a reconcile once it settles
- drain waits for turns the retiring adapter answers (delivery adapter), not a namespace
- the file baseline is taken before boot builds adapters; the watcher applies edits made
during a slow startup at once
- secondary reconcile answers carry changed/started/restarted/stopped like the primary's;
plugin platforms whose deps do not import in the gateway are reported unavailable with a
reason (dashboard/Desktop show restart)
A secondary whose reconnect task held the bot's claim was skipped by the rebuild after a
credential change; the cancelled task is now awaited so its hold is gone first. The platform
reconcile base rides on GatewayProfileReconcileMixin, `hermes config set` routes through
set_config_value_live (config.py stays at its size), the dashboard header no longer says
channels connect on the next restart.
Tests (red on origin/main, green here): a real single-profile `gateway run` starts, restarts
(port change) and stops the webhook adapter via `reconcile-platforms`; a retired adapter waits
for its own platform's in-flight turn, not another platform's, before teardown.
The messaging save now answers `live: {applied, state, detail}` for every profile (single-profile
and multiplex primary included). Desktop's settleAfterUpdate and the dashboard Channels page read
it (falling back to `hot_served` for older backends): an applied save shows the card connecting and
re-reads status; only a gateway that could not build the adapter (or no/older gateway) raises the
restart banner, with the gateway's reason in the toast.
A running gateway only built adapters at boot: a platform enabled or given credentials afterwards
(by .env edit, `hermes config set`, the dashboard/Desktop save, or a plugin installed mid-run) stayed
down until a restart, on the primary profile and in single-profile mode alike.
GatewayPlatformReconcileMixin diffs one served profile's wanted platforms against its live or
reconnect-queued adapters and starts, restarts (build material changed) or stops only those,
through boot's own create/wire/connect path (`_start_connect_pending`) for the primary and the
existing `_start_one_profile_adapters` rescan for secondaries. A retired adapter first lets its
in-flight turns finish (bounded by agent.restart_drain_timeout). Triggers: the reconcile watcher
(launch profile signature, every gateway), plugin-loaded events, and a new `reconcile-platforms`
control verb that answers each platform's live state. The messaging save and `hermes config set`
use it and report applied vs. could-not-apply.
Review follow-ups on the sessions list:
- min_message_count was applied to the compression ROOT before the walk to
its tip, so a root that rotated before its first flush (0 messages) hid its
populated tip. The floor now admits a compression-ended row when any
continuation in its lineage meets it (same continuation edge as the list
CTE; the recursive EXISTS runs only for compression rows under the floor).
The reference backend's filter follows the same lineage rule.
- The tip-title inheritance lookup bound every ancestor id in one IN (...);
six 180-deep chains exceed a 999-variable SQLite build. It now goes
through _id_chunks.
- `--all` dropped every exclusion except `tool`; it now lists every source.
- Gateway `/sessions` leaves cron runs out of its recents/search page, as
#140273 proposed; pinned listings are unchanged.
Co-authored-by: hbtjm9000 <260822553+hbtjm9000@users.noreply.github.com>
Bare `hermes sessions` printed argparse help. On a terminal it now opens the
existing `browse` picker (arrows + Enter resumes via `hermes --resume <id>`);
off a terminal it prints the list.
`hermes sessions list` ranked root rows by started_at and cut the page before
projecting compression tips. A cron tick writes a `local-<sha>` row every run
(most stay empty, untitled: "—"), so the newest-started rows were all cron and
every compacted human thread, whose root started days ago, fell off the page.
List and browse now use the Desktop recents shape: rank lineages by their
tip's last message (order_by_last_active), drop zero-message rows, and leave
out automated sources (cron, webhook, push, kanban, tool, oneshot). `--all`
or an explicit `--source` brings them back. Subagent children stay out.
A projected tip with no title of its own fell back only to the root's title;
it now takes the nearest titled segment of its lineage (a thread titled after
its first rotation carries the title on a middle segment).
A default plugin install that keeps failing (offline, a refused clone) was repeated by its own
coordinator whenever a CLI process booted during the pass: each boot step re-requested the pass
before the failure backoff was recorded, and install_and_record looped while requests kept arriving
(13 clone attempts per plugin in 76 s at one config write a second).
- install_and_record holds the installer lock for its whole loop and records the backoff (or the
settled revision) before releasing it; a failed pass is never repeated in the loop.
- spawn_install reads whether a pass is in flight (the lock holder's pid stamp) and then neither
re-requests nor spawns; only a new profile (spawn_install(home)) is a rescan request.
A gateway start whose profile owes platform plugins waited for the other installer's whole pass
(up to five minutes per row) before serving anything (Docker: ~70 s before api_server answered).
It now waits one budget of 30 s in all (every row and home of the start share it), then serves the
ready platforms; the plugin is served once installed (live where the running gateway applies it,
else at the next start).
Tests (real processes, red on 22dea1f5a9cb): boots during a failing pass never repeat it; a gateway
start waits one bounded budget for another installer.
The publication guard compared every home's whole config.yaml, so a key outside the
plugin selection written during the dependency build (the dashboard's metrics prompt
answered while the default qqbot install ran) refused the enable and left the plugin
installed but disabled. The guard now compares only what the selection and build read
(the plugins section and memory.provider) and re-applies the change to the file as it
is at publish time, so the other key survives; a change to the selection still refuses.
The refusal is typed (SelectionChanged -> SelectionRaced), the install-and-enable path
retries it on a re-read selection (bounded), a raced default install is owed without
the hour backoff, and a left-core install whose enable was refused is owed (its tree no
longer counts as installed) so the next start enables it.
A container image runs from the venv baked into its tree until PM commits a generation; the first
plugin install (Feishu at gateway start) publishes one. running_environment only knew generations,
so adoption saw "no generation of this install" and the adapter waited for a container restart that
would only boot into that generation. The shipped venv (sealed payload or checkout venv/.venv, never
the interpreter's own venv elsewhere) now counts; adopt refuses a generation built for another
Python version.
A platform plugin whose Python dependencies are new (Feishu: lark-oapi) lands them in a new PM
dependency generation. The gateway that installed it at start, or saw it installed while running
(Desktop / dashboard save, `hermes plugins install`), kept importing its boot generation: discovery
logged "restart Hermes" and the adapter failed with "lark-oapi is not installed" until a restart.
PM already adopts a published generation in place when nothing the process imported would change
(pm.environments_adopt.adopt / adopt_selected, used by pm.extras.ensure_import). Plugin discovery and
the platform dependency probe (PlatformRegistry.ensure_deps) now use it through one helper,
pm.environments_adopt.adopt_published; when PM refuses (a loaded package would change) the restart
remedy stays, unchanged.
catalog_platforms.pending_entries no longer names an entry whose required env a platform plugin the
home already has also requires (the community hermes-tag overrides Feishu with the same FEISHU_*), so
a working Feishu user is not told on every start that a plugin they do not need is missing.
Review follow-ups on the start-hook retry:
- The fingerprint reads the config layer through config_backend (a remote layer changes with no
local file change) next to the .env bytes.
- An attempt records the settings only once they held still across a pass: credentials saved while
it installed or waited for the installer lock get a re-pass in the same start (rows already tried
are never retried), in the left-core migration and the catalog platform install.
- The catalog platform pass reads the default set once per pass.
- The two-process race test waits on its handshakes with tests.waiting.wait_until.
A gateway start that found the default-plugin child had installed the plugin while it waited for the
installer lock recorded it but never loaded it, so the platform stayed down until the next start (live
Docker first start with QQ credentials). It now activates the plugin as its own install would.
Catalog platform notices name the entry title only when it has one.
The detached default-plugin child and a gateway start's left-core migration raced in one home: the
start installed while the child's tree landed and recorded "Plugin already exists" as its own failure
(failure stamp, later starts skipped the row, a misleading "could not be installed" notice).
- Left-core installs hold the default-plugin installer lock (default_plugins.installer_lock) and
re-check the home after taking it; a plugin another installer placed meanwhile is recorded, not
reinstalled. A lock still held past the wait is reported, never stamped as a failure.
- One automatic install per plugin and home by either installer: _pending skips the install (not the
scope conversion) of a plugin recorded under _default_plugins_installed, and the default installer
treats _left_core_installed as its own record (the seam the platform slate PRs each carried).
- A gateway start retries inside the failure backoff (the user restarting the gateway after the
network came back sat out the backoff in silence); agent starts keep it.
- A start that already tried a home tries again in that process once its .env or config.yaml changed,
so credentials added to a served profile after boot install its platform on the rescan.
- Gateway start installs a default (official/verified) catalog platform plugin whose requires_env the
profile has, and names `hermes plugins install <name>` for any other catalog platform entry.
- Notices for a default plugin no longer tell a user who never ran the core feature it "moved out of
core"; the agent-start restart hint is printed only when the running gateway did not pick the
platform up after a reload-plugins nudge.