Skip to content

[Fix] Reasoning and API request rows after a batched read group are hidden - #2126

Merged
edelauna merged 1 commit into
Zoo-Code-Org:mainfrom
PierrunoYT:fix/batch-trailing-ignorable
Oct 21, 2026
Merged

edelauna merged 1 commit into
Zoo-Code-Org:mainfrom
PierrunoYT:fix/batch-trailing-ignorable

Conversation

@PierrunoYT

Copy link
Copy Markdown
Contributor

Fixes #2061

Problem

batchNearby (webview) collects ignorable messages (api_req_started, reasoning, empty text) in pendingIgnorable while looking for more batch targets. When the batch had more than one item, all of pendingIgnorable was dropped, including the ones after the last target. Those belong to the next turn, so after a "read multiple files" card its API Request row and Thinking block never appeared, even after the turn finished. The same logic serves list_files and file-edit batches.

Fix

pendingIgnorable is cleared each time another target is added (items between two targets are consumed by the batch, as before) and whatever remains after the last target is emitted after the synthesized batch item. The single-target case already restored them, so both branches now share that emission.

Tests

Four new cases in batchNearby.spec.ts: trailing items kept after a batch, kept before a boundary, kept after a single target, and no duplication across three targets. Chat component and utils suites (491 tests), tsc and ESLint pass.

🤖 Generated with Claude Code

batchNearby discarded every ignorable message collected while batching, so
the api_req_started and reasoning rows after the last batched target (which
belong to the next turn) disappeared. Only consume ignorable items between
targets and re-emit the trailing ones.

Fixes Zoo-Code-Org#2061

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: Zoo-Code-Org/Zoo-Code/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 09eb916f-7c0a-404d-b151-1b2f87534c32
📥 Commits

Reviewing files that changed from the base of the PR and between 16425bc and 8233f9b.

📒 Files selected for processing: 2
  • webview-ui/src/utils/__tests__/batchNearby.spec.ts
  • webview-ui/src/utils/batchNearby.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.

📜 Recent review details
🧰 Additional context used
📓 Path-based instructions: 4
Require regression coverage at the lowest valid harness with behavior-focused assertions, including relevant negative, error, false/unset, and boundary cases.

⚙️ CodeRabbit configuration file

Files:

  • webview-ui/src/utils/__tests__/batchNearby.spec.ts
Check strict typing and exhaustive behavior across normal, boundary, error, cancellation, retry, and compatibility paths.

⚙️ CodeRabbit configuration file

Files:

  • webview-ui/src/utils/__tests__/batchNearby.spec.ts
  • webview-ui/src/utils/batchNearby.ts
Check React state and effect dependencies, cleanup, accessibility, i18n, and light/dark theme behavior.

⚙️ CodeRabbit configuration file

Files:

  • webview-ui/src/utils/__tests__/batchNearby.spec.ts
  • webview-ui/src/utils/batchNearby.ts
Act as an adversarial second-opinion reviewer.

⚙️ CodeRabbit configuration file

Files:

  • webview-ui/src/utils/__tests__/batchNearby.spec.ts
  • webview-ui/src/utils/batchNearby.ts
🪛 GitHub Check: mutation-diff
webview-ui/src/utils/batchNearby.ts

[warning] 80-80: Mutation test advisory
webview-ui/src/utils/batchNearby.ts:80: 2 mutation test gaps; example: Survived ConditionalExpression mutant (replacement: true). See the job summary for the complete list and resolution guidance.

🔇 Additional comments: 2
webview-ui/src/utils/batchNearby.ts: 1

60-61: LGTM!

Also applies to: 72-74, 79-81

webview-ui/src/utils/__tests__/batchNearby.spec.ts: 1

453-510: LGTM!

📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Preserved ignorable messages that appear after batched targets or near request boundaries.
    • Prevented trailing messages from being dropped when processing a single target or completing a batch.
    • Avoided duplicate messages when multiple requests occur between targets.
  • Tests

    • Added coverage for single-target, trailing-request, boundary, and multi-request scenarios.

batchNearby now consumes ignorable messages between targets and preserves trailing ignorable messages after a batch or single-target fallback. Tests cover ordering, boundary cases, and duplicate prevention.

Changes: Batch message preservation

Layer / File(s) Summary
Batch handling and coverage
webview-ui/src/utils/batchNearby.ts, webview-ui/src/utils/__tests__/batchNearby.spec.ts
batchNearby clears pending ignorable messages when it finds another target. It restores trailing ignorable messages after successful batching and single-target fallback. Tests cover trailing messages, boundaries, and multiple targets.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: easonliangworldedtech

Merge Risk: ⚪ Minimal · up to 8233f

No unresolved issue identified here prevents merging after normal checks.

Pre-merge checks: Passed 7 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Regression Evidence Warning The new unit tests focus on the changed batchNearby behavior, but the fix also changes durable visible chat output without a Playwright component snapshot. batchNearby now emits trailing `api_req_… Keep the focused batchNearby unit tests and add a Playwright component test/snapshot for the ChatView or equivalent chat-row sequence: a multi-target batch followed by api_req_started and reasoning, including the completed-turn state.…
Passed Passed checks: 7 passed
Check name Status Explanation
Title check Passed The title clearly identifies the user-visible fix: restoring reasoning and API request rows after batched read groups.
Description check Passed The description links issue #2061, explains the problem and implementation, and documents four regression cases plus test results. It does not reproduce the pre-submission checklist or separate templa…
Linked Issues check Passed Issue #2061 requires preserving api_req_started and reasoning messages after multi-target read_file batches, while consuming ignorable messages between targets. batchNearby.ts clears `pendingIgn…
Out of Scope Changes check Passed The pull request changes only webview-ui/src/utils/batchNearby.ts and its focused batchNearby.spec.ts tests. The implementation and tests directly support issue #2061 by fixing pending ignorable-m…
Security Boundaries Passed No security-boundary failure is introduced. The changed path in webview-ui/src/utils/batchNearby.ts only clears and later restores already-present ignorable chat messages. It does not read or transm…
Persistence Integrity Passed PASS. The changed path is an in-memory batchNearby transformation used by ChatView; it does not perform persistence, writes, async operations, rollback, or default propagation. The change preserve…
Lifecycle Resource Cleanup Passed PASS. The changed path is the synchronous, pure batchNearby array transformation. The diff only clears an in-memory array and appends preserved messages. It adds no listener, watcher, provider, time…
Full details: Description check

Explanation

The description links issue #2061, explains the problem and implementation, and documents four regression cases plus test results. It does not reproduce the pre-submission checklist or separate template sections, but the required technical information is present.

Full details: Linked Issues check

Explanation

Issue #2061 requires preserving api_req_started and reasoning messages after multi-target read_file batches, while consuming ignorable messages between targets. batchNearby.ts clears pendingIgnorable when it finds each additional target, then emits the remaining pending items after both synthesized batches and single-target results. The added tests cover trailing items, a following boundary, the single-target path, and three-target de-duplication. The shared utility also covers the issue's list_files and file-edit cases.

Full details: Out of Scope Changes check

Explanation

The pull request changes only webview-ui/src/utils/batchNearby.ts and its focused batchNearby.spec.ts tests. The implementation and tests directly support issue #2061 by fixing pending ignorable-message handling. No unrelated product behavior or refactor is present in the reviewed diff.

Full details: Security Boundaries

Explanation

No security-boundary failure is introduced. The changed path in webview-ui/src/utils/batchNearby.ts only clears and later restores already-present ignorable chat messages. It does not read or transmit secrets or PII, execute input, validate tool requests, or alter approval and allowlist controls. The callers continue to use the existing target, boundary, and ignorable predicates in ChatView.tsx.

Full details: Persistence Integrity

Explanation

PASS. The changed path is an in-memory batchNearby transformation used by ChatView; it does not perform persistence, writes, async operations, rollback, or default propagation. The change preserves pending messages in the returned array and adds no persistence failure condition.

Full details: Lifecycle Resource Cleanup

Explanation

PASS. The changed path is the synchronous, pure batchNearby array transformation. The diff only clears an in-memory array and appends preserved messages. It adds no listener, watcher, provider, timer, task, subscription, or cancellation/disposal path. Its caller runs it inside ChatView's useMemo; no changed lifecycle resource handling or restart-related duplicate work exists.

Full details: Regression Evidence

Explanation

The new unit tests focus on the changed batchNearby behavior, but the fix also changes durable visible chat output without a Playwright component snapshot. batchNearby now emits trailing api_req_started and reasoning messages (webview-ui/src/utils/batchNearby.ts:58-81); ChatView passes this result to ChatRow (ChatView.tsx:1298-1315, 1520-1533), where both message types render visibly (ChatRow.tsx:1070-1089). The pull request changes only the utility and its unit test, and no Playwright visual test or screenshot covers the batched card followed by persistent API Request and Thinking rows.

Resolution

Keep the focused batchNearby unit tests and add a Playwright component test/snapshot for the ChatView or equivalent chat-row sequence: a multi-target batch followed by api_req_started and reasoning, including the completed-turn state. Commit the corresponding visual snapshot.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review status

Thanks for contributing. This comment tracks the review sequence and the next action.

Current step: Awaiting fresh human maintainer or CODEOWNER approval.

Automated review is complete for the latest commit but does not replace human approval.

Review-state labels are managed by this workflow; do not edit them manually. community-approved is managed the same way — do not add or remove it manually. It signals a fresh community code approval for the current head as an advisory priority only; maintainer review is still required.

@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions github-actions Bot added coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Oct 20, 2026
@github-actions github-actions Bot added awaiting-maintainer CodeRabbit approved; waiting for a human maintainer and removed coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Oct 20, 2026

@edelauna edelauna left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@edelauna
edelauna added this pull request to the merge queue Oct 21, 2026
Merged via the queue into Zoo-Code-Org:main with commit 9cb83c3 Oct 21, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-maintainer CodeRabbit approved; waiting for a human maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Reasoning and API request rows after a batched read_file group are hidden in the chat

2 participants