Conversation
- Add pendingReset property to AcpSession type to track async reset promises - Add setPendingReset method to AcpSessionStore interface - Create startResetIfNeeded function that returns reset promise without blocking - Update newSession and loadSession to start reset asynchronously - Update prompt method to wait for pending reset before sending first message - Add comprehensive tests for async reset behavior - All existing tests pass Co-authored-by: TimLai666 <[email protected]>
- Update docs/cli/acp.md to explain async reset behavior - Add changelog entry describing the fix and its benefits Co-authored-by: TimLai666 <[email protected]>
- Use setPendingReset to clear pending reset for consistent state management - Simplify promise void conversion in startResetIfNeeded Co-authored-by: TimLai666 <[email protected]>
- Update AcpSessionStore interface to accept null for resetPromise parameter Co-authored-by: TimLai666 <[email protected]>
Copilot
AI
changed the title
[WIP] Optimize session reset to reduce startup delay
ACP: Make --reset-session non-blocking to fix latency-sensitive client timeouts
Feb 7, 2026
TimLai666
reviewed
Feb 7, 2026
Author
這是小改,只修改了 ACP 的 session 初始化流程。 核心變更(約 144 行代碼):
影響範圍:
效果:
主要就是調整了執行順序,讓 handshake 先完成,reset 在背景執行,第一個 prompt 前才等待 reset 完成。 |
TimLai666
approved these changes
Feb 7, 2026
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.
The
--reset-sessionflag blocks the ACP initialization handshake while performingsessions.reset, causing connection failures in clients with tight startup timeouts (e.g., Zed editor).Changes
Defer reset to after handshake
newSession()andloadSession()now start reset asynchronously and return immediatelyAcpSession.pendingResetvia newsetPendingReset()methodprompt()awaits pending reset before sending first messageNew session-mapper API
startResetIfNeeded()returnsPromise<void> | nullwithout blockingresetSessionIfNeeded()preserved for backward compatibilityExample
Reset completes before first prompt preserving correctness while eliminating handshake delay.
Original prompt
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.