Skip to content

MCP server: real-time progress reporting for workflow runs #394

Closed

Description

@admarble

MCP Server: Real-Time Progress Reporting

Depends on: #388 (async spawn — prerequisite for all approaches)
Related: #372 (MCP server), #391 (structured output), #370 (CI integration)
Priority: P2 — essential for usable MCP experience

Problem

When an MCP client calls sequant_run, the workflow can take 5–30 minutes. During that time the client has zero visibility into progress. Users see nothing — no phase updates, no issue status, no indication the server is even working. This makes the MCP server feel broken for anything beyond trivial runs.

Goal

Provide real-time progress reporting during MCP-triggered workflow runs, using protocol-appropriate mechanisms at each maturity stage.

Implementation Phases

Phase 1: Polling via sequant_status (v1 — after #388)

Prerequisite: #388 replaces spawnSync with async spawn so the server can handle concurrent requests.

Once the event loop is unblocked, MCP clients can poll sequant_status while sequant_run is in progress. The state file (.sequant/state.json) is already updated per-phase by the orchestrator, so polling gives phase-level progress with no additional server changes.

Acceptance Criteria:

  • sequant_status returns current phase and phase status while sequant_run is executing
  • State file reflects in-progress phase within seconds of phase start
  • Document recommended polling interval for MCP clients (e.g., every 10s)
  • sequant_status response includes isRunning: true indicator when a run is active

Client usage pattern:

Client: sequant_run({ issues: [42], phases: "spec,exec,qa" })
Client: sequant_status({ issue: 42 })  // poll every 10s
  → { issue: 42, status: "in_progress", currentPhase: "exec", phases: { spec: "completed", exec: "in_progress", qa: "pending" } }

Effort: Small (mostly documentation + isRunning flag)


Phase 2: MCP Notifications (v2 — protocol-native)

The MCP spec supports server-initiated notifications. This is the "right" answer — no polling, clients get pushed updates as phases complete.

Acceptance Criteria:

  • Server emits notifications/progress (or custom sequant/progress) as each phase starts and completes
  • Notification payload includes: { issue, phase, status, duration?, error? }
  • Notifications work over both stdio and SSE transports
  • Clients that don't support notifications are unaffected (graceful degradation)
  • Test coverage for notification emission timing and payload

Notification design:

// Using MCP SDK's built-in notification support
server.notification({
  method: "sequant/progress",
  params: {
    issue: 42,
    phase: "exec",
    status: "completed",
    durationSeconds: 145
  }
});

MCP SDK support: server.sendNotification() or server.notification() — verify current API against MCP TypeScript SDK docs.

Client compatibility:

  • Claude Desktop: supports server notifications
  • Cursor: supports server notifications
  • MCP Inspector: displays notifications in UI

Effort: Medium (notification emission + phase lifecycle hooks)


Phase 3: Resource Subscriptions on sequant://state (v2+)

The sequant://state MCP resource already exists (#372). Adding subscription support lets clients subscribe to state changes and receive updates whenever the state file changes.

Acceptance Criteria:

  • sequant://state resource supports MCP resource subscriptions
  • Server watches .sequant/state.json with fs.watch() and pushes updates on change
  • Debounce file watch events (state may update rapidly during phase transitions)
  • Subscription is cleaned up on client disconnect
  • Works over both stdio and SSE transports

Implementation notes:

  • Use fs.watch() (not fs.watchFile() — polling-based and slower)
  • Debounce to ~500ms to avoid flooding clients during rapid state updates
  • The resource handler already reads and returns the state file — subscription just adds the push trigger

Effort: Medium


Phase 4: Webhook Callbacks (future — for remote/CI use)

For SSE transport running on a server, webhook callbacks on phase completion would let external systems (Slack, dashboards, CI pipelines) react to workflow progress.

Acceptance Criteria:

  • sequant_run accepts optional webhookUrl parameter
  • Server POSTs phase completion events to the webhook URL
  • Payload matches notification format for consistency
  • Webhook failures are logged but don't block the workflow
  • Authentication token support for webhook endpoints

Note: This overlaps with #370 (GitHub Actions integration). Coordinate to avoid duplicate webhook infrastructure.

Effort: Medium


Recommended Rollout

Phase When Depends On Value
1. Polling Immediately after #388 #388 (async spawn) Unblocks basic progress visibility
2. Notifications Next iteration Phase 1 Protocol-native, no polling overhead
3. Subscriptions After Phase 2 Phase 2 Richer state visibility for dashboards
4. Webhooks When CI integration lands #370 Remote/server use cases

Phase 1 is the minimum viable solution. Phase 2 is what MCP clients (Claude Desktop, Cursor) are built to consume. Phases 3–4 are for power users and CI.

Testing Strategy

  • Phase 1: Verify sequant_status returns accurate in-progress state during a run (integration test with short-running workflow)
  • Phase 2: Verify notifications are emitted at correct lifecycle points using InMemoryTransport in unit tests
  • Phase 3: Verify file watch triggers resource update notifications (mock fs.watch)
  • Phase 4: Verify webhook POST with mock HTTP server

Activity

  1. added
    enhancement
    multi-agent
    on Mar 23, 2026
  2. admarble commented on Mar 23, 2026

    @admarble
    ContributorAuthor

    Spec Plan — #394 MCP Server: Real-Time Progress Reporting

    AC Quality Check

    The issue contains 19 AC items across 4 implementation phases. AC items lack AC-N: prefixes (reformatted below). Quality notes:

    ⚠️ Phase 1 AC-2: "State file reflects in-progress phase within seconds of phase start" — timing threshold is vague ("within seconds"). Suggest: Already true by design (StateManager writes synchronously before phase execution). Reframe as "state file is updated before phase handler starts."

    ⚠️ Phase 1 AC-3: "Document recommended polling interval" — documentation-only AC, no code verification. Suggest: Verify via presence of polling guidance in MCP tool description or README.

    ✅ Remaining AC items are clear and testable.


    Scope Assessment

    Non-Goals (from issue body)

    The issue explicitly scopes 4 phases with a recommended rollout. Phase 4 (Webhooks) is marked as "future — for remote/CI use" and overlaps with #370.

    Recommended non-goals for this implementation:

    • Phase 4 (Webhooks) — defer to separate issue, overlaps GitHub Actions integration for CI/CD-driven workflows #370
    • Custom notification method names (use MCP standard notifications/resources/updated and progress tokens)
    • Dashboard integration changes (dashboard already has its own chokidar watcher)
    • Backward-incompatible changes to sequant_status response schema

    Scope Metrics

    Metric Value Status
    Feature count 3 (polling + notifications + subscriptions) ❌
    AC items 14 (excluding Phase 4) ❌
    Directory spread 2 (src/mcp/, src/lib/workflow/) ✅

    Scope Verdict

    ❌ SCOPE_SPLIT_RECOMMENDED — This issue bundles 4 distinct features. Recommendation: Implement Phase 1 only in this issue. Phase 2 (notifications) and Phase 3 (subscriptions) should be separate issues.

    However, the issue itself defines a phased rollout and explicitly notes "Phase 1 is the minimum viable solution." I recommend implementing Phase 1 only in this PR, with Phase 2 and Phase 3 as follow-up issues.


    Acceptance Criteria (Phase 1 Only)

    AC-1: sequant_status returns current phase and phase status while sequant_run is executing

    Verification Method: Integration Test

    Test Scenario:

    Integration Points: StateManager, sequant_run async spawn, sequant_status tool

    Assumptions to Validate:

    AC-2: State file reflects in-progress phase within seconds of phase start

    Verification Method: Integration Test (same test as AC-1)

    Test Scenario:

    • Given: Workflow orchestrator starts a phase
    • When: Phase transitions to in_progress
    • Then: .sequant/state.json contains the updated phase status

    Note: This is already true — batch-executor.ts calls manager.updatePhaseStatus() before executePhaseWithRetry(). This AC validates existing behavior works end-to-end through MCP.

    AC-3: Document recommended polling interval for MCP clients

    Verification Method: Manual Test

    Test Scenario:

    • Given: sequant_status tool registration
    • When: MCP client discovers tool
    • Then: Tool description includes polling guidance (e.g., "Poll every 5-10 seconds during active runs")

    AC-4: sequant_status response includes isRunning: true indicator when a run is active

    Verification Method: Integration Test

    Test Scenario:

    • Given: A sequant_run is actively executing (tracked via in-memory run registry)

    • When: Client calls sequant_status({ issue: 42 })

    • Then: Response JSON includes "isRunning": true

    • Given: No sequant_run is executing

    • When: Client calls sequant_status({ issue: 42 })

    • Then: Response JSON includes "isRunning": false

    Integration Points: New run-tracking mechanism needed (see implementation plan)


    Derived ACs

    Source Derived AC Priority
    Architecture AC-5: Active run registry tracks spawned processes by issue number High
    Error Handling AC-6: isRunning returns false if run process has exited but state wasn't cleaned up Medium
    Test Coverage AC-7: Integration test verifying concurrent status polling during active run High

    Implementation Plan

    Phase 1: Active Run Registry (AC-4, AC-5, AC-6)

    1. Create run registry module (src/mcp/run-registry.ts)

      • In-memory Map<number, { pid: number; startedAt: string }> tracking active runs by issue number
      • registerRun(issue, pid) / unregisterRun(issue) / isRunning(issue) / getActiveRuns()
      • Module-level singleton (same process = same registry)
    2. Wire registry into sequant_run (src/mcp/tools/run.ts)

      • Call registerRun() after successful spawn
      • Call unregisterRun() in the settlement function (on close, error, abort, timeout)
      • Handle edge case: if process exits but settlement hasn't fired yet

    Phase 2: Enhance sequant_status Response (AC-1, AC-4)

    1. Add isRunning to status response (src/mcp/tools/status.ts)

      • Import isRunning() from run registry
      • Add isRunning: isRunning(issue) to response JSON
      • Return isRunning: false for untracked issues
    2. Update tool description (src/mcp/tools/status.ts)

      • Add polling guidance: "Poll every 5-10 seconds during active runs for phase-level progress updates"

    Phase 3: Documentation (AC-3)

    1. Update MCP server docs — add "Polling for Progress" section explaining the sequant_status polling pattern with recommended interval

    Phase 4: Tests (AC-7)

    1. Integration tests (src/mcp/server-extended.test.ts or new src/mcp/tools/status.test.ts)
      • Test: isRunning: true when run is active (mock spawn that doesn't close)
      • Test: isRunning: false when no run active
      • Test: isRunning: false after run completes
      • Test: concurrent sequant_status calls during active sequant_run
      • Test: run registry cleanup on abort/timeout

    Parallel Groups

    [Phase 1] ──→ [Phase 2] ──→ [Phase 4]
                       ↓
                  [Phase 3] (parallel with Phase 4)
    

    Conflict Risk Analysis

    In-flight work detected:

    Overlapping files:

    Recommended approach:


    Dependencies

    Depends on: #388 (async spawn) — Status: CLOSED (merged) ✅


    Feature Quality Planning

    Completeness Check

    • All AC items have corresponding implementation steps
    • Integration points: run registry ↔ run tool ↔ status tool
    • No partial implementations planned
    • State management: leverages existing StateManager, adds in-memory run tracking

    Error Handling

    • Registry handles process exit without explicit unregister (settlement always fires)
    • isRunning returns false for untracked issues (not an error)
    • Race condition: status called between spawn and register → isRunning: false (acceptable, next poll catches it)

    Code Quality

    • Types: ActiveRun interface for registry entries
    • Follows existing tool registration pattern
    • No magic strings — reuse existing status types
    • Module singleton pattern matches existing codebase conventions

    Test Coverage Plan

    • Integration tests for isRunning lifecycle
    • Edge case: concurrent runs for same issue (last-write-wins in registry)
    • Edge case: status call for issue with completed-but-not-cleaned state
    • Mock strategy: mock spawn (existing pattern), real registry

    Best Practices

    • No new dependencies required
    • Backward compatible — adds field to existing response, doesn't remove any
    • Logging: registry operations logged at debug level

    Open Questions

    1. Should isRunning be per-issue or server-wide?

      • Recommendation: Per-issue (query by issue number). Add activeRuns: number to a future sequant_server_info tool for server-wide view.
      • Impact: Low — easy to add server-wide later.
    2. Should Phase 2 (notifications) and Phase 3 (subscriptions) be filed as separate issues now?

      • Recommendation: Yes, file #394a and #394b after this PR merges.
      • Impact: Keeps this PR focused and reviewable.
    3. Should the run registry persist across server restarts?

      • Recommendation: No — in-memory only. On restart, all runs are "not running." The state file still shows phase progress.
      • Impact: If server crashes mid-run, isRunning will be false but state shows in_progress. Acceptable — state reconciliation already handles this.

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: disabled
    Reasoning: Well-defined Phase 1 scope with clear AC. Small change footprint (new module + 2 modified files). No UI components. Dependency #388 is merged. Wait for #389/#391 to merge before starting exec to minimize conflicts.


    Label Review

    Current: enhancement, multi-agent
    Recommended: enhancement, multi-agent, mcp
    Reason: All changes are in src/mcp/ — mcp label aids filtering

    → gh issue edit 394 --add-label mcp


    Effort Estimate

    Step Effort
    Run registry module Small
    Wire into run tool Small
    Enhance status response Small
    Documentation Small
    Tests Medium
    Total Small-Medium
  3. added
    planned
    on Mar 23, 2026
  4. added a commit that references this issue on Mar 23, 2026
  5. admarble commented on Mar 23, 2026

    @admarble
    ContributorAuthor

    Exec Phase — Progress Update

    AC Coverage

    AC Source Description Status
    AC-1 Original sequant_status returns current phase during run ✅ Implemented
    AC-2 Original State file reflects in-progress phase ✅ Already true (existing behavior validated)
    AC-3 Original Document recommended polling interval ✅ Implemented
    AC-4 Original isRunning indicator in status response ✅ Implemented
    AC-5 Derived Active run registry tracks by issue number ✅ Implemented
    AC-6 Derived isRunning: false after process exits ✅ Implemented
    AC-7 Derived Integration test for concurrent polling ✅ Implemented

    Key Files Changed

    File Change
    src/mcp/run-registry.ts New — in-memory active run registry (singleton)
    src/mcp/run-registry.test.ts New — unit tests for registry
    src/mcp/tools/run.ts Wire registerRun/unregisterRun around spawn
    src/mcp/tools/status.ts Add isRunning field + polling guidance in description
    src/mcp/server-extended.test.ts Integration tests for isRunning lifecycle
    CHANGELOG.md Unreleased entry for #394

    Quality Gates

    Check Result
    npm run build ✅ Pass
    npm run lint ✅ Pass (0 errors, 0 warnings)
    npm test ✅ 1803 tests pass (78 files)

    Quality Plan Alignment

    Quality Dimension Items Addressed Notes
    Error Handling 2/2 Registry handles untracked issues; finally block ensures cleanup
    Test Coverage 3/3 Unit + integration + lifecycle tests
    Code Quality 2/2 TypeScript types, singleton pattern matches codebase
    Best Practices 1/1 Backward compatible, no new deps

    Derived ACs: 3/3 addressed

    PR

    ✅ Created: #408

  6. admarble commented on Mar 23, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #394

    AC Coverage

    AC Source Description Status Notes
    AC-1 Original sequant_status returns current phase during run MET StateManager reads .sequant/state.json which is updated by batch-executor before phase execution. Integration test confirms.
    AC-2 Original State file reflects in-progress phase within seconds MET Already true by design — batch-executor.ts calls updatePhaseStatus() before phase handler. Validated end-to-end.
    AC-3 Original Document recommended polling interval MET Tool description: "Poll every 5-10 seconds during active runs for phase-level progress updates." Integration test verifies description text.
    AC-4 Original isRunning: true indicator when run is active MET isRunning field added to both tracked and untracked issue responses. Registry-backed via run-registry.ts.
    Derived ACs
    AC-5 Derived (Architecture) Active run registry tracks by issue number MET run-registry.ts singleton with Map<number, ActiveRun>. Register before spawn, unregister in finally.
    AC-6 Derived (Error Handling) isRunning: false after process exits MET finally block ensures unregisterRun runs on success, error, and abort paths. Unit tests confirm.
    AC-7 Derived (Test Coverage) Integration test for concurrent polling MET server-extended.test.ts tests mid-run status polling with mock process, verifies lifecycle transition.

    Coverage: 7/7 AC items fully met
    Original ACs: 4/4 met
    Derived ACs: 3/3 met


    Quality Plan Verification

    Dimension Items Planned Items Addressed Status
    Completeness 4 4 ✅ Complete
    Error Handling 2 2 ✅ Complete
    Code Quality 4 4 ✅ Complete
    Test Coverage 3 3 ✅ Complete
    Best Practices 3 3 ✅ Complete

    Derived ACs: 3/3 addressed
    Quality Plan Status: Complete


    CI Status

    No CI checks configured for this repository.


    Quality Metrics

    Metric Value Status
    Type issues (any) 0 OK
    Deleted tests 0 OK
    Files changed 6 OK
    Lines added +256 -
    Lines deleted -1 -

    Build Verification

    N/A — Build passed (npm run build exits 0)


    Test Coverage Analysis

    Changed File Tier Has Tests? Test File
    src/mcp/run-registry.ts Standard ✅ Yes src/mcp/run-registry.test.ts
    src/mcp/tools/run.ts Standard ✅ Yes __tests__/mcp-run-async.test.ts, src/mcp/server-extended.test.ts
    src/mcp/tools/status.ts Standard ✅ Yes src/mcp/server-extended.test.ts
    CHANGELOG.md Optional N/A -

    Coverage: 3/3 changed source files have corresponding tests
    Critical paths without tests: None


    Code Review

    Strengths:

    • Clean module-level singleton pattern for run registry — matches codebase conventions
    • finally block ensures cleanup on all exit paths (success, error, abort, timeout)
    • isRunning added to both tracked and untracked responses — consistent API
    • Integration test covers the full lifecycle: register → poll mid-run → complete → verify cleanup
    • Backward compatible — adds isRunning field without changing existing response shape

    Issues:

    • Minor: registerRun(issue, process.pid) at run.ts:82 stores the MCP server's own PID, not the spawned child's PID. The child PID isn't available until spawnAsync starts internally. Functionally harmless since isRunning() only checks map presence, but the pid field in ActiveRun is misleading. Consider renaming to serverPid or deferring PID capture.

    Suggestions:

    • None blocking. The PID issue is cosmetic and could be addressed in a follow-up if ActiveRun.pid is ever used for process management.

    Test Quality Review

    Category Status Notes
    Behavior vs Implementation ✅ OK Tests assert on isRunning output, not registry internals
    Coverage Depth ✅ OK Unit tests cover register, unregister, concurrent, replace, clear; integration covers lifecycle
    Mock Hygiene ✅ OK Only mocks child_process.spawn (external dependency)
    Test Reliability ✅ OK Uses setTimeout(r, 10) for event loop tick — minimal timing sensitivity

    Anti-Pattern Detection

    Dependency Audit

    N/A — No dependency changes

    Code Patterns

    No anti-patterns detected:

    • No await in loops (the for..of loops in run.ts are synchronous registerRun/unregisterRun calls)
    • No empty catch blocks
    • No hardcoded secrets
    • No uncleared intervals/timeouts

    Call-Site Review

    New exported functions detected: 5

    Function Call Sites Loop? Conditions AC Match
    registerRun() run.ts:82 Yes (for..of issues) Before spawn ✅ Correct — registers all issues before execution
    unregisterRun() run.ts:141 Yes (for..of issues) In finally block ✅ Correct — cleanup on all paths
    isRunning() status.ts:53, status.ts:69 No In both tracked/untracked responses ✅ Matches AC-4
    getActiveRuns() Tests only - - ✅ OK — internal API for testing
    clearRegistry() Tests only - - ✅ OK — @internal testing utility

    Findings: All call sites match AC constraints. No issues.


    Execution Evidence

    N/A — No scripts changed. MCP tool changes verified via integration tests.

    Skill Command Verification

    N/A — No skill files changed.

    CLI Registration Verification

    N/A — No option interface changes.

    Smoke Test

    Not Required — No workflow-affecting changes (no skills, scripts, or CLI changes).


    CHANGELOG Verification

    Check Status
    CHANGELOG.md exists ✅ Found
    User-facing changes ✅ Yes (feat commit)
    [Unreleased] entry ✅ Present
    Entry format ✅ Valid — includes (#394), action verb, sub-bullets

    Result: CHANGELOG requirements met


    Self-Evaluation

    • Verified working: Yes — integration tests exercise the full register → poll → complete lifecycle through MCP server transport
    • Test efficacy: High — tests catch registry lifecycle bugs, missing isRunning field, and cleanup failures
    • Likely failure mode: Registry state leak if finally block doesn't fire (e.g., process crash). Acceptable — in-memory registry is ephemeral by design, and server restart clears all state.
    • Verdict confidence: High — small, well-scoped change with thorough test coverage

    Verdict: READY_FOR_MERGE

    All 7 AC items (4 original + 3 derived) are met. Implementation is clean, backward compatible, and well-tested. The minor PID semantics issue is cosmetic and doesn't affect functionality.

    Documentation

    • CHANGELOG entry added
    • N/A — No new CLI flags or user-facing docs needed (MCP tool description serves as documentation)

    Next Steps

    1. Merge PR feat(#394): MCP real-time progress reporting for workflow runs #408
    2. File follow-up issues for Phase 2 (MCP notifications) and Phase 3 (resource subscriptions) per spec recommendation

    Documentation: Before merging, run /docs 394 to generate feature documentation.

  7. added
    ready-for-review
    on Mar 23, 2026
  8. added a commit that references this issue on Mar 24, 2026
  9. admarble commented on Mar 24, 2026

    @admarble
    ContributorAuthor

    Merge Resolution Complete

    Branch rebased onto current main (was 7 commits behind). Resolved conflicts in 3 files:

    File Resolution
    src/mcp/tools/run.ts Integrated registerRun/unregisterRun calls into the updated async handler with resolveCliBinary (#389) and structured output (#391)
    src/mcp/server-extended.test.ts Added both existsSync import (#389) and run-registry imports (#394)
    CHANGELOG.md Kept both #394 and #391 entries

    Build: Passes
    Tests: 84/84 MCP-related tests pass

    Ready for /qa 394.

  10. admarble commented on Mar 24, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #394

    AC Coverage

    AC Source Description Status Notes
    AC-1 Original sequant_status returns current phase during run MET StateManager reads .sequant/state.json which is updated by batch-executor before phase execution. Integration test confirms via MCP transport.
    AC-2 Original State file reflects in-progress phase within seconds MET Already true by design — batch-executor.ts calls updatePhaseStatus() before phase handler. Validated end-to-end.
    AC-3 Original Document recommended polling interval MET Tool description: "Poll every 5-10 seconds during active runs for phase-level progress updates." Integration test verifies description text (server-extended.test.ts:510).
    AC-4 Original isRunning: true indicator when run is active MET isRunning field added to both tracked and untracked issue responses. Registry-backed via run-registry.ts.
    Derived ACs
    AC-5 Derived (Architecture) Active run registry tracks by issue number MET run-registry.ts singleton with Map<number, ActiveRun>. Register before spawn, unregister in finally.
    AC-6 Derived (Error Handling) isRunning: false after process exits MET finally block ensures unregisterRun runs on success, error, and abort paths. Unit tests confirm.
    AC-7 Derived (Test Coverage) Integration test for concurrent polling MET server-extended.test.ts:456-502 tests mid-run status polling with mock process, verifies lifecycle transition.

    Coverage: 7/7 AC items fully met
    Original ACs: 4/4 met
    Derived ACs: 3/3 met


    Quality Plan Verification

    Dimension Items Planned Items Addressed Status
    Completeness 4 4 ✅ Complete
    Error Handling 2 2 ✅ Complete
    Code Quality 4 4 ✅ Complete
    Test Coverage 3 3 ✅ Complete
    Best Practices 3 3 ✅ Complete

    Derived ACs: 3/3 addressed
    Quality Plan Status: Complete


    CI Status

    Check State Conclusion Impact
    build (20.x) COMPLETED SUCCESS ✅ MET
    build (22.x) COMPLETED SUCCESS ✅ MET
    validate-skills COMPLETED SUCCESS ✅ MET
    typecheck COMPLETED SUCCESS ✅ MET
    validate-plugin COMPLETED SUCCESS ✅ MET

    CI Summary: 5 passed, 0 pending, 0 failed


    Stale Branch Check

    Check Value
    Commits behind main 0
    Threshold 5
    Status ✅ OK

    Quality Metrics

    Metric Value Status
    Type issues (any) 0 OK
    Deleted tests 0 OK
    Files changed 6 OK
    Lines added +256 -
    Lines deleted -2 -

    Build Verification

    N/A — Build passed (npm run build exits 0)


    Test Coverage Analysis

    Changed File Tier Has Tests? Test File
    src/mcp/run-registry.ts Standard ✅ Yes src/mcp/run-registry.test.ts
    src/mcp/tools/run.ts Standard ✅ Yes src/mcp/server-extended.test.ts
    src/mcp/tools/status.ts Standard ✅ Yes src/mcp/server-extended.test.ts
    CHANGELOG.md Optional N/A -

    Coverage: 3/3 changed source files have corresponding tests
    Critical paths without tests: None


    Code Review

    Strengths:

    • Clean module-level singleton pattern for run registry — matches codebase conventions
    • finally block ensures cleanup on all exit paths (success, error, abort, timeout)
    • isRunning added to both tracked and untracked responses — consistent API surface
    • Integration test covers full lifecycle: register → poll mid-run → complete → verify cleanup
    • Backward compatible — adds isRunning field without changing existing response shape
    • No new dependencies

    Issues:

    • Minor: registerRun(issue, process.pid) at run.ts:338 stores the MCP server's own PID, not the spawned child's PID. The child PID isn't available until spawnAsync starts internally. Functionally harmless since isRunning() only checks map presence, but the pid field in ActiveRun is misleading. Consider renaming to serverPid or documenting the limitation.

    Suggestions:

    • None blocking. The PID semantics issue is cosmetic and could be addressed in a follow-up if ActiveRun.pid is ever used for process management.

    Test Quality Review

    Category Status Notes
    Behavior vs Implementation ✅ OK Tests assert on isRunning output and MCP response shape, not registry internals
    Coverage Depth ✅ OK Unit: register, unregister, concurrent, replace, clear. Integration: full lifecycle via MCP transport
    Mock Hygiene ✅ OK Only mocks child_process.spawn (external dependency)
    Test Reliability ✅ OK Uses setTimeout(r, 10) for event loop tick — minimal timing sensitivity

    Anti-Pattern Detection

    Dependency Audit

    N/A — No dependency changes

    Code Patterns

    No anti-patterns detected:

    • No await in loops
    • No empty catch blocks
    • No hardcoded secrets
    • No uncleared intervals/timeouts

    Critical Issues: 0
    Warnings: 0


    Call-Site Review

    New exported functions detected: 5

    Function Call Sites Loop? Conditions AC Match
    registerRun() run.ts:338 Yes (for..of issues) Before spawn ✅ Correct — registers all issues before execution
    unregisterRun() run.ts:404 Yes (for..of issues) In finally block ✅ Correct — cleanup on all paths
    isRunning() status.ts:53, status.ts:69 No In both tracked/untracked responses ✅ Matches AC-4
    getActiveRuns() Tests only - - ✅ OK — internal API for testing
    clearRegistry() Tests only - - ✅ OK — @internal testing utility

    Findings: All call sites match AC constraints. No issues.


    Execution Evidence

    N/A — No scripts changed. MCP tool changes verified via integration tests.

    Skill Command Verification

    N/A — No skill files changed.

    CLI Registration Verification

    N/A — No option interface changes.

    Smoke Test

    Not Required — No workflow-affecting changes (no skills, scripts, or CLI changes).


    CHANGELOG Verification

    Check Status
    CHANGELOG.md exists ✅ Found
    User-facing changes ✅ Yes (feat commit)
    [Unreleased] entry ✅ Present
    Entry format ✅ Valid — includes (#394), action verb, sub-bullets

    Result: CHANGELOG requirements met


    Self-Evaluation

    • Verified working: Yes — 67/67 MCP tests pass including full register → poll → complete lifecycle through InMemoryTransport
    • Test efficacy: High — tests catch registry lifecycle bugs, missing isRunning field, and cleanup failures
    • Likely failure mode: Registry state leak if finally block doesn't fire (e.g., process crash). Acceptable — in-memory registry is ephemeral by design, server restart clears all state.
    • Verdict confidence: High — small, well-scoped change with thorough test coverage. CI green.

    Verdict: READY_FOR_MERGE

    All 7 AC items (4 original + 3 derived) are met. Implementation is clean, backward compatible, and well-tested. CI is 5/5 green. The minor PID semantics note is cosmetic and doesn't affect functionality.

    Documentation

    • CHANGELOG entry added
    • N/A — No new CLI flags or user-facing docs needed (MCP tool description serves as documentation)

    Next Steps

    1. Merge PR feat(#394): MCP real-time progress reporting for workflow runs #408
    2. File follow-up issues for Phase 2 (MCP notifications) and Phase 3 (resource subscriptions) per spec recommendation

    Documentation: Before merging, run /docs 394 to generate feature documentation.

  11. added 2 commits that reference this issue on Mar 24, 2026
  12. admarble commented on Mar 24, 2026

    @admarble
    ContributorAuthor

    Documentation Updated

    File: docs/features/mcp-server.md (existing file updated — no new file needed)

    Changes:

    • Added sequant_status response field table (matching sequant_run response table style)
    • Documented isRunning field with polling guidance (5–10 second interval)
    • Updated "Nothing happens for a long time" troubleshooting to reference isRunning
    • Updated "MCP vs CLI" comparison table for progress reporting
    • Removed misleading pid field from run registry (code cleanup)
    • Added MCP server: real-time progress reporting for workflow runs #394 to provenance line

    Sections Updated:

    • Tools Reference → sequant_status (response table + polling)
    • MCP vs CLI (progress column)
    • Troubleshooting → "Nothing happens for a long time"

    Quality Check:

    • Documentation is operational (how to poll, not how the registry works)
    • Response fields documented in table format
    • Polling interval guidance included
    • Troubleshooting updated
    • Provenance line updated

    Ready to merge!

  13. added a commit that references this issue on Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementmulti-agentplannedready-for-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions