The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update): attribute an earlier --no-open respawn to its launchd job
teknium129979b8c25fc
diff --git a/hermes_cli/main_dashboard.py b/hermes_cli/main_dashboard.pyindex 9e4589280d7..d285376c161 100644--- a/hermes_cli/main_dashboard.py+++ b/hermes_cli/main_dashboard.py@@ -274,13 +274,18 @@ def _launchd_job_owning_backend() -> tuple[str, str, int | None] | None:"""``(domain, label, live_pid)`` of the loaded launchd job that owns *pid*: launchd reports *pid*(or one of its *ancestors* — a plist may wrap the backend in ``/bin/sh -c …`` without ``exec``)- as the job's live process, OR the process runs the job's exact ``ProgramArguments`` — a detached- copy of a supervised backend (an earlier respawn) holds the port the job needs, and respawning it- again would only re-create that conflict. None when no loaded job claims the process."""+ as the job's live process, OR the process runs the job's ``ProgramArguments`` — a detached copy+ of a supervised backend (an earlier respawn) holds the port the job needs, and respawning it again+ would only re-create that conflict. ``--no-open`` is ignored on both sides: the respawn path adds+ it, so an earlier respawn's argv is the plist's plus that flag. None when no loaded job claims+ the process."""+ def _norm(argv: list[str]) -> list[str]:+ return [a for a in argv if a != "--no-open"]+for domain, label, argv, live_pid in jobs:if live_pid is not None and (live_pid == pid or live_pid in ancestors):return (domain, label, live_pid)- if cmdline is not None and list(cmdline) == argv:+ if cmdline is not None and _norm(list(cmdline)) == _norm(argv):return (domain, label, live_pid)return Nonediff --git a/tests/hermes_cli/test_update_stale_dashboard.py b/tests/hermes_cli/test_update_stale_dashboard.pyindex 238010f2582..c06dfbfa82e 100644--- a/tests/hermes_cli/test_update_stale_dashboard.py+++ b/tests/hermes_cli/test_update_stale_dashboard.py@@ -1054,6 +1054,9 @@ class TestLaunchdSupervisedBackends:assert owning(4242, ["something", "else"], jobs) == (f"user/{uid}", "ai.hermes.dashboard", 4242)assert owning(9999, ["python"], jobs, ancestors=[4242, 1]) == (f"user/{uid}", "ai.hermes.dashboard", 4242)assert owning(9999, serve_argv, jobs) == ("system", "ai.hermes.serve", None)+ # An earlier detached respawn runs the plist argv plus the ``--no-open`` the respawn path+ # appends; it must still be attributed to the job, or every update respawns it again.+ assert owning(9999, backend_argv + ["--no-open"], jobs) == (f"user/{uid}", "ai.hermes.dashboard", 4242)assert owning(9999, serve_argv[:-1] + ["8643"], jobs) is Noneassert owning(9999, None, jobs) is Noneassert owning(4242, None, []) is None