Repository navigation
Description
Tier: mechanical Found: 2026-09-10/11 running the wave-2 graph over MCP (#980, #990, #1024)
Why
PHASE_TIMEOUT in src/mcp/tools/run.ts is hard-coded to 1 800 000 ms and applied by spawnAsync as a no-progress kill, reset only on SEQUANT_PROGRESS lines — which exec emits only at phase boundaries. Any exec phase that takes longer than 30 minutes end-to-end is killed as "no progress", even when it is healthily running the test suite. run.timeout in .sequant/settings.json (5400 here) does not extend it. In wave 2 of sequant's own graph four exec phases died at that wall (#990 ×1, #980 ×2, #1024 ×1); two of them had already committed everything and were on their last full-suite run. Each kill costs a re-dispatch (spec context reload + worktree reuse) and, in one case (#1024), the worktree was reaped — only the branch commits survived.
The CLI path has no such wall (run.timeout governs it), so the limit is an MCP-only regression in capability for exactly the issues a runner tiers as judgment.
Proposed change
- Add
timeoutMinutes(orphaseTimeoutMs) to thesequant_runMCP input schema, bounded (e.g. 10–120 min), defaulting to the current 30; document the minimum server version in the description (NEEDS_VERIFICATION maps to ready_for_merge, blocking QA re-runs; MCP sequant_run ignores force #972 precedent: older servers drop unknown params silently). - Honour
run.timeoutfrom settings as the default when the param is absent, so the two paths agree. - Keep the no-progress semantics; optionally have exec emit a heartbeat progress line every N minutes while its agent is alive so a genuinely healthy long phase resets the watchdog and a hung one still dies.
Scope
- may touch:
src/mcp/tools/run.ts(schema,PHASE_TIMEOUT→ resolved value),src/mcp/tools/run.test.ts,docs/reference/mcp-server.md(or whereversequant_runparams are documented),CHANGELOG.md(one bullet). - not in scope: the CLI's
run.timeoutsemantics; exec-phase progress events (separate, optional follow-up).
Acceptance criteria
- AC-1:
sequant_runacceptstimeoutMinutes; a value outside the bound is rejected with a clear error — Verify:npx vitest run src/mcp/tools/run.test.ts -t "timeoutMinutes"→ accepted 45 forwards a 2 700 000 ms wall tospawnAsync; 5 and 500 are rejected. - AC-2: with the param absent, the wall equals
run.timeoutfrom settings when set, else 30 minutes — Verify:npx vitest run src/mcp/tools/run.test.ts -t "default wall". - AC-3: the tool description names the minimum server version that honours the param — Verify:
grep -c "timeoutMinutes" src/mcp/tools/run.ts≥ 2 (schema + description). - AC-4: documented — Verify:
grep -rc "timeoutMinutes" docs/reference/ CHANGELOG.md≥ 2. - AC-5: suite green — Verify:
npm run build && npm test.
Related: #435 (progress notifications — the reset mechanism this relies on), #508 (in-process engine would remove the subprocess wall entirely), #1032 (the background-task stranding that shared the symptom).
Activity
admarble commentedon Sep 11, 2026
Complexity: Standard (5 ACs, 3 directories)
AC Quality Check
— Verify:clauses, not the houseEvidence:format the AC parser scans for (constitution §2). None register as declared evidence, soextractAcceptanceCriteriafalls back to keyword inference — which resolves all 5 tomanualinstate.json. Doesn't block planning (each Verify command is concrete and automatable); flagging so a future pass can rewrite them asEvidence:clauses for automation.grep -c "timeoutMinutes" src/mcp/tools/run.ts≥ 2 passes as soon as the schema field exists (field name + destructuring already produce ≥2 hits) — it never actually confirms a version string was written. See Open Questions.docs/reference/exists but has nomcp-server.md; the realsequant_rundocs live atdocs/features/mcp-server.md(has a "Tools Reference" →sequant_runsection already). See Open Questions.Scope Assessment
Non-Goals:⚠️ Not found in issue body.
Verdict:⚠️ SCOPE_WARNING (auto-enables quality loop)
The directory-spread count is keyword-driven, not path-driven — it picked up "settings"/"test"/"docs" as directory tokens from AC prose rather than real paths. Actual touched locations:
src/mcp/tools/(run.ts, run.test.ts),docs/features/(mcp-server.md), repo root (CHANGELOG.md) — 3. Treating the 4 as a heuristic false positive, but quality loop still auto-enables since Non-Goals is genuinely missing.Note: an empty worktree already exists for this issue (
feature/1049-..., HEAD == main, no commits/diff) — leftover from a prior dispatch. Not a real conflict;/execcan reuse or recreate it.Acceptance Criteria
AC-1:
timeoutMinutesaccepted; out-of-bound rejectedVerification: Unit Test
Scenario: Given
runToolInputSchema→ When parsed withtimeoutMinutes: 45→ Then accepted and resolves to a 2,700,000ms wall passed tospawnAsync. Given5or500→ rejected at schema validation.Assumptions: zod-level
.min(10).max(120)is sufficient; no separate handler-level check needed.AC-2: default wall =
run.timeout(settings) else 30 minVerification: Unit Test
Scenario: Given
timeoutMinutesabsent andsettings.run.timeout=5400→ resolves to 5,400,000ms. Given settings unavailable → resolves to 1,800,000ms (current behavior, unchanged).Assumptions:
getSettings()already defaultsrun.timeoutto 1800s when unset (settings.numeric-guards.test.ts), so the "else 30 min" branch is mostly aboutgetSettings()itself failing (missing/corrupt.sequant/), not an unset field.AC-3: description names minimum server version
Verification: Unit Test
Scenario:
runToolInputSchema.timeoutMinutes.descriptioncontains a version string, mirroring the existingfullQaprecedent (run.test.ts:752-754, #982) — same assertion shape, not just the grep count.AC-4: documented
Verification: Manual Test (doc content check)
Scenario:
docs/features/mcp-server.md'ssequant_runTools Reference section and oneCHANGELOG.mdUnreleased/Added bullet both mentiontimeoutMinutes.AC-5: suite green
Verification: Integration Test (CI gate)
Scenario:
npm run build && npm testpasses.Implementation Plan
Phase 1: Schema + resolution (
src/mcp/tools/run.ts)getSettingsfrom../../lib/settings.js.timeoutMinutes: z.number().int().min(10).max(120).optional().describe(...)torunToolInputSchema(~L504), naming the minimum server version (mirrorfullQa's wording at ~L536).resolvePhaseTimeoutMs(timeoutMinutes, settings)helper (same "exported for testing" convention asbuildRunArgs/resolveCliBinary):timeoutMinutespresent →*60_000; elsesettings.run.timeout*1000; wrap thegetSettings()call in try/catch falling back to thePHASE_TIMEOUTconstant.timeout: PHASE_TIMEOUT(~L698) withtimeout: phaseTimeoutMs.description(~L578-583) — "up to 30 minutes" → reflects the configurable wall.Phase 2: Tests (
src/mcp/tools/run.test.ts)z.object(runToolInputSchema).safeParse(...)with 5/45/500 (mirrors thefullQalive-surface tripwire at L748).resolvePhaseTimeoutMsunit tests for both resolution branches.run.test.ts:752-754exactly.Phase 3: Docs + CHANGELOG
docs/features/mcp-server.md— extend thesequant_runTools Reference (~L219) and the "30-minute ceiling" prose (~L236).CHANGELOG.mdbullet under## [Unreleased]→### Added.Design Review
buildRunArgs, not inline in the handler closure.fullQa(feat(run): fresh-session QA — never resume the exec session into qa; expose run.fullQa (setting + --full-qa + MCP param) #982): optional zod field + version note in.describe()+ description-regex test + live-surface tripwire. Reuse that shape exactly.MAX_TOTAL_TIMEOUTtoo? Out of scope per the issue's own list; the 120-min upper bound already sits at the existing 2h absolute ceiling, so no interaction to resolve.Open Questions
docs/reference/) vs. actual doc location (docs/features/mcp-server.md). Recommendation: document at the real location per the issue's own hedge ("or wherever ... documented"); note the correction in the PR rather than blocking. Impact if unresolved: AC-4's literal command needs the path substituted before it passes.run.test.ts:752-style description assertion, since that pattern already exists for the near-identicalfullQacase. Impact if skipped: AC-3 could pass on a false positive (two bare mentions, no version string).Recommended Workflow
Phases: spec → testgen → exec → qa
Quality Loop: enabled
Reasoning: AC-1/AC-2 are Unit Test verification (schema-bound rejection; settings-driven default) — testgen stubs both before implementation, mirroring the existing
fullQascaffolding in the same file. Quality loop auto-enables from SCOPE_WARNING (missing Non-Goals).Label Review
Current: enhancement
Recommended: enhancement, planned
Reason: Standard-tier feature spec; 5 AC, no cross-cutting refactor.
Quality Loop: Will auto-enable (SCOPE_WARNING — Non-Goals missing)
→
gh issue edit 1049 --add-label plannedadmarble commentedon Sep 16, 2026
Field datapoint — the wall fired on #1059, 2026-09-15
sequant_runover MCP,phases: spec,exec,qaon #1059. spec completed in 5 minutes; exec then ran past the wall and the task died:State was left
currentPhase: exec,status: in_progress, and the worktree was reaped —/Users/tony/Projects/worktrees/feature/1059-…no longer existed afterwards.What saved the run: the exec agent had been told to commit
chore(#1059): wip checkpointroughly every 10 minutes, so three commits survived on the branch (710 insertions across init, doctor, the config template, README and five test files). A re-dispatch ofexec,qarecreated the worktree from the branch and resumed. Nothing was lost.Two things this run suggests for the configurable wall:
in_progress, and only the worktree's absence hints at what happened. Whatever the configurable wall ends up being, a distinguishable "killed at the no-progress wall" signal in the run log would save the re-dispatch guesswork.Related: #1032 (bg-task stranding, which is what the wip-checkpoint rule came from).
admarble commentedon Sep 30, 2026
New evidence (2026-09-29, field graph wave 3): the wall applies to the whole call, not to each issue.
A single
sequant_runfor #1213, #1200, #1209 and #1198 was killed at 3561 s withno progress for 1800000ms.SEQUANT_PROGRESSfrom any issue resets the one watchdog. The last reset was #1213's qa completing at 15:54Z. The #1209 and #1198 execs (started 15:40Z and 15:48Z) were still committing WIP at 16:08–16:09Z, but mid-phase commits emit no progress event, so the whole batch died at 16:24Z. Re-dispatching each as its own call worked: #1209's exec took 24 min and #1198's 16 min.So a batch dies when its quick issues finish and its long ones are still in exec, even if every exec stays under 30 min measured from its own start. That makes the optional exec heartbeat in this issue's proposal more important than the configurable wall. A heartbeat would have saved this run; a larger wall only moves the cliff. The kill's aftermath (no run log, half-deleted worktree) is filed separately as #1222.
admarble commentedon Oct 1, 2026
More evidence, 2026-10-01 (sequant 2.18.0 MCP server). Two more exec phases were killed at the 30-minute wall, this time on mechanical-tier issues, each in its own
sequant_runcall:Process timed out: no progress for 1800000ms (total elapsed: 1812209ms)... (total elapsed: 1829974ms)In both, the implementation was finished and committed early, at
chore(#N): wip checkpoint before the full suite. Exec then ran the full suite (10–13 min locally; 6–8.5 min in CI) and produced noSEQUANT_PROGRESSevents until the watchdog fired. QA never ran, and the #1263 worktree was removed by the kill cleanup (the branch survived). Both PRs were finished by hand and merged (#1266, #1267).So the wall isn't only a judgment-tier problem. Any exec that runs the full suite as its last step can hit it. Options that would have saved both runs:
SEQUANT_PROGRESSwhile a long child command runs. That would also cover fix(exec): phase agent that backgrounds the test suite and waits for a notification strands uncommitted work — block Monitor/run_in_background under the orchestrator, WIP-commit on the no-commit guard #1032's background suite.Workaround in use: a context comment telling exec not to run the full
npm test(see #1265).admarble commentedon Oct 6, 2026
Upstream note from the v2.1.287/288 assessments (#1331, #1334): Claude Code now stops background Bash commands after a time limit in unattended sessions (
-p, Agent SDK, CI, cloud). The limit is the command'stimeoutwithrun_in_background, default 30 min, max 2 h. Phase agents run as-p, so raising Sequant's no-progress wall above 30 min does not by itself keep a backgrounded test suite alive. The agent's backgrounded command also needs an explicittimeout. Account for both limits in the design.