Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/hosted/self-host/src/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export const selfHostMcp = Effect.gen(function* () {
timeoutMs: yield* Config.Number("EXECUTOR_MCP_TIMEOUT_MS").pipe(
Config.withDefault(defaultMcpLimits.timeoutMs),
),
maxSteps: yield* Config.Number("EXECUTOR_MCP_MAX_STEPS").pipe(
Config.withDefault(defaultMcpLimits.maxSteps),
),
});
const sessions = yield* RcMap.make({
// Each session keeps what its callers' last tool calls read (CallStateCache).
Expand Down
33 changes: 17 additions & 16 deletions apps/local/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,23 @@ are resolved from the process working directory. `bun run with:local …` loads

## Configuration

| Variable | Meaning |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `EXECUTOR_DATA_DIR` | Directory containing `executor.pglite/`, `browser-auth.pglite/`, `builds/` and the [service files](#background-service); defaults to `.local/executor` (`~/.executor/v2/cli` in releases). |
| `EXECUTOR_PORT` | Loopback listener port; wins over the background service's `port` setting, then defaults to `4312`. `0` chooses any free port. |
| `EXECUTOR_API_KEY` | Optional supplied bearer token; set with the encryption key. At least 32 characters. |
| `EXECUTOR_ENCRYPTION_KEY` | Optional supplied AES key; set with the API key. Exactly 64 hexadecimal characters. |
| `EXECUTOR_KEY_STORAGE` | Optional key storage for a new directory: `file` for `keys.json`, `os` for the OS credential store without the key file fallback. See [Key storage](#key-storage). |
| `EXECUTOR_MCP_TIMEOUT_MS` | Catalog discovery plus program timeout; defaults to `300000`. |
| `EXECUTOR_MCP_MAX_TOOL_CALLS` | Admitted calls per execute, including search; defaults to `100`. |
| `EXECUTOR_TOOL_LISTING_FRESH_SECONDS` | Reuse an app's evaluated tool list this long before refreshing it in the background; defaults to `30`. |
| `EXECUTOR_TOOL_LISTING_RENEW_SECONDS` | Renew the tool lists search serves in the background once they are this old; defaults to `86400`. |
| `EXECUTOR_TOOL_LISTING_MAX_AGE_SECONDS` | Never serve an evaluated tool list older than this; `0` evaluates every list. Defaults to `604800`. |
| `EXECUTOR_TOOL_LISTING_LOAD_SECONDS` | Stop evaluating an app's tool list after this long when no request is waiting for it; defaults to `45`. |
| `EXECUTOR_EVALUATION_MEMORY_MB` | Memory for kept tool lists and app declarations; defaults to `256`. |
| `EXECUTOR_APP_WORKERS` | Most app and data Workers kept loaded; defaults to `64`. Idle ones above it unload and reload on their next call. An app with a database runs its calls in a data Worker, which counts too. |
| `EXECUTOR_APP_WORKER_IDLE_SECONDS` | Unload an app or data Worker not called for this long, even below `EXECUTOR_APP_WORKERS`; `0` turns this off. Defaults to `300`. |
| Variable | Meaning |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `EXECUTOR_DATA_DIR` | Directory containing `executor.pglite/`, `browser-auth.pglite/`, `builds/` and the [service files](#background-service); defaults to `.local/executor` (`~/.executor/v2/cli` in releases). |
| `EXECUTOR_PORT` | Loopback listener port; wins over the background service's `port` setting, then defaults to `4312`. `0` chooses any free port. |
| `EXECUTOR_API_KEY` | Optional supplied bearer token; set with the encryption key. At least 32 characters. |
| `EXECUTOR_ENCRYPTION_KEY` | Optional supplied AES key; set with the API key. Exactly 64 hexadecimal characters. |
| `EXECUTOR_KEY_STORAGE` | Optional key storage for a new directory: `file` for `keys.json`, `os` for the OS credential store without the key file fallback. See [Key storage](#key-storage). |
| `EXECUTOR_MCP_TIMEOUT_MS` | Catalog discovery plus program timeout; defaults to `300000`. |
| `EXECUTOR_MCP_MAX_TOOL_CALLS` | Admitted calls per execute, including search; defaults to `100`. |
| `EXECUTOR_MCP_MAX_STEPS` | Interpreter steps one execute program may spend: statements and expressions, plus native calls, whole-value operators, storing values and string `+` in proportion to the data they read, copy or return, not counting time spent waiting on tools; past it the program fails with `TimeoutExceeded`. Defaults to `5000000`, which stops a comparator sort of about 100,000 objects (about 20 million steps). |
| `EXECUTOR_TOOL_LISTING_FRESH_SECONDS` | Reuse an app's evaluated tool list this long before refreshing it in the background; defaults to `30`. |
| `EXECUTOR_TOOL_LISTING_RENEW_SECONDS` | Renew the tool lists search serves in the background once they are this old; defaults to `86400`. |
| `EXECUTOR_TOOL_LISTING_MAX_AGE_SECONDS` | Never serve an evaluated tool list older than this; `0` evaluates every list. Defaults to `604800`. |
| `EXECUTOR_TOOL_LISTING_LOAD_SECONDS` | Stop evaluating an app's tool list after this long when no request is waiting for it; defaults to `45`. |
| `EXECUTOR_EVALUATION_MEMORY_MB` | Memory for kept tool lists and app declarations; defaults to `256`. |
| `EXECUTOR_APP_WORKERS` | Most app and data Workers kept loaded; defaults to `64`. Idle ones above it unload and reload on their next call. An app with a database runs its calls in a data Worker, which counts too. |
| `EXECUTOR_APP_WORKER_IDLE_SECONDS` | Unload an app or data Worker not called for this long, even below `EXECUTOR_APP_WORKERS`; `0` turns this off. Defaults to `300`. |

### Key storage

Expand Down
3 changes: 3 additions & 0 deletions apps/local/server/src/contracts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ export const config = Config.all({
maxToolCalls: Config.Number("EXECUTOR_MCP_MAX_TOOL_CALLS").pipe(
Config.withDefault(defaultMcpLimits.maxToolCalls),
),
maxSteps: Config.Number("EXECUTOR_MCP_MAX_STEPS").pipe(
Config.withDefault(defaultMcpLimits.maxSteps),
),
}),
}).pipe(Effect.flatMap(Schema.decodeUnknownEffect(Schema.toType(ServerConfig))));

Expand Down
1 change: 1 addition & 0 deletions e2e/ci-selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ const patchGuards: Readonly<Record<string, ReadonlyArray<string>>> = {
"mcp-catalog.spec.ts",
"mcp-execute-concurrency.spec.ts",
"mcp-execute-lazy.spec.ts",
"mcp-execute-step-budget.spec.ts",
"local-mcp-connections.spec.ts",
],
effect: [
Expand Down
11 changes: 11 additions & 0 deletions e2e/test-plan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,17 @@ export const scenarios = plan({
cloud: na("Hosted products run the same programs in mcpExecuteCallDepth."),
},
},
mcpExecuteStepBudget: {
fixtures: "actors",
file: "mcp-execute-step-budget.spec.ts",
title:
"Hosted MCP execute stops a program that only computes, in the interpreter, through native calls, operators or string joins, at its step budget with TimeoutExceeded, while other callers stay fast and ordinary programs, including grouping, shared values and `in` lookups, complete",
targets: {
"self-host": scheduled,
cloud: na("Shared execute path and CodeMode patch; covered on self-host"),
local: na("Shared execute path and CodeMode patch; covered on self-host"),
},
},
mcpExecuteReach: {
fixtures: "actors",
file: "mcp-execute-reach.spec.ts",
Expand Down
Loading
Loading