feat(ai-harness, ai-mcp, ai-acp, ai-code-mode, ai-harness-cli): the final review of the harness, with its fixes, one object per call, and the known limits #1825
feat/harness-point-bugs fromrefs/pull/1825/head·merged by AlemTuzlak View on GitHubThis PR finishes the harness redesign with a final review of the whole stack against the eight rules (Closed, Fast, Portable, Isolated, Durable waits, Agent tree, No leaks, Visible). It fixes what the review found, gives session, client, and view methods one object argument, and documents the limits that stay. The fixed bugs are in code from PRs 1 to 14 of this stack, which is not on main, so this is the last feat step of the stack and not a fix of main. This is PR 15 of the harness redesign stack for #1755. It targets #1824 (feat/harness-point-bugs).
🎯 Changes#
- Durability and ownership.
settled()ends when the owner on another host refuses an input.isIdle()counts background jobs.- Recovery checks ownership before it writes. A host gives a thread back and tries to open it again after 30 s.
renewMsmust be less thanttlMs(else aRangeError). The default is a third ofttlMs.- A conflicting offer id writes a new
harness.offer.rejectedrecord. A remote fold reloads settings, config, and the interrupted turn. - The host keeps the last 500 snapshot steps, and reads past a truncated log.
- Access.
- Runs, operations, and handle methods act as their user and check access.
handle.agents.runusesprincipal. revokeandunsharestop work on any host and block schedules.revokenow returns a Promise.- Plugin
sendandnotetakeprincipal?, with the owner as the default.permissions()decides inonGuardToolCall.
- Runs, operations, and handle methods act as their user and check access.
- Integrations and coding tools.
- MCP: an elicitation goes to one run only, else
decline. A failed first connect is tried again. The OAuth connector reconnects. - ACP: one agent app serves one connection. Editor capabilities come from that connection, with no private SDK field, and tool updates carry the real
toolCallId. - Code mode uses the current mode for
include. Snapshots and the formatter use the workspace of the thread. - A thread delete closes its workspace and removes its snapshots. A bash spill is scrubbed.
- MCP: an elicitation goes to one run only, else
- Transport, client, and view.
- Commands and agent inputs carry their
inputId.client.events()reconnects after 60 s with no data. - The view reloads after a gap in one step, and socket frames are handled in order. The base64 media cache is shared per blob store.
- Commands and agent inputs carry their
- One object per call (F6, F7).
- Session:
cancelInput,revert,background,getMedia,mediaUrl,agentTranscript, andappend.appendtakes an optionalinputIdand returns aReceipt. - Client:
uploadis nowputMedia, and thread methods move toclient.sessions. View:approve,reject,notice, andputMedia. - Text-first sends do not change:
send(text, options?),steer, andfollowUp. Internal fields leave the public types.
- Session:
Docs: about 27 pages under docs/harness/, plus docs/tools/server-tools.md and durable-tools.md. A new ## Known limits section in docs/harness/deploy.md lists what stays open, and overview.md links to it. The changesets are edited in place.
Decisions made while building (Alem's answers hold):
session.appendtakes an optionalinputIdto drop a repeated append.- An ACP app serves one connection. A second connection throws in
onConnect. - The limits below are documented, not fixed: a
harnessAgentchild keeps its waits in memory, the snapshot is the full fold,sessionOfTurnopens threads one at a time, the MCP SDK refreshes once per session, and plugin tools do not reach background agents.
✅ Checklist#
- I have followed the steps in the Contributing guide.
- I have tested code changes locally with
pnpm run test:pr, or these tests do not apply to this pull request. - I fully understand the code in this pull request, including any code generated with AI assistance.
- Docs: I updated
docs/for this change, or this change is not user-facing. - Changeset: I added a changeset (
pnpm changeset), or this PR does not change a published package.
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
Testing#
Commands run:
- Builds of the E2E app's dependencies and the CLI.
test:typesofai,ai-harness,ai-mcp,ai-acp,ai-harness-cli,ai-code-mode,ai-skills,ai-sandbox, the E2E app, andexamples/harness-cli. All pass. vitest relatedon every changedai-harnesssource file, with--maxWorkers=2: 150 files, 2,006 tests, all pass. The changed test files inai-mcp(9),ai-acp(4),ai-code-mode(1), andai-harness-cli(5) pass too.test:oxlintofai-harness,test:knip,pnpm test:docs,kiira checkon the changed pages, andoxfmt --checkon every changed file.
Not run locally: E2E and coverage. CI runs them.
Manual test:
- Run
pnpm --dir packages/ai-harness exec vitest run tests/access-work.test.ts tests/ownership.test.ts tests/durable-inputs.test.ts. - Run
pnpm --dir packages/ai-mcp exec vitest run tests/connector-reconnect.test.ts tests/harness-elicit.test.ts. - Read "has their work and their schedules stopped by an unshare on another host" in
tests/access-work.test.ts.
How this PR makes testing easy: each fix has a test that failed on the old code. The new files are access-work and the MCP connector-reconnect. The other fixes add cases to the ownership, durable-inputs, permissions, snapshots, view, client, and ACP tests. The E2E coding-tools route moves to the one-object API.
Risk / rollback#
Medium. The one-object API changes call sites of session, client, and view methods, and revoke is now async. The harness is not released yet, and all callers in this repo are moved. To undo, revert this PR.
Public API change#
Before
await session.cancelInput(inputId)
await session.revert(messageId)
await client.upload({ body: file, mimeType: file.type })
await client.renameSession({ threadId, title })
view.approve(id)
host.revoke({ threadId, principal })
After
await session.cancelInput({ inputId })
await session.revert({ messageId })
await client.putMedia({ body: file, mimeType: file.type })
await client.sessions.rename({ threadId, title })
view.approve({ id })
await host.revoke({ threadId, principal })
const receipt = await session.append({ records, inputId })
Review fixes#
These fixes come from a stack review. They are squash-merged into #1824, together with this PR.
createHarnessHost({ harnesses })lists the harnesses of the host, sohost.sessions.deletecan end plugins after a restart. If a harness is still unknown, the delete warns.host.revokeandunsharereject when the work stop fails.unsharecuts reads first.- Plugins declare kept records with
keepRecords, and read them withctx.session.keptRecords(type). The core fold no longer names the snapshots plugin. harness.revertkeeps the principal.appendwithoutinputIdgoes throughaccept(), so the id is real.- The client takes
idleTimeoutMs(default 60 s). The media cache uses the largest cap that is asked for. - Thread delete frees child workspaces from the root log. Revert reopens the workspace after a restart. Revoke stops reads that started before the first pull.
- The formatter asks again when a write touches a nested formatter config or
node_modules/. These answers save no rule.
Checks: the unit tests for the changed files, plus test:types and test:oxlint for ai-harness. CI runs the rest.
- 1
Important
Review skipped#
Auto reviews are disabled on base/target branches other than the default branch.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
-
- Configuration used: Repository: TanStack/ai/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4a5b22c1-5971-490f-8696-54c9a3b416ee
You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- 🔍 Trigger review
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment `@coderabbitai help` to get the list of available commands.-
View your CI Pipeline Execution ↗ for commit f15ba720526a0ef36f454614386e8579004c507b
Command Status Duration Result nx run-many --targets=build --exclude=examples/...✅ Succeeded 58s View ↗
☁️ Nx Cloud last updated this comment at
2026-10-19 09:06:25UTC@tanstack/ai
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai@1825@tanstack/ai-acp
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-acp@1825@tanstack/ai-angular
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-angular@1825@tanstack/ai-anthropic
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-anthropic@1825@tanstack/ai-bedrock
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-bedrock@1825@tanstack/ai-byteplus
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-byteplus@1825@tanstack/ai-claude-code
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-claude-code@1825@tanstack/ai-client
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-client@1825@tanstack/ai-cloudflare
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-cloudflare@1825@tanstack/ai-code-mode
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-code-mode@1825@tanstack/ai-code-mode-snippets
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-code-mode-snippets@1825@tanstack/ai-codex
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-codex@1825@tanstack/ai-cohere
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-cohere@1825@tanstack/ai-compaction
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-compaction@1825@tanstack/ai-devtools-core
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-devtools-core@1825@tanstack/ai-durable-stream
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-durable-stream@1825@tanstack/ai-elevenlabs
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-elevenlabs@1825@tanstack/ai-event-client
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-event-client@1825@tanstack/ai-fal
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-fal@1825@tanstack/ai-gemini
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-gemini@1825@tanstack/ai-grok
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-grok@1825@tanstack/ai-grok-build
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-grok-build@1825@tanstack/ai-groq
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-groq@1825@tanstack/ai-harness
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-harness@1825@tanstack/ai-harness-cli
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-harness-cli@1825@tanstack/ai-isolate-cloudflare
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-cloudflare@1825@tanstack/ai-isolate-daytona
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-daytona@1825@tanstack/ai-isolate-e2b
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-e2b@1825@tanstack/ai-isolate-node
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-node@1825@tanstack/ai-isolate-quickjs
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-quickjs@1825@tanstack/ai-isolate-quickjs-bun
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-quickjs-bun@1825@tanstack/ai-llmgateway
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-llmgateway@1825@tanstack/ai-lovable
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-lovable@1825@tanstack/ai-mcp
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-mcp@1825@tanstack/ai-memory
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-memory@1825@tanstack/ai-mistral
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-mistral@1825@tanstack/ai-octane
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-octane@1825@tanstack/ai-ollama
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-ollama@1825@tanstack/ai-ollaya
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-ollaya@1825@tanstack/ai-openai
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openai@1825@tanstack/ai-opencode
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-opencode@1825@tanstack/ai-openrouter
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openrouter@1825@tanstack/ai-perplexity
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-perplexity@1825@tanstack/ai-persistence
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-persistence@1825@tanstack/ai-preact
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-preact@1825@tanstack/ai-react
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react@1825@tanstack/ai-react-ui
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react-ui@1825@tanstack/ai-reactor
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-reactor@1825@tanstack/ai-remix
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-remix@1825@tanstack/ai-sandbox
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox@1825@tanstack/ai-sandbox-blaxel
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-blaxel@1825@tanstack/ai-sandbox-boxd
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-boxd@1825@tanstack/ai-sandbox-cloudflare
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-cloudflare@1825@tanstack/ai-sandbox-daytona
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-daytona@1825@tanstack/ai-sandbox-docker
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-docker@1825@tanstack/ai-sandbox-e2b
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-e2b@1825@tanstack/ai-sandbox-local-process
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-local-process@1825@tanstack/ai-sandbox-railway
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-railway@1825@tanstack/ai-sandbox-sprites
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-sprites@1825@tanstack/ai-sandbox-upstash-box
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-upstash-box@1825@tanstack/ai-sandbox-vercel
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-vercel@1825@tanstack/ai-skills
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-skills@1825@tanstack/ai-solid
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid@1825@tanstack/ai-solid-ui
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid-ui@1825@tanstack/ai-svelte
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-svelte@1825@tanstack/ai-typesafe
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-typesafe@1825@tanstack/ai-utils
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-utils@1825@tanstack/ai-vercel-gateway
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vercel-gateway@1825@tanstack/ai-vertex
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vertex@1825@tanstack/ai-vue
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue@1825@tanstack/ai-vue-ui
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue-ui@1825@tanstack/ai-worldlabs
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-worldlabs@1825@tanstack/openai-base
npm i https://pkg.pr.new/TanStack/ai/@tanstack/openai-base@1825@tanstack/preact-ai-devtools
npm i https://pkg.pr.new/TanStack/ai/@tanstack/preact-ai-devtools@1825@tanstack/react-ai-devtools
npm i https://pkg.pr.new/TanStack/ai/@tanstack/react-ai-devtools@1825@tanstack/solid-ai-devtools
npm i https://pkg.pr.new/TanStack/ai/@tanstack/solid-ai-devtools@1825@tanstack/svelte-ai-devtools
npm i https://pkg.pr.new/TanStack/ai/@tanstack/svelte-ai-devtools@1825commit:
f15ba72Coverage#
✅ Coverage held across 30 compared package(s).
Each package is measured twice in this job — on this PR and on its merge-base with
main— and compared. A metric fails only when it is at or above 60% on the merge-base and under 60% on this PR. Other drops are listed but do not fail. Packages your PR doesn't affect are not measured and not listed.package statements branches functions lines ai-acp 82.85% (+0.16) 71.01% (-0.03) 78.73% (+0.10) 84.87% (+0.15) ok ai-claude-code 88.93% (0.00) 76.88% (0.00) 86.88% (0.00) 90.40% (0.00) ok ai-code-mode 93.12% (+0.08) 86.17% (+0.10) 89.70% (+0.15) 93.82% (+0.06) ok ai-code-mode-snippets 87.13% (0.00) 75.67% (0.00) 91.11% (0.00) 88.39% (0.00) ok ai-codex 94.55% (0.00) 85.10% (0.00) 89.28% (0.00) 95.56% (0.00) ok ai-durable-stream 86.70% (0.00) 82.25% (0.00) 92.30% (0.00) 88.72% (0.00) ok ai-grok-build 79.19% (0.00) 63.56% (0.00) 77.39% (0.00) 81.02% (0.00) ok ai-harness 93.33% (+0.03) 87.25% (+0.10) 93.32% (-0.16) 95.23% (+0.05) ok ai-harness-cli 92.01% (0.00) 82.89% (0.00) 88.00% (0.00) 93.02% (0.00) ok ai-isolate-cloudflare 94.11% (0.00) 70.66% (0.00) 100.00% (0.00) 93.96% (0.00) ok ai-isolate-daytona 90.25% (0.00) 80.59% (0.00) 100.00% (0.00) 90.15% (0.00) ok ai-isolate-e2b 92.11% (0.00) 82.22% (0.00) 97.36% (0.00) 95.05% (0.00) ok ai-isolate-node 84.00% (0.00) 43.39% (0.00) 100.00% (0.00) 83.78% (0.00) ok ai-isolate-quickjs 89.07% (0.00) 76.41% (0.00) 90.90% (0.00) 90.30% (0.00) ok ai-isolate-quickjs-bun 7.76% (0.00) 8.08% (0.00) 5.00% (0.00) 8.33% (0.00) ok ai-mcp 96.04% (-0.32) 90.90% (-0.34) 96.33% (-0.34) 98.14% (-0.14) ok ai-opencode 69.04% (0.00) 60.82% (0.00) 65.26% (0.00) 70.87% (0.00) ok ai-sandbox 78.48% (-0.06) 83.00% (-0.04) 75.63% (-0.11) 79.05% (-0.04) ok ai-sandbox-blaxel 87.64% (0.00) 77.18% (0.00) 82.26% (0.00) 89.71% (0.00) ok ai-sandbox-boxd 95.86% (0.00) 87.12% (0.00) 95.31% (0.00) 98.17% (0.00) ok ai-sandbox-cloudflare 67.91% (0.00) 57.47% (0.00) 71.79% (0.00) 69.62% (0.00) ok ai-sandbox-daytona 82.70% (0.00) 81.89% (0.00) 67.14% (0.00) 85.18% (0.00) ok ai-sandbox-docker 80.15% (0.00) 71.49% (0.00) 77.38% (0.00) 82.13% (0.00) ok ai-sandbox-e2b 94.42% (0.00) 88.97% (0.00) 93.24% (0.00) 98.63% (0.00) ok ai-sandbox-local-process 69.43% (0.00) 54.01% (0.00) 77.27% (0.00) 70.27% (0.00) ok ai-sandbox-railway 94.75% (0.00) 92.68% (0.00) 90.90% (0.00) 97.59% (0.00) ok ai-sandbox-sprites 73.23% (0.00) 59.70% (0.00) 73.83% (0.00) 76.17% (0.00) ok ai-sandbox-upstash-box 94.82% (0.00) 91.52% (0.00) 91.04% (0.00) 97.76% (0.00) ok ai-sandbox-vercel 44.67% (0.00) 38.18% (0.00) 35.18% (0.00) 45.76% (0.00) ok ai-skills 83.98% (0.00) 68.19% (0.00) 88.51% (0.00) 86.02% (0.00) ok github-actions[bot](GitHub profile, opens in a new tab) assignedtombeckenham
github-actions[bot](GitHub profile, opens in a new tab) added labelswaiting-on: maintainer
AlemTuzlak merged this58b5cc6
AlemTuzlak closed this
Sign in to join this conversation.
⚠️ No Changeset found#
Latest commit: f15ba720526a0ef36f454614386e8579004c507b
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes changesets to release 69 packages
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR