Register fr/de/es in the Locale type, catalog and Appearance picker, map
display.language values and regional aliases (fr-CA, de-AT, es-419, ...)
to them, and add behavioral coverage: catalog key/kind/placeholder parity
with English, config round-trip for every picker option, display.language
loading, intro rotation, and slash descriptions after a locale switch.
Fixes#75282Fixes#89980
Full Translations object for es (neutral tú imperatives), reusing the
current-key strings from the community Spanish locale PRs and translating
the rest, plus the display-only intro rotation.
Co-authored-by: Kiro 有点Yes <246816394+sdyckjq-lab@users.noreply.github.com>
Co-authored-by: Jordi <satiro_jordi@hotmail.com>
Co-authored-by: Tormen28 <enriqueyepez28@gmail.com>
Co-authored-by: Eduardo Christopher López Acevedo <echla@gmail.com>
Full Translations object for de in the formal Sie register, reusing the
current-key strings from the community German locale PR (rewritten from du
to Sie) and translating the rest, plus the display-only intro rotation.
Co-authored-by: Oliver Hees <oliverhees@gmail.com>
Chat prose and both composers pick a base direction per block from its
first strong character. That cannot tell an Arabic paragraph that opens
with a Latin name from an English one that quotes Arabic, so mixed
Arabic/English text can line up the wrong way (#100280, #83868).
Add Appearance -> Chat display -> Text direction:
- Auto (default) keeps today's first-strong behavior with an unchanged
DOM: no attribute is added and nothing is written to storage.
- Right-to-left / Left-to-right stamp dir on the assistant/reasoning
markdown root, its list and quote boxes (in place of dir="auto"), each
user message line block, and the main and edit composers. The
plaintext vote steps aside for those surfaces, so every line follows
the chosen direction.
- Fenced code, inline code and KaTeX stay isolated LTR; app chrome does
not flip. Presentation only: no bidi control characters are inserted
into drafts, sent text or copied text.
The preference is renderer-owned and desktop-global
(hermes.desktop.textDirection), findable in Settings search, and
localized in every desktop locale.
Fixes#100280Fixes#83868
On a custom branch the updater runs `git merge --no-edit origin/<branch>` inside the marker window.
Its files are the merge of both sides, a blob that is neither pre nor target, so the restore took
them for user edits: it put the upstream-only files back to pre, kept the merged ones and spent the
marker, leaving a mixed tree (a real random-kill of that merge: 104 of 500 trials broken).
- _early_recovery: when pre and target diverge, `git merge-tree --write-tree pre target` gives the
tree the merge was writing; its blobs (and prefixes of them, for a file cut short) count as git's
like the target's. Conflicted paths, and on git < 2.38 every path both sides changed, count as
git's whatever their content. Paths with a newline are hashed one by one (`--stdin-paths` is
newline-delimited). The docstring lists the by-design limits.
- run_agent (`hermes-agent`) and acp_adapter.entry (`hermes-acp`) never import hermes_cli.main, so
they now run the same restore right after hermes_bootstrap (run_agent only when hermes_cli.main is
not loaded, since it is also a library module).
- Tests: the second test kills inside a clean custom-branch merge (merged file, upstream-only file,
a cut-short file, a user edit); the first pins that each console script's entry module imports
no other checkout module before the restore runs. Both red on the previous head.
- evals/update_pipeline/interrupted_pull_ab.sh gains scenario E: a kill inside the custom-branch
merge, then the `hermes-agent` import.
Git rewrites a file as unlink, create, write. A SIGKILL inside that window
leaves a path the pre->target diff marks as changed either missing, empty
or (for a multi-page write) cut short. None of those matches the target
blob, so the restore treated it as the user's edit, left the module
missing, still unlinked the marker and printed "Checkout restored".
A path now counts as git's unless its content is non-empty and differs
from both the pre and target blobs (a prefix of the target counts as a
cut-short write). Also:
- a mode-only entry counts only when the worktree exec bit left pre's,
so a marker git never acted on no longer forces a restore + relaunch;
- a marker whose target commit git no longer knows is dropped with a
one-line warning instead of being kept forever;
- a hash-object failure keeps the marker instead of passing for "gone".
Tests folded to two invariants (torn missing/empty/cut-short restored
with the user's edit kept; nothing restored when git wrote nothing),
both red on 9df93fdabdc.
Disposable origin/install, real autostash + _pull_updates, real SIGKILLs and
the real entry point; covers the user-edit cases from the review (kill before
git wrote, failed update + manual merge, torn tree with a user edit) and a
linked-worktree install. One VERDICT line.
Review blocker on this PR: the pull marker was removed only on the success
path. When `_reconcile_diverged_checkout` exited (merge conflict on a custom
branch, failed reset) the marker stayed with a dead owner, the updater told
the user to `git stash apply`, and the next `hermes` launch ran
`git restore` over every dirty file upstream also changed, wiping the
re-applied work (and restoring files mid-merge, leaving a dangling
MERGE_HEAD).
- The marker is removed on every exit of the git phase except
KeyboardInterrupt, which reaches git too and can leave a torn tree.
- The marker records the resolved target commit, not `origin/<branch>`,
so a later `git fetch` cannot widen the restore.
- Startup restores only paths whose content is exactly the target blob
(per `git hash-object`, so autocrlf/filters match) or, for deletions,
that are gone; anything else is the user's and stays.
- Startup does nothing while a merge, rebase, cherry-pick or revert is in
progress.
- The marker lives in the real git dir, so linked-worktree installs are
covered too; the bare `except Exception: pass` is narrowed and reports.
- New test pins the main.py wiring: the restore/relaunch runs before any
other hermes_cli module is imported.
Git moves the checkout file by file and HEAD last, so an update killed while
"Pulling updates" (Ctrl-C, closed terminal, power loss, OOM) left HEAD on the
old commit with a prefix of the files already new. That mixed tree failed at
import in every entry point, `hermes update` included
(`cannot import name 'load_yaml_file_readonly' from 'utils'`), and only a
manual `git reset --hard` could bring the install back.
The updater now brackets the fast-forward (and the divergence reconcile) with
`.git/hermes-update-pull` naming its pid, the pre-pull commit and the target.
`hermes_cli.main` calls `_early_recovery.restore_interrupted_pull()` right
after `hermes_bootstrap`, before any other checkout import: when the marker's
owner is gone and HEAD is still the pre-pull commit, every path that differs
between the two commits goes back to HEAD (the tree the venv was built for),
the dead git's index.lock is cleared, and the command re-execs itself (modules
already imported, main.py included, may be the half-written ones), so a rerun
`hermes update` repairs the install and then updates normally. Paths the update does not change keep local edits; the
updater's autostash stays in `git stash list`. Our own pid is never treated as
a live owner (containers hand a retry the killed updater's pid).
A stalled stream burned the 600 s per-test timeout until the 30-min job
timeout cancelled the lane, and the failure()-only upload then saved no
traces. The CLI --reporter flag also dropped the config's html report.
The onboarding spec is a smoke test; #120005 needs a non-default profile.
The legacy visual Playwright lane stays disabled; the core suite gets its own
reusable workflow (retries 0, one worker, failure-only artifacts) gated on the
same python_prod/frontend classification and counted by All required checks
pass. The legacy config ignores e2e/core so the specs never run twice.
Loop run 7 at 22e8184 went red on "no sandbox process survives quit #1":
a `git fetch origin --filter=blob:none --stdin` (+ its index-pack) was
still running 60 s after quit. That is git's lazy promisor fetch: the dev
checkout is a blob:none partial clone, and a git read by the backend
needed a missing blob, so git went to the network, and the fetch outlived
the backend (reported as a finding; same class as the gh probe). CI
checkouts are not partial clones, so the spawned app gets
GIT_NO_LAZY_FETCH=1: dev runs stay offline and deterministic like CI.
With no tirith on PATH (a CI runner) the backend installs it from GitHub
releases synchronously on the first terminal command, which puts a network
download inside a required lane. With one on PATH (a dev box) it fetched a
12 MB threat DB into the sandbox HOME that was still being written after
quit and cleanup (the stability loop left a recreated sandbox dir behind).
The approval prompts the suite asserts come from Hermes's own dangerous-
command detector, so the sandbox config turns tirith off, the same way the
suite fakes gh.
Fresh home, no provider: the real first-run onboarding, custom endpoint
pointed at the scripted provider, then the first chat, a second turn and
a reload, each under the transcript oracle (exactly once, DOM ==
persisted, streamed == provider at every sampled frame). Also asserts
the persisted assignment is the entered endpoint, the model is called
with the endpoint's advertised model, and one live socket remains after
onboarding: the path where #120005 (every word painted twice) shipped.
Red when onboarding persists the URL as typed instead of the probed /v1
base (#65488 class).
The boot census flagged "backend pids seen during boot: 2" in about 1 of
20 boots. Diagnosis (tight /proc watcher beside 20 repeats): every
`hermes serve` forks ~40 probes per boot (git, ps, ldconfig/gcc for
find_library, pip, docker version), and between fork and exec each child
still shows the backend's argv and HERMES_HOME; ~9 per boot were caught
in that window at 2 ms sampling, and the 100 ms census caught one every
few boots (the reproduced red: two extra pids with ppid = the backend,
one sample each). No double spawn by the supervisor was ever observed.
backendProcesses() now drops a serve process whose parent is itself a
serve process. A real second spawn has Electron main as parent, and a
pre-exec child orphaned by a dead backend is reparented and still counted.
The census also records ppid, argv and lifetime per pid so any future
extra pid explains itself in the failure message.
Under heavy load message.complete can trail the persisted row, so the wire
check is now a deadline poll run first (duplicate frames never heal, so the
poll cannot mask them) and the DOM oracle then covers whatever the renderer
does on completion. A boot that never becomes interactive now fails with the
blocking element chain, route, body text and the main-process log tail.
Clarify: one card, and the clicked choice is exactly what the model receives in
the tool result. Approval: the gated command has not run before the click and
has run after Run once; Deny never runs it and the turn still completes.
Parks the REST page read in main and the provider stream on gates so
message.complete lands before / after the switch-back hydrate
deterministically. complete-before-hydrate was 4/4 red on base (reply rendered
twice) and is green with the renderer fix.
The non-default-profile step now asserts the renderer holds exactly one live
socket to the host backend (red when 0bb539b472, #120006, is reverted); the
earlier per-turn check alone missed that regression. Transient-duplicate
violations now report which bubble ids carry the copies.
Class: Desktop boot / backend lifecycle - stuck boots, crash-loop or double
respawn, orphaned hermes serve / tool processes piling up after quit.
Real app + real backend: interactive composer and first turn with exactly
one backend; kill -9 the backend -> exactly one supervised replacement
(background /proc census catches transient extra spawns) and a working
turn; quit mid-turn with a running terminal-tool child -> zero processes
carrying the sandbox HERMES_HOME (orphans reparented to init included);
relaunch the same home 3x -> one backend per boot, zero after each quit,
transcript cold-hydrates exactly once.
Class: duplicate / vanishing / reordered messages in the Desktop (#120005
and its dupes #119131#119566#119540#118934; completed-reply refresh,
warm-resume, steer and reconnect regressions).
One real Electron app + one real hermes serve; only the LLM is faked by a
lane-private scripted provider keyed by each turn's own marker (no shared
trigger soup / global counters). After every transition - stream, tool-call
turn, reasoning turn, steer, queued follow-up, session switch mid-stream,
warm resume, reload, WebSocket drop+reconnect mid-stream (loopback proxy
the test controls), a non-default profile's chat, a forced second socket to
the same backend, final reload - the oracle asserts: persisted rows render
exactly once, in order, nothing unpersisted renders, no marker ever renders
twice even transiently, and the backend's concatenated deltas equal what
the provider streamed.
Why: the Desktop E2E job is disabled, so the 67 legacy specs run nowhere;
this is the small deterministic lane meant to be required (retries 0,
no fixed sleeps, one worker).
On a Docker / Hermes Cloud image there is no .git; the code identity is the baked
build stamp (build_info.get_code_identity, source == "build-file"). checkout_contains
walked git merge-base regardless and was therefore always False on an image, which
made _marker_only_restart_obsolete and _live_fleet_covers_receipt disagree with the
fleet matrix: the update catch-up printed "Every running gateway already serves the
checkout code" and "gateways are still off the checkout code" in the same run
(found in the s6 update-tail audit for #120516).
With no history to walk, contained collapses to equal-to-the-stamp (either side may be
the short form an older writer recorded). A source install keeps asking git, so a
carried hotfix past the pulled SHA still counts (#119367).
Red on main / green here: tests/hermes_cli/test_update_fleet_checkout_build_stamp.py
`hermes plugins validate` kept a private `_CONFIG_TYPES` copy that never learned
`secret` (or `object`) when the manifest loader and the Desktop settings renderer
did, so catalog admission (`pinned-source-validate`) went red for any plugin that
declares a `type: secret` setting — the documented way to surface an API key in
the Plugins tab (#120088 web-search-plus 4.3.0, #120492 browserclaw 3.1.0).
Derive the admission set from `plugins_manifest._CONFIG_SCHEMA_TYPES` so the three
cannot drift again; `mapping`/`map`, which only the validator ever accepted (the
loader warned "unknown type" on every load), are no longer admitted.
* fix(desktop): preserve interim commentary across history and tool boundaries
* fix(desktop): preserve interim commentary across history and tool boundaries
* fix(desktop): keep public Codex commentary out of hydrated thinking
Project profile-scoped, sanitized display commentary and reasoning for REST and gateway history without changing persisted replay items. Preserve canonical finals across stream recovery and keep tool-delimited interim text through settlement.
---------
Co-authored-by: Xipong <217837358+Xipong@users.noreply.github.com>
A tool-using turn streams as several sealed bubbles but hydrates as one
folded row. The post-turn reconcile only matched bubbles of the latest
turn, only against text parts, and only when settled, so three shapes fell
through to the tail:
- Codex Responses commentary stored in `reasoning` (#119716): no text part
ever matched, and the progress updates with their tool calls landed
below the final reply.
- An earlier turn's bubbles after a new prompt, when no submit receipt
had moved the acknowledged boundary past that turn yet: they resurfaced
under the newer prompt (#119511, the stale commentary tail in #119362).
- Narration still marked pending when the rehydrate landed (#118228).
Locate a bubble's folds by its own turn: rows sharing a tool call id with
that turn (durable identity), plus the rows after its prompt's stored
twin. Accept its text from a text part or as whole lines of Thinking, and
treat a sealed interim as final even while pending. The latest turn keeps
its positional fallback. A final answer the fold has not committed is
still preserved.
Co-authored-by: tian0cai <tian0cai@sohu.com>
Co-authored-by: xpk84 <36138499+xpk84@users.noreply.github.com>
Co-authored-by: Benjamin Brumbaugh <benbrumbaugh@gmail.com>
A tool-using turn streams as several sealed bubbles but hydrates as one
folded row. The post-turn reconcile only matched bubbles of the latest
turn, only against text parts, and only when settled, so three shapes fell
through to the tail:
- Codex Responses commentary stored in `reasoning` (#119716): no text part
ever matched, and the progress updates with their tool calls landed
below the final reply.
- An earlier turn's bubbles after a new prompt, when no submit receipt
had moved the acknowledged boundary past that turn yet: they resurfaced
under the newer prompt (#119511, the stale commentary tail in #119362).
- Narration still marked pending when the rehydrate landed (#118228).
Locate a bubble's folds by its own turn: rows sharing a tool call id with
that turn (durable identity), plus the rows after its prompt's stored
twin. Accept its text from a text part or as whole lines of Thinking, and
treat a sealed interim as final even while pending. The latest turn keeps
its positional fallback. A final answer the fold has not committed is
still preserved.
Co-authored-by: tian0cai <tian0cai@sohu.com>
Co-authored-by: xpk84 <36138499+xpk84@users.noreply.github.com>
Co-authored-by: Benjamin Brumbaugh <benbrumbaugh@gmail.com>
A server started as `cmd &` from a non-interactive shell inherits SIGINT as
SIG_IGN. The exit-flush handler still ran _stop_turns_before_exit, which raises
the one-way foreground-spawn fence, then chained to the ignored disposition and
kept running: every later terminal command returned "[host is exiting: command
not started]" rc 130. An ignored signal ends nothing, so the handler now returns
before flushing or stopping turns.
Re-review findings on the foreground-process registry:
- Spawn vs exit races. A child spawned but not yet registered when the hard-exit kill ran, or a
command launched after the kill took its snapshot, survived under init. The hard-exit kill now
raises a one-way exit fence and waits (bounded) for spawns already past it to register; a spawn
refuses once the fence is up, and one that registers after a timed-out wait kills itself.
- The immediate kill fell back to proc.kill() for every handle. On Modal/Daytona/Vercel that is a
blocking SDK cancel (an 8s cancel made _hard_exit take 8s). Popen handles are still killed
inline (killpg, never blocks); every other handle's kill runs on a daemon thread under one
shared 0.5s deadline.
- The registry lock was a plain Lock: a signal landing on a thread that held it deadlocked the
exit. It is now an RLock (via a Condition) and the hard-exit path only takes it with a timeout,
falling back to a lock-free copy.
- The kanban worker's SIGALRM deadman os._exit()ed without the kill; it now goes through it.
The SIGTERM handler arms a 1s os._exit timer, then runs _shutdown_sessions: a flush of up to
5s, then _stop_turns_before_exit, whose kill was the graceful TERM, wait 1s, KILL. A command
that ignores SIGTERM was still alive when the timer fired, and os._exit left it reparented to
init (live: `trap '' TERM; sleep 3600` survived a SIGTERM to `python -m tui_gateway.entry`).
- kill_live_foreground_processes(now=True): SIGKILL each in-flight foreground tree at once,
no TERM grace, no wait (BaseEnvironment._force_kill_process; LocalEnvironment kills the
recorded process group, never our own).
- The grace timer's exit (entry._hard_exit) runs it before os._exit.
- _stop_turns_before_exit SIGKILLs whatever is still alive halfway through its settle budget
(it ignored the interrupt's TERM), so the tool call still ends with a result the teardown
persists instead of a dangling tool_call in state.db.
- The other hard exits that skip cleanup do the same before os._exit: the serve parent-death
watchdog, the CLI exit watchdog, the kanban worker's SIGTERM path, and the messaging
gateway's shutdown and loop-liveness watchdogs.
- Deflake test_shutdown_mid_tool_kills_the_command_and_keeps_its_result: the 0.5s settle
budget was too tight under -n 40 (1 red in 9 runs); the join returns when the turn ends.
Foreground terminal commands run in their own session (start_new_session) so an
interrupt can kill the whole tree, which also puts them outside the host's process
group. When the tui_gateway left mid-command (client closed stdin, or SIGTERM) nothing
killed them: _shutdown_sessions closed the agents, the SIGTERM path hard-exits after a
1s grace, and the `bash -c` + child tree survived, reparented to init.
- tools/environments/base.py: execute() records every in-flight foreground command;
kill_live_foreground_processes() kills their trees through the backend's own
_kill_process (the same kill an interrupt uses).
- cleanup_all_environments() (the exit funnel of the CLI, one-shot, messaging gateway
and terminal_tool's atexit, so `hermes serve` too) kills them first.
- tui_gateway _shutdown_sessions (EOF atexit + SIGTERM handler) and the serve
SIGTERM/SIGINT exit-flush handler interrupt running turns, wait up to 0.5s for them
to settle so the tool call ends with a result the final persist records (no dangling
tool_call in state.db), then kill any foreground command still alive.
- ComputeHost.close() kills them too: every caller os._exit()s right after.
Covers the case of b9dac83d366c (Desktop quit: serve SIGTERM handler) on every host.
Only the --provider path handed user_providers/custom_providers to
resolve_alias, so the provider-identity comparison behind the
current-provider preference could not see legacy custom_providers
entries on the implicit path (/model <id>) or the authenticated-provider
fallback. On custom:corp-llm, /model shared-model picked another
provider's alias for the same model id and switched to its base_url.
Pass both provider maps on every resolve_alias call site. The two
existing resolve_alias stubs in test_ollama_cloud_auth.py accept the
extra positional args; their assertions are unchanged.
The --provider ownership check compared normalize_provider() spellings, but a
legacy custom_providers entry resolves to id "custom:<name>". An alias with
"provider: corp-llm" under "--provider corp-llm" was therefore dropped and the
switch fell back to the provider's own base_url/key instead of the alias's.
Compare resolve_provider_full(...).id on both sides (normalize_provider when
unresolvable), in the ownership check and in resolve_alias's reverse-lookup
preference loop, which now receives the user/custom provider config.
Two invariants against a real config.yaml: an alias bound to another
provider's endpoint never outranks an explicit --provider (host and key stay
on the named provider), and when several aliases share a model id the one
owned by the named provider wins regardless of mapping order.
Found by the C11 routing truth table E2E (lands separately with the E2E suites).
An explicit `/model <id> --provider X` switch could report target_provider=X
while base_url still pointed at the previous provider's endpoint: resolve_alias
finds a direct alias by reverse model-ID lookup, and the base_url override
applied that alias unconditionally even when the alias belonged to a different
provider. Requests would then be sent to the old provider's URL under the new
provider's identity.
Two narrow changes:
- resolve_alias's reverse lookup now prefers an alias whose provider matches
current_provider, falling back to first-match only when none does. Insertion
order is not a routing decision.
- The direct-alias base_url override now ignores (and stops reporting) an alias
whose provider differs from target_provider.
Exact alias-name lookup stays provider-agnostic, and the first-match fallback is
preserved, both pinned by tests.
[salvaged onto the refactored switch pipeline: the ownership guard now sits in
_route_explicit_provider, where resolved_alias is settled, so both the runtime
resolve (explicit_base_url) and the direct-alias override see the filtered alias]
- _stored_prompt_matches_runtime: with the Session ID trailer on
(--pass-session-id / HERMES_TUI_PASS_SESSION_ID), a stored prompt whose
Session ID line is not this session's is a mismatch. A /branch child now
copies its parent's prompt bytes, and without this it told the model the
parent's id. Gated on the flag so a "Session ID:" line in project text
cannot force a rebuild every turn when the trailer is off.
- _seed_workspace_pin: adopt only a real workspace block. A stored prompt
that names this cwd but carries no block (built on a messaging surface,
resumed on the CLI in the same repo) pinned "no workspace" and dropped the
git snapshot for the rest of the session; now the next build captures one.
The branch copies the parent transcript byte-for-byte so its first turn can hit the warm
prefix cache, but the child row was created without a system prompt. The child's first
build then found nothing to restore and re-probed the workspace, rewriting the prompt at
byte 0 for any repo that moved since the parent's session start — the same rewrite this PR
removes for /compress and resume, on the one session transition it did not reach. It also
logged the "stored system prompt is null; investigate update_system_prompt" WARNING for
every branch.
Both branch writers now pass the parent's prompt into create_session: the CLI prefers the
running agent's cached bytes (what this process sends) and falls back to the parent row;
_persist_branch (TUI/Desktop, seeded and lazy) reads the parent row. With the row in place
the seeding in agent/system_prompt.py replays the snapshot on the branch's later rebuilds.
Tests: one per surface, red on the PR head (child["system_prompt"] is None), green here.
The workspace git snapshot is pinned per session so a rebuild (compaction,
/compress) replays it instead of re-probing a repo that moved. Two gaps let
the rebuild re-probe anyway and rewrite the system prompt mid-session:
- The pin was keyed by resolve_context_cwd(), which is None when no cwd is
bound (CLI launch dir) and the path once the TUI /compress binds the
session cwd: the same directory under two keys. Key by the directory the
probe actually inspects (resolve_context_cwd() or resolve_agent_cwd()).
- An agent that did not build the session's prompt (resumed, a fresh
gateway/TUI agent whose first act is /compress, a kill -9 restart) had
no pin, so its first rebuild probed git now instead of replaying the
session-start bytes. Seed the pin from the prompt the session already
sends (cached copy, else its persisted row), only when that prompt names
this cwd and its snapshot's Root covers it.
reset_session_state still drops the pin, so /new, /resume and /branch
re-snapshot at their own session start.
The FTS fail-open detach now waits up to the caller's write budget (20 s /
60 s) for the write lock, so the one-time quarantine check before the loop
left a long window: a sibling that quarantined the file meanwhile still got
its triggers dropped and the stale breadcrumb committed on the quarantined
handle. Re-check the handle flag and the process-wide storage latch at the
top of every attempt, via the same _raise_if_db_corrupt(storage=True) that
_execute_write runs per attempt.
Classify the retryable lock error with is_sqlite_lock_error (result code
first) instead of a locked/busy substring match, matching #120488.