Skip to content

feat(#421): add MCP progress notifications for sequant_run - #429

Merged
admarble merged 4 commits into
mainfrom
feature/421-mcp-server-add-progress-notifications-for-sequant-
Mar 25, 2026
Merged

admarble merged 4 commits into
mainfrom
feature/421-mcp-server-add-progress-notifications-for-sequant-

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • Emit notifications/progress during phase transitions when the MCP client provides a progressToken, preventing client-side timeouts and giving real-time visibility into sequant_run execution
  • Parse PhaseSpinner stdout output (⏳ pattern) to detect phase starts and map them to progress increments
  • Backward compatible: no notifications emitted when no progressToken is provided; sendNotification failures are caught and don't abort the run

AC Coverage

AC Description Status Evidence
AC-1 Read progressToken from extra._meta?.progressToken ✅ src/mcp/tools/run.ts:384
AC-2 Phase transitions emit notifications/progress ✅ parsePhaseStart + handleOutputChunk in handler
AC-3 total = issue count × phase count ✅ src/mcp/tools/run.ts:380
AC-4 Skipped when no progressToken (backward compatible) ✅ Guard in emitProgress + onStdout/onStderr only wired when token exists
AC-5 Existing tests pass + new tests ✅ 21 new tests, 1920/1921 existing pass (1 pre-existing timeout)
AC-6 sendNotification failures caught ✅ try/catch + .catch() in emitProgress

Test plan

  • npm run build passes
  • npm run lint passes
  • 21 new progress notification tests pass (unit + integration)
  • Full test suite: 1920/1921 pass (1 pre-existing timeout in state-utils.test.ts)

Closes #421

🤖 Generated with Claude Code

Emit notifications/progress during phase transitions when client
provides a progressToken. This prevents client-side timeouts for
long-running runs and gives real-time visibility into execution
progress without polling.

- Read progressToken from extra._meta (AC-1)
- Parse PhaseSpinner output for phase start patterns (AC-2)
- Calculate total = issues × phases (AC-3)
- Skip notifications when no progressToken (AC-4)
- Catch sendNotification failures to avoid aborting runs (AC-6)
- Add onStdout/onStderr callbacks to spawnAsync for real-time parsing

Entire-Checkpoint: d02a575b0638
Replace regex-based PhaseSpinner output parsing with structured
SEQUANT_PROGRESS JSON lines emitted by the batch executor to stderr.

Fixes two gaps:
- Parallel mode: spinners are suppressed, so no progress was emitted
- Chunk boundaries: stream data events could split lines mid-pattern

The batch executor emits SEQUANT_PROGRESS:{"issue":N,"phase":"name"}
at each phase start (only when SEQUANT_ORCHESTRATOR is set). The MCP
handler parses these via a line buffer, getting exact issue numbers
instead of deducing them from a sequential step counter.
Add progress notification details to existing mcp-server.md:
- During a run: automatic progress updates, no polling needed
- MCP vs CLI table: updated progress row
- sequant_run reference: progressToken behavior
- Timeout troubleshooting: resetTimeoutOnProgress guidance
Merge CHANGELOG.md and docs/features/mcp-server.md keeping both
#421 progress notifications and #418/#420/#423 entries from main.
@admarble
admarble merged commit d21e26c into main Mar 25, 2026
4 of 5 checks passed
@admarble
admarble deleted the feature/421-mcp-server-add-progress-notifications-for-sequant- branch March 25, 2026 06:26
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.

MCP server: add progress notifications for sequant_run

1 participant