Skip to content

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

feat(chat): add runtime provider for chat state

Steven Enamakelde1ede761f61
diff --git a/app/src/providers/ChatRuntimeProvider.tsx b/app/src/providers/ChatRuntimeProvider.tsx
index da798e7ae7..0479d6ef20 100644
--- a/app/src/providers/ChatRuntimeProvider.tsx
+++ b/app/src/providers/ChatRuntimeProvider.tsx
@@ -1460,11 +1460,12 @@ const ChatRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
// for a DIFFERENT thread's request arrives.
if (!event.thread_id) return;
// A detached card (an async sub-agent's) has no turn end of its own
- // to clear it, so any decision for exactly that request — made on
- // another client, or by a typed reply — removes it here. Matching on
- // `request_id` keeps a different thread's or a newer request's card.
+ // to clear it, so any resolution of exactly that request — a decision
+ // made on another client or by a typed reply, an expiry, a cancel —
+ // removes it here. Matching on `request_id` keeps a different
+ // thread's or a newer request's card.
const held = store.getState().chatRuntime.pendingApprovalByThread[event.thread_id];
- if (held?.detached && held.requestId === event.request_id && !event.resolution) {
+ if (held?.detached && held.requestId === event.request_id) {
dispatch(
clearPendingApprovalIfRequest({
threadId: event.thread_id,
diff --git a/app/src/providers/__tests__/ChatRuntimeProvider.test.tsx b/app/src/providers/__tests__/ChatRuntimeProvider.test.tsx
index ade84cecf4..f97626eae7 100644
--- a/app/src/providers/__tests__/ChatRuntimeProvider.test.tsx
+++ b/app/src/providers/__tests__/ChatRuntimeProvider.test.tsx
@@ -3078,7 +3078,6 @@ describe('ChatRuntimeProvider — detached sub-agent approvals', () => {
listeners.onApprovalDecided?.({
thread_id: 't-sub',
request_id: 'appr-sub',
- tool_name: 'media_generate_image',
message: 'approve_once',
});
});