Conversation
`capa install` for a 65-tool / 6-server project dropped from ~62s to ~4.8s (~13x) and now shows a live "N/M validated · last-server ✓" counter instead of a static spinner. - `validateTools` groups MCP tools by server and fans out one `listTools` per server with `Promise.all`, then matches expected names against the returned set in memory. Accepts an optional `onProgress` callback and emits `validation_init` / `server_done` events. - `handleProjectConfigure` extracted into `runProjectConfigure(...)` so the existing logic can be reused with progress hooks. OAuth2 detection now runs in parallel across servers. - The endpoint emits NDJSON progress events when the client sends `Accept: application/x-ndjson`; otherwise it returns the same single JSON body as before — fully backward compatible. - The CLI's configure-tools task consumes the NDJSON stream and updates `task.output` per event, with a graceful fallback to `response.json()` for older servers. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Two issues raised by review on the streaming branch of handleProjectConfigure: 1. After `cancel()`, `controllerRef` was nulled and subsequent `emit` calls fell through to `pending.push(...)` — but `start()` will never run again, so the buffer grew unbounded for the rest of the (possibly long-running) runProjectConfigure work. 2. The `work.then(...)` completion handler called `controller.enqueue` and `controller.close` without try/catch. If the client disconnected before completion, both throw and surface as an unhandled rejection. Fix: collapse the two paths through a single `writeLine` that respects a `streamClosed` flag, set both on client cancel and on terminal write, and drop the pending buffer on cancel. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
perf(install): parallelize tool validation and stream live progress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request implements live progress streaming for the project configuration process, improving the user experience for large projects by providing real-time feedback during OAuth2 detection and tool validation. It introduces an NDJSON streaming mode to the
/api/projects/:id/configureendpoint, updates the CLI to consume and display progress events, and refactors the server-side logic to emit and handle these events. The final response payload remains unchanged for compatibility.Live progress streaming for project configuration:
Added support for NDJSON streaming in the
/api/projects/:id/configureendpoint, allowing the server to emit progress events during OAuth2 detection and tool validation. This enables clients to display live counters and status updates instead of a static spinner. [1] [2] [3] [4]Introduced the
ValidationProgressEventtype to standardize progress events emitted during tool validation, including initialization and per-server completion events.CLI enhancements for progress streaming:
Updated the CLI (
configureToolsTaskinconfigure-tools.ts) to request NDJSON streaming by setting theAcceptheader, and to consume and process the streamed progress events, rendering live progress updates in the UI. [1] [2] [3]Exported the
TaskWrappertype from the CLI UI utilities to support live task output updates during streaming. [1] [2]General improvements and refactoring:
These changes collectively provide a more responsive and informative CLI experience for users configuring projects with many tools and servers, while maintaining compatibility with existing clients.