Skip to content

The agent that grows with you

Merge origin/main: profile-scoped browser env, sudo prompt copy, clone special files

teknium11a4d8761769f
diff --cc apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/input-requests.ts
index 5e4713b3022,4b60698e73c..1dbfe679715
--- a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/input-requests.ts
+++ b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/input-requests.ts
@@@ -116,12 -121,38 +121,40 @@@ export function handleInputRequestEvent
return true
}
- if ($approvalRequests.get()[key]?.serverRequestId === id) {
- clearApprovalRequest(sessionId, $approvalRequests.get()[key]?.requestId)
+ const approval = sessionApprovalRequests(sessionId ?? null)
+ .get()
+ .find(request => request.serverRequestId === id)
+
+ if (approval) {
+ clearApprovalRequest(sessionId, approval.requestId)
+
+ // The Run/Reject bar vanishing is the only thing the user would otherwise
+ // see; the tool row then shows a model-facing "BLOCKED" result. Say what
+ // happened in human terms and point at the setting that controls the wait.
+ if (payload?.reason === 'timeout' && sessionId) {
+ const line = translateNow('assistant.approval.timedOutSystemLine')
+
+ deps.flushQueuedDeltas(sessionId)
+ deps.updateSessionState(sessionId, state => ({
+ ...state,
+ messages: [
+ ...state.messages,
+ { id: `approval-timeout-${id}`, role: 'system', parts: [textPart(line, occurredAt)], timestamp: occurredAt }
+ ]
+ }))
+ notify({
+ kind: 'warning',
+ message: line,
+ action: {
+ label: translateNow('assistant.approval.openSafetySettings'),
+ onClick: () => requestRoute(SAFETY_SETTINGS_ROUTE)
+ }
+ })
+ }
} else if ($sudoRequests.get()[key]?.requestId === id) {
clearSudoRequest(sessionId, id)
+ } else if ($sudoRequests.get()['']?.requestId === id) {
+ clearSudoRequest(null, id) // the app-level Bot Screen install card: not owned by any chat
} else if ($secretRequests.get()[key]?.requestId === id) {
clearSecretRequest(sessionId, id)
} else if ($vaultCodeRequests.get()[key]?.requestId === id) {
diff --cc apps/desktop/src/components/prompt-overlays.tsx
index d847a6f982d,84084c3d547..d3110fe2979
--- a/apps/desktop/src/components/prompt-overlays.tsx
+++ b/apps/desktop/src/components/prompt-overlays.tsx
@@@ -119,12 -120,29 +120,29 @@@ function SudoDialog({ sessionId }: { se
return (
<Dialog onOpenChange={onOpenChange} open>
- <DialogContent showCloseButton={false}>
+ <DialogContent blurBackdrop={false} showCloseButton={false}>
<DialogHeader>
<DialogTitle icon={Lock}>{copy.sudoTitle}</DialogTitle>
- <DialogDescription>{copy.sudoDesc}</DialogDescription>
+ <DialogDescription>{request.description ?? copy.sudoDesc}</DialogDescription>
</DialogHeader>
+ {request.command?.trim() ? (
+ <Field label={t.assistant.approval.command}>
+ <LogView
+ aria-label={t.assistant.approval.command}
+ className="max-h-48 text-xs text-foreground"
+ role="region"
+ tabIndex={0}
+ >
+ {request.command}
+ </LogView>
+ </Field>
+ ) : (
+ <p className="text-xs text-(--ui-text-secondary)" role="status">
+ {copy.sudoCommandUnavailable}
+ </p>
+ )}
+
<form className="grid gap-3" onSubmit={onSubmit}>
<Input
autoFocus
diff --cc apps/desktop/src/i18n/ar.ts
index d8229e2123a,36ca2afbaf0..044c7e22c03
--- a/apps/desktop/src/i18n/ar.ts
+++ b/apps/desktop/src/i18n/ar.ts
@@@ -3075,8 -3145,8 +3145,9 @@@ export const ar = defineLocale(
sudoSendFailed: 'فشل إرسال كلمة مرور sudo',
secretSendFailed: 'فشل إرسال السر',
sudoTitle: 'مطلوب sudo',
- sudoDesc: 'أدخل كلمة المرور لمتابعة الأمر.',
+ sudoDesc: 'راجع الأمر قبل إدخال كلمة مرور sudo. تُرسل كلمة المرور إلى الوكيل الذي ينفّذه وتُحفظ مؤقتًا لهذه الجلسة.',
+ sudoCommandUnavailable: 'لم يقدّم هذا الوكيل الأمر. ألغِ الطلب إذا لم تتمكن من التحقق منه في المحادثة.',
+ sudoInstallDesc: 'يحتاج Hermes إلى كلمة مرور sudo لتثبيت حزم Bot Screen (TigerVNC + Xfce) على مضيف البوابة. تُرسل إلى ذلك المضيف فقط.',
sudoPlaceholder: 'كلمة المرور',
secretTitle: 'مطلوب سر',
secretDesc: 'أدخل القيمة المطلوبة لمتابعة المهمة.',
diff --cc apps/desktop/src/i18n/en.ts
index d84b6748e6d,ec101c86bfa..097a5865eee
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@@ -4061,8 -4377,8 +4377,9 @@@ export const en: Translations =
sudoSendFailed: 'Could not send sudo password',
secretSendFailed: 'Could not send secret',
sudoTitle: 'Administrator password',
- sudoDesc: 'Hermes needs your sudo password to run a privileged command. It is sent only to your local agent.',
+ sudoDesc: 'Review the command before entering your sudo password. Your password is sent to the agent running it and cached for this session.',
+ sudoCommandUnavailable: 'This agent did not provide the command. Cancel if you cannot verify it in the conversation.',
+ sudoInstallDesc: 'Hermes needs your sudo password to install the Bot Screen packages (TigerVNC + Xfce) on the gateway host. It is sent only to that host.',
sudoPlaceholder: 'sudo password',
secretTitle: 'Secret required',
secretDesc: 'Hermes needs a credential to continue.',
diff --cc apps/desktop/src/i18n/ja.ts
index b1a16ef4619,91efc4db084..aa79afc55ff
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@@ -3483,8 -3552,8 +3552,9 @@@ export const ja = defineLocale(
secretSendFailed: 'シークレットを送信できませんでした',
sudoTitle: '管理者パスワード',
sudoDesc:
- 'Hermes は特権コマンドを実行するために sudo パスワードが必要です。ローカルエージェントにのみ送信されます。',
+ 'sudo パスワードを入力する前にコマンドを確認してください。パスワードは実行するエージェントに送信され、このセッション中キャッシュされます。',
+ sudoCommandUnavailable: 'エージェントからコマンドが提供されていません。会話で確認できない場合はキャンセルしてください。',
+ sudoInstallDesc: 'Bot Screen のパッケージ(TigerVNC + Xfce)をゲートウェイホストにインストールするため、sudo パスワードが必要です。そのホストにのみ送信されます。',
sudoPlaceholder: 'sudo パスワード',
secretTitle: 'シークレットが必要です',
secretDesc: 'Hermes は続行するための認証情報が必要です。',
diff --cc apps/desktop/src/i18n/ru.ts
index 6efa5d2e919,1b6f9f3d593..abc72975aa7
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@@ -3773,8 -3846,8 +3846,9 @@@ export const ru = defineLocale(
secretSendFailed: 'Не удалось отправить секрет',
sudoTitle: 'Пароль администратора',
sudoDesc:
- 'Hermes нужен ваш пароль sudo, чтобы выполнить команду с повышенными правами. Он отправляется только вашему локальному агенту.',
+ 'Проверьте команду перед вводом пароля sudo. Пароль отправляется агенту, который её выполняет, и кэшируется на время сеанса.',
+ sudoCommandUnavailable: 'Агент не предоставил команду. Отмените запрос, если не можете проверить её в разговоре.',
+ sudoInstallDesc: 'Hermes нужен ваш пароль sudo, чтобы установить пакеты Bot Screen (TigerVNC + Xfce) на хосте шлюза. Он отправляется только на этот хост.',
sudoPlaceholder: 'пароль sudo',
secretTitle: 'Требуется секрет',
secretDesc: 'Hermes нужны учётные данные, чтобы продолжить.',
diff --cc apps/desktop/src/i18n/types.ts
index 2dad79c00ac,33f70765042..d4669fbc5c0
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@@ -3552,7 -3741,7 +3741,8 @@@ export interface Translations
secretSendFailed: string
sudoTitle: string
sudoDesc: string
+ sudoCommandUnavailable: string
+ sudoInstallDesc: string
sudoPlaceholder: string
secretTitle: string
secretDesc: string
diff --cc apps/desktop/src/i18n/zh-hant.ts
index a71a37794b8,4ba4a0551cf..0a8b5ad41b3
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@@ -3406,8 -3480,8 +3480,9 @@@ export const zhHant = defineLocale(
sudoSendFailed: '無法傳送 sudo 密碼',
secretSendFailed: '無法傳送密鑰',
sudoTitle: '管理員密碼',
- sudoDesc: 'Hermes 需要您的 sudo 密碼來執行特權指令。它只會傳送給您的本機代理。',
+ sudoDesc: '輸入 sudo 密碼前,請先確認指令。密碼會傳送給執行指令的代理,並在本次工作階段中快取。',
+ sudoCommandUnavailable: '此代理未提供指令。如果無法在對話中確認,請取消。',
+ sudoInstallDesc: 'Hermes 需要您的 sudo 密碼,以在閘道主機上安裝 Bot Screen 套件(TigerVNC + Xfce)。它只會傳送到該主機。',
sudoPlaceholder: 'sudo 密碼',
secretTitle: '需要密鑰',
secretDesc: 'Hermes 需要一個憑證才能繼續。',
diff --cc apps/desktop/src/i18n/zh.ts
index 6519023621c,f760066a643..0e8a487c5d1
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@@ -4203,8 -4281,8 +4281,9 @@@ export const zh = defineLocale(
sudoSendFailed: '无法发送 sudo 密码',
secretSendFailed: '无法发送密钥',
sudoTitle: '管理员密码',
- sudoDesc: 'Hermes 需要你的 sudo 密码来运行特权命令。它只会发送给你的本地 agent。',
+ sudoDesc: '输入 sudo 密码前,请先检查命令。密码会发送给执行命令的 agent,并在本次会话中缓存。',
+ sudoCommandUnavailable: '此 agent 未提供命令。如果无法在对话中确认,请取消。',
+ sudoInstallDesc: 'Hermes 需要你的 sudo 密码,以在网关主机上安装 Bot Screen 软件包(TigerVNC + Xfce)。它只会发送到该主机。',
sudoPlaceholder: 'sudo 密码',
secretTitle: '需要密钥',
secretDesc: 'Hermes 需要一个凭据才能继续。',
diff --cc apps/desktop/src/plugins/hermes-bots/bot-row.tsx
index ab4ed243729,1079cfe32a8..613fd64215d
--- a/apps/desktop/src/plugins/hermes-bots/bot-row.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/bot-row.tsx
@@@ -72,9 -74,17 +74,18 @@@ import
useTurnBusy,
workerActiveAt
} from './row-helpers'
+import { openBotScreen } from './screen-open'
import type { GroupMember, RosterRow, SidebarRowLabels } from './types'
- import { $botSections, $draggingBot, BOT_DRAG_MIME, botSectionId, moveBotsToSection } from './user-sections'
+ import {
+ $botSections,
+ $draggingBot,
+ BOT_DRAG_MIME,
+ botSectionId,
+ groupChatSectionId,
+ groupDragKey,
+ moveBotsToSection,
+ moveGroupChatsToSection
+ } from './user-sections'
// ── bot row ──────────────────────────────────────────────────────────────────
diff --cc apps/desktop/src/store/prompts.ts
index 99c48448020,cfb73106f8a..30cf1351716
--- a/apps/desktop/src/store/prompts.ts
+++ b/apps/desktop/src/store/prompts.ts
@@@ -106,11 -103,8 +106,12 @@@ interface PendingApprovalPayload
}
export interface SudoRequest extends KeyedPrompt {
+ command?: string
requestId: string
+ /** Description override so the card can say WHAT the password is for (the Bot Screen install).
+ * The reply travels as a JSON-RPC response on the socket the request arrived on, so a password
+ * typed for host A can never reach host B without any origin bookkeeping here. */
+ description?: string
}
export interface SecretRequest extends KeyedPrompt {
@@@ -278,12 -361,14 +368,16 @@@ export async function answerApproval
/** The prompt request for one specific session — the tile counterpart of the
* active-session `$*Request` views (same map, fixed key). */
+ export const sessionApprovalStackSize = (sessionId: string | null) =>
+ computed($approvalStackSizes, sizes => sizes[keyFor(sessionId)] ?? 0)
+ export const sessionApprovalRequests = (sessionId: string | null) =>
+ computed($approvalQueues, all => all[keyFor(sessionId)] ?? EMPTY_APPROVALS)
export const sessionApprovalRequest = (sessionId: string | null) =>
computed(approval.$all, all => all[keyFor(sessionId)] ?? null)
+/** A session's sudo card, else the app-level one (a Bot Screen package install is raised with no
+ * session: it belongs to the connection, not to a turn, so whichever chat is focused shows it). */
export const sessionSudoRequest = (sessionId: string | null) =>
- computed(sudo.$all, all => all[keyFor(sessionId)] ?? null)
+ computed(sudo.$all, all => all[keyFor(sessionId)] ?? (sessionId ? all[keyFor(null)] ?? null : null))
export const sessionSecretRequest = (sessionId: string | null) =>
computed(secret.$all, all => all[keyFor(sessionId)] ?? null)
diff --cc hermes_cli/profiles.py
index bb73570dfec,f99b0db3596..2d19ee55a7c
--- a/hermes_cli/profiles.py
+++ b/hermes_cli/profiles.py
@@@ -1761,11 -1892,11 +1925,11 @@@ def rename_profile(old_name: str, new_n
old_dir = get_profile_dir(old_canon)
new_dir = get_profile_dir(new_canon)
if not old_dir.is_dir():
- raise FileNotFoundError(f"Profile '{old_canon}' does not exist.")
+ raise _unknown_profile_error(old_canon)
if new_dir.exists():
- raise FileExistsError(f"Profile '{new_canon}' already exists.")
+ raise _profile_exists_error(new_canon)
- # 1. Stop gateway if running
+ # 1. Stop gateway if running, and the screen whose launcher holds paths under the old name
if _check_gateway_running(old_dir):
_cleanup_gateway_service(old_canon, old_dir)
_stop_gateway_process(old_dir)
diff --cc tests/hermes_cli/test_profiles.py
index 47010dbf7ff,48642b78532..b82c42dc4dd
--- a/tests/hermes_cli/test_profiles.py
+++ b/tests/hermes_cli/test_profiles.py
@@@ -216,25 -261,22 +261,41 @@@ class TestCreateProfile
assert not any((profile_dir / "cron").iterdir())
assert yaml.safe_load((profile_dir / "config.yaml").read_text())["model"] == "test"
+ def test_clone_all_does_not_inherit_the_source_screens_identity(self, profile_env):
+ """launcher.pid / env / lease name the SOURCE's live X server; a clone that inherits them believes it
+ owns that screen and `screen stop` on the clone kills the source's desktop. The browser profile
+ beside them is user data (logins) and must come along."""
+ default_home = profile_env / ".hermes"
+ (default_home / "config.yaml").write_text("model: test")
+ bd = default_home / "bot-desktop"
+ (bd / "browser-profile" / "Default").mkdir(parents=True)
+ (bd / "browser-profile" / "Default" / "Cookies").write_text("jar")
+ (bd / "launcher.pid").write_text("4242 1.5")
+ (bd / "env").write_text("DISPLAY=:21\nXAUTHORITY=/x\n")
+ (bd / "lease.json").write_text(json.dumps({"holder": "human", "viewer_id": "v", "epoch": 3}))
+
+ profile_dir = create_profile("coder", clone_all=True, no_alias=True)
+
+ for runtime_file in ("launcher.pid", "env", "lease.json"):
+ assert not (profile_dir / "bot-desktop" / runtime_file).exists(), runtime_file
+ assert (profile_dir / "bot-desktop" / "browser-profile" / "Default" / "Cookies").read_text() == "jar"
+
+ @pytest.mark.skipif(not hasattr(os, "mkfifo"), reason="special files need a POSIX filesystem")
+ def test_clone_all_skips_special_files(self, profile_env):
+ # A live source profile holds special files copytree cannot copy (e.g. a suffixless
+ # agent-browser control socket); one of them must not abort the whole clone.
+ default_home = profile_env / ".hermes"
+ (default_home / "config.yaml").write_text("model: test")
+ browser_dir = default_home / "home" / ".agent-browser"
+ browser_dir.mkdir(parents=True)
+ (browser_dir / "state.json").write_text("{}")
+ os.mkfifo(browser_dir / "control")
+
+ profile_dir = create_profile("coder", clone_all=True, no_alias=True)
+
+ assert (profile_dir / "home" / ".agent-browser" / "state.json").is_file()
+ assert not (profile_dir / "home" / ".agent-browser" / "control").exists()
+
@@@ -1237,70 -1497,66 +1516,134 @@@ class TestResolveProfileEnvSpelling
assert Path(resolve_profile_env("default")) == _get_default_hermes_home()
+
+
+def _live_bot_desktop_launcher(profile_dir: Path):
+ """A synthetic Bot Desktop launcher for ``profile_dir``: its own session (like launcher.sh) with the
+ identity file + env runtime.status() reads, so the profile op sees a running screen."""
+ import subprocess
+ from tools.bot_desktop import runtime
+
+ proc = subprocess.Popen(["sleep", "60"], start_new_session=True)
+ sd = profile_dir / "bot-desktop"
+ sd.mkdir()
+ (sd / "launcher.pid").write_text(f"{proc.pid} {runtime._create_time(proc.pid)}", encoding="utf-8")
+ (sd / "env").write_text("DISPLAY=:42\n", encoding="utf-8")
+ return proc
+
+
[email protected]("op", ["delete", "rename"])
+def test_profile_delete_and_rename_stop_the_profiles_bot_desktop(profile_env, op):
+ """Deleting or renaming a profile stops its gateway, and must stop its Bot Desktop launcher too: the
+ Xvnc/Xfce session otherwise keeps running against a directory that no longer exists (or now belongs to
+ another name), holding its display number and an rfb.sock nobody can reach through status()."""
+ import time
+ from tools.bot_desktop import runtime
+
+ profile_dir = create_profile("coder", no_alias=True)
+ proc = _live_bot_desktop_launcher(profile_dir)
+ # A human held the screen when the op ran. lease.json moves with a rename; left human-held it would
+ # fence the agent out of the renamed profile's next screen for a viewer that no longer exists.
+ (profile_dir / "bot-desktop" / "lease.json").write_text(
+ json.dumps({"holder": "human", "viewer_id": "gone", "since": 1.0, "epoch": 3, "reason": ""}), encoding="utf-8")
+ try:
+ with patch("hermes_cli.profiles._cleanup_gateway_service"), \
+ patch("hermes_cli.profiles.check_alias_collision", return_value="skip"):
+ if op == "delete":
+ delete_profile("coder", yes=True)
+ else:
+ rename_profile("coder", "hacker")
+ # The runtime reaps what it kills (a later gateway holds no Popen for the launcher), so our own
+ # Popen may see the status already collected; liveness, not the exit code, is the contract.
+ deadline = time.monotonic() + 10
+ while time.monotonic() < deadline and runtime._pid_alive(proc.pid):
+ time.sleep(0.05)
+ assert not runtime._pid_alive(proc.pid), "the launcher was not stopped by the profile op"
+ if op == "rename":
+ moved = json.loads((profile_dir.parent / "hacker" / "bot-desktop" / "lease.json").read_text(encoding="utf-8"))
+ assert moved["holder"] == "agent", "stale human lease survived the teardown"
+ finally:
+ proc.kill()
+
+
[email protected]("name", ["coder", "default"])
+def test_export_leaves_the_bot_desktop_browser_profile_out(profile_env, tmp_path, name):
+ """bot-desktop/ holds the screen's persistent Chromium profile (Cookies, Login Data: the bot's live web
+ sessions) plus sockets and X state. None of it belongs in an export archive meant to move a persona."""
+ profile_dir = create_profile(name, no_alias=True) if name != "default" else get_profile_dir("default")
+ (profile_dir / "config.yaml").write_text("model: test")
+ cookies = profile_dir / "bot-desktop" / "browser-profile" / "Default" / "Cookies"
+ cookies.parent.mkdir(parents=True)
+ cookies.write_bytes(b"SQLite format 3\x00")
+ output = tmp_path / "export" / f"{name}.tar.gz"
+ output.parent.mkdir(parents=True, exist_ok=True)
+ export_profile(name, str(output))
+ with tarfile.open(str(output), "r:gz") as tf:
+ names = tf.getnames()
+ assert f"{name}/config.yaml" in names
+ assert not [n for n in names if "bot-desktop" in n], names
++
+ # ===================================================================
+ # TestCloneAllExcludesRuntimeTrees
+ # ===================================================================
+
+ class TestCloneAllExcludesRuntimeTrees:
+ """``--clone-all`` from the default profile must not copy the machine-scoped
+ runtime trees the local-models flow puts under ``~/.hermes``: ``models/``
+ (GGUF weights, tens of GB), ``runtimes/`` (llama.cpp binaries) and ``node/``
+ (managed Node). ``backup.py`` already excludes exactly these; the clone-all
+ ignore list had not followed.
+ """
+
+ RUNTIME_TREES = ("models", "runtimes", "node")
+
+ def _seed(self, home):
+ (home / "models").mkdir(); (home / "models" / "big.gguf").write_bytes(b"\0" * 64)
+ (home / "runtimes" / "llamacpp" / "bin").mkdir(parents=True)
+ (home / "runtimes" / "llamacpp" / "bin" / "llama-server").write_text("bin")
+ (home / "node" / "bin").mkdir(parents=True)
+ (home / "node" / "bin" / "node").write_text("bin")
+ (home / "skills" / "greet").mkdir(parents=True)
+ (home / "skills" / "greet" / "SKILL.md").write_text("# greet\n")
+ (home / "config.yaml").write_text("model: test\n")
+
+ def test_ignore_drops_runtime_trees_only_at_the_default_root(self, profile_env):
+ default_home = profile_env / ".hermes"
+ self._seed(default_home)
+ # a skill that happens to carry a nested models/ dir is user data
+ (default_home / "skills" / "greet" / "models").mkdir()
+ ignore = _clone_all_copytree_ignore(default_home)
+
+ at_root = ignore(str(default_home), ["models", "runtimes", "node", "skills", "config.yaml"])
+ nested = ignore(str(default_home / "skills" / "greet"), ["models", "SKILL.md"])
+
+ assert set(at_root) == set(self.RUNTIME_TREES)
+ assert not nested
+
+ # Gated on the default profile: a named profile that really has a
+ # models/ dir of its own must not have it dropped when used as source.
+ source = create_profile("source", no_alias=True)
+ for tree in self.RUNTIME_TREES:
+ (source / tree).mkdir()
+ assert not _clone_all_copytree_ignore(source)(str(source), [*self.RUNTIME_TREES, "SOUL.md"])
+
+ def test_runtime_trio_is_one_constant_shared_with_backup(self):
+ """backup's exclusion list and the clone-all root gate must be built from the same
+ constant; two literals drifting apart is how the models/ copy of #111718 crept in."""
+ from hermes_cli import backup, profiles
+ from hermes_constants import LOCAL_RUNTIME_ROOT_DIRS
+ assert LOCAL_RUNTIME_ROOT_DIRS == frozenset(self.RUNTIME_TREES)
+ assert backup._EXCLUDED_ROOT_DIRS is LOCAL_RUNTIME_ROOT_DIRS
+ assert LOCAL_RUNTIME_ROOT_DIRS <= profiles._CLONE_ALL_DEFAULT_EXCLUDE_ROOT
+
+ def test_clone_all_from_default_skips_runtime_trees_but_keeps_the_rest(self, profile_env):
+ default_home = profile_env / ".hermes"
+ self._seed(default_home)
+
+ clone = create_profile("clone", clone_all=True, no_alias=True)
+
+ for name in self.RUNTIME_TREES:
+ assert not (clone / name).exists(), name
+ assert (clone / "skills" / "greet" / "SKILL.md").is_file()
+ assert (clone / "config.yaml").is_file()
diff --cc tools/browser_tool.py
index 556b432e9ac,16c40486001..0df3968e810
--- a/tools/browser_tool.py
+++ b/tools/browser_tool.py
@@@ -37,14 -37,27 +37,31 @@@ _BROWSER_PASSTHROUGH_KEYS: tuple[str, .
def _build_browser_env() -> dict:
"""Credential-scrubbed env for an agent-browser subprocess (deferred import: test
- harnesses stub the ``tools`` package)."""
- from tools.environments.local import hermes_subprocess_env
-
- env = hermes_subprocess_env(inherit_credentials=False)
- env.update({k: os.environ[k] for k in _BROWSER_PASSTHROUGH_KEYS if k in os.environ})
+ harnesses stub the ``tools`` package). The passthrough keys are re-added from the active
+ profile's secret scope, never ``os.environ``: under multiplex that holds the LAUNCH profile's
+ Browserbase/Firecrawl keys, and a served profile's browser must run on its own (or none)."""
+ from agent.secret_scope import current_secret_scope, get_secret, serves_routed_profile
+ from tools.environments.local import served_profile_child_env
+
+ from agent.proxy_bypass import add_loopback_no_proxy
+
+ env = served_profile_child_env(inherit_credentials=False)
+ # A routed profile (multiplex, or a Desktop/dashboard backend serving ``?profile=B`` with the
+ # flag off) resolves from its bound scope only — a miss is "no key", never the launch profile's
+ # ``os.environ`` value that ``get_secret`` falls through to while multiplexing is inactive.
+ routed = serves_routed_profile()
+ scope = (current_secret_scope() or {}) if routed else None
+ for key in _BROWSER_PASSTHROUGH_KEYS:
+ value = scope.get(key) if routed else get_secret(key)
+ if value is not None:
+ env[key] = value
+ # The Browser Use harness dials the resolved local CDP URL over ``websockets``; without a
+ # loopback NO_PROXY a macOS system proxy captures that dial (#110565).
- return add_loopback_no_proxy(env)
++ # Headed Chromium opens on this profile's Bot Desktop when one is running (human can take it over).
++ from tools.bot_desktop.runtime import desktop_env as _bot_desktop_env
+ # Headed Chromium opens on this profile's Bot Desktop when one is running (human can take it over).
+ from tools.bot_desktop.runtime import desktop_env as _bot_desktop_env
- return _bot_desktop_env(env)
++ return add_loopback_no_proxy(_bot_desktop_env(env))
try: