Skip to content
Source
Sign inSign up
TanStack/ai

fix(ai-harness-cli): pass canAccess and mediaSecret to the harness handler #1782

Mergedjherrmerged 1 commit intofeat/harness-cli fromrefs/pull/1782/headmerged by AlemTuzlak View on GitHub

jherrcommented

--serve builds its harness handler without canAccess and mediaSecret. #1781 makes canAccess required, and mediaSecret required on a durable host, so the CLI would not compile, and would throw with a durable persistence. This PR passes both.

🎯 Changes

  • serve() passes canAccess: () => true: one principal holds the bearer token, so it can use every thread.
  • serve() passes the bearer token as mediaSecret, so signed media URLs work as long as the token does, also with a durable host.
  • Changeset for @tanstack/ai-harness-cli.
  • Not in this PR: this branch still carries an older copy of the session view code that #1761 replaced in feat/harness-transport. A rebase on feat/harness-transport picks up the current view, and tests/printer.test.ts then needs the new interrupts: [] and models: [] fields.

✅ 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. (See Testing.)
  • 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. (Not user-facing: --serve works the same.)
  • 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).

Root cause

Issue. With #1781, harness --serve fails to type-check, and throws at start with a durable persistence. Cause. serve() in ai-harness-cli/src/serve.ts calls createHarnessHandler with only host, harness, and authorize. Fix. Pass canAccess and mediaSecret explicitly.

Possible alternatives

  • A separate mediaSecret option on serve(). More surface for no gain: the token is already a per-run secret.

Testing

  • pnpm install, nx run-many -t build, then in packages/ai-harness-cli: tsc --noEmit and vitest run (52 tests): pass on this branch, rebased on the current feat/harness-cli.
  • With #1781 merged in an integration branch of the whole stack, ai-harness-cli type-checks and its tests pass.

Manual test

  1. Merge #1781 and this PR into one branch.
  2. Run harness --serve and call GET /capabilities with the printed token: it answers 200.

How this PR makes testing easy: the existing ai-harness-cli tests cover serve().

Risk / rollback

Low. Rollback: revert the PR.

🤖 Generated with Claude Code

    1. 🦋 Changeset detected

      Latest commit: ae7c8cc78613b42dc1d439989219d4b697c9cdfd

      The changes in this PR will be included in the next version bump.

      This PR includes changesets to release 1 package
      NameType
      @tanstack/ai-harness-cliPatch

      Not sure what this means? Click here to learn what changesets are.

      Click here if you're a maintainer who wants to add another changeset to this PR

    2. 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.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration
      • Configuration used: Repository: TanStack/ai/.coderabbit.yaml
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 1b0550fb-a20b-4b99-bbb1-261751fc4370

      You can disable this status message by setting the reviews.review_status to false in 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.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    3. nx-cloud[bot](GitHub profile, opens in a new tab)commented

      View your CI Pipeline Execution ↗ for commit ae7c8cc78613b42dc1d439989219d4b697c9cdfd

      CommandStatusDurationResult
      nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded39sView ↗
      nx run-many --targets=build --exclude=examples/...✅ Succeeded6sView ↗
      nx run-many --targets=test:coverage --projects=...✅ Succeeded<1sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-10-14 20:33:50 UTC

    4. Coverage

      ✅ Coverage held across 1 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.

      packagestatementsbranchesfunctionslines
      ai-harness-cli84.10% (+0.03)80.27% (0.00)80.34% (+0.17)84.63% (+0.04)ok
    5. Open in StackBlitz

      @tanstack/ai

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai@1782

      @tanstack/ai-acp

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-acp@1782

      @tanstack/ai-angular

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-angular@1782

      @tanstack/ai-anthropic

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-anthropic@1782

      @tanstack/ai-bedrock

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-bedrock@1782

      @tanstack/ai-byteplus

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-byteplus@1782

      @tanstack/ai-claude-code

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-claude-code@1782

      @tanstack/ai-client

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-client@1782

      @tanstack/ai-cloudflare

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-cloudflare@1782

      @tanstack/ai-code-mode

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-code-mode@1782

      @tanstack/ai-code-mode-snippets

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-code-mode-snippets@1782

      @tanstack/ai-codex

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-codex@1782

      @tanstack/ai-cohere

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-cohere@1782

      @tanstack/ai-compaction

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-compaction@1782

      @tanstack/ai-devtools-core

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-devtools-core@1782

      @tanstack/ai-durable-stream

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-durable-stream@1782

      @tanstack/ai-elevenlabs

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-elevenlabs@1782

      @tanstack/ai-event-client

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-event-client@1782

      @tanstack/ai-fal

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-fal@1782

      @tanstack/ai-gemini

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-gemini@1782

      @tanstack/ai-grok

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-grok@1782

      @tanstack/ai-grok-build

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-grok-build@1782

      @tanstack/ai-groq

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-groq@1782

      @tanstack/ai-harness

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-harness@1782

      @tanstack/ai-harness-cli

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-harness-cli@1782

      @tanstack/ai-isolate-cloudflare

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-cloudflare@1782

      @tanstack/ai-isolate-daytona

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-daytona@1782

      @tanstack/ai-isolate-e2b

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-e2b@1782

      @tanstack/ai-isolate-node

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-node@1782

      @tanstack/ai-isolate-quickjs

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-quickjs@1782

      @tanstack/ai-isolate-quickjs-bun

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-quickjs-bun@1782

      @tanstack/ai-llmgateway

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-llmgateway@1782

      @tanstack/ai-lovable

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-lovable@1782

      @tanstack/ai-mcp

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-mcp@1782

      @tanstack/ai-memory

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-memory@1782

      @tanstack/ai-mistral

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-mistral@1782

      @tanstack/ai-octane

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-octane@1782

      @tanstack/ai-ollama

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-ollama@1782

      @tanstack/ai-ollaya

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-ollaya@1782

      @tanstack/ai-openai

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openai@1782

      @tanstack/ai-opencode

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-opencode@1782

      @tanstack/ai-openrouter

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openrouter@1782

      @tanstack/ai-perplexity

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-perplexity@1782

      @tanstack/ai-persistence

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-persistence@1782

      @tanstack/ai-preact

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-preact@1782

      @tanstack/ai-react

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react@1782

      @tanstack/ai-react-ui

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react-ui@1782

      @tanstack/ai-reactor

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-reactor@1782

      @tanstack/ai-remix

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-remix@1782

      @tanstack/ai-sandbox

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox@1782

      @tanstack/ai-sandbox-blaxel

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-blaxel@1782

      @tanstack/ai-sandbox-boxd

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-boxd@1782

      @tanstack/ai-sandbox-cloudflare

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-cloudflare@1782

      @tanstack/ai-sandbox-daytona

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-daytona@1782

      @tanstack/ai-sandbox-docker

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-docker@1782

      @tanstack/ai-sandbox-e2b

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-e2b@1782

      @tanstack/ai-sandbox-local-process

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-local-process@1782

      @tanstack/ai-sandbox-railway

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-railway@1782

      @tanstack/ai-sandbox-sprites

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-sprites@1782

      @tanstack/ai-sandbox-upstash-box

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-upstash-box@1782

      @tanstack/ai-sandbox-vercel

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-vercel@1782

      @tanstack/ai-skills

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-skills@1782

      @tanstack/ai-solid

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid@1782

      @tanstack/ai-solid-ui

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid-ui@1782

      @tanstack/ai-svelte

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-svelte@1782

      @tanstack/ai-typesafe

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-typesafe@1782

      @tanstack/ai-utils

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-utils@1782

      @tanstack/ai-vercel-gateway

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vercel-gateway@1782

      @tanstack/ai-vertex

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vertex@1782

      @tanstack/ai-vue

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue@1782

      @tanstack/ai-vue-ui

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue-ui@1782

      @tanstack/ai-worldlabs

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-worldlabs@1782

      @tanstack/openai-base

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/openai-base@1782

      @tanstack/preact-ai-devtools

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/preact-ai-devtools@1782

      @tanstack/react-ai-devtools

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/react-ai-devtools@1782

      @tanstack/solid-ai-devtools

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/solid-ai-devtools@1782

      @tanstack/svelte-ai-devtools

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/svelte-ai-devtools@1782

      commit: ae7c8cc

    6. github-actions[bot](GitHub profile, opens in a new tab) added labelswaiting-on: maintainer

    7. AlemTuzlak approved these changes

    8. AlemTuzlak merged this3b70e31

    9. AlemTuzlak closed this

Sign in to join this conversation.