Skip to content

fix(run): add MCP fallback retry for cold-start failures (#267) - #296

Merged
admarble merged 2 commits into
mainfrom
feature/267-fix-sequant-run-fails-on-first-execution-succeeds-
Feb 19, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/267-fix-sequant-run-fails-on-first-execution-succeeds-

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • Add MCP fallback retry in executePhaseWithRetry() - when a phase fails with MCP enabled, retry once with MCP disabled
  • Wrap logWriter.initialize() in try/catch to prevent crashes from permission issues or disk errors
  • Add --no-retry CLI flag to disable retry behavior (useful for debugging)
  • Add run.retry setting for persistent configuration

Test plan

  • npm run build passes
  • npm run lint passes
  • All MCP fallback tests pass (12 tests)
  • All logWriter error handling tests pass (3 tests)
  • All run.test.ts tests pass (75 tests)

Closes #267

🤖 Generated with Claude Code

When sequant run fails on first execution due to MCP server cold-start
issues (npx caching), the phase is now retried with MCP disabled. This
handles the common pattern where npx-based MCP servers fail to initialize
on first run but work after the cache is warm.

Changes:
- Add MCP fallback retry in executePhaseWithRetry() - when a phase fails
  with MCP enabled, retry once with MCP disabled
- Wrap logWriter.initialize() in try/catch to prevent crashes from
  permission issues or disk errors
- Add --no-retry CLI flag to disable retry behavior (useful for debugging)
- Add run.retry setting for persistent configuration
- Add unit tests for retry logic and error handling

Closes #267
… tests

Export executePhaseWithRetry with dependency injection for executePhase,
enabling proper unit tests that verify actual retry behavior instead of
testing local boolean variables.

New tests verify:
- MCP fallback triggers when MCP enabled and phase fails
- No MCP fallback when MCP already disabled
- No retry when phase succeeds on first attempt
- Original error preserved when both attempts fail
- No retry when config.retry is false
- No cold-start retry when failure duration exceeds threshold
- Cold-start retry limited to MAX_RETRIES
- Warning logged when falling back to no-MCP
@admarble
admarble merged commit e21b538 into main Feb 19, 2026
6 checks passed
@admarble
admarble deleted the feature/267-fix-sequant-run-fails-on-first-execution-succeeds- branch February 19, 2026 19:38
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.

fix: sequant run fails on first execution, succeeds on retry (cold-start race)

1 participant