Repository navigation
Conversation
|
CodeAnt AI is reviewing your PR. |
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
Warning Review limit reached
Next review available in: 36 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks 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 |
There was a problem hiding this comment.
Code Review
This pull request addresses issue anomalyco#35511 by capturing the reader fiber and joining it on a clean exit to ensure that the merged stdout/stderr stream drains to EOF before the scope closes, preventing lost buffered output. A regression test is also added to verify this behavior. The reviewer pointed out a potential issue where the tool could hang indefinitely if a background process keeps the stdout/stderr streams open, since Fiber.join(reader) is called outside of the race block. They suggested racing the join with abort and timeout effects to prevent this hang.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
CodeAnt AI finished reviewing your PR. |
d779212 to
895e46d
Compare
… on exit 0 The output reader was forked with forkScoped but only handle.exitCode was awaited, so the scope could close and interrupt the reader before buffered stdout/stderr drained to EOF, yielding "(no output)" on a clean exit 0 (anomalyco#35511). Capture the reader fiber and, on a clean exit, join it so the merged stream drains before the scope closes. Bound the best-effort drain with the abort/timeout races so a backgrounded child holding the pipe open cannot hang the tool; a clean exit is never relabelled aborted/terminated if the drain is cut short.
895e46d to
13c9c38
Compare
There was a problem hiding this comment.
chethanuk has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
Issue for this PR
Closes anomalyco#35511 (staged on fork against
dev).Type of change
What does this PR do?
The shell tool can return
(no output)with exit0on the first call, even when the command clearly printed to stdout.Root cause. The merged stdout+stderr reader runs in a
forkScopedfiber, but the main flow only awaitshandle.exitCode. When the process exits, the enclosingEffect.scopedblock closes and interrupts the reader fiber before it has drained the buffered chunks to EOF, so the assembledlistis empty and the tool reports(no output)despite a clean exit.Fix. Capture the reader fiber and, on the clean-exit branch,
Fiber.joinit so the merged stream drains to EOF before the scope closes. A backgrounded child can keep the stdout/stderr write end open past the parent's exit, so the join is bounded by the sameabort/timeoutraces to avoid hanging forever. Because the process already exited cleanly on this branch, a cut-short drain is not relabelled as aborted/terminated — that would contradict the clean exit code and print a misleading "terminated after exceeding timeout" message.Ordering that the fix guarantees:
sequenceDiagram participant Tool as ShellTool participant Proc as Process participant Reader as reader fiber (forkScoped) participant Scope as Effect.scoped Tool->>Proc: spawn(command) Tool->>Reader: forkScoped(Stream.runForEach handle.all) Tool->>Tool: raceAll [exitCode, abort, timeout] Proc-->>Tool: exitCode resolves (exit.kind = exit) Note over Tool,Reader: Fiber.join(reader), bounded by abort/timeout Reader-->>Tool: buffered stdout/stderr drained to EOF Tool->>Scope: scope closes (reader already finished) Note over Tool: output assembled from full list Note over Tool,Scope: Before: scope closed on exit, reader interrupted mid-buffer -> "(no output)"How did you verify your code works?
bun run typecheck(tsgo,packages/opencode) — passes.bun test test/tool/shell.test.ts— 24 pass / 0 fail. Includes a new regression that runsecho hi10x and asserts exit0with output (andmetadata.output) never equal to(no output); this reliably reproduced the race before the fix.Screenshots / recordings
Not a UI change.
Checklist