Repository navigation
fix: use active interrupt from thread instead of saving to global state - #2031
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
WalkthroughThe changes refactor interrupt event handling in the Changes
Sequence Diagram(s)sequenceDiagram
participant Controller
participant streamEvents
participant ThreadState
participant emitInterrupt
Controller->>streamEvents: Start streaming with args
streamEvents->>ThreadState: Inspect tasks[0]?.interrupts
alt Outstanding interrupts exist
streamEvents->>emitInterrupt: Emit interrupt event(s)
emitInterrupt-->>streamEvents: Event emission complete
streamEvents-->>Controller: Return early (no further streaming)
else No interrupts
streamEvents->>Controller: Proceed with streaming run
end
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
CopilotKit/packages/runtime/src/lib/runtime/remote-lg-action.ts (1)
899-919: Well-designed interrupt emission helper.The
emitInterruptfunction effectively centralizes interrupt handling logic with proper support for both CopilotKit-specific and regular interrupts. The conditional JSON stringification for non-string values is handled correctly.Consider adding JSDoc documentation to describe the function's purpose and the two interrupt types it handles:
+/** + * Emits interrupt events to the stream. + * Handles two types of interrupts: + * 1. CopilotKit interrupts with __copilotkit_interrupt_value__ property + * 2. Regular interrupts + */ function emitInterrupt(interruptValue: any, emit: (data: string) => void) {
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
CopilotKit/packages/runtime/src/lib/runtime/remote-lg-action.ts(6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (15)
- GitHub Check: Build Images (coagents-qa-text, ui)
- GitHub Check: Build Images (coagents-qa-native, agent, js, local-deps)
- GitHub Check: Build Images (next-openai, next-openai)
- GitHub Check: Build Images (coagents-qa-text, agent, python, local-deps)
- GitHub Check: Build Images (coagents-qa-native, ui)
- GitHub Check: Build Images (coagents-routing, agent, python, local-deps)
- GitHub Check: Build Images (coagents-research-canvas, agent, js, local-deps)
- GitHub Check: Build Images (coagents-qa-native, agent, python, local-deps)
- GitHub Check: Build Images (coagents-routing, agent, js, local-deps)
- GitHub Check: Build Images (coagents-routing, ui)
- GitHub Check: Build Images (coagents-qa-text, agent, js, local-deps)
- GitHub Check: Build Images (coagents-research-canvas, agent, python, local-deps)
- GitHub Check: Build Images (coagents-research-canvas, ui)
- GitHub Check: Test (18.x)
- GitHub Check: Test (20.x)
🔇 Additional comments (5)
CopilotKit/packages/runtime/src/lib/runtime/remote-lg-action.ts (5)
5-7: LGTM!The addition of
InterruptandThreadStateimports is appropriate for the interrupt handling refactoring.
191-191: Good type safety improvement.Explicitly typing
agentStateasThreadStateimproves code maintainability and helps catch type errors at compile time.
314-327: Excellent interrupt resolution logic.The implementation correctly handles two interrupt resolution scenarios:
- Auto-resolution via upcoming messages when no meta event exists
- Immediate emission and early return when meta event is present
The early return prevents unnecessary streaming operations when interrupts need resolution first.
360-360: Good refactoring to use the centralized helper.Replacing inline interrupt emission with the
emitInterrupthelper improves code maintainability and ensures consistent interrupt handling.
227-230: ```shell
#!/bin/bashRefined search to locate ThreadState and its
tasksproperty in TS filesSearch for any mention of ThreadState in .ts files
rg -n "ThreadState" -g "*.ts"
Specifically look for interface or type definitions
rg -n -e "interface ThreadState" -g ".ts"
rg -n -e "type ThreadState" -g ".ts"Search for where
tasksis declared on any State typerg -n -e "tasks\s*:" -g "*.ts"
</details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
|
Preview environments destroyed for this pull request. |
Test ResultsStatus: ✅ Passed (View Run) Commit: 0a5a75b Duration: 299.1s Total Tests: 20 Pass Rate: 100.0% Failed Tests: 0 🔍 Detailed Resultscoagents-research-canvasCoAgents Research Canvas (UI) - Local Depenencies
coagents-qa-nativeCoAgents QA Native (UI) - Local
coagents-qa-textCoAgents QA Text (UI) - Local
coagents-routingCoAgents Routing (UI) - Local
next-openaiNext OpenAI - Self Hosted
|
🦋 Changeset detectedLatest commit: 864cf60 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Click here if you're a maintainer who wants to add another changeset to this PR |
|
@ranst91 Could you please release a version to fix this issue? Thank you! |
|
@the-waste-land There would probably be a release today. |
See #2026 for discussions & final resolution
Summary by CodeRabbit