fix(agent): preserve streamed replies after model failures (#6494)
* fix(agent): preserve streamed replies after model failures * test(webui): settle lazy imports and async settings saves * test(agent): synchronize estimation checks at the operation boundary * docs(webui): explain retained replies after stream failures
This commit is contained in:
1 parent
b6536bfc5e
commit
219c8bb2bc
31 files changed
+462
-27
No files matched your search
@@ -822,6 +822,26 @@ describe("useNanobotStream", () => {
|
||||
},
|
||||
);
|
||||
|
||||
it.each([true, false, undefined])("keeps saved-reply facts consistent live and on attach (%s)", (preserved) => {
|
||||
const fake = fakeClient();
|
||||
const { result } = renderHook(() => useNanobotStream("chat-preserved", EMPTY_MESSAGES), {
|
||||
wrapper: wrap(fake.client),
|
||||
});
|
||||
const state = {
|
||||
recovery_id: "preserved-1", status: "awaiting_user" as const,
|
||||
reason: "model_request_failed", failure_error_kind: "connection",
|
||||
...(preserved === undefined ? {} : { reply_preserved: preserved }),
|
||||
};
|
||||
act(() => fake.emit("chat-preserved", {
|
||||
event: "recovery_state", chat_id: "chat-preserved", ...state,
|
||||
}));
|
||||
expect(result.current.recoveryState).toEqual(state);
|
||||
act(() => fake.emit("chat-preserved", {
|
||||
event: "attached", chat_id: "chat-preserved", recovery_state: state,
|
||||
}));
|
||||
expect(result.current.recoveryState).toEqual(state);
|
||||
});
|
||||
|
||||
it("does not let historical recovered state clear a later active turn", () => {
|
||||
const fake = fakeClient();
|
||||
const { result } = renderHook(
|
||||
|
||||
Reference in new issue
Block a user