Skip to content

The agent that grows with you

chore: drop the pre-cutover Bot Chat turn argv and two unreferenced symbols

teknium18c46622dbba4
diff --git a/evals/botmode-dm-delivery/probe-cron-root.spec.ts b/evals/botmode-dm-delivery/probe-cron-root.spec.ts
index d9a9757e329..dbbaf80acd5 100644
--- a/evals/botmode-dm-delivery/probe-cron-root.spec.ts
+++ b/evals/botmode-dm-delivery/probe-cron-root.spec.ts
@@ -63,7 +63,7 @@ test('ordinary cron pins an unowned named target under a custom root', async ()
await composer.fill('initialize default Desktop owner')
await page.keyboard.press('Enter')
await expect(page.getByText(MOCK_REPLY).filter({ visible: true }).first()).toBeVisible({ timeout: 60_000 })
- const discovery = 'from pathlib import Path; import json,os; from tools.bot_live_delivery import find_canonical_owner; h=Path(os.environ["HERMES_HOME"]); print(json.dumps({"default":find_canonical_owner(h),"alpha":find_canonical_owner(h/"profiles"/"alpha")}))'
+ const discovery = 'from pathlib import Path; import json,os; from tools.bot_live_delivery import find_canonical_live_owner; h=Path(os.environ["HERMES_HOME"]); print(json.dumps({"default":find_canonical_live_owner(h),"alpha":find_canonical_live_owner(h/"profiles"/"alpha")}))'
const before = probe(discovery)
expect(before.default.surface).toBe('desktop')
expect(before.alpha).toBeNull()
diff --git a/evals/botmode-dm-delivery/probe-dm-delivery.spec.ts b/evals/botmode-dm-delivery/probe-dm-delivery.spec.ts
index 6b57e5a0273..ff52c46c7b7 100644
--- a/evals/botmode-dm-delivery/probe-dm-delivery.spec.ts
+++ b/evals/botmode-dm-delivery/probe-dm-delivery.spec.ts
@@ -49,26 +49,18 @@ test('cron output waits for a CLI-only owner and arrives after owner release', a
try {
await fixture.mock.waitForHeldCompletion()
const script = 'import json; from cron.scheduler_delivery import _deliver_to_bot_chat; j={"id":"cli-residual","name":"CLI residual","execution_id":"fixed-execution"}; result=_deliver_to_bot_chat(j,"CLI_OWNER_CRON_SENTINEL","beta"); print(json.dumps({"result":result,"job":j}))'
- const setup = process.env.BOT_DM_EXCEPTION ? 'from pathlib import Path; from cron.bot_chat_delivery import defer; from hermes_constants import get_hermes_home; defer("e"*64,{"id":"exception-head"},"EXCEPTION_MUST_NOT_RUN","beta",get_hermes_home()/"profiles"/"beta"); ' : ''
+ const setup = ''
const result = JSON.parse(execFileSync(python, ['-c', setup + script], { env: cronEnv, cwd: repo, encoding: 'utf8', timeout: 30_000 }))
console.log('CLI_OWNER_CRON_ADMISSION', JSON.stringify(result))
fs.writeFileSync(path.join(evidence, 'cli-owner-admission.json'), JSON.stringify(result, null, 2))
- if (process.env.BOT_DM_CORRUPT) fs.writeFileSync(path.join(fixture.sandbox.hermesHome, 'cron', 'bot_chat_pending', 'broken.json'), '{')
fixture.mock.releaseHeldStream()
await expect.poll(() => child.exitCode, { timeout: 60_000 }).toBe(0)
fs.mkdirSync(path.join(fixture.sandbox.root, 'changed-launch-home'), { recursive: true })
- const tickArgs = process.env.BOT_DM_EXCEPTION ? [path.join(repo, 'evals/botmode-dm-delivery/exception-tick.py')] : ['-c', 'import time; from cron.scheduler import tick; from cron.bot_chat_delivery import _running; tick(verbose=False);\nwhile _running: time.sleep(0.1)']
- const receiptPath = path.join(evidence, 'exception-receipts.json')
- const ticker = spawn(python, tickArgs, { env: { ...cronEnv, HOME: path.join(fixture.sandbox.root, 'changed-launch-home'), BOT_DM_EXCEPTION_RECEIPT: receiptPath }, cwd: repo, stdio: ['ignore', output, output] })
+ // Delivery is admitted through the profile authority inside tick(); nothing to drain afterwards.
+ const tickArgs = ['-c', 'from cron.scheduler import tick; tick(verbose=False)']
+ const ticker = spawn(python, tickArgs, { env: { ...cronEnv, HOME: path.join(fixture.sandbox.root, 'changed-launch-home') }, cwd: repo, stdio: ['ignore', output, output] })
await expect.poll(() => ticker.exitCode, { timeout: 90_000 }).not.toBeNull()
expect(ticker.exitCode).toBe(0)
- if (process.env.BOT_DM_EXCEPTION) {
- const receipts = JSON.parse(fs.readFileSync(receiptPath, 'utf8'))
- expect(receipts.raised).toBe(1)
- expect(receipts.records.find((r: { id: string }) => r.id === 'e'.repeat(64)).status).toBe('ambiguous')
- expect(receipts.records.find((r: { id: string }) => r.id !== 'e'.repeat(64)).status).toBe('settled')
- expect(dbMessages('beta').filter(([, text]) => text.includes('EXCEPTION_MUST_NOT_RUN'))).toHaveLength(0)
- }
await openBot('beta')
expect(dbMessages('beta').filter(([role, text]) => role === 'user' && text.includes('CLI_OWNER_CRON_SENTINEL'))).toHaveLength(1)
await expect(fixture.page.getByText(/CLI_OWNER_CRON_SENTINEL/).filter({ visible: true }).first()).toBeVisible({ timeout: 45_000 })
diff --git a/hermes_cli/relay_plugin_migrate.py b/hermes_cli/relay_plugin_migrate.py
index bf2606c6735..7eead89d6c3 100644
--- a/hermes_cli/relay_plugin_migrate.py
+++ b/hermes_cli/relay_plugin_migrate.py
@@ -244,9 +244,6 @@ def run_relay_migration_after_update() -> None:
print_relay_migration_report(migrate_all_profile_relay_envs())
-RELAY_MIGRATE_COMMAND = "hermes migrate relay"
-
-
def cmd_migrate_relay(args) -> None:
"""``hermes migrate relay [--all-profiles] [--no-validate]``."""
from hermes_constants import get_hermes_home
diff --git a/tests/desktop/test_bots_chat_live_append.py b/tests/desktop/test_bots_chat_live_append.py
index b57be0d4c37..f7a3b2b6ab8 100644
--- a/tests/desktop/test_bots_chat_live_append.py
+++ b/tests/desktop/test_bots_chat_live_append.py
@@ -3,8 +3,8 @@ up background deliveries.
Mechanism (traced on 85a55e2b30-era main, re-verified through 03b87d666d):
-* Background DMs deliver via a separate ``hermes -p <profile> chat``
- subprocess (``tools/bot_relay.py::local_delivery_command``) that writes the
+* Background DMs delivered via a separate ``hermes -p <profile> chat``
+ subprocess (since retired for authority admission) that wrote the
turn straight to the session DB. No gateway stream event reaches the desktop.
* The gateway broadcasts ``sessions.changed`` on state.db mtime movement, and
the desktop's tick handler calls ``requestActiveTranscriptRefresh(true)`` —
diff --git a/tests/hermes_cli/test_gateway_chat_title_live.py b/tests/hermes_cli/test_gateway_chat_title_live.py
index 68316b5e9e7..2d6b8fd8d68 100644
--- a/tests/hermes_cli/test_gateway_chat_title_live.py
+++ b/tests/hermes_cli/test_gateway_chat_title_live.py
@@ -76,7 +76,7 @@ finally:
created, sid = chat("-c", title, "--create-if-missing", "-q", "WS_SHARED create")
assert created.returncode == 0 and sid and "LOCAL_ACK_WS_SHARED" in created.stdout, created
- # Bot Mode's exact turn shape (tools.bot_relay.BOT_CHAT_TURN_ARGS): --in + --query-file
+ # The titled-thread turn shape: --in + --query-file
# + --create-if-missing must resume the existing titled thread, never fork a second one.
query_file = tmp_path / "dm.txt"
query_file.write_text("WS_SHARED again", encoding="utf-8")
diff --git a/tests/tools/test_bot_mode_dm.py b/tests/tools/test_bot_mode_dm.py
index 2ce06d5ae60..e335a86ac0a 100644
--- a/tests/tools/test_bot_mode_dm.py
+++ b/tests/tools/test_bot_mode_dm.py
@@ -409,8 +409,8 @@ def test_delivery_pins_the_hermes_entrypoint_beside_this_interpreter(tmp_path, m
mode, _dm_file, transport_argv, _profile_home = _runner_parts(calls[0]["command"])
assert mode == "query-file"
assert transport_argv[0] == str(hermes_entry)
- assert transport_argv[1:] == ["-p", "researcher", "chat", "--in", "~", "-c", "Bot Chat",
- "--create-if-missing", "-Q"]
+ # Local delivery is admitted through the authority; the argv only names the profile.
+ assert transport_argv[1:] == ["-p", "researcher"]
result2 = json.loads(
bot_mode_dm.message_agent_tool(target="spark", message="ping", agent=agent)
diff --git a/tests/tools/test_bot_relay_windows_paths.py b/tests/tools/test_bot_relay_windows_paths.py
index e6123a7371f..15e89314010 100644
--- a/tests/tools/test_bot_relay_windows_paths.py
+++ b/tests/tools/test_bot_relay_windows_paths.py
@@ -12,9 +12,9 @@ Two failures on a Windows desktop install talking to a remote gateway:
terminate the string, so the injection defense from #93091's
python -c hardening is unchanged.
-2. ``local_delivery_command`` hardcoded ``"hermes"``, relying on PATH —
+2. the delivery runner argv hardcoded ``"hermes"``, relying on PATH —
which service contexts (systemd units, desktop launchers, non-login
- SSH shells) do not provide, so delivery died with ENOENT. It now
+ SSH shells) do not provide, so delivery died with ENOENT. ``_hermes_cli``
resolves the CLI next to this gateway's own interpreter (the venv
bin/Scripts sibling), falling back to the bare name. The #93091
turn-lock recognition in bot_mode_dm matches the CLI element by
@@ -96,10 +96,7 @@ def test_local_delivery_resolves_sibling_hermes(tmp_path, monkeypatch):
sibling.chmod(0o755)
monkeypatch.setattr("sys.executable", str(bin_dir / "python"))
- argv = bot_relay.local_delivery_command("ops", "query.json")
- assert argv[0] == str(sibling)
- assert argv[1:3] == ["-p", "ops"]
- assert argv[argv.index("--query-file") + 1] == "query.json"
+ assert bot_relay._hermes_cli() == str(sibling)
def test_local_delivery_uses_shutil_which_when_no_sibling(tmp_path, monkeypatch):
@@ -113,8 +110,7 @@ def test_local_delivery_uses_shutil_which_when_no_sibling(tmp_path, monkeypatch)
bot_relay.shutil, "which", lambda name: which_hit if name == "hermes" else None
)
- argv = bot_relay.local_delivery_command("ops", "query.json")
- assert argv[0] == which_hit
+ assert bot_relay._hermes_cli() == which_hit
def test_local_delivery_falls_back_to_bare_name(tmp_path, monkeypatch):
@@ -123,9 +119,7 @@ def test_local_delivery_falls_back_to_bare_name(tmp_path, monkeypatch):
monkeypatch.setattr("sys.executable", str(empty / "python"))
monkeypatch.setattr(bot_relay.shutil, "which", lambda name: None)
- 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):
diff --git a/tests/tools/test_bot_turn_lock.py b/tests/tools/test_bot_turn_lock.py
index 9e942aead8d..13c88143223 100644
--- a/tests/tools/test_bot_turn_lock.py
+++ b/tests/tools/test_bot_turn_lock.py
@@ -181,20 +181,3 @@ def test_peer_stdin_delivery_skips_local_lock(root, tmp_path, monkeypatch):
# ── wiring: relay deliver RPC (tui_gateway/methods_bot_relay.py) ─────────────
-
-
-def test_local_delivery_command_never_reenters_the_lock():
- """The gateway deliver handler runs local_delivery_command ALREADY holding
- the profile lock. That argv must stay a raw hermes CLI invocation:
- routing it through the --run-delivery wrapper would make the child hit
- _delivery_lock (hermes CLI + '-p'), burn the full wait
- budget against its parent's flock, and fail every relay delivery with
- target_busy. argv[0] may be a resolved venv path (#93590) — the lock
- matcher and this assertion both go by basename."""
- from pathlib import Path
-
- argv = bot_relay.local_delivery_command("ops", "/tmp/q.txt")
- assert argv[1:3] == ["-p", "ops"]
- assert Path(argv[0]).name in ("hermes", "hermes.exe")
- assert "--run-delivery" not in argv
- assert not any("bot_mode_dm" in part for part in argv)
diff --git a/tools/bot_mode_dm.py b/tools/bot_mode_dm.py
index eafa41d46b8..7cc9efd6c69 100644
--- a/tools/bot_mode_dm.py
+++ b/tools/bot_mode_dm.py
@@ -183,7 +183,7 @@ def message_agent_tool(target: str = "", message: str = "", task_id: Optional[st
BOT_CHAT_TITLE, _handle, _hermes_root, _peers, _profile_name as _self_profile_name, _roster,
is_bot_mode_managed,
)
- from tools.bot_relay import BOT_CHAT_TURN_ARGS, _hermes_cli
+ from tools.bot_relay import _hermes_cli
if _session_title(agent) != BOT_CHAT_TITLE:
return _err("message_agent is only available in a Bot Mode 'Bot Chat' session. "
@@ -257,7 +257,9 @@ def message_agent_tool(target: str = "", message: str = "", task_id: Optional[st
return _roster_err(f"No teammate named '{raw_target}' on this install, on a connected "
"machine, or on a registered peer. Pick a name from the roster "
"(roles are listed in your system prompt).")
- return _start_delivery([_hermes_cli(), "-p", resolved, *BOT_CHAT_TURN_ARGS], content, f"@{_handle(resolved)}",
+ # Local teammates are admitted through the profile authority; the argv only names the
+ # profile for the runner's lock/home lookups and is never executed.
+ return _start_delivery([_hermes_cli(), "-p", resolved], content, f"@{_handle(resolved)}",
stdin_file=False, profile_home=roster_homes[resolved], author=author, **delivery)
diff --git a/tools/bot_relay.py b/tools/bot_relay.py
index bfad8a7a5a7..8e91e668551 100644
--- a/tools/bot_relay.py
+++ b/tools/bot_relay.py
@@ -74,10 +74,6 @@ class EnvelopeRefusedError(RuntimeError):
# ``message_agent`` target grammar in ``tools/bot_mode_dm.py``).
_HANDLE_RE = re.compile(r"^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$")
-# One turn in a profile's canonical Bot Chat: ``hermes -p <profile> *BOT_CHAT_TURN_ARGS``.
-# ``-c "Bot Chat"`` must match ``bot_mode_probe.BOT_CHAT_TITLE``.
-BOT_CHAT_TURN_ARGS = ("chat", "--in", "~", "-c", "Bot Chat", "--create-if-missing", "-Q")
-
def relay_root(root: Path | str) -> Path:
return Path(root) / RELAY_DIR_NAME
@@ -384,11 +380,6 @@ def _hermes_cli() -> str:
return str(sibling) if sibling.is_file() else shutil.which("hermes") or "hermes"
-def local_delivery_command(profile: str, query_file: str) -> list[str]:
- """argv that delivers a DM into ``profile``'s Bot Chat on THIS gateway."""
- return [_hermes_cli(), "-p", profile, *BOT_CHAT_TURN_ARGS, "--query-file", query_file]
-
-
class DeliveryAuthor:
"""A relayed turn's author as an in-process object. ``bot_relay.deliver`` builds it from the sender fields
an admitted gateway client relays for another connection; nothing verifies the sender itself. A JSON
diff --git a/tui_gateway/contracts/config_free_tier_control.py b/tui_gateway/contracts/config_free_tier_control.py
index afe5a22cb65..4d54aa3325d 100644
--- a/tui_gateway/contracts/config_free_tier_control.py
+++ b/tui_gateway/contracts/config_free_tier_control.py
@@ -66,12 +66,6 @@ method("config.get", params=ConfigGetParams, result=ConfigGetResult,
# ── config.set ────────────────────────────────────────────────────────────────────────────────
-class ConfigSetScope(WireEnum):
- session = "session"
- global_ = "global"
- once = "once"
-
-
class ConfigSetParams(ProfileParams):
"""``key`` picks the setter (``_CONFIG_SETTERS``, ``details_mode.<section>``, display toggles);
``value`` is the raw word/string the setter normalises (falsy non-strings are reported back in