Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

agent protocol: AGENT_TOOL_LIMIT_MS decides when a fix is the user's to run (#6803)

garrytan121011f6f083
diff --git a/docs/protocol/AGENT_OPERATOR_v1.md b/docs/protocol/AGENT_OPERATOR_v1.md
index b612f806f8..b09934cc90 100644
--- a/docs/protocol/AGENT_OPERATOR_v1.md
+++ b/docs/protocol/AGENT_OPERATOR_v1.md
@@ -661,6 +661,8 @@ per-token price), obtain each value as `how` describes and substitute it for
| `host_admin` | the operator of the brain host (a remote brain over HTTP, scope grants, server restarts). Never authorizable from MCP |
| `provider` | an outside service you wait on (rate limits, outages) |
+A fix whose expected run time exceeds 120 seconds (`AGENT_TOOL_LIMIT_MS`, the longest an agent tool call reliably stays open) is never `agent`: gbrain gives it actor `user` (or `host_admin` on a remote brain), so it renders `tell_user_to_run` and the user runs it in a terminal on the brain host.
+
### The `next` decision table
First matching row wins.
diff --git a/src/core/agent-output.ts b/src/core/agent-output.ts
index 32bff820b6..06894c47e6 100644
--- a/src/core/agent-output.ts
+++ b/src/core/agent-output.ts
@@ -29,6 +29,8 @@ export const CONTRACT_VERSION = 1 as const;
export type Effect = 'paid' | 'destructive' | 'credentials' | 'egress' | 'persistent_install';
export type Actor = 'agent' | 'user' | 'host_admin' | 'provider';
export type Next = 'run' | 'ask_user' | 'tell_user_to_run' | 'wait' | 'report';
+/** A fix expected to run longer than this is the user's or host admin's (`tell_user_to_run`), never the agent's. */
+export const AGENT_TOOL_LIMIT_MS = 120_000;
export type Transport = 'cli' | 'stdio' | 'http';
export type Surface = 'verbs' | 'starter' | 'full';
export type ErrorClass = 'caller' | 'consent' | 'retryable' | 'unavailable' | 'server' | 'host_only';