Skip to content

Fix sub-agent bootstrap from WebSocket messages - #1425

Merged
threepointone merged 2 commits into
mainfrom
fix/sub-agent-websocket-facet-bootstrap
Apr 30, 2026
Merged

threepointone merged 2 commits into
mainfrom
fix/sub-agent-websocket-facet-bootstrap

Conversation

@threepointone

@threepointone threepointone commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • npx vitest --project workers --run src/tests/sub-agent.test.ts
  • npx oxfmt --check packages/agents/src/index.ts packages/agents/src/tests/sub-agent.test.ts packages/agents/src/tests/agents/sub-agent.ts wip/issue-1410-reporter-repro/src/index.ts wip/issue-1410-reporter-repro/wrangler.jsonc wip/issue-1410-reporter-repro/package.json wip/issue-1410-reporter-repro/tsconfig.json wip/issue-1410-reporter-repro/README.md .changeset/native-context-facet-bootstrap.md
  • Deployed wip/issue-1410-reporter-repro and verified both /http-spawn and /ws return ok: true in production with scoped bootstrap suppression.

@changeset-bot

changeset-bot Bot commented Apr 30, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e8a8760

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

This PR includes changesets to release 1 package
Name Type
agents Patch

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

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new

pkg-pr-new Bot commented Apr 30, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@1425

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@1425

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@1425

hono-agents

npm i https://pkg.pr.new/hono-agents@1425

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@1425

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@1425

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@1425

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@1425

commit: e8a8760

@threepointone
threepointone force-pushed the fix/sub-agent-websocket-facet-bootstrap branch from 1d59b35 to e8a8760 Compare April 30, 2026 13:17
@threepointone
threepointone merged commit 6471cbd into main Apr 30, 2026
2 checks passed
@threepointone
threepointone deleted the fix/sub-agent-websocket-facet-bootstrap branch April 30, 2026 13:25
@github-actions github-actions Bot mentioned this pull request Apr 30, 2026
threepointone added a commit that referenced this pull request Jun 4, 2026
…rd (#1680)

The `_suppressProtocolBroadcasts` flag was added in #1425 to stop
`_broadcastProtocol()` from enumerating the parent DO's WebSockets during facet
bootstrap (the cross-DO Native I/O crash, #1410/#1677).

The proper fix in #1679 makes this unnecessary: on a facet, `getConnections()`
returns only virtual sub-agent connections and `broadcast()` routes through the
parent bridge, so `_broadcastProtocol()` can no longer touch the parent's own
sockets — during bootstrap or otherwise. Removing the flag also lets legitimate
state sync run during the bootstrap window.

Verified in production (raw #1410 repro): with the flag removed, both the
HTTP control path and the WebSocket path (spawn sub-agent from `onMessage`)
return ok:true.

Also removes the now-obsolete `wip/issue-1410-reporter-repro` fixture (issue
fully resolved by #1679; verified in prod before removal).

The separate request/WebSocket/email native-handle clearing from #1425 is
retained. It is not what fixes #1410 — verified that a child facet never
inherits the parent's connection across the facet RPC boundary even without it —
but it is kept as low-cost, correct context hygiene for cross-Agent calls
(covering request/email/general cases #1679 does not touch).
@github-actions github-actions Bot mentioned this pull request Jun 4, 2026
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