Several sessions of one app: a session's working folder names its agent when that agent runs in the same app (MCP server and hooks), an i_am tool binds a session explicitly, the doctor checks second sessions against their app's install, and an agent that left the roster can still be uninstalled

This commit is contained in:
KeelrLeek committed 2026-10-06 10:06:01 -05:00
1 parent d755ab8a76
commit e283e4cc54
6 files changed
+63 -5

No files matched your search

+13 -2
View File
@@ -208,14 +208,25 @@ def run(project, harbor, port=None, server_known=False):
checks.append(server_check(project, port, server_known))
links = harbor.connections()
servers = running_mcp_servers()
installed = {} # app -> the agent its Harbor install is for (the first one)
for spec in project.agents:
if spec["kind"] != "human" and spec.get("host"):
installed.setdefault(spec["host"], spec["name"])
for spec in project.agents:
if spec["kind"] == "human":
continue
host = spec.get("host")
as_agent = installed.get(host, spec["name"])
if host in HOST_CHECKS:
checks += HOST_CHECKS[host](spec["name"])
checks += HOST_CHECKS[host](as_agent)
elif host == "kimi":
checks += kimi_checks(spec["name"], project)
checks += kimi_checks(as_agent, project)
if as_agent != spec["name"]: # a second session of the same app: its folder names it
ok = bool(spec.get("workdir")) and project.identity_for(spec["workdir"]) == spec["name"]
checks.append(_check(spec["name"], "session identity", "ok" if ok else "fail",
f"shares the {host} install with {as_agent}; its folder {spec.get('workdir') or '?'} "
+ ("names it in [identities]" if ok else "is not in [identities]"),
"" if ok else "map its worktree folder to it in [identities], or have it call i_am"))
seen = {(r["channel"], r["host"]): r for r in links.get(spec["name"], [])}
live = ", ".join(f"{ch}{('/' + h) if h else ''} {r['minutes']} min ago" for (ch, h), r in sorted(seen.items()))
running = servers.get(spec["name"], 0)