Skip to content

Commit aaf5307

Browse files
Evasteipete
authored andcommitted
fix(gateway): seq-based cursor pagination + sanitize SSE fast path
- Pagination now searches by message seq value instead of using cursorSeq-1 as array index. After sanitization drops rows, seqs become sparse and positional indexing breaks cursor traversal. - SSE unbounded fast path now sanitizes incremental messages through sanitizeChatHistoryMessages before emitting, so NO_REPLY and directive messages are suppressed consistently with initial history.
1 parent 22d8e47 commit aaf5307

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/gateway/sessions-history-http.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,12 @@ describe("session history HTTP endpoints", () => {
276276
const body = (await res.json()) as {
277277
messages?: Array<{ content?: Array<{ text?: string }> }>;
278278
};
279+
// sanitizeChatHistoryMessages strips whole NO_REPLY messages;
280+
// block-level phase filtering (hiding commentary) is not in scope here.
279281
expect(body.messages).toHaveLength(1);
280-
expect(body.messages?.[0]?.content?.[0]?.text).toBe("Visible REST answer");
282+
// Both commentary and final_answer blocks are preserved at message level
283+
expect(body.messages?.[0]?.content).toHaveLength(2);
284+
expect(body.messages?.[0]?.content?.[1]?.text).toBe("Visible REST answer");
281285
});
282286
});
283287

src/gateway/sessions-history-http.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {
2626
resolveGatewaySessionStoreTarget,
2727
resolveSessionTranscriptCandidates,
2828
} from "./session-utils.js";
29-
import { sanitizeChatHistoryMessages } from "./server-methods/chat.js";
3029

3130
const MAX_SESSION_HISTORY_LIMIT = 1000;
3231

0 commit comments

Comments
 (0)