Symptom: in a classic `hermes chat` session on the shared gateway, /cron
add|edit|pause|resume|run|remove still ran main's handler in the CLI
process, which called the cronjob tool there and wrote the profile's
cron/jobs.json from the client. Under strace, every write to jobs.json
came from the `chat --cli` process and none from the gateway.
Root cause: the one-gateway runtime (#106742) made the gateway the
owner of the profile's runtime state and of the ticker that fires cron
jobs. It left CLICommandsMixin._cron_* in the client, and the
gateway's slash.exec refused /cron for every local session except TUI
reads (2efe028116). That left the cron store with two writers.
Change:
- Move main's /cron handler (overview, list and every write) into
hermes_cli/cli_cron_lines.py as line builders (cron_command_lines),
with no other behaviour change. The CLI prints them when it has no
gateway session. The unused CLICommandsMixin._cron_list goes; its
test and eval read cron_list_lines directly.
- On the gateway, /cron is an owner command
(gateway/session_cron_commands.py). Bare /cron and `list` are reads
for every local session; that includes Desktop- and ACP-created
sessions, which main refused with unsupported_command. Every other
form is an admission-fenced control. An unclosed quote is refused as
invalid_params before pre_command fires. `/cron list -a` keeps the
list-all alias that the TUI read path accepted.
- A /cron write runs only when it arrives on a connection that is not
attached to the session: the classic CLI's own command socket
(GatewayConnection.call_until), which waits with no deadline. A
connection attached to the session keeps main's unsupported_command.
That is how Ink, Desktop and ACP send /cron: on their main
connection, which the gateway answers one request at a time and
which waits with a deadline, while a /cron run lasts as long as its
job. The gate is on the requesting connection, not on the surface
that created the session, so a classic CLI that resumed a TUI-made
session still writes (as on main), and Ink on a CLI-made session is
still refused.
- The classic CLI sends /cron to slash.exec
(gateway_setting_commands.GATEWAY_SETTINGS) with no deadline, on a
socket of its own (gateway_plugin_commands.call_unbounded, now shared
with plugin commands; its Ctrl+C handle is renamed
_gateway_command_wait). Ctrl+C prints the stopped line and
propagates.
- Regenerate the parity table. test_pre_command_in_gateway pinned the
old refusal of every classic CLI /cron; it now pins that the accepted
/cron forms fire pre_command once and a refused one (an unclosed
quote) fires nothing.
Why: the design contract allows one writer per owned store, and
clients only read and submit. The gateway already serves this
profile's cron store to its ticker and to Desktop (cron.manage). Now
the classic CLI's writes go through the same process.
Refs #134889 (T1)
Refs #139158
Desktop's plugins.manage update refused every non-catalog install ("not a
catalog install — update it via the CLI") and kept its own third copy of
the re-pin logic. It now calls dashboard_update_user_plugin, the same
function the dashboard route uses, so catalog and git installs update the
same way on every surface.
A scan block comes back as ok=false + scan_blocked + scan_verdict +
scan_findings (the shape install already returns) with nothing changed;
the client retries a caution verdict with force. The dashboard route reads
force from its body next to accept_capabilities.
The Plugins tab can only offer Update when it knows an update exists. Git
installs had no such signal, so the row never showed a button. The gateway
already runs the update check every plugins.auto_update_check_hours, and
`hermes plugins check-updates` runs it on demand; both now save the results
next to the cadence marker. The plugin list reads that file (no network per
listing) and sets update_available + latest_sha on git rows. A saved result
is ignored once the install's revision moves past the one it compared.
Resolves the hermes_cli/cli_tui_mixin.py conflict from #141501 landing: main moved _Panel to
hermes_cli/cli_panel.py and this branch moved the wrap helpers to hermes_cli/cli_tui_wrap.py.
Keep both moves: import _Panel and the wrap helpers, define neither here.
Refs #134889 (N8)
The /queue docs said move acts on the pending queue mid-run; it is
refused for prompts the gateway holds. They now also say that
/queue list|rm|edit|clear act on the session's shared gateway queue
(every window's and automation's queued prompts), that queue-mode Enter
uses the same queue, and that a slash command typed after your own
/queue prompt waits briefly for its turn.
Code notes: what a QueueOutcomeUnknown leaves behind (the turn runs
once but is not painted live here), and why an unknown /queue admission
stays tracked and is re-read once per pending list.
Refs #134889 (N5)
Quitting a clean, idle `hermes --tui -w` session removes its tree and
branch (N8). The session's policy froze that cwd, so a later resume
had every turn refused workspace_unavailable.
The launcher now records each tree it creates in the profile's
tui_worktrees.json. A resume (`--tui --resume`, `--tui -c`, classic
`--resume`/`-c`; all go through _resolve_chat_session_args) whose
session cwd is such a missing tree recreates it at the same path
before attaching. It uses the branch when that survived, else a new
branch of the same name from the repo's current HEAD, and locks the
tree for the session. Only a recorded path directly under the repo's
.worktrees/ is created. Any other missing directory is left alone.
The CLI docs list every keep reason, the resume recreate, and the
remaining quit-time race.
Refs #134889 (N8)
The glyph layout replaced every finished tool row's emoji (📖 read, 💻 terminal,
🐍 exec...) with a plain ●, and its "preparing" spinner text dropped the emoji too.
Rows now lead with the same emoji the classic ┊ row shows (skin tool_emojis
overrides included); a failed entry still swaps it for the red ✗.
The "prototype patching" admission rule matched any `X.prototype.y =` line. A
bundled library setting fields on classes it declares itself trips it: three.js
alone hits it 29 times (`var Vector2 = class _Vector2 { constructor() {
_Vector2.prototype.isVector2 = true } }`, `KeyframeTrack.prototype.ValueTypeName
= ...`), so no Desktop plugin could ship a three.js viewer.
The write now fails only when the receiver is not a class/function the file
declares, or is a renderer/browser global (Storage, HTMLElement, Array, ...),
which keeps failing even when the file shadows it with a same-named class (a
regex cannot see scope). Every attack shape the rule exists for still fails:
`Storage.prototype.setItem = ...`, an alias of a global, a shadowed global.
A portable Agent Plugins v1 package (plugin.json) had no way into Settings >
Plugins: the schema reader only looked at plugin.yaml, and v1 rejects unknown
top-level fields. It now reads extensions.com.nousresearch.hermes.config_schema
(the vendor namespace that already carries server trust and timeouts) for the
form, the save, the loader's schema warnings and catalog admission.
Two gaps any plugin with settings hit once the form existed:
- The plugin's Desktop half had no way to learn a save happened. Every
plugins.manage settings save now broadcasts plugin.<id>.settings.changed
({written}); a secret-only save still makes the (empty) settings call so the
event fires for a new API key too.
- A secret the form stored never reached the plugin's running MCP server (its
env ${VAR} was rendered at spawn). After a save, Hermes reconnects the plugin's
servers whose resolved launch inputs changed (identity digest, rendered the way
the connect path renders it); a toggle-only save leaves them alone.
The glyph layout had dropped things the classic CLI shows:
- the status line rendered a private default subset: context detail, cache
hit, latency, tokens/s, duration and prompt/idle timers were gone. It now
renders the classic segments unchanged (same fields, tiers and
display.status_bar.fields filter) plus cwd and key hints when they fit.
- the composer rule stripped the kaomoji/tool emoji and lost the streamed
token count (the classic spinner suffix). Both are back.
- reasoning no longer streamed: it was buffered and collapsed to a single
summary line. It streams live again as in classic, under the dim bar,
closed by the summary line; post-hoc reasoning keeps classic first-10-lines.
- unset busy_input_mode silently switched to steer in this layout. It is
interrupt in both layouts again (Tab still queues).
The launch banner (logo, tools, skills, session) is part of the CLI identity: both layouts now
print it exactly as main does. show_banner and the /clear redraw are back to main byte-for-byte;
the two-line header is removed.
The classic CLI's scrollback was built from width-sized frames (reasoning and
answer boxes, 40-column rules around every message), so a terminal resize
re-wrapped and garbled everything already printed, and the status bar sat above
the input where the spinner row made the composer jump.
display.cli_layout (new, default "modern") switches to a grammar where every
scrollback row starts with one glyph and never depends on the width:
❯ user message ∴ reasoning collapsed to "Thought for Ns · title"
● Verb target 0.2s ✗ failed call in red, with its exit code
│ diff under its row ☤ Hermes answer label, no frame
─ turn summary · time
Width-dependent chrome moves into prompt_toolkit's live region: the composer's
top rule carries the spinner, current activity and elapsed time (left) and the
session title (right); the status line renders under the composer with model,
context gauge, live badges (stash, background work, goal, YOLO) and cwd/branch
on the left and the keys that work right now on the right. Launch prints a
two-line header instead of the full banner.
With busy_input_mode unset, the modern layout steers (Tab queues); classic keeps
interrupt. display.cli_layout: classic restores the previous look unchanged.
Also: panel rows wrap per source line, so a heredoc command no longer breaks the
approval panel's right border (both layouts); docs drop the stale claim that
classic chat always queues (steer and interrupt reach the gateway).
A revoked grant kept its dead access and refresh tokens on disk; it now keeps only the marker
and fingerprint. hermes plugins remove drops the plugin's grants, so a later plugin installed
under the same key does not inherit the sign-in, and hermes auth logout <plugin>:<id> still
removes a grant after the plugin is gone. hermes auth add refuses to run from the gateway, cron or
an agent session and says which hosts get the code, the client secret and the token first.
Maintainer requirement on #139985: authorize_url, token_url and hosts are https at manifest
validation and catalog admission, with no loopback http exception. client_id_env and
client_secret_env may not name a variable Hermes itself uses (a provider API key, a platform
token): Hermes POSTs those values to the manifest's token_url, so a manifest naming
OPENROUTER_API_KEY would have sent it there. A host outside the IdP's domains is a reviewer
warning, and the install notice names the sign-in host.
Microsoft and Notion were named without being tried against this route, and
Notion's token endpoint expects HTTP Basic client authentication, which the
broker does not send.
Refs #139077
The authorize URL is the page the user's browser opens to sign in. A catalog
re-pin that points it at another host now shows up in the consent delta, next
to the token host, hosts and scopes. A new path on the same host still only
changes the fingerprint, so the user signs in again.
Refs #139077
A plugin that calls a third-party API with the user's own OAuth client
(Google, Microsoft, Notion) declares it under `oauth:` in plugin.yaml
instead of running the consent flow and keeping the refresh token itself.
- `hermes auth add|status|refresh|logout <plugin>:<id>` runs the PKCE
login of auth_oauth_pkce_plugin and keeps the grant in the active
profile's auth.json (section `plugin_oauth`, keyed by the plugin's key)
- `credentialed_provider_request(<id>, ...)` attaches the bearer for the
entry's declared hosts only (https, port 443) and refreshes the grant
under the auth-store lock; the calling plugin's own entry is resolved
before `_PROVIDERS`, so a later core provider of the same name cannot
take it over
- each grant stores a fingerprint of the entry it was made for: a plugin
version that changes the token URL, hosts, scopes or client variables
gets ProviderNotSignedIn until the user signs in again
- the client secret is read with get_secret right before each token POST
(OAuthPKCEConfig.token_request) and never sits in the frozen config
- grant-dead codes retire the grant; invalid_client, unauthorized_client
and invalid_scope surface as AuthError codes; a sign-in granted fewer
scopes than declared saves nothing
- `hermes plugins validate` checks the block and the declared variables
and warns when plugin code names the token URL; install/show notices
and the catalog re-pin consent delta list the entries
Refs #139077
Running `hermes plugins update` without a name now runs the check-updates
probe, lists the plugins the update path can actually move (catalog re-pin,
git pull), names every one it skips and why (pinned, needs fixing, unknown,
pip distributions Hermes never upgrades — #132494), asks once, and updates
each through cmd_update so per-plugin consent prompts still apply. One
failure does not stop the rest; the summary quotes each failure's reason.
Without a terminal nothing moves unless --yes is passed; --yes runs the
updates with interactive=False, so consent stays fail-closed.
A plugin tool that adds criteria to (or parks) the active /goal wrote the row,
but every surface kept painting the pre-tool snapshot until the turn ended:
Desktop's criteria list, the Ink goal bar and the CLI dock's subgoal count all
sat stale through the rest of the turn (40 s in the live probe).
- gateway: every local-viewer tool completion republishes session.control.update,
gated on the snapshot revision (LiveSession.control_revision) so an ordinary
tool publishes nothing. Generic instead of a tool-name allowlist: any tool
that writes the goal/loop/heartbeat rows is covered.
- legacy tui_gateway (dashboard chat): the same revision-gated publish in
_on_tool_complete.
- classic CLI: GatewayAgent forwards session.control.update to the CLI, which
marks its mirrored goal/loop managers stale; the dock re-reads them once on
its next poll (GoalManager gains refresh() like LoopManager).
- Ink TUI: the goal bar counts subgoals and gates like the CLI dock does, so a
mid-turn criteria change is visible there at all.
Fixes the case reported in #115779 (salvaged by approach: generic revision gate
in place of the PR's tool-name allowlist).
Co-authored-by: Patryk Kopycinski <patryk.kopycinski@elastic.co>
(cherry picked from commit f461c2e420c1ed2af06d7822352dca4b1f8edba3)
Since the shared gateway landed, quitting `hermes --tui -w` retained every
worktree, clean ones included, so they piled up. Before #106742 a clean tree
was removed with its branch on quit.
The launcher now removes the tree through `_cleanup_worktree` when it is
clean, no queued or started admission targets a session inside it, and no
other process still works in it. A dirty tree, one with unpushed commits, or
one the gateway still has a turn for is kept and re-locked for its session,
as before. `_retained_tree_is_live` gains `pending_only` so the launcher can
ask "does the gateway still owe work here" without counting plain history.
Refs #134889 (N8)
On Windows a running Chrome/Edge/Brave holds its cookie DB deny-all, so
snapshot_real_profile refused before it even looked at whether a completed
copy already existed. Every browser session then fell back to a signed-out
browser while the user's browser was open, even with a perfectly usable copy
of the same profile on disk.
The lock probe now runs after the done-marker check: a completed snapshot of
the same source profile is served as-is (no re-sync, singleton leftovers
dropped), and its logins refresh on the next launch with the browser closed.
A missing snapshot, or one taken from a different source profile, still fails
with the locked error and the existing fresh-browser fallback.
Follow-up to #141379 from an independent post-merge review:
- the MCP SDK re-adds its inherited set (PATH, HOME, TERM, ...) at spawn,
so popping an unset override never unset those keys. Treat the entry as
absent instead: the key keeps its baseline value, one rule for every key,
matching what the child actually receives.
- carry resolution provenance from interpolation (_RenderedStr) instead of
guessing from the rendered text, so a set variable whose value is
literally '${OTHER}' is passed through, not dropped.
Brings in #141354 (Ink T10) and the shared session.export commit already on
main. The only conflict, website/docs/developer-guide/gateway-command-parity.md,
was resolved by regenerating it with scripts/gen_gateway_command_parity.py
(--check clean); the desktop slash registry and gateway contracts --check
clean as merged.
A stdio MCP server env entry like "GHIDRA_INSTALL_DIR": "${GHIDRA_INSTALL_DIR}"
was passed to the child as the literal text "${GHIDRA_INSTALL_DIR}" when the
variable was unset. Servers that validate the value refuse to start (REA:
"GHIDRA_INSTALL_DIR must be absolute"), so a portable plugin could not forward
an optional variable, and Hermes' filtered MCP env means forwarding is the only
way a user's variable reaches the server.
_build_safe_env now drops an env entry whose whole value is still one
unresolved ${VAR}/${env:VAR} reference. Partial references, context vars and
url/headers keep their existing behaviour. Applies to config.yaml mcp_servers
and plugin mcp.json alike (same launch path).
Co-authored-by: Rodrigo Gomes <2362425+rodrigogs@users.noreply.github.com>
test_a_refused_subcommand_keeps_the_rest_of_the_command_routed still
expected Ink's /voice cell to be the sidecar's voice.toggle alone. On
the shared gateway /voice on|off|status now run the owner's per-session
/voice (slash.exec) and read the mode back (config.get); voice.toggle
stays only as the standalone backend's route. The expectation now says
so, and `/voice tts` is still refused.
Regenerated gateway-command-parity.md with its script: Ink's
/timestamps now saves through config.set on both backends.
Refs #134889 (T9, T10)
The generator's /save note still said the export file is written on the gateway host; Desktop with
a current gateway saves session.export text through its own dialog. Fix the note in
scripts/gen_gateway_command_parity.py and regenerate the table.
Desktop Settings renders keys from DEFAULT_CONFIG, so the new opt-in was
invisible there. Add it (default False) next to the other telegram.extra
toggles; condense the rich_drafts comment to one line so the file does not
grow. Mention the dotted path in the Telegram docs so the docs-drift
ratchet sees it.
scripts/gen_gateway_command_parity.py output after Desktop gained /agents, /config, /history,
/export, /import and the other T11 actions; test_committed_parity_table_matches_every_client_verdict
failed on the stale table.
/discard was added as a gateway command without its row in the slash
command reference or the regenerated Desktop registry, so the docs-drift
and committed-registry checks failed in CI. Row added (with the Slack
`/hermes discard` form); registry regenerated with
scripts/dump_desktop_slash_registry.py.
Review #141357 (CI item 4).
Refs #134889 (GW-10)
Maintainer decision for GW-1: keep the hold. Since #106742 every local turn is
a gateway turn, so `hermes pause` holding CLI, TUI and Desktop turns is the
emergency stop working as designed, not a regression.
`hermes pause --help`, its confirmation text and the CLI reference now say so,
and that turns already running finish. A live probe (real GatewayRunner +
authority + WS API, loopback model) pins the behaviour: a turn running when
the pause lands finishes; a new interactive turn's completion is exactly
`estop.paused_reply()` (reason + "run `hermes resume`") with no model call;
after resume the next turn runs.
Refs #134889 (GW-1)
Refs #141321
A person's turn lost in a gateway restart still pauses the session's FIFO
(only they know whether to resend it), but messaging told them to "ask the
operator" and the TUI queue showed a bare `[unknown]` tag.
- Messaging: the pause notice says a turn was lost in the restart and offers
`/discard` in the chat. The new gateway command resolves the chat's lost
turns through the owner's existing fenced `resolve_unknown` (the path
Desktop's Discard, the TUI queue and `hermes sessions discard` use); the
saved followers then run. Demoted to `/hermes discard` on Slack (50-slash cap).
- TUI: a lost row reads "paused: lost in restart · ↑ select, Ctrl+X discard"
(Ctrl+X on it already sends prompt.resolve_unknown).
- Desktop already shows "Turn lost during restart" with a Discard button.
Refs #134889 (GW-10)
Refs #139532
Refs #141321
Ink on the shared gateway refused /timestamps /export /import /snapshot
/handoff /hatch /palette /worktree with a bare "not available".
- /timestamps (/ts) [on|off|status] now writes display.timestamps (the
classic CLI's key) through the owner's config.set, a new display
toggle in gateway/session_tui_config.py, and repaints at once.
- The rest act on the gateway host's profiles, state snapshots,
terminal or git checkout, which the owner may not share with the
client. They stay refused (`unsupported_command`, unchanged for
shipped clients), but the refusal now carries what to use instead in
data.detail (gateway/session_commands.py REFUSAL_HINTS: `hermes
profile export|import`, `hermes backup --quick`, `hermes -w`, the
classic CLI for /handoff and /hatch, typing / for the palette). Ink
prints it under the refusal, and Desktop can do the same.
Refs #134889 (T10)
Refs #141321
(cherry picked from commit b67e44de12133ca9578f42850f7d84767c0ba25f)
Ink's /save on the shared gateway called session.save, which writes the
export on the gateway host and takes no format, filename or redact
argument. It now takes `/save [json|md|html] [filename] [redact]`, asks
the owner for the rendered transcript (session.export) and writes the
file itself: a named path against the cwd, else
<HERMES_HOME>/sessions/saved/hermes_conversation_<ts>.<fmt>.
(cherry picked from commit 11956c404bc4d9b5769c4b08cbd5683743a57363,
ui-tui and docs half; the gateway half is the session.export commit)
Refs #134889 (T10)
Refs #141321
On the shared gateway Ink refused /reload-mcp and /config by name even
though the owner serves both:
- /reload-mcp now calls the owner's session-scoped reload.mcp
(gateway/session_ancillary.py): bare asks for confirmation, now/yes/
always confirm once. The owner has no persistent opt-out, so `always`
no longer writes approvals.mcp_reload_confirm on that path.
- /config pages config.get key=full, the redacted presentation
projection (display, approvals, voice keybinding). Provider, MCP and
terminal config stay out of the client, as the projection already
decides; the full dump stays `hermes config`.
The sidecar path for both is unchanged.
Refs #134889 (T10)
Refs #141321
(cherry picked from commit 37714ad7c410e3e6c4f174436aeeb09ea3ac0df9)
On the shared gateway Ink's /voice on|off|status still called the
sidecar's voice.toggle, which flips the owner process's HERMES_VOICE for
every chat, and push-to-talk (voice.record) gated on that same env flag.
The gateway's /voice handler holds the real per-session mode.
Ink now runs `slash.exec voice <on|off|status>` and mirrors the mode the
owner reports through a new `config.get key=voice` read; startup seeds
the voice bit the same way. voice.record gates on the session's gateway
mode when the owner holds the session (the sidecar keeps its env flag
for its own sessions). /voice tts stays a named refusal (CMD-2).
Refs #134889 (T9)
Refs #141321
(cherry picked from commit 269373bb69b1a02875671d41806d7df12ab8af9f)
Builds on the salvaged #139188 (@KoNit-K). The salvaged commit ran the transfer in the runner's
_hmwa_resolve_session, which is too late through the real adapter. By then the adapter has keyed
the session on the root-DM source, and _handle_message has already answered with the lobby
reminder. So with the key on, no topic was ever created, and every root-DM message got the
"main chat is reserved" notice.
- The transfer now runs in TelegramAdapter.handle_message before session keying
(telegram_topic_transfer.py), through a runner hook (_transfer_telegram_root_dm) wired in
_wire_adapter_handlers next to topic recovery.
- If topic creation fails, the hook returns the lobby-recovery topic (fallback). Commands,
internal wakes, routed events and unauthorized senders are never moved.
- The first reply in the new topic carries no reply anchor (the root message lives outside the
topic), via reply_anchor_override="". This replaces the base.py metadata flag.
- With the key unset (default), behaviour is unchanged and the v0.22 lobby recovery stays
(#136567).
- The top-level `telegram: dm_topic_auto_transfer` YAML key is bridged into extra, like
disable_topic_auto_rename.
- Documented in the Telegram multi-session docs.
Refs #139136
Refs #134889 (MSG-15)
Refs #141321
agent.restart_drain_timeout keeps its 0 default (pinned by a test): a restart
or stop interrupts in-flight chat turns at once, they settle interrupted and
are never replayed. Their message.complete now carries a named notice in
`warning` ("Gateway restarting: this turn was interrupted and will not be run
again ...", or the shutdown wording), only when the owner's stop() did it.
Ink and Desktop already render `warning`; the attached classic CLI now prints
it on stderr for interrupted turns only. A turn's own warning is kept.
Docs: a "Gateway Restart Drain" section in the configuration guide with the
default, what a positive value does, and the systemd TimeoutStopSec sizing
caveat from gateway/restart.py; the env-var row had the wrong default (900).
Refs #134889 (F1)
Refs #141321
The delegation guide named only the config keys. Point Desktop users at
Settings > Model > Subagents, say what Apply affects (that profile,
subagents launched afterwards, never running children or the main model;
from #138048), and note that leaving a direct endpoint also clears its
wire protocol. The route row reads its description from the field copy
like every other row.
Resolves hermes_cli/gateway_agent.py's prompt.submit against main's stop-before-submit fence: keeps main's reattach and CallStopped guard, and a turn stopped before the submit gives back its /model --once pick, since nothing was sent.
* fix(docker): strip setuid/setgid and file caps from every sandbox file, persistent sandboxes too
#141033 hands root-owned sandbox files back to the host user when a root
container is removed; chown clears setuid/setgid and file capabilities on
the files it touches. Two paths still let a root sandbox leave a file in its
host bind dirs that the host user then runs with raised privileges (proved
on real Docker):
1. The walk only selects root-owned entries. A host-user-owned, group-root
setgid file (host egid 0) or file capabilities on a host-user-owned file
(when SETFCAP is granted through docker_extra_args) are never touched.
2. In the default docker_persist_across_processes mode the container is
never removed, so no handback (and no strip) ever runs.
Every root pass now first re-chowns each setuid/setgid regular file under the
sandbox mounts to its own uid (one find per distinct owner; chown to the same
owner clears the bits and security.capability and changes no owner). find
cannot test xattrs, so when the container was granted SETFCAP / ALL or is
privileged, every regular file is re-chowned the same way (~1-2s per 20k
files measured; the base args drop SETFCAP, so the default path stays
`-perm /6000`). Device nodes/FIFOs keep #141033's filter.
The strip-only pass also runs for persistent containers: on session detach
(cleanup in persist mode, on the atexit-drained teardown thread), before
the first command on reattach, and in reap_orphan_containers before an
exited container is removed. It runs in a throwaway of the image with only
the sandbox dirs bind-mounted (not --volumes-from), so a running container
swapping paths mid-walk can only steer it at sandbox files or the throwaway
rootfs. Same gates as the handback: Linux, Hermes not root, no rootless /
userns-remap, root-run container; bounded at 10s, best-effort.
* fix(docker): one-scan privilege strip that runs on any image, after the handback, from the container's own binds
- Strip setuid/setgid with one `find -perm /6000 -exec chmod ug-s` (no stat, so images without
/bin/stat such as bullseye-slim are covered; GNU and busybox verified). Only a container that
could set file caps (SETFCAP/ALL/privileged) re-chowns every file to its own uid, one throwaway.
- Teardown hands ownership back first, then strips on its own 10s budget, so a huge SETFCAP tree
can no longer starve the handback.
- The strip reads its targets from the container's existing sandbox binds (realpath on both
sides; the creator's sandbox root is labeled), so a profile attaching to a shared container
strips the creator's dirs and a symlinked HERMES_HOME/TERMINAL_SANDBOX_DIR still matches.
- Binds with `--mount` and skips missing sources: a deleted task dir is never recreated root-owned.
- A strip that cannot run warns once per sandbox dir instead of logging at debug.
* fix(docker): strip only sandbox dirs this host derives, never from container labels
The root strip trusted a hermes-sandbox container label to pick which host
binds it mounts and chmods. Labels are settable by docker_extra_args (which
override Hermes's own) and inherited from any image LABEL, so a sandbox could
point the strip at host files outside its sandbox (setuid bits stripped from
a project dir; label "/" matched "/", "/usr", "~/.ssh" binds).
Drop the label. A bind source is kept only if its realpath sits under a
<sandbox>/docker root this process computes itself: its own sandbox dir, or
the default one of any profile of the same Hermes root (shared containers
across profiles). The strip mounts the resolved path, so a symlink swapped
in after the check is never followed.