From b117789286a096fd8cbd8a4d3c16b8ce4092a09d Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Wed, 28 Oct 2026 18:05:44 -0700 Subject: [PATCH] test(runtime): fix the stale orchestration context timestamp before the sync reads the clock (#35516) The mock built completed_at when the projection called it, after the projection captured now. With 1 ms or more between the two, the "stale" row was within the freshness window and the test failed under load. --- .../orca-runtime-tests/lineage-and-scan-cache-part-06.spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/runtime/orca-runtime-tests/lineage-and-scan-cache-part-06.spec.ts b/src/main/runtime/orca-runtime-tests/lineage-and-scan-cache-part-06.spec.ts index dc637b9372c..f61f1320abd 100644 --- a/src/main/runtime/orca-runtime-tests/lineage-and-scan-cache-part-06.spec.ts +++ b/src/main/runtime/orca-runtime-tests/lineage-and-scan-cache-part-06.spec.ts @@ -93,6 +93,8 @@ describe('OrcaRuntimeService', () => { const runtime = new OrcaRuntimeService(store) const workerLeafId = '77777777-7777-4777-8777-777777777777' const workerHandle = runtime.preAllocateHandleForPty('pty-worker') + // Fixed before the sync so its `now` is never older than this timestamp. + const staleCompletedAt = new Date(Date.now() - AGENT_STATUS_STALE_AFTER_MS - 1).toISOString() const orchestrationDb = makeRuntimeOrchestrationDb() vi.spyOn(orchestrationDb, 'listSessionDispatchesForPresentation').mockImplementation(() => []) vi.spyOn(orchestrationDb, 'getActiveDispatchForTerminal').mockImplementation(() => undefined) @@ -104,7 +106,7 @@ describe('OrcaRuntimeService', () => { task_id: 'task-stale', assignee_handle: workerHandle, status: 'completed', - completed_at: new Date(Date.now() - AGENT_STATUS_STALE_AFTER_MS - 1).toISOString() + completed_at: staleCompletedAt }) : undefined )