fix: E2E test seed session, cancel deadlock, and user_created_thread - #27
Merged
Conversation
…handling Three fixes for the Zed WebSocket sync E2E tests: 1. Seed session: Create a session in the store before Zed connects, matching HELIX_SESSION_ID (now ses_-prefixed). This mirrors production where sessions always exist before the agent connects, fixing handleUserCreatedThread "session not found" errors. 2. Cancel deadlock: In AcpThread::cancel(), drop the old send_task instead of awaiting it. The previous approach (cx.background_spawn(turn.send_task)) would deadlock if the ACP agent never responded to CancelNotification. Dropping the task triggers the existing tx-dropped handler in run_turn which emits Stopped(Cancelled). This fixes Phase 8 timeout with Claude Code. 3. Thread tracking: Only track thread_created events in threadIDs (not user_created_thread). Spontaneous threads from Zed startup shouldn't be used for test phase follow-ups. Adjusted expected interaction count from 6 to 5 to match production behavior where follow-ups update existing interactions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ions - cancel(): drop send_task instead of awaiting it to avoid deadlock when ACP agents don't respond to CancelNotification (claude-agent-acp#442, zed-industries#423) - Disable local claude-agent-acp mount in E2E test — let Zed auto-install latest from npm to match production behavior - Log claude-agent-acp version (local or npm) for debugging test failures Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Update E2E test section: 10 phases (was 7), seed session requirement, claude-agent-acp auto-install from npm, both agent rounds - Add Critical Fix #8: cancel() must drop send_task not await it - Add rebase checklist item #31 for cancel fix - Add commit history entries for seed session and cancel fixes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Even after claude-agent-acp cancel bugs are fixed, the drop approach protects against any ACP agent that doesn't properly handle CancelNotification. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2 tasks
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
Fixes the Zed WebSocket sync E2E test which has been failing in CI since the upstream merge (
ZED_COMMIT=85dc484c6e).Three root causes identified and fixed:
Seed session: The E2E test server didn't create a session in the store before Zed connected. In production, sessions always exist before the agent connects. Without a seed session,
handleUserCreatedThreadfailed with "session not found" when Zed sent spontaneoususer_created_threadevents on startup. Fixed by creating ases_-prefixed seed session matchingHELIX_SESSION_ID.Cancel deadlock:
AcpThread::cancel()awaited the old turn'ssend_taskviacx.background_spawn(), which required the ACP agent to respond toCancelNotification. Claude Code has multiple bugs where cancel doesn't cause the prompt to return (#442, #423), causingcancel()to block indefinitely. Fixed by droppingsend_taskinstead — this triggers the existingtx-dropped handler inrun_turnwhich emitsStopped(Cancelled). The cancel notification is still sent as a courtesy.Thread tracking: Spontaneous
user_created_threadevents from Zed startup were being mixed intothreadIDs[]alongsidethread_createdevents fromchat_messageresponses. Phase 2's follow-up was sent to the wrong thread. Fixed by only trackingthread_createdinthreadIDs.Additional improvements:
claude-agent-acpmount — let Zed auto-install latest from npm (matches production)claude-agent-acpversion at test start for debuggingCLAUDE.mdto e2e-test dir documenting binary freshness requirementsTest plan
E2E_AGENTS="zed-agent"— all 10 phases passE2E_AGENTS="zed-agent,claude"— all 10 phases pass for both agentscargo check -p acp_threadcompiles clean🤖 Generated with Claude Code