fix(test): fix sync continuation test mock leaking across sessions

The messages() mock in 'session_id with background=false' test did not
filter by session ID, causing resolveParentContext's SDK calls for
parent-session to increment messagesCallCount. This inflated
anchorMessageCount to 4 (matching total messages), so the poll loop
could never detect new messages and always hit MAX_POLL_TIME_MS.

Fix: filter messages() mock by path.id so only target session
(ses_continue_test) increments the counter. Restore MAX_POLL_TIME_MS
from 8000 back to 2000.
This commit is contained in:
YeonGyu-Kim 2026-02-15 19:48:59 +09:00
parent 96a67e2d4e
commit aad0c3644b

View File

@ -45,7 +45,7 @@ describe("sisyphus-task", () => {
STABILITY_POLLS_REQUIRED: 1, STABILITY_POLLS_REQUIRED: 1,
WAIT_FOR_SESSION_INTERVAL_MS: 10, WAIT_FOR_SESSION_INTERVAL_MS: 10,
WAIT_FOR_SESSION_TIMEOUT_MS: 1000, WAIT_FOR_SESSION_TIMEOUT_MS: 1000,
MAX_POLL_TIME_MS: 8000, MAX_POLL_TIME_MS: 2000,
SESSION_CONTINUATION_STABILITY_MS: 50, SESSION_CONTINUATION_STABILITY_MS: 50,
}) })
cacheSpy = spyOn(connectedProvidersCache, "readConnectedProvidersCache").mockReturnValue(["anthropic", "google", "openai"]) cacheSpy = spyOn(connectedProvidersCache, "readConnectedProvidersCache").mockReturnValue(["anthropic", "google", "openai"])
@ -1273,7 +1273,13 @@ describe("sisyphus-task", () => {
session: { session: {
prompt: async () => ({ data: {} }), prompt: async () => ({ data: {} }),
promptAsync: async () => ({ data: {} }), promptAsync: async () => ({ data: {} }),
messages: async () => { messages: async (args?: { path?: { id?: string } }) => {
const sessionID = args?.path?.id
// Only track calls for the target session (ses_continue_test),
// not for parent-session calls from resolveParentContext
if (sessionID !== "ses_continue_test") {
return { data: [] }
}
messagesCallCount++ messagesCallCount++
const now = Date.now() const now = Date.now()