Repository navigation
fix: preserve sibling Runs and stream parallel tool calls - #47
Conversation
getSession() destroyed the cached HTTP/2 session when its health-check
ping failed or timed out. Every other Run multiplexed on that session was
aborted mid-stream, and because those Runs had already produced output,
pumpWithRecovery refused to replay them ("automatic retry unsafe").
Retire the session the same way GOAWAY and age rotation do: drop it from
the cache and close() it so in-flight streams drain, while the new Run
opens a fresh connection.
CONTRIBUTING checklistPer CONTRIBUTING.md:
Problem statement, fix, test, and CHANGELOG are otherwise in good shape. This PR is not being closed. |
|
Thanks for this fix! It's merged in our fork as nkoynov@d1691d6, with a small follow-up so that a Run Cursor cancels on the retired connection isn't mistaken for a lost connection by our ping-skip resend under Bun. |
Merge current main and retain the reviewed CLI-based implementation. Keep sibling Runs alive on failed reuse pings, group streamed calls by Cursor's generation count, and preserve frame and replay safety. Add pump and Node/Bun transport regressions and track separate evaluation of recent-traffic ping suppression and cancellation-aware retries.
|
Thanks @moritzWa for opening this PR and providing the reproduction. I've updated the branch with our reviewed implementation: failed reuse pings retire the shared connection with The update also follows Cursor CLI's fire-on-arrival execution: emit tools as they arrive, then finish the OpenCode step when Cursor's listed call count is satisfied, with an idle fallback. Regression fixes cover late frames, internal/refused-call accounting, and terminal handling without replaying already-started host tools. Validation: 1,442 tests pass, strict typecheck/build pass, and Node/Bun transport regressions cover refused, timed-out, callback-error and throwing pings. The built-provider AI SDK probe starts three tools concurrently before finish and joins all three results in one step. Full live Cursor/OpenCode acceptance remains pending. Could you please retest your multi-chat reproduction and parallel tool/subagent calls on this updated branch? @nkoynov, thanks for identifying the retired-connection cancellation case under Bun. The recent-traffic ping optimization and its cancellation/retry behavior are worth investigating separately. I've added that evaluation to |
|
Thanks @oakimov, retested current main (ddb14a1) in a separate macOS 26 Cua VM with OpenCode 1.18.16 and composer-2.5.
Checked actual tool output, exit codes and timestamps rather than just the final model responses. No failures in those live concurrency cases. I did not inject failed reuse pings into the live Cursor connection or verify warm-cache continuity across retirement; those failure modes were covered by the deterministic Bun/Node tests. |
A failed reuse ping must retire the shared HTTP/2 connection with
close()so sibling Runs can finish. Separately, finishing the provider step after the first Cursor tool call serializes calls from the same generation. Emit each tool on arrival and defer the OpenCode step boundary using Cursor's listed call count, with an idle fallback.The implementation preserves late frames across timeouts, counts internal/refused calls correctly, and avoids replay after host tool emission. It includes streamed-edit, display-mirror and terminal regressions, plus sibling-stream tests on Node and Bun. Recent-traffic ping suppression and its cancellation/retry behavior are tracked separately in
tasks/todo.md.Validation: 1,442 tests pass; strict typecheck, build and architecture/package checks pass. A built-provider AI SDK probe verifies three overlapping tool executions in one step. Full live Cursor/OpenCode acceptance remains pending.
Related to #44.