Shared app servers: the PreToolUse hook leaves a ticket naming the calling session, the MCP server takes it per call (middleware), so two sessions of one app on one Harbor server act as themselves; i_am checks instead of binding and is allowed under a stop

This commit is contained in:
KeelrLeek committed 2026-10-06 10:47:08 -05:00
1 parent e283e4cc54
commit fdaa3b0806
4 files changed
+131 -18

No files matched your search

+5 -1
View File
@@ -63,7 +63,7 @@ ALLOWED_COMMANDS = {"brief", "inbox", "ack", "thread", "threads", "search", "tai
"tasks", "pins", "decisions", "handoffs", "handoff", "item", "pending-acks", "wait", "doing", "send",
"reply", "answer", "questions", "context", "notes", "note", "digest", "attention", "stop", "who",
"feed", "summarize", "git", "templates", "pulse", "metrics", "wins"}
ALLOWED_TOOLS = {"brief", "inbox", "ack", "thread", "threads", "search", "status", "queue", "claims", "tasks", "handoff",
ALLOWED_TOOLS = {"brief", "i_am", "mark_read", "inbox", "ack", "thread", "threads", "search", "status", "queue", "claims", "tasks", "handoff",
"send", "reply", "wait_for_messages", "doing", "questions", "answer", "context", "notes", "note",
"digest", "pin", "close_thread", "stop", "summarize", "who_knows", "git_status"}
TOOL_NAME = re.compile(r"^(?:mcp__harbor__|harbor[_.])([a-z_]+)$")
@@ -276,6 +276,10 @@ def _run(event, harbor, agent, host, payload):
try: # bookkeeping is best effort
from .launch import describe_target
tool_input = payload.get("tool_input") or payload.get("input") or {}
harbor_tool = _harbor_tool(str(tool))
if harbor_tool is not None: # tell the app's shared Harbor server which session is calling
from . import sessions
sessions.leave(harbor, host, harbor_tool, tool_input if isinstance(tool_input, dict) else {}, agent)
paths = harbor.edited_paths(tool, tool_input)
harbor.activity(agent, tool, host, target=describe_target(tool, tool_input, paths))
if not stops: