The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
Merge origin/main (#10: 382 commits to 8f897d2d23a) into feat/unified-gateway-runtime
teknium16f2aeb528fc6
diff --cc agent/context_compressor.pyindex 68a83badf4a,6809eb216bc..17315c44f5e--- a/agent/context_compressor.py+++ b/agent/context_compressor.py@@@ -5498,9 -5436,8 +5447,9 @@@ Write only the summary body. Do not incself._structural_no_op_result(telemetry, "no_compressible_window",f"compress_start ({compress_start}) >= compress_end ({compress_end}) - transcript fits within tail budget",+ n_messages,)- return messages+ return canonical_messagesturns_to_summarize = messages[compress_start:compress_end]# Lean mode demotes stale tail tool results before summary generation so stubs exist even if it aborts.if getattr(self, "tail_mode", "lean") == "lean":@@@ -5517,9 -5454,8 +5466,9 @@@self._structural_no_op_result(telemetry, "empty_post_handoff_window",f"window {compress_start}-{compress_end} holds only already-summarized handoffs",+ n_messages,)- return messages+ return canonical_messagesif not self.quiet_mode:self._log_compression_start(display_tokens, compress_start, compress_end, len(turns_to_summarize), n_messages - scan.tail_start,diff --cc apps/desktop/electron/main.tsindex a1d5ff210e2,8ebdd506d40..74c9aa9163f--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@@ -4066,7 -4329,14 +4117,8 @@@ async function releaseBackendLock(updatinitialPids.push(hermesProcess.pid)}- await Promise.all([teardownPrimaryBackendAndWait(), stopAllPoolBackends()])- for (const entry of backendPool.values()) {- if (entry.process && Number.isInteger(entry.process.pid)) {- initialPids.push(entry.process.pid)- }- }-+ // No backend comes back after an uninstall: stay silent, like a quit.+ await Promise.all([teardownPrimaryBackendAndWait(backendTeardownOptions('quit')), stopAllPoolBackends()])// Uninstall deletes the whole runtime. Drain separately-running gateways// through the CLI, rather than targeting a gateway worker by PID.@@@ -11792,10 -12498,14 +11844,10 @@@ const backendShutdown = createBackendShconst ownedChildren = IS_WINDOWS ? collectOwnedBackendChildren() : []const localShutdown = localBackendLifecycle.shutdown()const primary = backendConnectionState.getProcess()- const primaryStop = teardownPrimaryBackendAndWait()+ const primaryStop = teardownPrimaryBackendAndWait(backendTeardownOptions('quit'))const pooledStops = stopAllPoolBackends()- if (poolIdleReaper) {- clearInterval(poolIdleReaper)- poolIdleReaper = null- }-+ // Bounded: a backend that ignores SIGTERM must not wedge app quit (main's 7 s teardown budget).await waitForTeardown([localShutdown, primaryStop, pooledStops], 7_000)reapInstallRootedStragglers(Number.isInteger(primary?.pid) ? [primary.pid] : [])diff --cc apps/desktop/electron/quit-teardown.tsindex 51f63fd808c,1715e5b5c79..a51d3e07b96--- a/apps/desktop/electron/quit-teardown.ts+++ b/apps/desktop/electron/quit-teardown.ts@@@ -21,9 -22,33 +21,33 @@@ export interface BackendQuitActivity}export function backendQuitNeedsWait(activity: BackendQuitActivity): boolean {- return activity.shutdownPending || activity.processAttached || activity.connectionPending || activity.poolPending+ return activity.shutdownPending || activity.processAttached || activity.connectionPending}+ /**+ * What a deliberate primary-backend teardown intends to happen next.+ *+ * `'reconnect'`: a backend comes back (update hand-off, bundle swap, re-home).+ * `'quit'`: nothing comes back — the app is exiting, or being uninstalled.+ */+ export type BackendTeardownIntent = 'quit' | 'reconnect'++ /**+ * The `soft` option a deliberate teardown must pass to+ * `teardownPrimaryBackendAndWait()`.+ *+ * `soft: true` is what stops `resetHermesConnectionState()` from rewriting the+ * boot-progress overlay — the step that writes `[boot] Restarting desktop+ * connection` into desktop.log and pushes `hermes:boot-progress` to the+ * renderer. A reconnect may announce that; a quit must not, because the+ * announcement is false, it can overwrite the renderer's own "Update in+ * progress…" copy, and a reader of desktop.log then attributes a shutdown to a+ * re-home.+ */+ export function backendTeardownOptions(intent: BackendTeardownIntent): { soft: boolean } {+ return { soft: intent === 'quit' }+ }+function runTask(task: QuitTeardownTask): Promise<unknown> {try {return Promise.resolve(task.run())diff --cc apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/lifecycle.tsindex 8a672d591dd,79e873c2489..8e1686f120c--- a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/lifecycle.ts+++ b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/lifecycle.ts@@@ -1,7 -1,7 +1,8 @@@import type { GatewayEvent } from '@hermes/shared'import type { HermesSkin } from '@hermes/shared/skin'+import { eventSourceMatchesOwner, gatewayEventSource } from '@/lib/replay-gap-owner'+ import { clearClarifyRequest } from '@/store/clarify'import {notifyCronChanged,notifyPairingChanged,@@@ -13,15 -13,9 +14,16 @@@type PetChangeMeta,setChangeEventsAvailable} from '@/store/live-sync'+ import { clearAllPrompts } from '@/store/prompts'import { markRuntimeGone } from '@/store/runtime-gone'-import { dropSessionState, unbindTileRuntime } from '@/store/session-states'+import { getSessionOwnerHint, knownSessionOwner, ownerLookupSessionRows, requestSessionResume } from '@/store/session'+import type { SessionOwnerScope } from '@/store/session-request-router'+import {+ $sessionTiles,+ dropSessionState,+ sessionTileDelegate,+ unbindTileRuntime+} from '@/store/session-states'// Leaf import (not the `@/themes` barrel) to avoid pulling the ThemeProvider// module graph into the gateway event hot path.import { ingestBackendSkin } from '@/themes/backend-sync'diff --cc apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/session-info.tsindex e10e936ab5e,0113fe47901..9b11acfb7d8--- a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/session-info.ts+++ b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/session-info.ts@@@ -1,10 -1,11 +1,12 @@@import { normalizePersonalityValue } from '@/lib/chat-runtime'import { modelOptionsQueryKey } from '@/lib/model-options'import { reconcileApprovalModeForProfile } from '@/store/approval-mode'+ import { clearClarifyRequest } from '@/store/clarify'import { reconcileSessionCompacting } from '@/store/compaction'import { requestDesktopOnboardingForCredentialWarning } from '@/store/onboarding'+import { reconcilePendingSubmissions } from '@/store/pending-submissions'import { followActiveSessionCwd } from '@/store/projects'+ import { clearAllPrompts } from '@/store/prompts'import {$activeSessionId,$currentCwd,diff --cc apps/desktop/src/app/session/hooks/use-prompt-actions/slash.tsindex 8a91525cc65,2bb040f5e11..211b9cf6322--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash.ts+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash.ts@@@ -37,7 -37,7 +37,8 @@@ import$connection,$sessions,$yoloActive,+ applySessionTitle,+ resolveComposerSessionKey,setActiveSessionId,setCurrentUsage,setModelPickerOpen,diff --cc apps/desktop/src/lib/chat-messages/hydration.tsindex 4e50eba7df7,b01afb7a1c2..27fa5e25fe4--- a/apps/desktop/src/lib/chat-messages/hydration.ts+++ b/apps/desktop/src/lib/chat-messages/hydration.ts@@@ -1,8 -1,8 +1,9 @@@import { skillInvocationText } from '@hermes/shared'+import { formatRefValue } from '@/components/assistant-ui/directive-text'import { extractImageRefs } from '@/lib/embedded-images'import { dedupeGeneratedImageEchoesInParts } from '@/lib/generated-images'+ import { isTodoToolName } from '@/lib/todos'import type { MessageReaction, SessionMessage } from '@/types/hermes'import {diff --cc hermes_cli/web_server_app.pyindex c02ed90f94d,00000000000..69fc44ca52bmode 100644,000000..100644--- a/hermes_cli/web_server_app.py+++ b/hermes_cli/web_server_app.py@@@ -1,199 -1,0 +1,201 @@@+"""HTTP lifespan composition; standalone backend services remain opt-in owners."""++from contextlib import asynccontextmanager+import asyncio+import logging+import os+import threading++from fastapi import FastAPI+from hermes_cli.pty_session import run_reaper++_log = logging.getLogger("hermes_cli.web_server")+++@asynccontextmanager+async def standalone_lifespan(app: "FastAPI"):+ from hermes_cli.web_server import (+ _eager_reconcile_own_session_db, _warm_gateway_module,+ _start_desktop_cron_ticker, _dashboard_selftest_loop,+ _auto_archive_ticker_loop, _terminate_desktop_managed_gateway,+ )+ from hermes_cli.web_server_chat import PTY_REGISTRY++ app.state.event_channels = {} # dict[str, set]+ app.state.event_lock = asyncio.Lock()+ app.state.pty_active_session_files = {} # dict[str, Path]+ # Serializes chat-argv resolution so concurrent /api/pty connections don't+ # overlap ``npm install`` / ``npm run build``. Locks live on app.state (not+ # module globals) so they bind to the running loop, not the import-time one.+ app.state.chat_argv_lock = asyncio.Lock()++ # Bring state.db schema current BEFORE the first session-list poll+ # (#79531/#80037): a store left behind by `hermes update` otherwise 500s+ # every poll until its owner completes schema reconciliation.+ # Off-thread so a locked store never delays the socket (Desktop+ # ready-probe times out at 10s, GH-73083). NOT a daemon, and joined at+ # shutdown: its sqlite connection must be closed by the thread that is+ # stepping it. A daemon copy that outlived the lifespan had its+ # connection closed from the main thread mid-probe (pytest's leaked-DB+ # sweep) and segfaulted the interpreter. The worker is time-bounded by+ # SessionDB's lock patience, so the join cannot hang shutdown.+ eager_reconcile_thread = threading.Thread(+ target=_eager_reconcile_own_session_db,+ name="statedb-eager-reconcile",+ )+ eager_reconcile_thread.start()++ # Import hermes_cli.gateway *before* the yield: on Windows + 3.11 the+ # import holds the GIL, so run_in_executor still froze the loop 15-22s and+ # the Desktop's 10s ready-probe timed out (GH-73083).+ _warm_gateway_module()++ # Snapshot the checkout revision so lazy-import paths (model picker) can+ # refuse with "restart required" after `hermes update` replaced the code+ # (#86207); the update flow does not reliably restart the dashboard.+ from gateway.code_skew import record_boot_fingerprint++ record_boot_fingerprint()++ # Hosted Bot rooms belong to the backend process. Recovery may need a+ # contended state.db migration, so keep it off the pre-yield path: Group+ # Chat must degrade on its own rather than block every Desktop feature.+ from tui_gateway import methods_groups as _hosted_groups+ import tui_gateway.server # noqa: F401++ try:+ tui_gateway.server.install_tui_message_injector()+ except Exception:+ _log.warning("TUI message injector did not install", exc_info=True)++ hosted_room_start_cancel = threading.Event()++ def _start_hosted_rooms() -> None:+ try:+ _hosted_groups.start_hosted_room_service()+ except Exception:+ _log.exception("Hosted Group Chat recovery failed during backend startup")+ finally:+ if hosted_room_start_cancel.is_set():+ _hosted_groups.stop_hosted_room_service(timeout=1.0)++ hosted_room_start_thread = threading.Thread(+ target=_start_hosted_rooms,+ daemon=True,+ name="hosted-room-startup",+ )+ hosted_room_start_thread.start()++ # Desktop-spawned backends fire cron jobs themselves, since the app has no+ # gateway running the scheduler. Server `hermes dashboard` is unaffected —+ # it relies on its own gateway.+ from hermes_cli.process_identity import is_desktop_owned_backend+ cron_stop: "threading.Event | None" = None+ cron_thread: "threading.Thread | None" = None+ desktop_owned = is_desktop_owned_backend()+ if desktop_owned:+ # Reap an orphaned gateway from an abnormal previous exit (reparented to+ # launchd, still holding the platform WebSocket) before forking a fresh+ # one that would race the same credential (#77276). Runs+ # unconditionally; protection of a healthy standalone gateway lives+ # INSIDE the reaper (registration probed with cleanup_stale=False).++ # Startup grace: spare a gateway still claiming gateway.pid/lock (#122533).+ try:++ from hermes_cli.dashboard_procs import _REAP_MIN_AGE_SECONDS+ from hermes_cli.gateway import _reap_unsupervised_gateway_orphans+- _reap_unsupervised_gateway_orphans()++ _reap_unsupervised_gateway_orphans(min_age_s=_REAP_MIN_AGE_SECONDS)+ except Exception:+ _log.exception("Desktop startup: orphan gateway reap failed")++ cron_stop = threading.Event()+ cron_thread = threading.Thread(+ target=_start_desktop_cron_ticker,+ args=(cron_stop,),+ daemon=True,+ name="desktop-cron-ticker",+ )+ cron_thread.start()++ # Reap idle/dead keep-alive PTY sessions (30-min TTL).+ pty_reaper_task = asyncio.create_task(run_reaper(PTY_REGISTRY))+ # Periodic authenticated self-test feeding the ``dashboard`` component on /api/status.+ selftest_task = asyncio.create_task(_dashboard_selftest_loop())+ # Live auto-archive timer, independent of list requests.+ auto_archive_task = asyncio.create_task(_auto_archive_ticker_loop())++ # Managed local runtime (local_runtime.enabled): bring llama-server back so a+ # restart doesn't strand a llamacpp main model. Off-thread and best-effort;+ # failure falls back to cloud providers like a cold start. Server only —+ # models load on first inference (an empty router holds no VRAM).+ def _boot_local_runtime():+ try:+ from hermes_cli.config import load_config+ from hermes_cli.local_runtime.bootstrap import ensure_local_runtime++ ensure_local_runtime(load_config())+ except Exception as exc: # noqa: BLE001+ logging.getLogger(__name__).warning("local runtime boot failed: %s", exc)++ threading.Thread(target=_boot_local_runtime, daemon=True, name="local-runtime-boot").start()++ from hermes_cli.free_tier_bootstrap import start_background_bootstrap++ start_background_bootstrap()++ try:+ yield+ finally:+ try:+ tui_gateway.server.clear_tui_message_injector()+ except Exception:+ _log.debug("TUI message injector clear skipped", exc_info=True)+ hosted_room_start_cancel.set()+ _hosted_groups.stop_hosted_room_service(timeout=5.0)+ hosted_room_start_thread.join(timeout=1.0)+ if cron_stop is not None:+ cron_stop.set()+ pty_reaper_task.cancel()+ selftest_task.cancel()+ auto_archive_task.cancel()+ eager_reconcile_thread.join()+ await PTY_REGISTRY.close_all()+ # Stop the managed llama-server with its parent (an orphan pins VRAM).+ try:+ from hermes_cli.local_runtime.bootstrap import shutdown_local_runtime++ shutdown_local_runtime()+ except Exception: # noqa: BLE001+ pass+ if desktop_owned:+ _terminate_desktop_managed_gateway()+++@asynccontextmanager+async def http_lifespan(app: FastAPI):+ """The gateway already owns schema, rooms, scheduler and model services."""+ from hermes_cli.web_server import _dashboard_selftest_loop+ from hermes_cli.web_server_chat import PTY_REGISTRY++ app.state.event_channels = {}+ app.state.event_lock = asyncio.Lock()+ app.state.pty_active_session_files = {}+ app.state.chat_argv_lock = asyncio.Lock()+ tasks = [+ asyncio.create_task(run_reaper(PTY_REGISTRY), name="gateway-api-pty-reaper"),+ asyncio.create_task(_dashboard_selftest_loop(), name="gateway-api-selftest"),+ ]+ try:+ yield+ finally:+ for task in tasks:+ task.cancel()+ await asyncio.gather(*tasks, return_exceptions=True)+ await PTY_REGISTRY.close_all()+++@asynccontextmanager+async def app_lifespan(app: FastAPI):+ lifespan = http_lifespan if getattr(app.state, "gateway_runner", None) is not None else standalone_lifespan+ async with lifespan(app):+ yielddiff --cc hermes_state_compression.pyindex 0c7a070689d,f0a82bc601a..f9d80d68648--- a/hermes_state_compression.py+++ b/hermes_state_compression.py@@@ -308,9 -308,7 +308,9 @@@ class SessionCompressionMixin"WHERE id = ? AND ended_at IS NULL", (time.time(), parent_session_id))if updated.rowcount != 1:raise RuntimeError(f"Compression parent changed during publication: {parent_session_id}")+ from hermes_state_local_lineage import advance_local_target+ advance_local_target(conn, parent_session_id, child_session_id)- self._execute_write(_do)+ self._execute_transcript_write(_do, messages)def _write_sql_logged(self, op: str, session_id: str, sql: str, params) -> None:"""``_write_sql`` that logs (never raises) on ``sqlite3.Error``."""diff --cc hermes_state_maintenance.pyindex 5495e211f17,77fde861588..d3d49395ec0--- a/hermes_state_maintenance.py+++ b/hermes_state_maintenance.py@@@ -310,10 -313,7 +315,9 @@@ class SessionMaintenanceMixincursor = conn.execute(f"SELECT s.id FROM sessions s WHERE {where}", where_params)session_ids = {row["id"] for row in cursor.fetchall()}if exclude_active_write_guards:- session_ids -= {sid for sid in session_ids- if self._write_guards_reject(conn, sid, allow_closed_compression_parent=True)}+ session_ids -= self._guarded_ids(conn, session_ids)+ from hermes_state_mutation_retirement import retire_prunable+ session_ids = retire_prunable(conn, sorted(session_ids))if not session_ids:return 0# Batched: a cron-heavy store prunes tens of thousands of ids in one call.diff --cc hermes_state_messages.pyindex 32a0fe0c405,82e0187a5e7..826b69b3bcb--- a/hermes_state_messages.py+++ b/hermes_state_messages.py@@@ -374,22 -430,54 +430,59 @@@ class SessionMessagesMixincompression_lock_holder=compression_lock_holder, turn_lease_holder=turn_lease_holder,turn_lease_ttl_seconds=turn_lease_ttl_seconds)for start in range(0, len(messages), chunk_rows))- return self._execute_write(lambda conn: self._append_messages_in_transaction(- def _do(conn):- self._check_transcript_write_guards(conn, session_id, compression_lock_holder,- turn_lease_holder=turn_lease_holder, turn_lease_ttl_seconds=turn_lease_ttl_seconds)- from agent.transcript_repair import resolve_and_repair_transcript_batch- inserted_rows = resolve_and_repair_transcript_batch(- conn,- session_id,- messages,- encode_content_fn=self._encode_content,- decode_content_fn=self._decode_content,- serialize_message_fn=lambda msg, timestamp: self._serialized_message_row(- session_id, msg, timestamp- ),- decode_row_fn=self._decoded_repair_row,- )- inserted, tool_calls_total = self._insert_message_rows(conn, session_id, inserted_rows)- self._bump_session_counters(conn, session_id, inserted, tool_calls_total, unit=False)- return inserted- return self._execute_transcript_write(_do, messages, patience_s=self._TRANSCRIPT_WRITE_PATIENCE_S)++ return self._execute_transcript_write(lambda conn: self._append_messages_in_transaction(+ conn, session_id, messages, compression_lock_holder=compression_lock_holder,+ turn_lease_holder=turn_lease_holder, turn_lease_ttl_seconds=turn_lease_ttl_seconds),- patience_s=self._TRANSCRIPT_WRITE_PATIENCE_S)++ messages, patience_s=self._TRANSCRIPT_WRITE_PATIENCE_S)++ def _append_messages_in_transaction(self, conn, session_id, messages, *,+ compression_lock_holder=None, turn_lease_holder=None, turn_lease_ttl_seconds=300.0):+ self._check_transcript_write_guards(conn, session_id, compression_lock_holder,+ turn_lease_holder=turn_lease_holder, turn_lease_ttl_seconds=turn_lease_ttl_seconds)+ from agent.transcript_repair import resolve_and_repair_transcript_batch- inserted_rows = resolve_and_repair_transcript_batch(conn, session_id, messages,- encode_content_fn=self._encode_content, decode_content_fn=self._decode_content)++ inserted_rows = resolve_and_repair_transcript_batch(++ conn,++ session_id,++ messages,++ encode_content_fn=self._encode_content,++ decode_content_fn=self._decode_content,++ serialize_message_fn=lambda msg, timestamp: self._serialized_message_row(++ session_id, msg, timestamp++ ),++ decode_row_fn=self._decoded_repair_row,++ )+ inserted, tool_calls_total = self._insert_message_rows(conn, session_id, inserted_rows)+ self._bump_session_counters(conn, session_id, inserted, tool_calls_total, unit=False)+ return inserted+ _ROW_STATE_KEYS = ("_row_id", DB_ROW_SNAPSHOT, "timestamp")++ def _execute_transcript_write(self, fn, messages: List[Dict[str, Any]], **kwargs):+ """``_execute_write(fn)`` for callbacks that stamp row state onto the caller's *messages* (every+ :meth:`_insert_message_rows` caller that passes caller-owned dicts; rewind and import insert fresh copies). Each attempt, and a final failure, restores the caller's+ ``_row_id`` / digest / timestamp: a rolled-back insert's id is reused by SQLite, so a stale stamp+ would make a later flush adopt another writer's row and drop this message."""+ _absent = object()+ pre_state = [tuple(m.get(k, _absent) for k in self._ROW_STATE_KEYS) for m in messages]++ def _restore() -> None:+ for msg, state in zip(messages, pre_state):+ msg.pop(CANONICAL_ROW, None)+ for key, value in zip(self._ROW_STATE_KEYS, state):+ if value is _absent:+ msg.pop(key, None)+ else:+ msg[key] = value++ def _attempt(conn):+ _restore()+ return fn(conn)+ try:+ return self._execute_write(_attempt, **kwargs)+ except BaseException:+ _restore()+ raise+def set_latest_matching_message_display_kind(self, session_id: str, *, role: str, content: str,display_kind: str,display_metadata: Optional[Dict[str, Any]] = None) -> bool:diff --cc hermes_state_sessions.pyindex 4aa7315c5da,10f684cc25a..90e6d5f57d1--- a/hermes_state_sessions.py+++ b/hermes_state_sessions.py@@@ -1617,8 -1651,21 +1633,23 @@@ class SessionSessionsMixin).fetchall()]if not existing:return 0+ if exclude_active_write_guards:+ # A root is skipped when it or any delegate child it would cascade is guarded, so the+ # cascade below never deletes a guarded row reported back as kept.+ # One batched check first; per-root attribution only when something is guarded.+ active_ids: set = set()+ if self._guarded_ids(conn, [*existing, *_collect_delegate_child_ids(conn, existing)]):+ active_ids = {+ sid for sid in existing+ if self._guarded_ids(conn, [sid, *_collect_delegate_child_ids(conn, [sid])])+ }+ existing = [sid for sid in existing if sid not in active_ids]+ if skipped_ids is not None:+ skipped_ids.extend(sorted(active_ids))+ if not existing:+ return 0+ from hermes_state_mutation_retirement import retire_sessions+ retire_sessions(conn, existing)removed_ids.extend(_delete_delegate_children(conn, existing))for chunk in _id_chunks(existing):ph = _session_ids_placeholders(chunk)diff --cc tests/tools/test_bot_relay_windows_paths.pyindex 1c7e8b035eb,ba29cb1944f..861ba4ddc9a--- a/tests/tools/test_bot_relay_windows_paths.py+++ b/tests/tools/test_bot_relay_windows_paths.py@@@ -74,8 -81,11 +77,9 @@@ def test_local_delivery_falls_back_to_bempty.mkdir(parents=True)monkeypatch.setattr("sys.executable", str(empty / "python"))monkeypatch.setattr(bot_relay.shutil, "which", lambda name: None)+ monkeypatch.setattr(bot_relay, "__file__", str(empty / "bot_relay.py"))- argv = bot_relay.local_delivery_command("ops", "query.json")- assert argv[0] == "hermes"- assert argv[1:3] == ["-p", "ops"]+ assert bot_relay._hermes_cli() == "hermes"def test_delivery_lock_recognizes_resolved_cli_paths(tmp_path, monkeypatch):