Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(chat): record server-decided terminal resolution for pending approvals

Steven Enamakelefe6738d73b4
diff --git a/app/src/components/assistant-ui/elements/day-separator.tsx b/app/src/components/assistant-ui/elements/day-separator.tsx
index 9e94db9243..1870c24d91 100644
--- a/app/src/components/assistant-ui/elements/day-separator.tsx
+++ b/app/src/components/assistant-ui/elements/day-separator.tsx
@@ -5,6 +5,10 @@
* (https://r.assistant-ui.com/styles/base-nova/elements-day-separator.json).
* Changes from upstream:
* - `cn` import path (`@/components/assistant-ui/lib/utils`).
+ * - The day-boundary check no longer reassigns a `let` across `.map()`
+ * iterations (flagged by this repo's `react-hooks/immutability` lint); it
+ * compares each message's day against the previous array entry instead,
+ * with identical output.
*/
import { cn } from '@/components/assistant-ui/lib/utils';
import type { ComponentProps } from 'react';
@@ -24,16 +28,13 @@ export function DaySeparator({
className,
...props
}: Omit<ComponentProps<'div'>, 'children' | 'messages'> & { messages: readonly DatedMessage[] }) {
- let lastDay = '';
-
return (
<div
data-slot="day-separator"
className={cn('flex w-full max-w-sm flex-col gap-2', className)}
{...props}>
- {messages.map(message => {
- const newDay = message.day !== lastDay;
- lastDay = message.day;
+ {messages.map((message, index) => {
+ const newDay = index === 0 || messages[index - 1].day !== message.day;
return (
<div key={message.id} className="flex flex-col gap-2">
diff --git a/app/src/store/chatRuntimeSlice.ts b/app/src/store/chatRuntimeSlice.ts
index 7d35eac642..86792485b5 100644
--- a/app/src/store/chatRuntimeSlice.ts
+++ b/app/src/store/chatRuntimeSlice.ts
@@ -1919,6 +1919,28 @@ const chatRuntimeSlice = createSlice({
clearPendingApprovalForThread: (state, action: PayloadAction<{ threadId: string }>) => {
delete state.pendingApprovalByThread[action.payload.threadId];
},
+ /**
+ * Record a server-decided terminal resolution (`approval_decided` socket
+ * event carrying `resolution: 'expired' | 'cancelled'`) on the thread's
+ * still-parked entry, rather than deleting it outright. Only applies when
+ * the event names the SAME request the store is holding — a decided
+ * event for a request the client already cleared (the common,
+ * interactive-decision case) is a no-op here. A caller that wants the
+ * card gone immediately still dispatches `clearPendingApprovalForThread`
+ * itself once it has shown the resolution.
+ */
+ resolvePendingApprovalForThread: (
+ state,
+ action: PayloadAction<{
+ threadId: string;
+ requestId: string;
+ resolution: 'expired' | 'cancelled';
+ }>
+ ) => {
+ const current = state.pendingApprovalByThread[action.payload.threadId];
+ if (!current || current.requestId !== action.payload.requestId) return;
+ current.resolution = action.payload.resolution;
+ },
setPendingPlanReviewForThread: (
state,
action: PayloadAction<{ threadId: string; review: PendingPlanReview }>
@@ -2455,6 +2477,7 @@ export const {
resolveSubagentTranscriptTool,
setPendingApprovalForThread,
clearPendingApprovalForThread,
+ resolvePendingApprovalForThread,
setPendingPlanReviewForThread,
clearPendingPlanReviewForThread,
setWorkflowProposalForThread,