Fix Think RPC callbacks and e2e harness stability#1601
Merged
Conversation
🦋 Changeset detectedLatest commit: 3c4980c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Require the Think StreamCallback RPC surface to implement onStart and onError so Workers RPC does not probe missing optional methods across durable object boundaries. This fixes chat recovery for helper sub-agents and makes error delivery explicit for callback implementers. Stabilize local e2e runs by avoiding detached process-group kills that can terminate Vitest workers, using ephemeral Wrangler inspector ports, draining readiness fetches, clearing stale agents-as-tools Wrangler state, and running root e2e targets serially to avoid remote AI/dev-server contention. Co-authored-by: Cursor <cursoragent@cursor.com>
threepointone
force-pushed
the
fix/e2e-rpc-callback-and-harness
branch
from
May 28, 2026 10:55
a309eca to
a716a4a
Compare
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
Update documentation and design notes to mark StreamCallback handlers as required (remove optional ? for onStart and onError) across design/think.md, docs/think/sub-agents.md, and packages/think/README.md. Also clarify onError behavior text and add a usage example logging onStart. This aligns the docs with the runtime expectation that these callbacks are always provided.
Merged
threepointone
added a commit
that referenced
this pull request
May 28, 2026
* Fix Think RPC callbacks and e2e harness stability Require the Think StreamCallback RPC surface to implement onStart and onError so Workers RPC does not probe missing optional methods across durable object boundaries. This fixes chat recovery for helper sub-agents and makes error delivery explicit for callback implementers. Stabilize local e2e runs by avoiding detached process-group kills that can terminate Vitest workers, using ephemeral Wrangler inspector ports, draining readiness fetches, clearing stale agents-as-tools Wrangler state, and running root e2e targets serially to avoid remote AI/dev-server contention. Co-authored-by: Cursor <cursoragent@cursor.com> * Make StreamCallback handlers required in docs Update documentation and design notes to mark StreamCallback handlers as required (remove optional ? for onStart and onError) across design/think.md, docs/think/sub-agents.md, and packages/think/README.md. Also clarify onError behavior text and add a usage example logging onStart. This aligns the docs with the runtime expectation that these callbacks are always provided. --------- Co-authored-by: Cursor <cursoragent@cursor.com>
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@cloudflare/think'sStreamCallbackRPC surface fixed by requiringonStartandonError, avoiding Workers RPC calls to missing optional methods.Why
Nightly/local e2e runs were failing in two ways:
Think.chat()calledcallback.onStart?.(...), but optional method probing is unsafe across Workers RPC; callback receivers withoutonStartthrewThe RPC receiver does not implement the method "onStart".npm run test:e2eran remote-AI/dev-server e2e targets concurrently, which made tests contend for local runtimes/remote AI and left helper panels stuck inrunningor Vitest workers unable to terminate.Test plan
npm run testinpackages/thinknpm run buildinpackages/thinknpm run test:e2einpackages/thinkon Node 25npm run test:e2einpackages/agentson Node 25E2E_NO_RETRY=1 npx playwright test e2e/refresh-replay.e2e.ts --grep "two completed runs"inexamples/agents-as-toolson Node 25npx nx run-many -t test:e2e --parallel=1npm run checkNotes
npm run checkstill reports the existing Sherif warnings for example directories withoutpackage.json; no errors were introduced.Made with Cursor