Repository navigation
fix(chat): settle a waiting bubble on its own last whole-second turn (#2334) - #2365
Conversation
…2334) A send made before the chat's first read had no baseline, so a user turn stamped in the send's own whole second settled it only once a turn in a later second followed. When nothing came after that turn the chat showed the turn and its faded waiting copy for up to a minute. An immediate send means the agent was idle, so an older identical message of that second was already followed by its answer. A matching turn of the send's second with no turn at all after it is therefore this send's. A turn followed by any turn (dated or not) in that same second still waits, as before.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Match final user turns src/lib/sentWaiting.ts, src/lib/sentWaiting.test.ts, changelog.d/chat-sent-waiting-double.md |
The matcher tracks whether a candidate is the final transcript turn. Tests cover settlement with no successor and pending behavior when an undated or same-second assistant turn follows. The changelog describes the duplicate-bubble case. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related PRs
- devswha/ovis#2270: Introduces the sent waiting bubble and the
sentWaitingmodule changed here.
Suggested reviewers: charleoyang
Merge Risk: 
Minimal · up to 433ee
-
No actionable merge-blocking risk is identified; the documented cosmetic trade-off does not duplicate or lose turns.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title names the main behavior change: a waiting bubble settles on its own last whole-second turn. It matches the changeset in src/lib/sentWaiting.ts and the linked issue
#2334. It uses the conventional fix(chat) prefix and is specific enough for a teammate scanning history.
Full details: Description check
-
Explanation
The description follows the repository template. It has a Change section that explains the problem, the code change, and the known limits. It has a Validation section that lists the unit test results, typecheck, the check fast run, the reviews, and the real-app demo check. It links the issue with Closes
#2334. The description does not mention the changelog entry in changelog.d/, which the template comment says is required for changes, but the changeset includes one.
Full details: Linked Issues check
-
Explanation
For [
#2334],src/lib/sentWaiting.tsnow passes the last-turn state into matching. In the no-baseline whole-second case, a matching user turn settles the waiting send when no turn follows it, including an undated final turn condition. The tests cover the new final-turn behavior, preserve waiting when a same-second or undated turn follows, and confirm later-second settlement. The reported test and typecheck results provide additional support.
Full details: Out of Scope Changes check
-
Explanation
The implementation changes only whole-second waiting-send matching. The added tests verify the issue behavior and regression cases. The changelog documents the fix. These changes support [
#2334] and show no unrelated product behavior.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 2 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- 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.
Comment @coderabbitai help to get the list of available commands.
|
Merging 433ee6e (closes #2334). A message sent before the chat's first read, on an agent that writes whole-second times, showed twice (its turn and its faded waiting bubble) for up to a minute when nothing came after that turn: the bubble waited for a later-second turn that never came. Now the turn settles the bubble when it is the last turn read; a dated or undated turn after it within the same second still keeps it waiting, as an older same-words message answered before the send would look like that. Review by the merge pass (standing in for Codex, which stalled twice): the change is confined to sentWaiting.ts's no-baseline branch; tests are deterministic, assert values, and cover last-turn, undated-answer and later-second cases (fail first on 10855e0). Two documented LOW limits, both needing the same words twice within one second before the first read: an older message whose answer the transcript never kept, or a read taken before the older one was answered, can let the bubble go a moment before its own turn shows. Lane demo: main showed the turn twice, the fix once (1280 and 390 widths). |
Closes #2334.
Problem
Follow-up from #2270 (the faded waiting bubble, thanks again @CharleoYang). A message sent from Chat before the chat's first conversation read has no baseline: the chat had shown no turns to tell an older message from the new one. With a transcript that keeps whole-second times, the send's own user turn is stamped in the send's own second. Since #2270's review (M1), such a turn settled the bubble only once a turn in a later second had been written after it. When nothing came after it (an idle agent, an answer that never starts), the chat showed the real turn and its faded copy for up to a minute.
Change
src/lib/sentWaiting.tsnewerThanSend, no-baseline whole-second branch only: a matching user turn of the send's second also settles the send when it is the last turn of the read, with no turn at all after it, dated or not.Why this is proven, not guessed: a waiting send is recorded only for a confirmed immediate send, so the agent was idle to take it. An older identical message of that second had therefore already been answered before this send, and something follows it in the transcript within that second. That is the premise the existing later-second rule already rests on. A same-second turn followed by any turn, including an undated one, still waits as before, so #2270's M1 case (an older identical turn of the same second, answered before the send) keeps the new send's bubble. Nothing reads the screen.
Known limits (LOW), each needing the same words sent twice within one whole second before the chat's first read:
[turn, answer]reads exactly like feat(chat): show a sent message as the user's faded bubble until its turn #2270's M1 case (an older message that was already answered), so the copy stays until a turn in a later second arrives or the minute runs out. This is unchanged from main.Evidence
src/lib/sentWaiting.test.ts"settles a whole-second turn for a send made before the chat's first read on the turn itself when nothing was written after it" fails on main10855e0band passes here. The earlier test that pinned the double ("…once the agent answers it") is split into this one and "…once a turn after it is in a later second" (same-second answer still waits).lastis replaced withNumber.isNaN(answeredAt)(mutation checked).sentWaiting,SentWaitinganduseComposerSendstests: 63 pass / 0 fail.bun run typecheck: exit 0.bun run check faston the final head:433ee6ed: typecheck, build, unit 8661 pass / 0 fail (35 skipped).lastmeans); both are fixed in the comment.