Repository navigation
Conversation
|
🚨 SLOP COP 🚨 · I am reviewing this pull request now. I will check the change for security, code quality and architecture (including duplication), performance, and end-to-end behavior, then leave a consolidated review. |
|
🚨 SLOP COP 🚨 · I’m reviewing this pull request now. I’ll check security, code quality and architecture (including duplication), performance, and end-to-end behavior, then leave one consolidated review. |
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
Plain-English summary
This PR fixes an expandable AI “Thought” row losing detail when a response finishes or the page reloads. Providers can send a short reasoning summary and a separate reasoning body; the current code keeps only one, while this change keeps both.
Finding
- Medium — a valid interleaved stream changes order at completion. Live reasoning appends summary and body updates as they arrive, but the completed event stores those channels separately and the new parser always puts all summary text before all body text. I reproduced
summary S1 → body B1 → summary S2rendering live asS1 / B1 / S2and completed/restored asS1 / S2 / B1. The protocol grammar and shared assembler accept that sequence. I left an inline comment on the composition line with two concrete ways to make live and restored ordering share one invariant, plus the missing regression case.
Other review dimensions
- Security: no findings. Both reasoning channels were already provider-visible during streaming, and completed details remain capped at 32,000 characters.
- Performance: no findings. The production change adds one linear concatenation on reasoning completion, not per delta, and lifecycle buffers are still released normally.
- Architecture and duplication: the shared reasoning parser is the correct seam and avoids provider-specific code. I found no duplicate summary/body merge elsewhere. The needed refactor is to centralize a single channel-ordering policy across live and completed projection.
Verification
- Exact head SHA:
pnpm exec turbo run test --filter=@bb/thread-view --force— 23 files, 379 tests passed. - Exact head SHA:
pnpm exec turbo run typecheck --filter=@bb/thread-view --force— passed. - Real dev app with an assembler-valid dual-channel stream: both summary and body appeared in order in the completed Thought row and remained after a full reload for the non-interleaved case.
- Focused interleaving reproduction demonstrated the ordering mismatch above.
- Current GitHub CI is green, and later
maincommits do not touch the changed files.
I’m leaving this as a comment review, without approving or using GitHub’s request-changes state.
5275fe6 to
43cf954
Compare
Human comments
What was wrong
Completed reasoning has two valid persisted channels, summary and body, whose deltas can arrive interleaved. The final parser originally selected only one channel; the first version of this fix retained both but rebuilt them as all summary followed by all body, so a live
S1 → B1 → S2stream reopened asS1 → S2 → B1. This became user-visible after the completed-thinking history change.What changed
The shared reasoning projection now keeps the arrival-order buffer and separately totals each channel. When both totals exactly match the completed item, completion preserves the live buffer; when deltas are missing or the provider corrects the final payload, the combined completed summary and body remain the fallback replacement. The same decision feeds normal and late post-interruption completion, preserving the generic Thought row, timing, status, single-channel behavior, and deterministic live/restored parity. There are no wire, database, CLI, Plugin SDK, configuration, documentation, or mobile changes.
How you verified
summary S1 → body B1 → summary S2regression that failed before the projection change and passed after it across active, just-completed, restored, and replayed projections.pnpm exec turbo run test --filter=@bb/thread-view --force: 23 files and 379 tests passed.pnpm exec turbo run typecheck --filter=@bb/thread-view --forcepassed.origin/main.S1 → S2 → B1to the liveS1 → B1 → S2order.Fixes #1248