Conversation
…ex reuse CodeBuddy CLI parallel tool calls arrive as several tool_use blocks on ONE shared content-block index: intermediate blocks never receive a content_block_stop and only the final block does, while thinking deltas on other indices interleave freely. The single open-call slot mis-attributed argument fragments and miscounted completions (two starts, one counted stop), so the turn failed closed with "Coding-agent CLI ended with an incomplete tool call" 502s at message_stop — visible in Codex Desktop as reconnect banners on CodeBuddy turns that make parallel tool calls. Buffer each block under its own content-block index and emit it atomically (start, deltas, end) when it closes: at its own stop, or when a new tool_use start reuses its index — parallel argument streams are sequential, so the block open on a reused index is complete. Index-less start frames fall back to synthetic keys; index-less delta/stop frames resolve only when exactly one block is open, otherwise the turn still fails closed.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. This PR stays in draft until every box above is ticked. |
리뷰 · 우선순위 63 / 80CodeBuddy가 도구를 여러 개 한꺼번에 부르면, 턴이 502로 죽던 문제를 고치는 PR이다. 베이스는 예전 코드는 진행 중인 도구 호출을 한 칸만 기억했다. CodeBuddy는 같은 블록 번호에 도구를 여러 개 이어서 보내고, 중간 호출에는 끝(stop)을 보내지 않는다. 생각하는 내용의 조각은 다른 번호로 사이에 끼어든다. 그래서 인자 조각이 엉뚱한 호출에 붙거나, 시작은 두 번인데 끝은 한 번으로 세었다. 마지막에 "도구 호출이 안 끝났다"는 502가 났고, Codex Desktop에는 다시 연결하는 배너가 떴다. 이 PR은 블록 번호마다 호출을 따로 모아 둔다. 그 번호의 stop이 오거나, 같은 번호로 새 도구가 시작되면, 모아 둔 것을 시작, 인자, 끝 순서로 한 덩어리로 내보낸다. 아래쪽 다리는 한 번에 도구 하나만 열 수 있어서 이렇게 보낸다. 연 블록이 안 닫히면 턴을 성공으로 끝내지 않는다. 번호가 다른 호출이 겹치는 경우와, 같은 번호를 다시 쓰는 경우를 테스트로 넣었다. #5925에서 CodeBuddy 수정만 떼어 온 초안이다. 작성자는 이 두 테스트와 타입체크는 통과했다고 적었다. 더 넓은 테스트는 900초를 넘기고 실패해서, 그 결과는 통과 근거로 쓰지 않는다고 했다. 리뷰 준비 체크는 0/4다. src/adapters/coding-agent/turn.ts:453 - 도구 다리의 init 검사는 src/adapters/coding-agent/protocol.ts:438 - 같은 번호로 새 시작이 오면, 앞에 열려 있던 호출의 인자가 이미 끝났다고 보고 바로 닫는다. 2026-09-26 캡처(호출 두 개, 인자가 차례로 끝난 뒤 다음 시작)에는 맞다. 같은 번호에서 인자 조각이 겹치면 앞 호출은 그때까지 모인 조각만으로 닫히고, 뒤 조각은 다음 호출에 붙는다. 턴은 실패로 멈추지 않는다. #5925 - 그 PR은 아직 열려 있다. 이 CodeBuddy 수정과, 메인테이너의 판단이 필요한 지점 같은 번호 재사용을, 캡처처럼 인자가 항상 끝난 뒤로 볼지 정해야 한다. 겹칠 수 있다고 보면 조용히 섞는 대신 실패로 막는 쪽이 맞다. #5925에 남아 있는 CodeBuddy 커밋을 뺄지 정해야 한다. 너의 추천 init 검사와 호출 개수 제한은 블록을 여는 같은 번호로 닫기 전에 인자가 비어 있으면 성공으로 넘기지 말고, 지금처럼 502로 막는다. 캡처에 맞는 정상 경로는 이미 테스트가 있으니, 빈 인자로 닫히는 경우만 하나 더 넣으면 된다. #5925에서는 CodeBuddy 커밋을 빼고 code-mode 수정만 남긴다. 이 PR은 초안인 채로 두고, 작성자가 말한 넓은 테스트가 정리된 뒤에 머지 여부를 본다. 이 댓글은 grok-bot이 작성했습니다 |
…acy-gate hang) (#5945) * fix(codebuddy): serialize parallel tool-use blocks without corrupting calls (#5929) Carried from #5929 as one squashed commit. Co-authored-by: mdwsk88 <924038395@qq.com> * fix(codebuddy): validate bridge init at tool-use start arrival * fix(codebuddy): reject ambiguous indexless tool argument deltas * docs(devlog): batch 8 plan * fix(test): bound privacy gate aggregate child The macOS control batch stopped at the first aggregate-gate shell invocation and hit the 300s batch watchdog even though spawnSync specified 5s. Replace the synchronous call with an async spawn, ignored stdin, and an independent SIGKILL deadline that reports the child by name. Cover event-loop progress and the deadline path. --------- Co-authored-by: mdwsk88 <924038395@qq.com>
|
Thanks! This landed on |
Summary
8b980c5b0asc79968248and documents the event contract.Verification
bun test tests/providers/codebuddy-protocol.test.ts tests/providers/codebuddy-tool-bridge-turn.test.ts: 57 passed, 0 failed.bun run typecheck: passed.Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.