Conversation
…e coworker it is for `POST /api/route` refuses a message over 10,000 characters since CopilotKit#548, so the prompt it builds stays bounded. The composer has no such limit, and both callers of `routeMessage` carry on past a routing that failed. The home composer caught the 400 and sent the message to the default coworker, under a line that says it was "Sent to the coworker it is for". `startWithChosen` swallowed it, so a coworker chosen with `@` or from the To: field started with no `channel.routed` row, even though that branch never reads the text. `routeMessage` now sends the trimmed opening, cut to the route's limit and one unit short when the cut would split a character. Who a message is for is plain from its opening, and the whole message still goes to the coworker. A message that fits is sent as before. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
kevin9327
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso,
mxmzb and
tylerslaton
as code owners
September 16, 2026 10:27
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
What this changes
Since #548,
POST /api/routerefuses a message over 10,000 characters so the prompt it builds stays bounded. The composer has no such limit, so a pasted email thread, contract or log is one message. Both callers ofrouteMessagecarry on past a routing that failed, so the 400 never showed on screen:@catchin_app/index.tsxsends it to the default coworker, under the line "Sent to the coworker it is for". Nochannel.routedrow.@, or the To: field on/channel/newstartWithChosenswallows the 400. The channel starts with nochannel.routedrow, although the named branch never reads the text.viaMention: true).routeMessagenow sends the message's opening: trimmed, as the route trims, cut to 10,000 characters, and one unit short when the cut would split a character, so the router is not handed half of an emoji. Who a message is for is plain from its opening. The whole message still goes to the coworker, because both callers passdraft.texttostartunchanged. A message that fits is sent as before.The route's cap and its test from #548 are untouched. The fix is in the client that was sending more than the route accepts. The
channel.routedpayload never carried the text, so the audit row is the same either way.Where it runs
Boundary and audit
channel.routedrow that long messages had stopped writing.Changelog
CHANGELOG.mdunderUnreleased.Proof
New
app/tests/route-long-message.test.ts. It calls the realrouteMessagewithfetchanswered by the realcreateRoutingRouteshandler (the patternagent-api-path.test.tsuses), so the cap it holds against is the server's own. The router and audit store are fakes that record what they were asked and what was written.On
main(only the test file added):With the fix:
bun test app/tests/route-long-message.test.ts app/tests/start-chosen.test.ts: 8 pass, 0 fail. The four new cases cover the routed branch, the chosen branch, a cut that would split an emoji, and a message that fits.bun test app/: 854 pass, 29 fail. Onmainit is 850 pass with the same 29 failures, all from this Windows machine:serve.test.tsport and websocket cases, Windows path separators, and a relative-time assertion reading a Korean locale.cd server && bun test tests/routing-routes.test.ts tests/routing-limits-validation.test.ts: 17 pass, 0 fail.bun run typecheck(app, server, worker): exit 0.bunx biome checkon the changed files: clean.Every changed line runs in the new tests: both body shapes, the fits path, and the cut with and without the surrogate step.
This PR adds its line at the top of
## Unreleased, the same place other open PRs add theirs, so the changelog may conflict. I'm happy to rebase.🤖 Generated with Claude Code