Skip to content

Scope tool preview compile to referenced definitions - #1977

Merged
RhysSullivan merged 1 commit into
mainfrom
describe-compile-scope
Sep 11, 2026
Merged

Scope tool preview compile to referenced definitions#1977
RhysSullivan merged 1 commit into
mainfrom
describe-compile-scope

Conversation

@RhysSullivan

Copy link
Copy Markdown
Collaborator

describe.tool compiled the TypeScript preview against every definition in the connection's spec, not the subgraph the tool references. The compiler scans the whole definitions map per node, so one describe of a large spec (PostHog: 4k schemas) cost 10+ s of CPU on the shared session Durable Object isolate. The vendored compiler also memoized on a module-level Map with strong keys, retaining ~17 MB per call for the isolate's lifetime. Together these reset the isolate mid-execute and dropped in-flight results for every co-resident session.

  • Pass the already-computed referenced subgraph to the compiler. Output is identical; the referenced set was only used for a side field before.
  • Memoize on a WeakMap so compiled graphs are collectable.
  • Add a node-count guard before the synchronous compile; over the cap the preview degrades to unknown instead of pinning the isolate.

Bench on the real PostHog spec: persons.personsList 410 ms → 1 ms, all 2,142 tools average 2 ms, no retained heap after repeated compiles.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 11, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
executor-marketing 1ab9d7f Commit Preview URL

Branch Preview URL
Sep 11 2026, 10:31 PM

@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Cloudflare preview

Torn down — the PR is closed.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud 1ab9d7f Sep 11 2026, 10:33 PM

@pkg-pr-new

pkg-pr-new Bot commented Sep 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

@executor-js/cli

npm i https://pkg.pr.new/@executor-js/cli@1977

@executor-js/config

npm i https://pkg.pr.new/@executor-js/config@1977

@executor-js/execution

npm i https://pkg.pr.new/@executor-js/execution@1977

@executor-js/sdk

npm i https://pkg.pr.new/@executor-js/sdk@1977

@executor-js/codemode-core

npm i https://pkg.pr.new/@executor-js/codemode-core@1977

@executor-js/runtime-quickjs

npm i https://pkg.pr.new/@executor-js/runtime-quickjs@1977

@executor-js/plugin-file-secrets

npm i https://pkg.pr.new/@executor-js/plugin-file-secrets@1977

@executor-js/plugin-graphql

npm i https://pkg.pr.new/@executor-js/plugin-graphql@1977

@executor-js/plugin-keychain

npm i https://pkg.pr.new/@executor-js/plugin-keychain@1977

@executor-js/plugin-mcp

npm i https://pkg.pr.new/@executor-js/plugin-mcp@1977

@executor-js/plugin-onepassword

npm i https://pkg.pr.new/@executor-js/plugin-onepassword@1977

@executor-js/plugin-openapi

npm i https://pkg.pr.new/@executor-js/plugin-openapi@1977

executor

npm i https://pkg.pr.new/executor@1977

commit: 1ab9d7f

@RhysSullivan
RhysSullivan marked this pull request as ready for review September 11, 2026 23:03
@RhysSullivan
RhysSullivan merged commit 6870f38 into main Sep 11, 2026
44 checks passed
@RhysSullivan
RhysSullivan deleted the describe-compile-scope branch September 11, 2026 23:03
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.

1 participant