@@ -16,6 +16,8 @@ import { describe, expect, it } from "vitest";
1616const ASSERTIONS_SCRIPT = "scripts/e2e/lib/kitchen-sink-plugin/assertions.mjs" ;
1717const BASH_BIN = process . platform === "win32" ? "bash" : "/bin/bash" ;
1818const SWEEP_SCRIPT = "scripts/e2e/lib/kitchen-sink-plugin/sweep.sh" ;
19+ // The shim waits for an explicit log-ready marker; this only bounds a broken fixture process.
20+ const FIXTURE_READY_WAIT_ATTEMPTS = process . env . CI ? 2_000 : 1_000 ;
1921const REQUIRED_FULL_DIAGNOSTIC_CANARIES = [
2022 "agent tool result middleware must be a function" ,
2123 "trusted tool policy registration requires id, description, and evaluate()" ,
@@ -843,6 +845,7 @@ exit "$status"
843845 const fixtureDir = path . join ( scratchRoot , "clawhub-fixture" ) ;
844846 const nodeShim = path . join ( fakeBin , "node" ) ;
845847 const sleepShim = path . join ( fakeBin , "sleep" ) ;
848+ const fixtureReadyPath = path . join ( parent , "fixture-log-ready" ) ;
846849 try {
847850 mkdirSync ( fakeBin , { recursive : true } ) ;
848851 mkdirSync ( fixtureDir , { recursive : true } ) ;
@@ -853,6 +856,7 @@ exit "$status"
853856 "printf 'DO_NOT_DUMP_CLAWHUB_PREFIX\\n'" ,
854857 "head -c 2048 /dev/zero | tr '\\0' x" ,
855858 "printf '\\nFIXTURE_TAIL_MARKER\\n'" ,
859+ ': >"$FIXTURE_READY_PATH"' ,
856860 "/bin/sleep 30" ,
857861 "" ,
858862 ] . join ( "\n" ) ,
@@ -862,8 +866,8 @@ exit "$status"
862866 sleepShim ,
863867 [
864868 "#!/usr/bin/env bash" ,
865- " for _ in $(seq 1 50 ); do" ,
866- ' grep -q "FIXTURE_TAIL_MARKER" "$FIXTURE_DIR/clawhub-fixture.log" && exit 0' ,
869+ ' for _ in $(seq 1 "$FIXTURE_READY_WAIT_ATTEMPTS" ); do' ,
870+ ' [[ -f "$FIXTURE_READY_PATH" ]] && exit 0' ,
867871 " /bin/sleep 0.01" ,
868872 "done" ,
869873 "exit 1" ,
@@ -891,6 +895,8 @@ exit "$status"
891895 {
892896 FAKE_BIN : fakeBin ,
893897 FIXTURE_DIR : fixtureDir ,
898+ FIXTURE_READY_PATH : fixtureReadyPath ,
899+ FIXTURE_READY_WAIT_ATTEMPTS : String ( FIXTURE_READY_WAIT_ATTEMPTS ) ,
894900 SCRATCH_ROOT : scratchRoot ,
895901 } ,
896902 ) ;
0 commit comments