Skip to content

Chat: messageConcurrency as the lane's arrival policy (4.iii 6f, parity 1, draft) - #3308

Closed
mattzcarey wants to merge 2 commits into
slim/chat-fn-6dfrom
slim/chat-fn-6f1
Closed

mattzcarey wants to merge 2 commits into
slim/chat-fn-6dfrom
slim/chat-fn-6f1

Conversation

@mattzcarey

@mattzcarey mattzcarey commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

DRAFT, 4.iii 6f parity step 1, stacked on #3298. A host's messageConcurrency becomes the lane's arrival policy (ChatLane.arrival), applied to new messages (submit-message) only:

  • queue waits its turn;
  • latest skips the waiting turns that arrived the same way. The turn that arrives carries their questions (the messages they would have stored when they started) and answers them all;
  • merge is latest with the queued questions joined into one message (mergeUserMessages), which keeps the newest one's id, as AIChatAgent's merge does;
  • drop doesn't start a turn while one runs;
  • { debounceMs } is latest that also waits for quiet.

A request that is dropped or replaced ends at once for the tabs: a done frame with outcome skipped, since its turn never runs to say so.

Tests:

  • under latest, r2 is skipped and r3 answers both;
  • under drop, r2 doesn't start, isn't stored, and the tab is told;
  • under merge, one combined message is answered by one turn;
  • under debounce, the last turn of a burst answers it;
  • a regenerate under drop still queues.

Cost: a latest, merge or debounce submit lists the lane's waiting runs once.

@changeset-bot

changeset-bot Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 77bec88

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

agents

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

@cloudflare/ai-chat

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

@cloudflare/codemode

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

hono-agents

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

@cloudflare/shell

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

@cloudflare/think

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

@cloudflare/voice

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

@cloudflare/worker-bundler

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

commit: 77bec88

@agent-think

agent-think Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ agents import sizes: no significant changes (e44a9407 → 77bec889, workflow run)

@mattzcarey
mattzcarey force-pushed the slim/chat-fn-6f1 branch 4 times, most recently from 4c2daf9 to 720b90e Compare November 27, 2026 00:43
@mattzcarey
mattzcarey force-pushed the slim/chat-fn-6f1 branch 4 times, most recently from bd30552 to 38dab6e Compare November 27, 2026 01:20
@mattzcarey
mattzcarey force-pushed the slim/chat-fn-6f1 branch 2 times, most recently from 7b1fd32 to ecc5043 Compare November 27, 2026 01:39
@mattzcarey
mattzcarey force-pushed the slim/chat-fn-6f1 branch 4 times, most recently from 102698b to ab0d47c Compare November 27, 2026 02:13
… replaced request is told it was skipped; tests for drop, merge, debounce and a regenerate under drop (rv-3)
@mattzcarey

Copy link
Copy Markdown
Member Author

Closed to drain open PRs (COMMON, 27 Nov). This PR's commits are commits of #3361 (the switch), which now sits directly on #3298. The branch is kept.

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