Repository navigation
fix(#1075): timeout the codex+opencode CLI probes; add the missing templates/codex routing test - #1091
Merged
admarble merged 1 commit intoSep 19, 2026
Conversation
The three execSync probes in doctor.ts had no timeout, so a hung binary -- or a stalled network request from 'codex login status' -- hung 'sequant doctor' with no output. Each now passes a bound (5s for --version, 10s for the network-reaching login check) and lands on its existing catch, which already reports not-installed/not-authenticated with a hint. The per-issue 'git log --grep' probe gets the same treatment. Also adds the missing direct test for templates/codex/** null-routing, mirroring the opencode case. Entire-Checkpoint: c5fc39f412df
6 tasks
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.
Summary
Two small gaps left documented by #1059's QA, both a few lines.
doctor's CLI probes can no longer hang.opencode --version,codex --versionandcodex login statuseach shelled out withexecSyncand notimeout.codex login statusreaches the network, so a hung binary or a stalled request hungsequant doctorwith no output and no way out but Ctrl-C. All three now pass a bound —PROBE_TIMEOUT_MS = 5sfor the--versionpair,AUTH_PROBE_TIMEOUT_MS = 10sfor the network-reaching login check. No new error handling: Node kills the child and throwsETIMEDOUTinto each probe's existingcatch, which already returnsundefined/falseand prints the install/login hint.templates/codex/**null-routing now has a direct test, mirroring thetemplates/opencode/**case it sits next to. Previously the routing was only exercised indirectly through feat(#497): sequant init --agent codex — .agents/skills symlink, .codex hooks wrapper, doctor, README #1059's AC-6 symlink test, which would still have passed if the routing were wrong.Per the spec's Open Question 1, the fourth un-timed
execSyncin the same file — the per-issuegit log --grepatdoctor.ts:207— got the same one-line treatment. Local git, so a lower hang risk, but the same pattern in the same file.Not pulled in:
src/lib/workflow/platforms/github.ts:136(execSync("gh auth status"), un-timed and network-reaching) is the same failure class one layer down, butGitHubProviderownsgh— flagged in the spec as a recommended follow-up, deliberately out of scope here.Pre-PR AC Verification
timeouttoexecSyncgrep -c "timeout:" src/commands/doctor.ts→ 4 (was 0)codex⇒getCodexVersion()returns undefined within the timeout [GATE]doctor.integration.test.ts— 31075cases pass; suite wall time 20.03s = 5+10+5, i.e. each timeout firedcodex login status⇒isCodexAuthenticated()returns falsefalseand elapsed < 15sgetOpencodeVersionundefinedand elapsed < 10stemplateDestination("templates/codex/**")null test [GATE]templates.test.ts:640—npx vitest run src/lib/templates.test.ts -t "codex"→Tests 1 passed(was 0 matched)CODEX_API_KEYshort-circuits before any subprocess, value never loggeddoctor.test.ts—npx vitest run src/commands/doctor.test.ts -t "1075"→Tests 1 passedDerived ACs: none (spec recorded none).
Mutation verification
Both gate ACs were mutation-verified from a clean tree (
git status --short | wc -l= 0), then restored.Mutation-verified: AC-2 — deleted all
timeout: PROBE_TIMEOUT_MS/timeout: AUTH_PROBE_TIMEOUT_MSlines fromsrc/commands/doctor.ts(grep -c "timeout:"→ 0); all threedoctor probe timeouts (#1075)cases failed (Tests 3 failed | 2 skipped), test wall time rose from 20.03s to 76.25s as each probe sat through the full 25s stub sleep — AC-4's failure was the wall-time bound itself (expected 25257 to be less than 10000); restored.Mutation-verified: AC-5 — deleted
src/lib/templates.ts:331(if (normalized.startsWith(\"templates/codex/\")) return null;); exactly one test failed, the newreturns null for templates/codex/** (#1075)(expected '.claude/codex/config.toml' to be null), with53 passedand no other case affected — no blast radius; restored.The AC-2 mutation is the reason the wall-time assertion exists rather than the return value alone: a silent stub already yields
undefinedfrom the version-regex miss, so an un-timedgetCodexVersionstill returns the right value — just 25s late.Test plan
npm run buildnpm run lint--max-warnings 0)doctor.test.ts,doctor.integration.test.ts,templates.test.ts)npm test(full, once, foreground)Full-suite caveat — RESOLVED by the runner (2026-09-19)
Re-ran the full suite once more in this worktree at
64578189, foreground, nothing else running in it:Test Files 319 passed (319),Tests 6463 passed | 1 expected fail | 3 skipped, 371s, exit 0.prompt-wait.test.tsalso passes twice onmain. The three failures below were load flakes from the exec run, not this diff.Original exec-time caveat
Full-suite caveat — please read
The full suite ran once, in the foreground, in 937s:
Test Files 3 failed | 316 passed (319),Tests 3 failed | 6460 passed.None of the three are in files this PR touches — re-running all four touched files gives 118 passed, 0 failed. One of the three is identified:
src/commands/__tests__/prompt-wait.test.ts > returns 0 and prints the reply when one arrives within the window, which fails on a missing.sequant/relay/<pid>/inbox.jsonlinside asetTimeout— a relay-timer path with no coupling todoctor.tsortemplates.ts.The other two are unidentified. I piped the suite through
tail -40, so the per-fileFAILlines scrolled out of the captured log, and re-running the full suite to recover them would have hit the 30-minute phase wall with the work unpushed. They should be settled againstorigin/mainin this worktree before merge — I could not confirm they are pre-existing, only that they are outside this diff.Known gaps / notes
#1084has an open, unmerged branch also touchingsrc/commands/doctor.tsanddoctor.test.ts(checkShadowingLocalSequant, near line 116 — well clear of the 255–293 probes). Not pulled in. The second PR to land must mergeorigin/mainand re-run the doctor tests.doctor.integration.test.tson purpose: theunitproject keeps vitest's 5s default (fix(test): tsx-spawning integration tests blow vitest's 5s default — phase-registry should use the prebuilt dist like its five siblings #842), which a timeout test would blow.exec sleep 25rather than forking, so the killed child is the direct child — a grandchild would outlive the SIGTERM and hold the stdout pipe open past the timeout.PATHmutation is scoped to awithStubPathcallback, never a file-level hook: the existingruns without crashingcase spawns the real CLI and probes both binaries, so a leaked stubPATHwould make it eat three sleeps.describe.skipIf(process.platform === "win32")(the stubs are#!/bin/sh).Closes #1075