Skip to content

fix(chat): settle a waiting bubble on its own last whole-second turn (#2334) - #2365

Merged
devswha merged 1 commit into
mainfrom
fix/waiting-bubble-double
Oct 29, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/waiting-bubble-double

Conversation

@devswha

@devswha devswha commented Oct 29, 2026

Copy link
Copy Markdown
Owner

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.ts newerThanSend, 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:

  • The agent answers the new send within its own second and writes nothing more. Then [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.
  • An older identical message whose answer the transcript never kept (Grok stopped while thinking), or a first read that was requested before the older message was answered and arrives after the send. In both, the bubble goes a moment before its own turn shows. Nothing shows twice and nothing is lost. Codex reproduced both, and both are noted in the code comment. Closing the second one would mean carrying each read's request time through ChatView's read path, which is out of proportion for an input this rare.

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 main 10855e0b and 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).
  • New "keeps a send made before the chat's first read waiting past a same-second turn with an undated turn after it": it fails when last is replaced with Number.isNaN(answeredAt) (mutation checked).
  • sentWaiting, SentWaiting and useComposerSends tests: 63 pass / 0 fail. bun run typecheck: exit 0.
  • Real app on the demo transport (no herdr session). The chat's first read was held, a message was sent from the composer, then the read was served as a whole-second transcript whose last turn is that send: on main the turn shows twice (1 waiting copy), at 1280 and 390 px; on this branch it shows once (0 waiting copies). No page errors.
  • bun run check fast on the final head: 433ee6ed: typecheck, build, unit 8661 pass / 0 fail (35 skipped).
  • Reviews:
    • omo-native-code-reviewer: APPROVE, with no critical, high or medium findings. It raised two LOWs about comment wording (the older-turn-answered premise, and what last means); both are fixed in the comment.
    • Codex Sol 6.1 (fast, xhigh): no verdict. It hit "Selected model is at capacity" twice, and the second run ended without a report. Its scratch tests reproduced the two same-second counterexamples above. Both fail on this branch and pass on main, and both need the same words twice in one second before the first read, so they are listed as known limits. Under the lane rule, the merge pass reviews this head.

…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.
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 10855e0 and 433ee6e.

Files selected for processing: 3
  • changelog.d/chat-sent-waiting-double.md
  • src/lib/sentWaiting.test.ts
  • src/lib/sentWaiting.ts

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

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Fixed chat loading behavior so a sent message no longer appears both as a conversation turn and a faded waiting bubble when the matching turn is the last one in the conversation.
    • Waiting bubbles now remain visible when a subsequent assistant turn is still expected, including when that turn has no timestamp or shares the same timestamp second as the sent message.

For sends without a prior baseline, a matching turn in the send’s second now settles the waiting entry if it is the final transcript turn. Later turns that do not meet the existing timestamp conditions keep the entry pending.

Changes: Sent waiting settlement

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: Low

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 sentWaiting module 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: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning 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. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed 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 convent…
Description check Passed 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,…
Linked Issues check Passed For [#2334], src/lib/sentWaiting.ts now 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, includi…
Out of Scope Changes check Passed 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 s…
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.ts now 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.

❤️ Share

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

@devswha

devswha commented Oct 29, 2026

Copy link
Copy Markdown
Owner Author

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).

@devswha
devswha merged commit bbcc69a into main Oct 29, 2026
11 checks passed
@devswha
devswha deleted the fix/waiting-bubble-double branch October 29, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Waiting bubble doubles the user turn until a later turn or the 60 s expiry

1 participant