Repository navigation
Description
Two small gaps left documented by #1059's QA
1. doctor's version/auth probes can hang forever
src/commands/doctor.ts calls execSync("codex --version") and execSync("codex login status") with no timeout option. codex login status can reach the network, so a hung binary or a stalled request hangs sequant doctor with no output and no way out but Ctrl-C.
This mirrors the pre-existing getOpencodeVersion pattern, so the fix should cover both rather than only the codex pair: pass a timeout (a few seconds is plenty for --version) and treat the timeout as "not installed / not authenticated" with the existing hint.
2. templates/codex/ null-routing has no direct test
templateDestination maps templates/codex/** to null (it is rendered by writeCodexProvisioning, not copied by copyTemplates). src/lib/templates.test.ts has the equivalent case for templates/opencode/; codex has none. Today the routing is only exercised indirectly through #1059's AC-6 symlink test, which would still pass if the routing were wrong.
Neither is user-visible today. Filing so they are not lost — both are a few lines.
Release-graph plan — pre-2.16.0 blockers (2026-09-17)
Graph: pre-2.16.0 release blockers, node 3 of 4 Tier: mechanical Wave: 1
May touch: src/commands/doctor.ts, src/commands/doctor.test.ts, src/commands/doctor.integration.test.ts, src/lib/templates.test.ts, CHANGELOG.md
Confirmed 2026-09-17
src/commands/doctor.ts lines 255 / 273 / 293 — opencode --version,
codex --version, codex login status — all execSync, none with timeout. Each
already sits in a try/catch returning undefined / false, so an ETIMEDOUT lands
on the existing "not installed / not authenticated" path with its hint: the fix adds
the option and needs no new error handling.
src/lib/templates.test.ts — 16 opencode references including the direct
returns null for templates/opencode/** case at line 628; 0 codex references.
Acceptance Criteria
- AC-1: all three probes pass a
timeouttoexecSync— Evidence:grep -c "timeout:" src/commands/doctor.tsprints 3 or more (today 0) - AC-2: a hanging
codexon PATH makesgetCodexVersion()return undefined within the timeout instead of hanging — Evidence:npx vitest run src/commands/doctor.integration.test.ts -t "1075" 2>&1 | grep -E "Tests +([3-9]|[1-9][0-9]+) passed"prints a passed line (AC-2..AC-4 are three cases named with1075, each with a sleeping stub on PATH and a bounded wall-time assertion) - AC-3: a hanging
codex login statusmakesisCodexAuthenticated()return false within the timeout — Evidence: covered by the AC-2 command, as its own case - AC-4: the same treatment covers
getOpencodeVersion, not only the codex pair — Evidence: covered by the AC-2 command, as its own case - AC-5:
templateDestination("templates/codex/**")returning null has a direct test mirroring the opencode case attemplates.test.ts:628— Evidence:npx vitest run src/lib/templates.test.ts -t "codex" 2>&1 | grep -E "Tests +[1-9][0-9]* passed"prints a passed line (today: 0 matched, prints nothing) - AC-6:
CODEX_API_KEYset still short-circuits before any subprocess, value never logged — Evidence:npx vitest run src/commands/doctor.test.ts -t "1075" 2>&1 | grep -E "Tests +[1-9][0-9]* passed"prints a passed line (a unit case asserting no spawn when the env var is set)
AC-2 and AC-5 are gate tests: mutation-verify (drop the timeout option → AC-2 hangs
or fails; delete the codex routing line → AC-5 fails) and record the markers.
Placement note
Sleeping-stub cases go in doctor.integration.test.ts, not doctor.test.ts — a file
without .integration. runs under the 5s unit budget (#842) and a timeout test will
blow it.
Activity
admarble commentedon Sep 18, 2026
Runner context (2026-09-18, wave 1 of the pre-2.16.0 graph)
mainatf776158f. The files in May touch are unchanged since this plan was written, so the line references above still hold.timeout. Never background it.Mutation-verified: AC-N — <mutation>; <test> failed; restored.marker in the PR body (CLAUDE.md format, machine-anchored as<!-- SEQUANT_MUTATION: ... -->)./qa§6i enforces it.CHANGELOG.mdUnreleased entry; add yours alongside.src/commands/doctor.tsanddoctor.test.ts(local-shadow check). Do not pull it in; the second PR to land will mergeorigin/mainand re-run the doctor tests.grep -c "timeout:" src/commands/doctor.tsis still 0 onmaintoday.admarble commentedon Sep 18, 2026
/spec — Plan (#1075)
Complexity: Standard (6 ACs, 2 directories)
AC Quality Check
lintAcceptanceCriteria: 6/6 passed, 0 flagged. All six carry a declaredEvidence:clause with a runnable command. Behavior-rule detector: no AC triggers (AC-6 hitsneveronly — 1 keyword, below the 2-keyword threshold), so no Rule Touchpoints section.Scope Assessment
Non-Goals: not present as a section, but the body scopes itself explicitly ("both are a few lines", May touch list). Adequate for a mechanical node.
src/commands/,src/lib/)Verdict: ✅ SCOPE_OK
Acceptance Criteria — verification
AC-1 — three probes pass
timeouttoexecSyncVerification: Integration Test (grep gate)
Scenario: Given
doctor.ts→ Whengrep -c "timeout:"→ Then ≥3.AC-2 — hanging
codex⇒getCodexVersion()returns undefined within the timeout [GATE]Verification: Integration Test
Scenario: Given a
codexstub that sleeps 25s at the front ofPATH→ WhengetCodexVersion()→ Then returnsundefinedand elapsed < 10s.Assumptions:
execSyncinheritsprocess.env.PATH; the killed child is the direct child (stub mustexec sleep 25, not fork it, or the pipe can outlive the SIGTERM).AC-3 — hanging
codex login status⇒isCodexAuthenticated()returns falseVerification: Integration Test — Given the same stub → When
isCodexAuthenticated()→ Thenfalseand elapsed < 15s.AC-4 — same treatment for
getOpencodeVersionVerification: Integration Test — Given an
opencodestub → Thenundefinedand elapsed < 10s.AC-5 — direct null-routing test for
templates/codex/**[GATE]Verification: Unit Test —
expect(templateDestination("templates/codex/config.toml")).toBeNull()in a case whose name containscodex.AC-6 —
CODEX_API_KEYshort-circuits before any subprocess, value never loggedVerification: Unit Test — Given the env var set and
mockExecSynccleared → ThenisCodexAuthenticated()istrue,execSyncnot called, and the captured output never contains the value. Pair it with an unset-key control in the same case sonot.toHaveBeenCalled()is not vacuous.Implementation Plan
Phase 1 —
src/commands/doctor.tsPROBE_TIMEOUT_MS = 5_000(--version) andAUTH_PROBE_TIMEOUT_MS = 10_000(codex login status, which reaches the network and deserves the longer bound).timeout:to the threeexecSyncoption objects at lines 255 / 273 / 293. No new error handling — Node throwsETIMEDOUT/signal: SIGTERMinto the existingcatch, which already returnsundefined/falseand prints the install/login hint. Confirmed by reading all three catch blocks.Phase 2 —
src/commands/doctor.integration.test.ts(AC-2/3/4)3. New
describe.skipIf(process.platform === "win32")("doctor probe timeouts (#1075)", { timeout: 45_000 }, …)— three cases each naming1075. Precedent forskipIf:combined-branch-test.integration.test.ts:93.4.
beforeEachwritescodexandopencodestubs (#!/bin/sh+exec sleep 25, mode 0o755) into amkdtempdir; awithStubPath(fn)helper prepends it toPATHand restores infinally. Scope thePATHmutation to the helper, never file-levelbeforeAll— the existingruns without crashingcase spawns the realnode dist/bin/cli.js doctor, which probes both binaries; a leaked stubPATHwould make that case eat three sleeps.5. Each case asserts the return value and
Date.now() - t0 < bound. The wall-time assertion is the actual gate: a silent stub already yieldsundefinedfrom the regex miss, so the return value alone would pass even un-timed.Phase 3 —
src/lib/templates.test.ts(AC-5)6. Add
it("returns null for templates/codex/** (#1075)", …)next to the opencode case at line 628, assertingtemplates/codex/config.toml(the one real file in that tree) routes tonull.Phase 4 —
src/commands/doctor.test.ts(AC-6) +CHANGELOG.md7. Add the
1075unit case inside the existing1059 AC-4: codex CLI checksdescribe, which already saves/restoresCODEX_API_KEYinbeforeEach/afterEach.8. Add a
### Fixedbullet under[Unreleased], keeping every existing entry.Phase 5 — mutation verification (AC-2, AC-5)
9. Start from
git status --short | wc -l= 0 (commit first). AC-2: drop the threetimeout:lines → the three1075cases fail on the wall-time bound (~25s each, inside the 45s budget — they fail, they do not hang;execSyncis synchronous and vitest cannot interrupt it, which is why the stub sleeps a bounded 25s rather than forever). AC-5: deletedoctor-side linetemplates.ts:331→ the new case fails. Restore, then record bothMutation-verified: AC-N — …markers plus their<!-- SEQUANT_MUTATION: … -->anchors in the PR body. Note in the record if the AC-5 mutation also trips othertemplates.test.tscases.Design Review
doctor.ts— they already own the "binary is absent/broken ⇒ report unknown" contract; a hang is just a slower form of broken.spawnSyncwith manual kill (same semantics, more code); async/Promise.race(would ripple throughdoctorCommand's sync call sites for no user-visible gain).getOpencodeVersion's try/catch-returns-undefined shape, which the codex pair already copies — AC-4 keeps the three in lockstep rather than leaving one divergent.codex login statusthat legitimately takes 6s over a slow link must not be misreported as unauthenticated; 10s bounds the hang while leaving real headroom. And "is the wall-time assertion flaky in CI?" — the bound is 2× the timeout, and the integration project runsfileParallelism: false.Feature Quality Planning
src/commands/doctor.tsanddoctor.test.ts. Itsdoctor.tschange addscheckShadowingLocalSequantnear line 116 — well clear of 255–293 — so a textual conflict is unlikely, but the second PR to land must mergeorigin/mainand re-run the doctor tests before merge. Do not pull fix(mcp): plugin MCP server dies with CONNECTION_CLOSED when the open project has an older sequant in node_modules — npx ignores the pin and runs the local copy #1084 in.doctor.integration.test.ts; 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) and would kill them.Sibling-site scan
doctor.tshas a fourth un-timedexecSyncand there is one in an adjacent module. Neither is silently pulled in:doctor.ts:207—git log --oneline --grep=…, run once per closed issue in a loop. Local git, so low hang risk, but it is the same pattern in the same file and one extra line to fix. A 4thtimeout:still satisfies AC-1's "3 or more". → Open Question 1.src/lib/workflow/platforms/github.ts:136—execSync("gh auth status"), un-timed and network-reaching, called by doctor's own GitHub check. This is the exact failure class AC-3 fixes for codex, just one layer down, andGitHubProviderownsgh. → recommended follow-up issue, not in-scope here.system.ts:18(command -v, shell builtin) andaider.ts:166(which) are not worth changing.Open Questions
doctor.ts:207(git log) in this PR? — Recommendation: yes, one line, same file, same pattern, AC-1 still satisfied. Impact if wrong: a hung local git still hangsdoctor, just via a less likely path.AUTH_PROBE_TIMEOUT_MS = 10_000— right bound? — Recommendation: keep 10s. Impact if too short: a slow-but-working network login reports "not authenticated" and prints a misleading hint. Lowering it to 5s would shave ~5s off the suite, which is not worth a false negative.gh auth statusfollow-up now? — Recommendation: yes, one issue, linked here.Recommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning: SCOPE_OK, 6 tight evidence-bearing ACs, ~15 lines of source plus tests. testgen is deliberately skipped even though AC-2/5/6 declare unit/integration evidence: here the tests are the deliverable and are already specified down to the stub script and the assertion bounds, so generated stubs would be overwritten immediately — and
/testgenhas a record of leaving orphan stubs behind. No UI, so notestphase; no auth/secret surface beyond the existingCODEX_API_KEYnon-logging assertion, so nosecurity-review.Label Review
Current: (none)
Recommended:
planned,cli,no-browser-testReason: CLI-surface chore with no UI;
no-browser-testmakes the skippedtestphase explicit rather than inferred.Quality Loop: Won't auto-enable — SCOPE_OK.
admarble commentedon Sep 19, 2026
Runner note (2026-09-18) — §6i blocker resolved in the PR body
QA's AC_NOT_MET was driven by the two
SEQUANT_MUTATIONmarkers in PR #1091 lacking the<file> >prefix. Rewrote bothfailedTestvalues in the PR body (no code change):src/commands/doctor.integration.test.ts > doctor probe timeouts (#1075) — all 3 casessrc/lib/templates.test.ts > templates > templateDestination > returns null for templates/codex/** (#1075)Re-ran §6i's
parseMutationMarkers(prBody, diffTestFiles)against the live body: AC-2 valid, AC-5 valid (the original body reproducestest_not_in_difffor both, so the finding was real). All six AC evidence commands re-run by the runner in the worktree: AC-14, AC-2/3/43 passed, AC-51 passed, AC-61 passed.Still open from the PR body: three unidentified full-suite failures; the runner is settling them against
mainnow.github.ts:136follow-up left for the human to decide.admarble commentedon Sep 19, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
AC coverage: 0/2 met
Gaps:
Suggestions:
gh auth statusfollow-up the PR body promises.fix(#1075): timeout the codex+opencode CLI probes; add the missing te…