Skip to content

fix(studio): stop a compatibility round trip per request - #2312

Merged
kantord merged 1 commit into
mainfrom
studio-followups/02-compat-cache
Oct 15, 2026
Merged

kantord merged 1 commit into
mainfrom
studio-followups/02-compat-cache

Conversation

@kantord

@kantord kantord commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Summary

Session detail and plan ask resolution each issued a server.compatibility() RPC per request.

Part of #2303 ("Tiny follow-up fixes"); it does not close it. This is PR 2 of 14 in a stack of draft PRs, reviewed and merged in order.

What changed

  • MecatlRuntime exposes its cached negotiation (compatibility()); detail() reads it instead of making an RPC.
  • The resolvePlanAsk pre-flight is removed. The SDK already checks ExactPlanAskControl from its cached features and throws unsupported_feature, which the service already maps to "unavailable".
  • Comments on copyCapabilities explain that storageMigration is a constant false kept for BFF response-shape stability (a reserved proto field) and that bash is an alias of shell.
  • createMecatlChatService(client, compatibility?): the accessor is optional with a default that throws RuntimeNotReadyError, so about 25 existing test call sites did not change. app.ts already maps RuntimeNotReadyError to 503.

Behavior changes

None observable. Plan "unavailable" now surfaces via unsupported_feature instead of a pre-flight.

Verification

Biome, typecheck, the full Studio test suite and pnpm generated:check pass on this branch, run on the assembled stack. The full Playwright suite passes on the stack tip (122 passed, 30 skipped, 0 failed, including chat-approval against a real mecated build). With the old chat.ts restored, six tests fail, including the new "reads detail capabilities from the cached negotiation" test.

Not included

Removing storageMigration or bash from the schema.

Fully or partially written by an AI agent.

🤖 Generated with Claude Code

@kantord
kantord added this pull request to stack #2325 October 14, 2026 13:27
@kantord kantord mentioned this pull request Oct 14, 2026
41 tasks done
@kantord
kantord marked this pull request as ready for review October 15, 2026 08:41

@peppescg peppescg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Daniel. Reusing the runtime's cached negotiation is the right fix, and dropping the plan pre-flight in favour of the SDK's own unsupported_feature gate removes a duplicate check.

Nits:

  • apps/server/src/mecatl/chat.ts:124: the default accessor throws RuntimeNotReadyError. If a future caller forgets to wire it, detail() quietly returns 503 for every session, and no server test goes through createApp with a runtime to GET /api/v1/sessions/{id}. One app-level test (createApp({ runtime: fakeRuntime({ compatibility: () => ..., client: ... }) })) checking that capabilities.manualCompaction comes from runtime.compatibility() would pin it; making the parameter required in production code would also work.
  • apps/server/src/mecatl/runtime.ts:197: MecatlRuntime.compatibility() is new and has no test in runtime.test.ts. One case covering "throws before negotiation, returns the renegotiated value after a reconnect" would pin the staleness behaviour this PR now relies on.
  • apps/server/src/mecatl/chat.test.ts:720 (and :640): the server.compatibility mocks no longer affect anything; drop them. "gates plan control on the public SDK feature" (:630) could be renamed, since the gate is now the SDK's error.

Base automatically changed from studio-followups/01-stale-plan-ask to main October 15, 2026 09:25
Session detail now reads the runtime's cached negotiation, and plan ask
resolution relies on the SDK's own ExactPlanAskControl check
(unsupported_feature) instead of a pre-flight compatibility RPC.
Document the storageMigration and bash capability fields.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@kantord
kantord force-pushed the studio-followups/02-compat-cache branch from fa0ba4d to 32eae43 Compare October 15, 2026 09:25
@kantord
kantord merged commit d2b1467 into main Oct 15, 2026
1 check passed
@kantord
kantord deleted the studio-followups/02-compat-cache branch October 15, 2026 09:25
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Oct 20, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants