Skip to content

fix: use monotonic time for startup observation - #63

Open
ooiuuii wants to merge 1 commit into
tt-a1i:mainfrom
ooiuuii:fix/startup-observation-monotonic-clock
Open

ooiuuii wants to merge 1 commit into
tt-a1i:mainfrom
ooiuuii:fix/startup-observation-monotonic-clock

Conversation

@ooiuuii

@ooiuuii ooiuuii commented Oct 9, 2026

Copy link
Copy Markdown

Why

Startup observation measures elapsed wait with Date.now. A forward clock adjustment can return ok:true before a child exits nonzero; a backward adjustment extends the awaited startup HTTP response. Internal workspace creation consumes this result to show or clear its startup error.

Approach

Use performance.now for the four elapsed-clock reads in the existing autostart helper. Keep observation durations, silent-start extension, exit/cancellation semantics, wall-clock timestamps and receipts unchanged. One owner file, no new abstraction or dependency.

Validation

New real HTTP/SQLite/native-PTY diagnostic on 2026-10-09, Linux Node24.19.0, main f8f1343:

  • Corrected RED 02:40:17–02:40:24 UTC: 3 failed/6 passed. Forward +60s returns success in34ms before child exits23; continuing child also returns early. Backward -2s makes normal observation2808ms instead of808ms
  • GREEN 02:40:37–02:40:43: all9 scenarios pass. Early exits detected with steady/forward/backward clocks; continuing children observe810/812/810ms; real HTTP stop settles promptly
  • Actual createApp routes, store, child and HTTP requests; only in-process Date.now is offset after an actual waitForRunExit. No system-clock change, fake PTY/fetch or provider calls
  • 24 existing focused autostart/cancellation/error tests passed; pnpm install --frozen-lockfile, pnpm check, pnpm build, git diff --check and clean-main patch application passed
  • Current CI-selected affected closure completed unchanged: 593 passed,1 failed,1 skipped across105files. The sole lifecycle-hardening descendant-cleanup assertion was freshly reproduced on clean main (10pass/1samefail). This gate is NOT green
  • One scoped review found no blockers; no subsequent source edits

The runnable nine-scenario server self-check is retained outside the production diff, under AGENTS' current runnable-demo/new-test guidance; this is not a UI-test exemption. Earlier diagnostic mistakes about stop status/timer cleanup were corrected and retained; only the corrected RED is counted.

Not run: full default pnpm test (current classifier selects affected closure), whole-project tsc, package/release/native matrix, UI walkthrough, providers, Windows/macOS/Node22/26, full clean-main suite. Silent4000ms extension and legacy polling fallback have no direct clock-adjustment case. Existing cooperative observation is not a hard real-time guarantee. Remote CI remains unverified; read-only-home warnings retained without permission changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant