Fix /restart after ACP initialization failure - #548
Open
Kai Tao (vanzue) wants to merge 3 commits into
Open
Conversation
Keep restart event forwarding independent from the ACP connection task so /restart can recover after handshake failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a recovery dead-end in the WTA helper when ACP initialization fails by keeping /restart forwarding alive independently of the ACP client task, allowing Windows Terminal to force-restart the entire agent stack even after the ACP task has exited.
Changes:
- Moved
/restartevent forwarding out ofrun_acp_client_over_pipeinto a dedicated forwarder task that survives ACP initialization failure. - Updated helper/app wiring to spawn the restart forwarder outside the ACP connection lifecycle.
- Added a unit test ensuring restart forwarding works without an active ACP connection.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tools/wta/src/protocol/acp/client.rs | Introduces the standalone restart forwarder + adds a test; removes /restart handling from the ACP select loop. |
| tools/wta/src/helper/runtime.rs | Spawns the restart forwarder alongside channel creation so it survives master/ACP failures. |
| tools/wta/src/app.rs | Removes deferred restart receiver plumbing and spawns the restart forwarder when rebuilding ACP channels post-failure. |
| tools/wta/src/app_events.rs | Drops the now-removed restart_rx field from deferred ACP parameter initialization. |
Resolve the ACP client test import conflict while retaining both restart recovery coverage and the latest model usage tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8e3f0dba-54bd-41a6-8b79-117e2c108693
Use a Send-capable Tokio task and avoid logging custom agent command arguments that may contain credentials. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8e3f0dba-54bd-41a6-8b79-117e2c108693
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (1)
tools/wta/src/helper/runtime.rs:461
- The comment says the ACP client forwards /restart to C++, but restart forwarding is now handled by the independent forwarder (outside the ACP task). Updating this comment will avoid confusion about which component is responsible for publishing
restart_agent_stack.
// /restart channel: App emits a RestartRequest, the ACP client
// forwards to C++ independently of the ACP connection. Keeping
// this receiver outside the ACP task preserves recovery after a
// handshake failure.
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.
Summary
/restartevent forwarding alive independently of the ACP connection taskrestart_agent_stackafter ACP initialization exitsRoot cause
When ACP initialization failed,
run_acp_client_over_pipereturned and droppedrestart_rx. The UI still changed toConnecting("Restarting agent..."), but its restart send targeted the closed channel and the error was ignored, leaving the pane stuck indefinitely.Validation
cargo test --manifest-path tools\wta\Cargo.toml(1321 passed)session/newsucceeded