fix(acp): 修复 prompt 与 steering 的启动竞态 - #109
Merged
Merged
Conversation
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.
背景
PR #108 的 Ubuntu CI 连续在不同 ACP steering 兼容测试中卡到 10 分钟超时。Mini 上使用
-race -count=20 -timeout=90s可以复现相同卡死。根因不是单纯 CI 偶发:
StartPrompt在后台 goroutine 真正写出session/prompt前就返回。调用方若立即执行Steer/CancelPrompt,session/cancel可能先于 prompt 到达 Adapter 并被消费,随后原 prompt 永久等待取消。修复
StartPromptBlocks在返回started前等待session/prompt完成连接写入。Connection内部 request 路径在请求成功写入后发出 dispatch 信号。StartPrompt不会在 prompt dispatch 前返回,并验证随后的 steering 能取消正确 Run。验证
go test -race ./internal/acp -run 'Test(Claude|Codex).*SteeringFallback' -count=20 -timeout=90s可稳定复现 90s 超时。-race压测连续 30 次通过。go test ./... -count=1 -timeout=180s通过。go test -race ./... -count=1 -timeout=240s通过。go vet ./...通过。go build ./cmd/agentdock通过。