fix(cli): raise readiness budget, back off progressively, name the cheap check - #14
Draft
andromarces wants to merge 1 commit into
Draft
fix(cli): raise readiness budget, back off progressively, name the cheap check#14andromarces wants to merge 1 commit into
andromarces wants to merge 1 commit into
Conversation
…eap check waitForCodor gave up after ~5s effective wait (20 attempts, flat 250ms between them), which is not enough for a cold start on Windows through Task Scheduler + PowerShell + Node + better-sqlite3 binding load. The budget is now ~60s with delay doubling from 250ms to a 1s cap, so a fast start still reports fast and a slow start is not abandoned. The failure message named "the user-service logs" even when the service had started successfully and only the probe window was too short; it now points at the cheap, accurate check instead. Claude-Session: https://claude.ai/code/session_01RjMaDN6VbJP9pdbCY6u3Hk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Installer step 4/5 (
Start Codor) fails intermittently with:...on runs where the service is in fact healthy.
waitForCodorbudgets 20 attempts with a flat 250ms sleep between them. While the port is still closed the probe fails immediately (ECONNREFUSED), so the effective wait window is ~5 seconds. That's not enough for a cold start on Windows, wherewaitForCodorruns immediately afterschtasks /Runand the service has to clear Task Scheduler launch latency, PowerShell startup, Node startup, and thebetter-sqlite3native binding load before it binds.The failure message also says "inspect the user-service logs," which is actively misleading on this path — the service started fine, only the readiness probe gave up too early.
Fix
if the port is listening, the service started — verify with \codor channels``.sleepandprobestay injected, so the change remains fully testable and adds no wall-clock time to the suite.Scope
This intentionally does not widen the probe's
Promise<boolean>contract to a discriminatedrefused | timeout | bad-responseoutcome, which would let the message name the specific failure mode. That's a larger, separate change (touchesprobeCodorStatus,waitForCodor, and every call site/test double supplying a probe) and is left as a possible follow-up if the generic message proves insufficient in practice.Testing
Windows 11 only — the readiness path itself has no macOS/Linux-specific behavior, but this wasn't cross-platform verified.
This is build- and direct-CLI-suite-baseline-verified, not an entirely passing contribution gate.
pnpm -r testcurrently fails first inpackages/adapters/antigravity(an unrelated, already-trackedinterrupted-vs-failedassertion) before it ever reachespackages/cli, so it was not used as the gate here — see the command actually run below.Result: 177 passed, 18 skipped, 5 failed — the same 5 pre-existing baseline failures on this checkout (unrelated: a POSIX-literal path fixture in
runtime-install.spec.ts, one insetup-tailscale.spec.ts, a JSON-escaping fixture and a timeout inindex.spec.ts, and an NTFS permission-bit assertion inartifact.spec.ts), no new failures. The two new readiness tests added here both pass.Added to
packages/cli/src/index.spec.ts, alongside the existingwaitForCodorcoverage:Harn
Touches
setup-verifies-codor-before-creating-pairing-code("Setup proves Codor answers before reporting readiness",setup.ts). The assumption stays true — this extends how long codor is willing to wait for that proof and clarifies the failure message; it does not remove or weaken the proof itself.