-
Notifications
You must be signed in to change notification settings - Fork 1.7k
cli: queue messages (json-io + interactive) with backpressure + queue UI #4826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 0cc2576 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a comprehensive message queueing system for the CLI to handle both inbound JSON-IO stdin messages and interactive user messages. The implementation adds backpressure management to ensure messages are delivered sequentially only when the extension/agent is ready to process them.
Key Changes
- Added
SequentialWorkQueueutility for reliable message delivery with retry logic and backpressure - Implemented stdin message queueing for
--json-iomode with state-aware delivery gating - Added interactive user message queueing with UI preview showing queued messages
- Integrated ESC/cancel to clear all queued messages (both outgoing and stdin)
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
cli/src/utils/sequential-work-queue.ts |
New generic work queue with retry, backpressure, and sequential processing |
cli/src/state/hooks/useStdinJsonHandler.ts |
Refactored to queue stdin messages until service is ready and agent can accept them |
cli/src/state/hooks/useOutgoingMessageQueue.ts |
New hook managing outgoing user message queue with backpressure |
cli/src/state/hooks/useMessageHandler.ts |
Updated to enqueue messages when agent is busy or not ready |
cli/src/ui/components/CommandInput.tsx |
Added UI preview box showing next queued message |
cli/src/state/atoms/queuedMessages.ts |
New atoms for queue state and clear signals |
cli/src/state/atoms/actions.ts |
Cancel action now clears all message queues |
cli/src/state/hooks/__tests__/useStdinJsonHandler.test.ts |
Added comprehensive tests for stdin queue backpressure |
cli/src/state/hooks/__tests__/useOutgoingMessageQueue.test.ts |
New tests for outgoing message queue behavior |
cli/src/ui/components/__tests__/CommandInput.test.tsx |
Updated mocks to support queue UI |
cli/src/state/atoms/__tests__/modelValidation.test.ts |
Fixed mock to preserve actual exports |
cli/src/state/atoms/__tests__/config.test.ts |
Fixed mock to preserve actual exports |
.changeset/cli-json-io-message-queueing.md |
Changeset documenting the patch |
pnpm-lock.yaml |
Dependency lock file updates |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Code Review SummaryStatus: 8 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Positive Observations
Files Reviewed (14 files)
|
Implements reliable message queueing in the CLI so clients can enqueue messages even before the extension/agent is ready.
--json-iostdin messages and deliver when the extension is ready and the agent can accept them (approval gating + backpressure).cli/docs/MESSAGE_QUEUE.mdandcli/docs/AGENT_MANAGER_JSON_IO_QUEUE_SPEC.md.Changeset included:
.changeset/cli-json-io-message-queueing.md.Out of scope: Agent manager integration