Skip to content

Conversation

@dascard
Copy link

@dascard dascard commented Dec 12, 2025

Summary

This PR includes several ACP-related fixes and improvements:

  1. Fix single-line retry/edit returning empty content
  2. Fix ACP client variable name inconsistency
  3. Use cancel_session instead of stopping ACP client
  4. Reset sidebar state after cancellation

Problems Fixed

1. Single-line retry/edit broken

When a user message is a single line, get_current_user_request_block() returns empty content because line 755 unconditionally removes the last element:

content_lines = vim.list_slice(content_lines, 1, #content_lines - 1)

For single-line messages, this results in an empty table.

  1. ACP client stop not working
    cancel_inflight_request() calls get_registered_acp_clients() which returns M._acp_clients, but register_acp_client() stores clients in M.acp_clients. This mismatch causes the stop function to never find any clients.

  2. Full client stop causes reconnection delay
    Previously, cancellation would stop the entire ACP client process, requiring a new connection for subsequent requests.

  3. UI stuck in "generating" state after cancel
    After cancelling, the sidebar state was not properly reset.

Solution
Only slice content_lines when there are multiple lines
Use acp_clients consistently (not _acp_clients)
Use cancel_session() to cancel the current session while keeping the connection alive
Reset current_state, scroll, and clear state extmarks after cancellation
Testing
Send a single-line message → retry/edit now works
Cancel during generation → UI properly resets
Send new message after cancel → responds without reconnection delay

@guojinc guojinc force-pushed the fix/acp-improvements branch from 041cf74 to 3d176ae Compare December 15, 2025 18:50
@PeterCardenas
Copy link
Contributor

PeterCardenas commented Dec 30, 2025

part of this was superseded by #2847.

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.

2 participants