Skip to content

Defer TTL-expired catalog refresh off the read path - #1615

Draft
RhysSullivan wants to merge 8 commits into
fix/tools-sync-lifecyclefrom
fix/tools-sync-defer
Draft

Defer TTL-expired catalog refresh off the read path#1615
RhysSullivan wants to merge 8 commits into
fix/tools-sync-lifecyclefrom
fix/tools-sync-defer

Conversation

@RhysSullivan

@RhysSullivan RhysSullivan commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #1612.

TTL expiry is speculative ("maybe the server changed") — unlike drift signals, nothing about the next read's correctness depends on it, so it should never block a response.

  • New ExecutorConfig.deferToolSync seam: expired-only candidates are batched (cap 16, overflow counted) into one background task; the claim is taken inside the task, so a dropped batch strands no lease. Absent seam = the same batch runs inline and its outcomes count in the terminal partition; deferred counts only work genuinely handed away.
  • Invalidation triggers (drift token, config revision, cold) stay inline — including connections that are both drifted and expired.
  • MCP session Durable Object defers via ctx.waitUntil with the Effect tracer provided and a bounded flush (a bare runPromise would have silently dropped every background sync span). Long-lived hosts (local, selfhost) fork a daemon fiber. host-cloudflare has no tracer at all; documented.
  • Cloud's /api/* plane deliberately stays inline: the request-scoped postgres pool is released before the response is written (pinned by a new ordering test), so there is no post-response window to defer into, and deferring the scope close would reintroduce the unbounded-socket teardown this codebase already fixed once. Expired work there remains filter-scoped, claim-deduped, and backoff-bounded from the earlier layers.
  • Interrupts pass through the deferred batch untouched (red-proven test); failures are contained and logged, never surfaced to later callers.

Not included, needs a product decision: an e2e for the expired trigger requires plumbing toolsSyncTtlMs through host config + an env knob (the 15-min default is unreachable in e2e without banned DB pokes or sleeps). The wire-level MCP test covers the stale-serve/drain/converge guarantee one layer down.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 16, 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 Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud ad87861 Aug 16 2026, 09:39 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 16, 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 ad87861 Commit Preview URL

Branch Preview URL
Aug 16 2026, 09:40 PM

@RhysSullivan RhysSullivan changed the title fix/tools sync defer Defer TTL-expired catalog refresh off the read path Aug 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare preview

Console https://executor-preview-pr-1615.executor-e2e.workers.dev
MCP https://executor-preview-pr-1615.executor-e2e.workers.dev/mcp
Deployed commit ad87861

Sign-in is Cloudflare Access (one-time PIN to an allowed email). The preview has its own database and encryption key; it is destroyed when this PR closes.

@pkg-pr-new

pkg-pr-new Bot commented Aug 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

@executor-js/cli

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

@executor-js/config

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

@executor-js/execution

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

@executor-js/sdk

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

@executor-js/codemode-core

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

@executor-js/runtime-quickjs

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

@executor-js/plugin-file-secrets

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

@executor-js/plugin-graphql

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

@executor-js/plugin-keychain

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

@executor-js/plugin-mcp

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

@executor-js/plugin-onepassword

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

@executor-js/plugin-openapi

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

executor

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

commit: ad87861

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