Repository navigation
fix: interrupt persistence - #2488
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughImplements per-thread scoping for LangGraph interrupt actions across react-core by adding a thread-keyed map and changing setter/remover signatures to accept a threadId; updates hooks and provider wiring. React-UI CodeBlock now chooses Prism or Light highlighter at runtime based on RegExp lookbehind support. Adds a patch changeset. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant UIHook as useLangGraphInterrupt / Render
participant Context as CopilotContext
participant Provider as CopilotProvider
participant Store as langGraphInterruptActions (map)
participant Thread as LangGraph Thread
User->>UIHook: Trigger interrupt or render update
UIHook->>Context: setLangGraphInterruptAction(threadId, action)
Context->>Provider: invoke setter with threadId
Provider->>Store: upsert map[threadId] = merged action/event
Note over Store,Provider: Action stored per threadId
Thread-->>Provider: read action via internalThreadId
Provider-->>Context: expose langGraphInterruptAction = map[internalThreadId] ?? null
Context-->>UIHook: provide per-thread action
UIHook->>Context: removeLangGraphInterruptAction(threadId)
Context->>Provider: invoke remover(threadId)
Provider->>Store: clear map[threadId]
sequenceDiagram
autonumber
participant CodeBlock
participant Env as Environment (RegExp lookbehind)
participant Prism as PrismHighlighter
participant Light as LightHighlighter
CodeBlock->>CodeBlock: mount
CodeBlock->>Env: check lookbehind support
alt Supported
CodeBlock->>CodeBlock: set SyntaxHighlighter = Prism
CodeBlock->>Prism: render(code, language)
else Not supported / error
CodeBlock->>CodeBlock: set SyntaxHighlighter = Light
CodeBlock->>Light: render(code, language)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. 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. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
CopilotKit/packages/react-core/src/hooks/use-chat.ts (1)
875-893: Add threadId to runChatCompletion dependencies
runChatCompletionusesthreadIdandsetLangGraphInterruptAction. MissingthreadIdcan cause updates to the wrong thread.const runChatCompletion = useAsyncCallback( async (previousMessages: Message[]): Promise<Message[]> => { // ... }, - [ + [ messages, setMessages, makeSystemMessageCallback, copilotConfig, setIsLoading, initialMessages, isLoading, actions, onFunctionCall, onCoAgentStateRender, setCoagentStatesWithRef, coagentStatesRef, agentSession, setAgentSession, disableSystemMessage, context, + threadId, ], );
🧹 Nitpick comments (6)
CopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsx (2)
1-2: Avoid statically importing Prism to prevent crashes/bloat on unsupported browsersDynamically import Prism only when lookbehind is supported so older engines never parse Prism code.
Apply this diff here:
-import { Prism, Light } from "react-syntax-highlighter"; +import { Light } from "react-syntax-highlighter";And update the effect (outside this hunk) to lazy-load Prism:
// inside useEffect let mounted = true; try { new RegExp("(?<=#)\\w+"); import("react-syntax-highlighter").then((mod) => { if (mounted) setSyntaxHighlighter(() => mod.Prism); }); } catch { setSyntaxHighlighter(() => Light); } return () => { mounted = false; };
62-69: Guard against setState after unmount and use lazy Prism import
- Add a mounted flag to avoid post-unmount state updates.
- Prefer dynamic import of Prism inside this effect (see prior comment) to avoid loading Prism on unsupported browsers.
Example (outside this hunk):
useEffect(() => { let mounted = true; try { new RegExp("(?<=#)\\w+"); import("react-syntax-highlighter").then((mod) => { if (mounted) setSyntaxHighlighter(() => mod.Prism); }); } catch { setSyntaxHighlighter(() => Light); } return () => { mounted = false; }; }, []);CopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt.ts (1)
12-17: Remove unused destructure and include threadId in effect deps
removeLangGraphInterruptActionisn’t used and forces an extra dependency. Also,threadIdis used in the effect but isn’t in the dependency array.- const { - setLangGraphInterruptAction, - removeLangGraphInterruptAction, - langGraphInterruptAction, - threadId, - } = useContext(CopilotContext); + const { setLangGraphInterruptAction, langGraphInterruptAction, threadId } = + useContext(CopilotContext);CopilotKit/packages/react-core/src/hooks/use-chat.ts (1)
916-947: Include threadId in composeAndFlushMetaEventsInput depsPrevents flushing the wrong thread’s interrupt when switching threads.
- }, [setLangGraphInterruptAction]); + }, [setLangGraphInterruptAction, threadId]);CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx (1)
546-546: Coalesce undefined to null for context valueEnsure the context exposes
nullwhen there’s no entry for the current thread, matching its declared type.- langGraphInterruptAction: langGraphInterruptActions[internalThreadId], + langGraphInterruptAction: langGraphInterruptActions[internalThreadId] ?? null,CopilotKit/packages/react-core/src/types/interrupt-action.ts (1)
39-42: Type change LGTM — verified call sites (no single-arg calls remain)All usages pass (threadId, action) or (threadId, null). Optional: update the default no-op in CopilotKit/packages/react-core/src/context/copilot-context.tsx (currently
setLangGraphInterruptAction: () => {}) to(threadId, action) => {}to match the setter signature.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
CopilotKit/.changeset/loud-ways-smell.md(1 hunks)CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx(2 hunks)CopilotKit/packages/react-core/src/context/copilot-context.tsx(2 hunks)CopilotKit/packages/react-core/src/hooks/use-chat.ts(2 hunks)CopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt-render.ts(3 hunks)CopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt.ts(2 hunks)CopilotKit/packages/react-core/src/types/interrupt-action.ts(1 hunks)CopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsx(2 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
CopilotKit/packages/react-core/**
📄 CodeRabbit inference engine (.cursor/rules/copilotkit-architecture.mdc)
Core React components and hooks for CopilotKit should be placed in CopilotKit/packages/react-core/
Files:
CopilotKit/packages/react-core/src/types/interrupt-action.tsCopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt.tsCopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt-render.tsCopilotKit/packages/react-core/src/hooks/use-chat.tsCopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsxCopilotKit/packages/react-core/src/context/copilot-context.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)
Use TypeScript for better type safety
Files:
CopilotKit/packages/react-core/src/types/interrupt-action.tsCopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt.tsCopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt-render.tsCopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsxCopilotKit/packages/react-core/src/hooks/use-chat.tsCopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsxCopilotKit/packages/react-core/src/context/copilot-context.tsx
{**/*.{ts,tsx},CopilotKit/utilities/tailwind-config/**}
📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)
Maintain consistent styling with Tailwind CSS
Files:
CopilotKit/packages/react-core/src/types/interrupt-action.tsCopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt.tsCopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt-render.tsCopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsxCopilotKit/packages/react-core/src/hooks/use-chat.tsCopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsxCopilotKit/packages/react-core/src/context/copilot-context.tsx
CopilotKit/packages/react-core/**/*
📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
Use [react-core/] for basic integration when building a simple Copilot
Files:
CopilotKit/packages/react-core/src/types/interrupt-action.tsCopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt.tsCopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt-render.tsCopilotKit/packages/react-core/src/hooks/use-chat.tsCopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsxCopilotKit/packages/react-core/src/context/copilot-context.tsx
CopilotKit/packages/react-ui/**
📄 CodeRabbit inference engine (.cursor/rules/copilotkit-architecture.mdc)
UI components for copilot interfaces should be placed in CopilotKit/packages/react-ui/
Files:
CopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsx
{CopilotKit/packages/react-ui/**/*.{ts,tsx},examples/**/ui/**/*.{ts,tsx}}
📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)
{CopilotKit/packages/react-ui/**/*.{ts,tsx},examples/**/ui/**/*.{ts,tsx}}: Implement responsive design
Provide clear user feedback
Files:
CopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsx
CopilotKit/packages/react-ui/**/*
📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
Add [react-ui/] for pre-built components when building a simple Copilot or customizing UI components
Files:
CopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsx
🧠 Learnings (2)
📚 Learning: 2025-07-04T14:02:44.814Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.814Z
Learning: Applies to CopilotKit/packages/react-ui/**/* : Add [react-ui/] for pre-built components when building a simple Copilot or customizing UI components
Applied to files:
CopilotKit/.changeset/loud-ways-smell.md
📚 Learning: 2025-07-20T15:40:00.391Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/suggestions-development.mdc:0-0
Timestamp: 2025-07-20T15:40:00.391Z
Learning: Applies to packages/react-ui/src/hooks/use-copilot-chat-suggestions.tsx : Check useEffect dependencies and ensure they're properly memoized to avoid infinite re-renders
Applied to files:
CopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt.tsCopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsx
🧬 Code graph analysis (1)
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx (1)
CopilotKit/packages/react-core/src/types/interrupt-action.ts (2)
LangGraphInterruptAction(32-34)LangGraphInterruptActionSetterArgs(36-38)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- 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, agent, python, local-deps)
- GitHub Check: Build Images (coagents-routing, ui)
- GitHub Check: Build Images (coagents-qa-native, ui)
- GitHub Check: Build Images (coagents-research-canvas, ui)
- GitHub Check: Build Images (coagents-qa-text, ui)
- GitHub Check: Build Images (coagents-routing, agent, python, local-deps)
- GitHub Check: Build Images (coagents-research-canvas, agent, python, local-deps)
- GitHub Check: E2E Tests
- GitHub Check: Test (18.x)
- GitHub Check: Test (20.x)
🔇 Additional comments (6)
CopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsx (1)
58-61: Good default to Light for SSR and first renderUsing Light as the initial component avoids hydration issues and works across browsers.
CopilotKit/.changeset/loud-ways-smell.md (1)
1-5: Add a changeset for react-core API surface changesThis PR changes public types and context signatures in @copilotkit/react-core (threadId parameter). Please add at least a patch changeset for react-core to avoid publishing UI-only changes that break consumers of react-core.
CopilotKit/packages/react-core/src/context/copilot-context.tsx (1)
226-227: Signature change acknowledgedContext now requires
removeLangGraphInterruptAction(threadId: string). Keep provider/defaults in sync.CopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt-render.ts (1)
21-21: Context destructure LGTMThread-scoped setter usage is correct.
CopilotKit/packages/react-core/src/hooks/use-chat.ts (2)
490-494: Per-thread event registration looks correctIncoming interrupt events are scoped to the current thread.
926-927: Flushing per-thread interrupt state is correctClearing the interrupt after response is serialized is aligned with the new model.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx (1)
451-453: Include stable dependency to satisfy exhaustive-deps.Add the setter to the dependency array (it’s stable).
- const removeLangGraphInterruptAction = useCallback((threadId: string): void => { - setLangGraphInterruptAction(threadId, null); - }, []); + const removeLangGraphInterruptAction = useCallback((threadId: string): void => { + setLangGraphInterruptAction(threadId, null); + }, [setLangGraphInterruptAction]);
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx(2 hunks)CopilotKit/packages/react-core/src/context/copilot-context.tsx(2 hunks)CopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt-render.ts(3 hunks)CopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- CopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt.ts
- CopilotKit/packages/react-core/src/context/copilot-context.tsx
- CopilotKit/packages/react-core/src/hooks/use-langgraph-interrupt-render.ts
🧰 Additional context used
📓 Path-based instructions (4)
CopilotKit/packages/react-core/**
📄 CodeRabbit inference engine (.cursor/rules/copilotkit-architecture.mdc)
Core React components and hooks for CopilotKit should be placed in CopilotKit/packages/react-core/
Files:
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)
Use TypeScript for better type safety
Files:
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx
{**/*.{ts,tsx},CopilotKit/utilities/tailwind-config/**}
📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)
Maintain consistent styling with Tailwind CSS
Files:
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx
CopilotKit/packages/react-core/**/*
📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
Use [react-core/] for basic integration when building a simple Copilot
Files:
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx
🧬 Code graph analysis (1)
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx (1)
CopilotKit/packages/react-core/src/types/interrupt-action.ts (2)
LangGraphInterruptAction(32-34)LangGraphInterruptActionSetterArgs(36-38)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: Test (20.x)
- GitHub Check: Test (18.x)
- GitHub Check: E2E Tests
- GitHub Check: Build Images (next-openai, next-openai)
- GitHub Check: Build Images (coagents-research-canvas, ui)
- GitHub Check: Build Images (coagents-qa-text, agent, python, local-deps)
- GitHub Check: Build Images (coagents-research-canvas, agent, python, local-deps)
- GitHub Check: Build Images (coagents-routing, agent, python, local-deps)
- GitHub Check: Build Images (coagents-qa-native, agent, python, local-deps)
- GitHub Check: Build Images (coagents-qa-text, ui)
- GitHub Check: Build Images (coagents-qa-native, ui)
- GitHub Check: Build Images (coagents-routing, ui)
🔇 Additional comments (2)
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx (2)
427-430: Good move to per‑thread storage.Scoping interrupt actions by threadId via a Record keeps concurrent threads isolated as intended.
431-449: Remove ts-ignore and type the merged event safely.The ts-ignore masks real type issues. Merge the event with proper typing and set it conditionally.
Apply this diff:
const setLangGraphInterruptAction = useCallback( (threadId: string, action: LangGraphInterruptActionSetterArgs) => { _setLangGraphInterruptAction((prev) => { if (action == null) return { ...prev, [threadId]: null, }; - let event = prev[threadId]?.event; - if (action.event) { - // @ts-ignore - event = { ...(prev[threadId]?.event || {}), ...action.event }; - } + const mergedEvent: LangGraphInterruptAction["event"] = action.event + ? ({ ...(prev[threadId]?.event ?? {}), ...action.event } as LangGraphInterruptAction["event"]) + : prev[threadId]?.event; return { ...prev, - [threadId]: { ...(prev[threadId] ?? {}), ...action, event } as LangGraphInterruptAction, + [threadId]: { + ...(prev[threadId] ?? {}), + ...action, + ...(mergedEvent ? { event: mergedEvent } : {}), + } as LangGraphInterruptAction, }; }); }, [], );
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx (1)
451-453: Add dependency to useCallback to satisfy exhaustive-deps.Include
setLangGraphInterruptActionin the dependency array to avoid lint noise and ensure correctness if it ever changes.- const removeLangGraphInterruptAction = useCallback((threadId: string): void => { - setLangGraphInterruptAction(threadId, null); - }, []); + const removeLangGraphInterruptAction = useCallback((threadId: string): void => { + setLangGraphInterruptAction(threadId, null); + }, [setLangGraphInterruptAction]);
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx(2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
CopilotKit/packages/react-core/**
📄 CodeRabbit inference engine (.cursor/rules/copilotkit-architecture.mdc)
Core React components and hooks for CopilotKit should be placed in CopilotKit/packages/react-core/
Files:
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)
Use TypeScript for better type safety
Files:
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx
{**/*.{ts,tsx},CopilotKit/utilities/tailwind-config/**}
📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)
Maintain consistent styling with Tailwind CSS
Files:
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx
CopilotKit/packages/react-core/**/*
📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
Use [react-core/] for basic integration when building a simple Copilot
Files:
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx
🧠 Learnings (2)
📚 Learning: 2025-07-20T15:40:00.391Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/suggestions-development.mdc:0-0
Timestamp: 2025-07-20T15:40:00.391Z
Learning: Applies to packages/react-ui/src/hooks/use-copilot-chat-suggestions.tsx : Check useEffect dependencies and ensure they're properly memoized to avoid infinite re-renders
Applied to files:
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx
📚 Learning: 2025-07-20T15:40:00.391Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/suggestions-development.mdc:0-0
Timestamp: 2025-07-20T15:40:00.391Z
Learning: Applies to packages/react-ui/src/hooks/use-copilot-chat-suggestions.tsx : Check if `useCopilotChatSuggestions` is being called in your component if there are no initial suggestions
Applied to files:
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx
🧬 Code graph analysis (1)
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx (1)
CopilotKit/packages/react-core/src/types/interrupt-action.ts (2)
LangGraphInterruptAction(32-34)LangGraphInterruptActionSetterArgs(36-38)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: Build Images (coagents-qa-native, ui)
- GitHub Check: Build Images (next-openai, next-openai)
- GitHub Check: Build Images (coagents-qa-text, ui)
- GitHub Check: Build Images (coagents-routing, ui)
- GitHub Check: Build Images (coagents-research-canvas, ui)
- GitHub Check: Build Images (coagents-qa-text, agent, python, local-deps)
- GitHub Check: Build Images (coagents-qa-native, agent, python, local-deps)
- GitHub Check: Build Images (coagents-routing, agent, python, local-deps)
- GitHub Check: Build Images (coagents-research-canvas, agent, python, local-deps)
- GitHub Check: E2E Tests
- GitHub Check: Test (20.x)
- GitHub Check: Test (18.x)
🔇 Additional comments (3)
CopilotKit/packages/react-core/src/components/copilot-provider/copilotkit.tsx (3)
427-430: Good: per-thread interrupt state introduced.The state shape and initialization look correct for scoping by threadId.
439-446: Remove ts-ignore and perform a typed event merge.Avoid suppressing type checks; merge the event patch explicitly and keep the final assignment typed.
Apply this diff:
- let event = prev[threadId]?.event; - if (action.event) { - // @ts-ignore - event = { ...(prev[threadId]?.event || {}), ...action.event }; - } - return { - ...prev, - [threadId]: { ...(prev[threadId] ?? {}), ...action, event } as LangGraphInterruptAction, - }; + const prevEntry = prev[threadId]; + const { event: eventPatch, ...rest } = action; + const nextEvent = eventPatch + ? { ...(prevEntry?.event ?? {}), ...eventPatch } + : prevEntry?.event; + return { + ...prev, + [threadId]: { + ...(prevEntry ?? {}), + ...rest, + ...(nextEvent ? { event: nextEvent } : {}), + } as LangGraphInterruptAction, + };
546-546: LGTM: coalescing to null prevents undefined leaking through context.Matches the context type contract.
PreviewsCommit SHA: d663345
|
Test ResultsStatus: ✅ Passed (View Run) Commit: d663345 Duration: 232.4s Total Tests: 37 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: 9de9cdd 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 |
This PR handles the interrupt events so they are bounded to a thread ID. This way, they are only fetched or displayed when the relevant threadId is set
Summary by CodeRabbit
New Features
Bug Fixes
Chores