fix(runtime): keep dispatch alive when model context is not cloneable - #3528
Conversation
|
Warning Review limit reached
Next review available in: 28 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe runtime bridge now skips non-cloneable model context events. It records an error metric, logs a warning, and continues model dispatch. Tests verify successful dispatch and skipped sink delivery. ChangesRuntime bridge clone handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c61c8d3ea
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/runtime/runtime-bridge.ts`:
- Around line 513-520: Update the event delivery flow around cloneEvent so a
null clone for one sink does not return before the other sink is invoked; remove
the combined mandatoryEvent/publicEvent early return and rely on the existing
per-sink guards to deliver each successfully cloned event. Add a regression test
covering two sinks where one clone fails and the other succeeds, verifying only
the successful clone is delivered.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a5614692-c8c1-4578-97bc-890ffc03ef62
📒 Files selected for processing (2)
src/runtime/runtime-bridge.test.tssrc/runtime/runtime-bridge.ts
Closes veryfront/veryfront-issue-inbox#375.\n\n## Summary\n\n- drop a model-call context event when its payload cannot be structured-cloned\n- count and log the sanitized failure class without including tool output\n- continue model dispatch while preserving fail-closed behavior for actual sink failures\n\n## Verification\n\n- \n- \n- \n- running 1 test from ./src/runtime/runtime-bridge.test.ts
runtime-bridge ...
skips non-cloneable model context without failing model dispatch ...
------- output -------
12:17:28 SERVER ▲ [runtime-bridge] Model call context event was not persisted because it is not cloneable
failureClass=DataCloneError
12:17:28 SERVER ▲ [runtime-bridge] Model call context event was not persisted because it is not cloneable
failureClass=DataCloneError
----- output end -----
skips non-cloneable model context without failing model dispatch ... ok (1ms)
emits one exact run event with normalized messages and resolved tools before direct generate ... ok (0ms)
records exactly one ordered context for each evolving skill-backed dispatch ... ok (0ms)
emits before stream-backed generate and direct stream dispatch ... ok (1ms)
propagates sink failures without dispatching ... ok (0ms)
awaits the mandatory sink before the public sink and provider dispatch ... ok (0ms)
calls a sink shared by both lanes only once ... ok (0ms)
fails closed in either sink lane ... ok (1ms)
isolates nested sink mutations from generate and stream provider inputs ... ok (0ms)
uses the direct generate path for models without tools ... ok (0ms)
forwards reasoning options to direct generate models ... ok (0ms)
buffers the stream path for models that prefer streamed generate ... ok (0ms)
buffers streamed tool calls for models that prefer streamed generate ... ok (1ms)
uses the direct stream path for models without tools ... ok (0ms)
rejects a second stream view started after direct consumption ... ok (0ms)
cancels a sole stream consumer without waiting for an unused branch ... ok (0ms)
handles an abandoned stream request rejection ... ok (0ms)
forwards reasoning options to direct stream models ... ok (0ms)
uses the direct generate path for ordinary function tools ... ok (0ms)
uses the direct stream path for ordinary function tools ... ok (0ms)
uses the direct stream path for provider-native tools ... ok (0ms)
uses the direct generate path for provider-native tools ... ok (0ms)
keeps providerExecuted on direct generate provider tool results ... ok (0ms)
uses the direct stream path for provider-native web_fetch ... ok (1ms)
uses the direct generate path for provider-native web_fetch ... ok (0ms)
drops trailing assistant prefill messages before direct stream requests ... ok (0ms)
drops trailing assistant prefill messages before direct generate requests ... ok (0ms)
runtime-bridge ... ok (7ms)
ok | 1 passed (27 steps) | 0 failed (10ms)\n-
Summary by CodeRabbit