fix(webui): preserve oversized turn history with record pagination (#6586)
This commit is contained in:
1 parent
5c1083df7f
commit
3c61bcfdf0
34 files changed
+3466
-380
No files matched your search
@@ -1139,6 +1139,35 @@ describe("useSessions", () => {
|
||||
expect(result.current.lineage).toBe(latestLineage);
|
||||
});
|
||||
|
||||
it("continues past an empty latest fragment to the visible history", async () => {
|
||||
vi.mocked(api.fetchWebuiThread)
|
||||
.mockResolvedValueOnce({
|
||||
schemaVersion: 3, projection: "events", completed_turn_ids: ["long"],
|
||||
events: [
|
||||
{ event: "model_request", chat_id: "empty-tail", projection_id: "request", turn_id: "long", turn_seq: 4,
|
||||
request_id: "request", run_id: "run", sequence: 1, phase: "completed" },
|
||||
{ event: "turn_end", chat_id: "empty-tail", projection_id: "end", turn_id: "long", turn_seq: 5 },
|
||||
],
|
||||
page: { before_cursor: "inside", has_more_before: true, truncated_oversized_turn: true,
|
||||
record_range: { turn: 0, start: 3, end: 5 } },
|
||||
})
|
||||
.mockResolvedValueOnce({
|
||||
schemaVersion: 3, projection: "events",
|
||||
events: [{ event: "user_message", chat_id: "empty-tail", projection_id: "question", turn_id: "long",
|
||||
turn_seq: 1, text: "Question", starts_turn: true }],
|
||||
page: { before_cursor: null, has_more_before: false, truncated_oversized_turn: true,
|
||||
record_range: { turn: 0, start: 0, end: 3 } },
|
||||
});
|
||||
const { result } = renderHook(() => useSessionHistory("websocket:empty-tail"), {
|
||||
wrapper: wrap(fakeClient()),
|
||||
});
|
||||
await waitFor(() => expect(result.current.messages.map((row) => row.content)).toEqual(["Question"]));
|
||||
expect(api.fetchWebuiThread).toHaveBeenCalledTimes(2);
|
||||
expect(api.fetchWebuiThread).toHaveBeenLastCalledWith("tok", "websocket:empty-tail",
|
||||
expect.objectContaining({ before: "inside", limit: 120 }));
|
||||
expect(result.current.hasMoreBefore).toBe(false);
|
||||
});
|
||||
|
||||
it("keeps older-history failures separate and retries them explicitly", async () => {
|
||||
vi.mocked(api.fetchWebuiThread)
|
||||
.mockResolvedValueOnce(canonicalThreadPayload({
|
||||
|
||||
Reference in new issue
Block a user