1+ // @effect -diagnostics nodeBuiltinImport:off
12import fs from "node:fs" ;
23import path from "node:path" ;
34
@@ -17,7 +18,10 @@ import {
1718 ProviderInstanceId ,
1819} from "@t3tools/contracts" ;
1920import { assert , it } from "@effect/vitest" ;
20- import { Effect , Option , Schema } from "effect" ;
21+ import * as Clock from "effect/Clock" ;
22+ import * as Effect from "effect/Effect" ;
23+ import * as Option from "effect/Option" ;
24+ import * as Schema from "effect/Schema" ;
2125
2226import type { TestTurnResponse } from "./TestProviderAdapter.integration.ts" ;
2327import {
@@ -47,7 +51,7 @@ const CODEX_PROVIDER = ProviderDriverKind.make("codex");
4751const CLAUDE_AGENT_PROVIDER = ProviderDriverKind . make ( "claudeAgent" ) ;
4852
4953function nowIso ( ) {
50- return new Date ( ) . toISOString ( ) ;
54+ return "2026-05-01T00:00:00.000Z" ;
5155}
5256
5357class IntegrationWaitTimeoutError extends Schema . TaggedErrorClass < IntegrationWaitTimeoutError > ( ) (
@@ -64,14 +68,14 @@ function waitForSync<A>(
6468 timeoutMs = 10_000 ,
6569) : Effect . Effect < A , never > {
6670 return Effect . gen ( function * ( ) {
67- const deadline = Date . now ( ) + timeoutMs ;
71+ const deadline = ( yield * Clock . currentTimeMillis ) + timeoutMs ;
6872
6973 while ( true ) {
7074 const value = read ( ) ;
7175 if ( predicate ( value ) ) {
7276 return value ;
7377 }
74- if ( Date . now ( ) >= deadline ) {
78+ if ( ( yield * Clock . currentTimeMillis ) >= deadline ) {
7579 return yield * Effect . die ( new IntegrationWaitTimeoutError ( { description } ) ) ;
7680 }
7781 yield * Effect . sleep ( 10 ) ;
@@ -156,6 +160,7 @@ const startTurn = (input: {
156160 readonly messageId : string ;
157161 readonly text : string ;
158162 readonly modelSelection ?: ModelSelection ;
163+ readonly createdAt ?: string ;
159164} ) =>
160165 input . harness . engine . dispatch ( {
161166 type : "thread.turn.start" ,
@@ -174,7 +179,7 @@ const startTurn = (input: {
174179 : { } ) ,
175180 interactionMode : DEFAULT_PROVIDER_INTERACTION_MODE ,
176181 runtimeMode : "approval-required" ,
177- createdAt : nowIso ( ) ,
182+ createdAt : input . createdAt ?? nowIso ( ) ,
178183 } ) ;
179184
180185it . live ( "runs a single turn end-to-end and persists checkpoint state in sqlite + git" , ( ) =>
@@ -755,6 +760,7 @@ it.live("reverts to an earlier checkpoint and trims checkpoint projections + git
755760 commandId : "cmd-turn-start-revert-1" ,
756761 messageId : "msg-user-revert-1" ,
757762 text : "First edit" ,
763+ createdAt : "2026-02-24T10:04:59.900Z" ,
758764 } ) ;
759765
760766 yield * harness . waitForThread (
@@ -813,6 +819,7 @@ it.live("reverts to an earlier checkpoint and trims checkpoint projections + git
813819 commandId : "cmd-turn-start-revert-2" ,
814820 messageId : "msg-user-revert-2" ,
815821 text : "Second edit" ,
822+ createdAt : "2026-02-24T10:05:00.900Z" ,
816823 } ) ;
817824
818825 yield * harness . waitForThread (
0 commit comments