Skip to content

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

fix(chat): restore missing chat runtime state on provider mount

Steven Enamakel5625408e4391
diff --git a/app/src/providers/ChatRuntimeProvider.tsx b/app/src/providers/ChatRuntimeProvider.tsx
index 9f430b9dd0..8f93ff3f68 100644
--- a/app/src/providers/ChatRuntimeProvider.tsx
+++ b/app/src/providers/ChatRuntimeProvider.tsx
@@ -690,6 +690,7 @@ const ChatRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
toolCallId: event.tool_call_id,
displayLabel: event.tool_display_label,
displayDetail: event.tool_display_detail,
+ args: event.args,
})
);
},
diff --git a/app/src/store/chatRuntimeSlice.ts b/app/src/store/chatRuntimeSlice.ts
index bb257f21b9..a1f737317c 100644
--- a/app/src/store/chatRuntimeSlice.ts
+++ b/app/src/store/chatRuntimeSlice.ts
@@ -24,6 +24,16 @@ import { resetUserScopedState } from './resetActions';
const turnStateLog = debug('chatRuntime.turnState');
+/** A tool call's event args as a row `argsBuffer`; `undefined` when there are none. */
+function argsBufferOf(args: Record<string, unknown> | undefined): string | undefined {
+ if (!args || typeof args !== 'object' || Object.keys(args).length === 0) return undefined;
+ try {
+ return JSON.stringify(args);
+ } catch {
+ return undefined;
+ }
+}
+
/** How many turns settled this session keep a frozen trail per thread. */
const SETTLED_TURNS_KEPT = 20;
@@ -1324,9 +1334,18 @@ const chatRuntimeSlice = createSlice({
toolCallId?: string;
displayLabel?: string;
displayDetail?: string;
+ /**
+ * The call's arguments as the `tool_call` event carries them. Kept as
+ * the row's `argsBuffer` unless `tool_args_delta` already streamed
+ * them, so a call whose args were not streamed still shows its input —
+ * as the same call does on reload, where the core transcript always
+ * has them.
+ */
+ args?: Record<string, unknown>;
}>
) => {
const { threadId, round, toolName, displayLabel, displayDetail } = action.payload;
+ const argsBuffer = argsBufferOf(action.payload.args);
// Normalise an absent id to `undefined` *before* anything reads it. A
// provider that sends `tool_call_id: ""` is saying "no id", but `??` only
// falls back on null/undefined — so the empty string used to survive as
@@ -1369,6 +1388,7 @@ const chatRuntimeSlice = createSlice({
name: toolName,
round,
status: 'running',
+ argsBuffer: prev.argsBuffer ?? argsBuffer,
displayName: displayLabel ?? prev.displayName,
detail: displayDetail ?? prev.detail,
});
@@ -1382,6 +1402,7 @@ const chatRuntimeSlice = createSlice({
round,
seq,
status: 'running',
+ argsBuffer,
displayName: displayLabel,
detail: displayDetail,
})