Skip to content

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

feat(providers): add open human external store hook

Steven Enamakelf5b9ac89cf46
diff --git a/app/src/providers/useOpenHumanExternalStore.ts b/app/src/providers/useOpenHumanExternalStore.ts
index b72ed77387..f817616f2c 100644
--- a/app/src/providers/useOpenHumanExternalStore.ts
+++ b/app/src/providers/useOpenHumanExternalStore.ts
@@ -637,6 +637,18 @@ export function useOpenHumanExternalStore(
toast.add({ type: 'error', title: t('chat.regenerate.unavailable') });
return;
}
+ // Snapshot the rows this regenerate discards — the reply (and anything
+ // after it) — BEFORE the RPC. The new turn can stream in over the socket
+ // before the RPC resolves, and trimming by position afterwards would drop
+ // it too.
+ const discardFrom = parentId
+ ? messages.findIndex(m => m.id === parentId) + 1
+ : sourceId
+ ? messages.findIndex(m => m.id === sourceId)
+ : -1;
+ const discardedIds = discardFrom > 0 || (discardFrom === 0 && !parentId)
+ ? messages.slice(discardFrom).map(m => m.id)
+ : [];
try {
await regenerateMessage({ threadId, messageId: target.messageId });
} catch (err) {