Repository navigation
Add the hosted agents v2 box runtime packages - #2017
niall-sandboxaq wants to merge 18 commits into
Conversation
Three new packages under console/packages: the providers, controller and runtime builds that run inside a hosted agents v2 box. They are copies of the upstream agent packages, kept in step with main, plus the box-only changes. Nothing in Core, the apps or the existing packages changes, and nothing uses these packages until the hosted agents v2 server and cluster setup are in, so v1 is unchanged. Also adds the lockfile entries for the new packages, and three path- and line-scoped gitleaks allowlist entries for test fixtures and pinned blob ids that look like keys but are not. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The launcher tests waited for a quiet spell after each order before asserting. Under load the launcher's file and process work can take longer than that, so the assertions sometimes ran too early. The launcher replies to an order only once its work is done, so the tests now wait for that reply, and poll for the few effects that land after it. Test-only; the same tests and assertions. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
| const transport = new StreamableHTTPServerTransport({ | ||
| sessionIdGenerator: undefined, | ||
| enableJsonResponse: true, | ||
| }); |
There was a problem hiding this comment.
🟠 High severity and reachable issue identified in your code:
Line 681 has a potentially vulnerable usage of @modelcontextprotocol/sdk, possibly introducing a high severity vulnerability.
ℹ️ Why this is reachable
A reachable issue is a possible security risk because your project actually executes the vulnerable code. This issue is reachable because your code calls vulnerable code in this version of @modelcontextprotocol/sdk.
Affected versions of @modelcontextprotocol/hono, @modelcontextprotocol/node, @modelcontextprotocol/sdk, and @modelcontextprotocol/server are vulnerable to Allocation of Resources Without Limits or Throttling. The MCP TypeScript SDK Streamable HTTP server transports and HTTP handlers (StreamableHTTPServerTransport, WebStandardStreamableHTTPServerTransport, NodeStreamableHTTPServerTransport, createMcpHandler, isLegacyRequest, legacyStatelessFallback, toNodeHandler/toWebRequest, createMcpHonoApp) read POST request bodies without a size limit and dispatch JSON-RPC batches of unbounded length. An unauthenticated remote client can exhaust server memory with an oversized body or block other clients with a very long batch, causing denial of service.
References: GHSA
To resolve this comment:
Upgrade this dependency to at least version 1.30.1 at console/pnpm-lock.yaml.
💬 Ignore this finding
To ignore this, reply with:
/fp <comment>for false positive/ar <comment>for acceptable risk/other <comment>for all other reasons
You can view more details on this finding in the Semgrep AppSec Platform here.
The box controller's run() unrefs process.channel so a forked controller
doesn't hold its parent open. Under vitest's fork pool that channel is the
worker's own, and once a test reached that line the worker could exit
early ("Worker exited unexpectedly with exit code 0"). The tests now stub
unref on the channel, and remove any message or signal listeners a test
added to the process. Product code is unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Main's #2019 changed agent-controller's login-path.ts, its test and main.ts, so a controller on Windows reads the PATH from the registry and finds a CLI installed after it started. The box copy of login-path.ts and its test now match upstream's, and the same change is merged into the box's main.ts. The pin in upstream-packages.json and the BOX.md notes move to 48f6758. No other file in the four upstream packages changed since 35b7915. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Ports upstream's changes to agent-controller, agent-providers and switch-agent-runtime since 48f6758 into the box copies (shared is used as it is), and moves the pin in upstream-packages.json and the BOX.md notes to 268f12b. Where the box differs from upstream: - session-host: upstream's new interruptOpenWork() returns the turns it interrupted, so the box still owes each cut-off turn its restart line, on a recovered start and when the provider exits. - agent-controller: windowsRegistryPath and withWindowsPathEntries now come from agent-providers-box, as upstream moved them. - index.ts keeps the left-out providers out; the Pi adapter change isn't ported, as the box carries no Pi adapter. - The new mcp-tool-descriptions.ts imports switch-agent-runtime-box. - Tests: upstream's tool-list tests and imports are merged beside the box's own; the runtime package version follows upstream to 0.8.4. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Ports upstream's changes to agent-controller, agent-providers and switch-agent-runtime since 268f12b into the box copies (shared is used as it is), and moves the pin in upstream-packages.json and the BOX.md notes to 483d322. Where the box differs from upstream: - store.ts takes loadNodeSqlite from agent-providers-box. - index.ts adds upstream's opencode v1-database exports beside the box's own valve exports. - The runtime package version follows upstream to 0.8.5. interruptOpenWork() is unchanged and still returns the turns it ends. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ice id Ports upstream's agent-controller changes since 483d322 into the box copy, among them device identity on re-enrolment (device-id.ts, kept as upstream's), and moves the pin in upstream-packages.json and the BOX.md notes to 9704ba1. A box never sends a device id, at enrolment, in its status reports, or for --device-id (boxDeviceId in main.ts, BOX.md item 24). It stays the same device across restarts and sleep through the credential on its volume, and enrols again only after it was revoked or lost its controller, where adopting an earlier device could give back a paused or deleted machine's agents past hosted agents v2's own re-enrolment. main.device-id.test.ts checks this with a machine id present. Elsewhere upstream's lines are merged beside the box's own: the run flags, the status schema and report, and the box-only status tests, which now give the collector no device id. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Core sends each box controller its workspace's daily call budget in the assignment. The box now applies it, with the lower of that budget and the operator's own per-box cap in force, re-read on every assignment pull, and reports which cap applies. Calls past the cap are refused before they reach the provider. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Closing: this is being folded into a single hosted agents v2 PR, built from current main. A link will be added here once it's up. The branch is kept for history. |
|
Folded into #2216, which brings all of hosted agents v2 into one PR with one commit per area. Closing this one in its favour. |
What this adds
The software that runs inside a hosted agents v2 box: three new packages under
console/packages/.agent-providers-box,agent-controller-boxandswitch-agent-runtime-boxare copies of the upstream agent packages, kept in step with current main, plus the changes a box needs.BOX.mdin each package says where it came from and which upstream commit it is pinned to. A pin guard test fails if the copy drifts from that pin.console/pnpm-lock.yamlgains the entries for the new packages..gitleaks.tomlgains three allowlist entries, each limited to one path, one line pattern and thegeneric-api-keyrule. They cover pinned blob ids and test fixtures that look like keys but are not. If the separate allowlist PR merges first, these drop out.No change to v1
Nothing in Core, the gateway, the apps or the existing packages changes, and nothing builds or runs these packages yet. They are only used once the hosted agents v2 cluster setup and server PRs are in and the v2 flag is turned on. This is the first of three PRs: box software, then the cloud setup, then the server and the flag.
Changed after review
After the first review, one commit makes a box enforce its workspace's daily AI budget. Core already sends that budget in each box's assignment. The box now applies the lower of it and the operator's per-box cap, re-reads it on every assignment pull, and reports which cap applies. Calls past the cap are refused before they reach the provider. Tested in the box packages' gateway, provider-gateway and controller tests.
Testing
switch-agent-runtime-box: 121 tests pass, including the pin guard.agent-providers-box: 1,486 pass.agent-controller-box: 1,205 pass. One test (runtime.test.ts, "probes a provider") fails outside the box environment because it needs a provider CLI on the machine..gitleaks.toml.Known check result
The "secrets and commit metadata" check reads main's
.gitleaks.toml, so it will flag the three fixture files until the allowlist PR (#1972) is on main.🤖 Generated with Claude Code