Repository navigation
Conversation
…never match An optimistic composer echo is cached per pane+agent and retires only by matching its real user turn in the transcript. Nothing invalidated it when the pane's conversation was replaced — `/clear`, an agent restart, or resuming a different session — so a leftover echo could never match the new transcript and stayed pinned at the list tail, rendering an old prompt as the newest message for the rest of the pane's life. Record the provider session an echo was issued into and keep only the echoes the pane's current conversation can still match. Echoes sent before the session id resolved (a fresh launch learns it after the first send) adopt the first id observed instead of being dropped, so the first-turn empty-state flash the pane+agent scope was protecting against does not come back. Echoes queued before the latest `/clear` are dropped too, matching the transcript boundary that `applyCommandMarkerBoundaries` already applies to real messages. Moves the pending-send and command-marker state into `useNativeChatPendingEchoes` so `NativeChatView` stays under its max-lines ceiling; no behavior change in the moved code. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ion drops one Repeat sends of the same text get an explicit `matchingOccurrence` so a later one cannot reuse a transcript occurrence an earlier echo already consumed. That is right for pruning, where a real user turn is what removed the predecessor. Dropping an echo because its conversation was replaced consumes nothing — no turn will ever arrive for it — so a survivor left numbered past it waits for a second identical turn that cannot exist, and stays pinned at the list tail permanently. Renumber each match key from 1 whenever the retain rule changes the set.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughNative chat pending sends now record an optional provider session, filter echoes across session changes and 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
Greptile SummaryThis PR fixes a ghost-bubble bug where an optimistic composer echo, cached per
Confidence Score: 5/5Renderer-only change with no IPC, no new dependencies, and no user-visible state beyond removing a bubble that should never have been rendered. The fix is narrow and well-bounded: it adds a filtering pass over an in-memory array of at most 8 entries, all guarded by the scope-identity check that prevents cross-pane interference. Every behavioral claim in the PR description is pinned by a failing test that passes with the fix, including the subtle asymmetry between conversation replacement (renumber from 1) and cancellation (shift by 1). The withoutNativeChatPendingOccurrence logic correctly handles the capped-out-echo case that would make full renumbering unsound on the cancellation path. No new side effects outside the existing pane-scoped caches. Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/renderer/src/components/native-chat/use-native-chat-pending-echoes.ts | New hook encapsulating all pending-echo state; fixes stale-markers issue via scope-identity guard; effects chain correctly through functional updaters |
| src/renderer/src/components/native-chat/native-chat-pending-conversation.ts | New pure module implementing the five-rule retain filter; correctly guards the null-sessionId reconnect window and drops pre-/clear entries before the session check |
| src/renderer/src/components/native-chat/native-chat-pending-occurrence.ts | Adds renumberNativeChatPendingOccurrences (renumber from 1 for conversation replacement) and withoutNativeChatPendingOccurrence (shift-by-1 for cancellation); asymmetry is intentional and correct |
| src/renderer/src/components/native-chat/native-chat-pending.ts | Adds optional sessionId field to NativeChatPendingSend and exports latestClearSentAt; additive, backward-compatible change |
| src/renderer/src/components/native-chat/NativeChatView.tsx | Removes ~80 lines of inline pending-echo logic and delegates to useNativeChatPendingEchoes; mechanical extraction, no behavioral change beyond the fix |
| src/renderer/src/components/native-chat/native-chat-pending-conversation.test.ts | Comprehensive tests covering all five retain rules, including renumbering after a drop and independence of distinct match keys |
| src/renderer/src/components/native-chat/use-native-chat-pending-echoes.test.tsx | Hook-level tests covering session swap, null-session bind, /clear interaction, pane-move stale-markers guard, cancelSend renumbering, and PENDING_SEND_LIMIT capped-echo safety |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[paneKey / agent / sessionId changes] --> B{markerState.scope === commandMarkerScope?}
B -- No: stale markers, pane just moved --> C[bail out, wait one commit]
B -- Yes: scopes aligned --> D[retainPendingSendsForConversation]
D --> E{latest /clear sentAt?}
E -- entry.sentAt <= clearedAt --> F[drop: pre-clear echo]
E -- No clear or entry.sentAt > clearedAt --> G{current sessionId}
G -- null: reconnect window --> H[keep all entries]
G -- entry.sessionId === sessionId --> I[keep entry unchanged]
G -- entry.sessionId == null, first-send case --> J[adopt: set sessionId]
G -- entry.sessionId different --> K[drop: foreign session]
F --> L{any dropped?}
J --> L
K --> L
I --> L
L -- Yes --> M[renumberNativeChatPendingOccurrences counts from 1 per key]
L -- No --> N[return same reference]
Reviews (3): Last reviewed commit: "style(native-chat): cut the pending-echo..." | Re-trigger Greptile
…conversation The chat surface is one portal per tab, so moving it to another leaf changes paneKey in place: the pending and command-marker scopes both change in one commit while the marker state still describes the leaf we came from. The retain rule then measured the new pane's echoes against the previous pane's `/clear` and wrote the drop to the module-level pane cache, where the correcting render cannot restore it — `/clear` in one pane could delete a live, legitimately pending echo in another. Carry the scope with the markers so the rule can tell that a value still describes this conversation, and wait the one commit when it does not. Cancelling a send also released nothing. A cancelled send consumes no transcript occurrence, so a later repeat of the same text kept waiting on a turn that can never arrive. Renumbering from 1 is wrong here: PENDING_SEND_LIMIT trims the oldest echo while its send still lands, so that turn still arrives and still consumes an occurrence, and a conversation swap is the only case where counting genuinely restarts. Shift only the later same-key siblings down by one.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/native-chat/native-chat-pending-occurrence.ts (1)
252-261: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCondense the new explanatory comments.
Keep the invariants, but reduce these multi-line implementation walkthroughs to brief rationale.
src/renderer/src/components/native-chat/native-chat-pending-occurrence.ts#L252-L261: summarize the cancellation-occurrence invariant.src/renderer/src/components/native-chat/use-native-chat-pending-echoes.ts#L101-L105: summarize the stale-marker persistence risk.As per coding guidelines, comments must be concise, limited to non-obvious information, and preferably one line.
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 57edbffd-5f6e-47ea-960b-f64fa1940030
📒 Files selected for processing (3)
src/renderer/src/components/native-chat/native-chat-pending-occurrence.tssrc/renderer/src/components/native-chat/use-native-chat-pending-echoes.test.tsxsrc/renderer/src/components/native-chat/use-native-chat-pending-echoes.ts
`recordSend` carried the only member doc on the returned object; the other three are equally part of the hook's contract and each has a non-obvious trigger (a cancelled delayed Enter, a local-only system line, Stop).
|
@coderabbitai on the docstring-coverage warning (27.27% vs 80%) — I've taken the part of it I think is real and I'm deliberately not taking the rest. Taken (281e4aa): the object Not taken: the rest of what the metric counts is test helpers ( So this one stays as an accepted warning rather than a fix. Happy to add specific docstrings anyone names. Two follow-ups filed for the limits this PR documents rather than fixes, so they are tracked outside the description: #11511 (a send that never reaches the agent has no recovery path — includes the label-semantics decision, where merged #9792 already settled the same question one way on mobile) and #11519 (the pending matcher compares renderer send time against remote-host transcript timestamps). |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- Repository comment guidance ---'
if [ -f AGENTS.md ]; then
rg -n -i -C 3 'comment|docstring|documentation|non-obvious|concise' AGENTS.md || true
else
fd -HI '^AGENTS\.md$' . -x sh -c 'printf "\n--- %s ---\n" "$1"; rg -n -i -C 3 "comment|docstring|documentation|non-obvious|concise" "$1" || true' sh {}
fi
printf '%s\n' '--- Hook outline ---'
ast-grep outline src/renderer/src/components/native-chat/use-native-chat-pending-echoes.ts --items all --view expanded
printf '%s\n' '--- Hook return-contract docs and stop-agent call site ---'
rg -n -C 5 'recordSend|cancelSend|recordSlashCommand|clearPending|stopAgent' \
src/renderer/src/components/native-chat/use-native-chat-pending-echoes.ts \
src/renderer/src/components/native-chat/NativeChatView.tsx
printf '%s\n' '--- Targeted commit diff ---'
git show --format=fuller --stat --find-renames 281e4aad4 --
git show --format= --find-renames 281e4aad4 -- \
src/renderer/src/components/native-chat/use-native-chat-pending-echoes.ts \
src/renderer/src/components/native-chat/use-native-chat-pending-echoes.test.tsxLength of output: 15263
The remaining metric count concerns trivial test helpers and implementation-local callbacks. Requiring JSDoc there would conflict with 🐇💭 ✏️ Learnings added
You are interacting with an AI system. |
…nale AGENTS.md asks for the why in one line where possible; these had grown into walkthroughs of the surrounding code. Same invariants, no mechanics.
|
@coderabbitai taken in 66522f0 — you were right, and the guideline you cited is the one I'd invoked myself a comment earlier, so it applies to my own prose first. Net −20 lines of comment across the three files, same invariants kept:
Also removed a dead
|
|
Tip For best results, initiate chat on the files or code changes.
🐇✨ If you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! You are interacting with an AI system. |
… nothing Adopting the first observed session id changes no membership, so renumbering from 1 erased the slot a capped-out predecessor still owns and retired the survivor against an already-consumed turn.
…actually vacated Dense renumbering reset every match key, so dropping one echo could pull an unrelated repeat send down onto a turn a real transcript reply had already consumed. Count drops per match key and shift only that key's later siblings, which also subsumes the adoption case.
|
Thanks for this — stamping each echo with the session id it was sent into is the right shape, and the per-pane vs per-conversation framing made the diff easy to follow. Heads up that I pushed two small commits to your branch rather than leaving them as inline comments, since both are in the new occurrence bookkeeping and read better as diffs. Each has a regression test that fails on revert.
Two requests, both asks rather than blockers: 1. Could you move 2. Could you adjust the PR body so it doesn't imply the never-resolved-session-id window is covered? If you send into a brand-new pane before the agent has reported any session id, then restart or resume a different session, the first id the renderer ever sees is the replacement's — rule 4 adopts the orphan into it and it still pins. That isn't a defect introduced here, and it's strictly better than One pre-existing issue I looked at and deliberately left alone, just so it isn't lost: |
…markers by scope
Three mechanisms in the pending-echo path were bespoke where a plainer shape
already existed:
- `withoutNativeChatPendingOccurrence` (shift one slot for one removed index)
and the `droppedByKey` loop in `retainPendingSendsForConversation` (shift N
slots for a predicate) are the same operation written twice. Collapse both
into `dropNativeChatPendingOccurrences(pending, shouldDrop)`; `cancelSend`
loses its `findIndex` + not-found guard because an id predicate that matches
nothing is already a no-op.
- The `{scope, markers}` state wrapper existed so the retain effect could skip a
commit when its markers described the leaf it came from. Read the markers from
the scope-keyed cache the effect is already keyed on instead — no staleness to
detect, and the drop lands a commit earlier.
- The `useRef` mirror + `useCallback` stabilising `setWorkingInterrupted` is what
`useEffectEvent` does in one line, as at SourceControl.tsx:1609 and
mobile/src/session/use-initial-session-terminal-autocreate.ts:51. Event
handlers call the setter directly, which the rules-of-hooks gate requires.
No behavior change: the pre-existing test files pass verbatim against this, and
reverting the marker read reproduces the original failure
(`expected [] to deeply equal [ 'leaf two prompt' ]`). Adds six direct tests for
the shared primitive, which two callers now depend on and which had none.
|
Audit pass on the head as it stands (author's commits + my earlier review fixes together). The diagnosis and the fix are right and are what ships — this only changes the mechanism in three places where the diff built something bespoke that the repo, or React, already gives us. Pushed as 1. One occurrence-release primitive instead of two. 2. Read the markers by scope rather than tagging state with the scope. Your 3. Behaviour unchanged, checked rather than asserted. I checked out your three test files at Two small notes: |
|
@brennanb2025 Both asks are done, and your four commits are all in — I read them before touching anything and did not revert any of them. 1. Cancelled-send fix split out → #13513. One constraint worth flagging: I only have read access to this repo, so I cannot push a branch here and target
2. Description no longer implies the never-resolved-session-id window is covered. Rule 4 now says outright that it adopts by position rather than by identity, and that if the first id the renderer ever observes is already the replacement's, the orphan is adopted into it and still pins. It is Known limit 1, credited to you, with the note that closing it needs a conversation epoch or restart marker on The description also now describes the head rather than my original diff: your three fixes are summarised in a Review rounds on this branch section, the occurrence semantics are stated as the per-key shift-down you landed rather than my renumber-from-1, and the stale-marker entry says your keyed Verification on this branch after the split — On #13513 I also reverted the source hunk alone against both tests to confirm they fail without it — |
…ts own PR Cancelling a delayed Enter strands a later identical echo on `main` today, with no dependency on the stale-echo work here — a separate bug that reviews and reverts on its own. `cancelSend` goes back to the plain filter it had, and its two regression tests move with it; `dropNativeChatPendingOccurrences` stays because the conversation-retain path is its remaining caller.
6387598 to
da42f23
Compare
…taken Repeat sends of identical text carry an explicit `matchingOccurrence` so a later one cannot reuse a slot an earlier echo already consumed. Cancelling the delayed Enter removes an echo without any transcript turn consuming its slot, so the survivor is left waiting on a second identical turn that never arrives and its bubble is stranded for the rest of the pane's life. `dropNativeChatPendingOccurrences` shifts only the later same-key siblings down by exactly one — not a renumber from 1, which would erase the slot an echo trimmed at `PENDING_SEND_LIMIT` still legitimately owns (that send landed, so its turn still arrives). Both cases are pinned by tests that fail on revert. Split out of stablyai#11509 on review: the strand is reachable on main today with no dependency on the stale-echo work there.
Native-chat QA (chat driver)Drove the real native-chat surface on exact SHA IdentityCDP
Sequence
Result
Residual gaps
|
|
Thanks for all the work here, and for splitting out #13513 when I asked — your diagnosis was right and it led somewhere useful. I've opened #15032 as a replacement rather than merging this one, and I want to be straight about why. Two things pushed it that way:
The one rule that survives is a one-shot bootstrap claim for the window before the agent reports a session id, since that was the genuinely hard part. To be clear: this isn't a knock on the work. Your root cause was right and I reused your test intent where it still applied. #15032 credits this PR and refs it. #13513 is unaffected and still stands on its own. I'd rather explain the reasoning than close this quietly — happy to discuss if you see something the new shape gets wrong. |
|
No objection to #15032 replacing this — the call and the reasoning both hold. Leaving the close itself to you rather than doing it myself. On the two points. (1) Reproduction: fair, and the gap was mine. I never demonstrated the defect on unmodified One handover item, since it does not travel with this PR. #13513 is stacked on this branch and its merge-order note ("needs #11509 first, then I rebase onto the squashed Thanks for the review time — the four commits you pushed were all in the head that shipped here. |







Summary
An optimistic composer echo is cached per
paneKey + agentand retires only by matching its real user turn in the transcript. Nothing invalidated it when the pane's conversation was replaced —/clear, an agent restart, or resuming a different session — so a leftover echo could never match the new transcript and stayed pinned at the list tail, rendering an old prompt as the newest message for the rest of the pane's life.Root cause
pendingSendScopeKeykeys the echo cache bypaneKey + agentonly; there is no conversation identity in it.prunePendingSends/pendingSendsAsMessages).Change
retainPendingSendsForConversationkeeps only the echoes the pane's current conversation can still match:/clear→ drop, matching the transcript boundaryapplyCommandMarkerBoundariesalready applies to real messages.sessionIdisnull→ keep everything; a reconnect can briefly drop provider-session metadata andNativeChatSessionGate(NativeChatSessionGate.tsx:27-40) holds the last identity across it.entry.sessionId === sessionId→ keep.entry.sessionId == null→ adopt the current id. A fresh launch learns its session id only after the first send, so the first id observed claims those echoes instead of dropping them — this is what keeps the first-turn empty-state flash away. This adopts by position, not by identity: if the id the renderer observes first is already the replacement's, the orphan is adopted into it and still pins. See Known limit 1 — that window is out of scope here, not closed by it.Drops release occurrence slots through
dropNativeChatPendingOccurrences: repeat sends of identical text carry an explicitmatchingOccurrenceso a later one cannot reuse a slot an earlier echo already consumed, and a survivor left numbered past a dropped sibling would wait for an identical turn that cannot arrive. The release shifts only the later same-key siblings down by the number of drops that key actually vacated — not a renumber from 1, and not across keys. Renumbering from 1 would erase the slot an echo trimmed atPENDING_SEND_LIMITstill legitimately owns (that send landed, so its transcript turn still arrives); renumbering across keys would pull an unrelated repeated prompt onto a turn a real reply already consumed.The pending/command-marker state moved into
useNativeChatPendingEchoessoNativeChatViewstays under its max-lines ceiling — oxlint counted the file at exactly 400/400 before this change, so the extraction is forced rather than cosmetic.Review rounds on this branch
@brennanb2025 pushed four commits here rather than leaving them inline; all four are in and this description reflects the head, not my original diff.
c6acd073b1— adoption (rule 4) was renumbering even though it drops nothing, erasing the slot a capped-out echo still owns.a132c25ae9— the drop path renumbered every match key densely from 1, so dropping one prompt's echo pulled an unrelated repeated prompt down a slot. Replaced with the per-key shift-down described above, which subsumes the first fix.2697c8ff31— one occurrence-release primitive instead of two,readCommandMarkerCacheread inside the retain effect by scope instead of tagging marker state with its scope and skipping a commit, anduseEffectEventfor the suppression reset (the indirection I flagged in my own description as droppable).da42f231ef— splitting the cancelled-send fix back out, per the request below.Split out on review:
cancelSendreleasing the occurrence a cancelled echo would have taken was in this PR and is now #13513. It is a real strand — a cancelled delayed Enter leaves a later identical echo waiting on a turn that cannot arrive — but it is reachable onmaintoday with no dependency on the stale-echo work here, so it reviews and reverts on its own.cancelSendis back to the plain filter it has onmainin this PR;dropNativeChatPendingOccurrencesstays because the conversation-retain path is its remaining caller.Screenshots
No visual changein the fixed state — the change removes a bubble that should never have been on screen, so there is nothing new to show. The defect and each review finding are pinned by tests that fail without their fix.Testing
pnpm lintpnpm typecheckpnpm testpnpm build— not run; renderer-only change with no main/preload, packaging, or native surface touched. Say the word if you want it anyway.pnpm lint(includingcheck:max-lines-ratchetwith no new bypasses) and all threepnpm typecheckprojects exit 0.native-chatis green at 93 files / 837 tests. Full suite: 3758 files passed, 9 failed, 9 skipped (39754 tests passed, 44 failed, 71 skipped) — 0 new failures, each one accounted for:TypeError: window.localStorage.<removeItem|clear|getItem> is not a function— the happy-dom stub under local Node 25 against the repo's Node 24 requirement. Unrelated to this diff.src/relay/agent-exec-handler.test.ts(2 tests) fails identically onorigin/main; I checked outorigin/mainand reran it to confirm.src/main/native-chat/transcript-watch-liveness.test.ts(1 test) fails only inside the full run and passes 7/7 on this branch when run alone — load-dependent, and a main-process file-watch test that a renderer-only change cannot reach.Differential evidence — every behavioural claim here has a test that fails without its fix:
native-chat-pending-conversation.test.ts,use-native-chat-pending-echoes.test.tsxnative-chat-pending-occurrence.test.tsuse-native-chat-pending-echoes.test.tsxexpected 1 to be 2— a capped-out echo's real slot is eraseduse-native-chat-pending-echoes.test.tsxexpected [] to deeply equal [ 'leaf two prompt' ]— a live echo in another pane is dropped permanentlyNegative cases are covered too, so the rules cannot over-reach: an echo is dropped only when the session genuinely differs;
sentAtexactly equal to the clear boundary resolves as pre-clear; a dropped echo stays dropped across a remount, since native/TUI view switches re-read the pane cache; distinct match keys stay independent; and the release never invents an occurrence or falls below slot 1.I also exercised this by hand in a dev build — send,
/clearimmediately after a send, agent restart in place, resuming a different session, Stop right after a send, and two panes with separate sessions — reading each rendered row's message id and source so an optimistic echo could be told apart from a real transcript row. No stranded echo in any of them, and the first send in a fresh pane never blanks the list while the echo hands over to its real turn.AI Review Report
Two rounds of four-lens review (pure logic / React effects / test quality / repo fit), each finding measured rather than argued, plus the bot review on this PR.
What it checked and what it flagged:
/clearboundary, to stop a send queued between/clearand the replacement session id from blanking) turned out to reopen this PR's own failure mode more broadly: the boundary has to outlive the session change to be useful, so it never expires, and every later send in that pane then adopted into whatever session appeared next. Measured: a send 4 hours after one/clearadopted into an unrelated session. I reverted that entirely rather than ship it — this PR is deliberately narrower than my first attempt. See Known limit 2.setPendingeffects chain safely because both use functional updaters.commandMarkersin the retain effect. Correct, and reachable more easily than the bot estimated: the chat surface is one portal per tab with nokey, so moving it to another leaf changespaneKeyin place. Both scopes change in one commit while the marker state still describes the leaf you came from, and the drop it writes to the module-level pane cache is permanent./clearin one pane could therefore delete a live, legitimately-pending echo in another. My fix tagged the marker state with its scope and waited a commit when they disagreed; @brennanb2025 replaced it in2697c8ff31with a keyedreadCommandMarkerCacheread inside the effect, which cannot be stale in the first place. My test still pins it either way.cancelSendskipped occurrence release. Real, fixed, and now split out to fix(native-chat): release the occurrence a cancelled send would have taken #13513 — see above. Not fixed with the suggested dense renumber, which I measured to be incorrect here: a randomised probe over the hook (400 seeds × 50 operations) turned up survivors legitimately holding occurrence 3+ with no pruning involved, becausePENDING_SEND_LIMITtrims the oldest echo while its send still landed. The probe was temporary and is not part of the diff.281e4aad4: the hook's return object is a contract and three of its members had non-obvious triggers) and declined for the rest, which is test helpers and inline callbacks that already carry// Why:comments.AGENTS.mdasks for concise comments only where non-obvious. Happy to add specific ones you want.Mapcaches, array filtering, numeric timestamp comparison. No paths, no shell, no shortcuts or key handling, no labels or new user-visible strings (so no localisation surface —verify:localization-catalogpasses at 11546 keys × 5 locales), noprocess.platformbranch, and no Electron main/preload/IPC surface. Nothing here can behave differently on macOS, Linux, or Windows.Security Audit
No new attack surface. Reviewed against the categories that apply:
normalizeNativeChatPendingText(strips the[Image #N]marker, collapses whitespace). It is compared, never parsed, evaluated, or rendered as markup by this change.imagePathsare carried through as opaque strings for content-key equality only.sessionIdis a provider session identifier already present in renderer state; it is used only as an equality key and is not logged, persisted to disk, or sent anywhere.PENDING_SEND_LIMIT = 8,COMMAND_MARKER_LIMIT = 8, LRU of 128 scope keys). The release pass is O(n) over at most 8 entries. Note the reverted work removed an unbounded-lifetime cache entry, so this direction is strictly better than my first attempt.Notes
Known limits
Echo retirement still rests on a single text match. These are deliberately left out rather than widened into this PR:
main— where that echo ghosts forever rather than dying at the next swap — but this PR does not close it. Doing so needs a conversation epoch or restart marker onNativeChatSession, which does not exist yet. Raised by @brennanb2025 in review./clearand the replacement session id resolving carries the pre-clear id, so rule 5 drops it and the bubble blanks until its real user turn lands. Cosmetic and the opposite direction from the bug above — a brief gap rather than a permanent ghost. I had a fix for this and dropped it for the reason in the AI Review Report. Worth doing properly by recording the session observed at/cleartime, which felt like its own change.useNativeChatSendLifecycledrops the send handle aftersettleAfterMs. Filed separately as [Bug]: Chat UI leaves a permanent "sent" bubble when a composer send never reaches the agent #11511 — it produces the same symptom by a different cause, and the fix needs a product decision about label semantics that fix(mobile): stop reporting delivered chat messages as "Message not sent" #9792 already settled in one direction on mobile.sentAtis the renderer's clock whilemessage.timestampis the transcript host's, anduse-native-chat-live-session.tsroutes reads to a remote host whenruntimeEnvironmentIdis set — so a host running behind excludes the echo's own real turn.applyCommandMarkerBoundariesmixes the same two clocks. Both predate this PR; filed as [Bug]: Chat UI matches pending echoes across two clock domains — renderer send time vs remote transcript timestamps #11519.[Image #N]marker and collapses whitespace. This PR narrows that from permanent to until-the-conversation-is-replaced.COMMAND_MARKER_LIMIT = 8evicts a/clearafter nine later slash commands, after whichapplyCommandMarkerBoundariesstops hiding the cleared transcript. Pre-existing onmainand it cannot strand an echo — rule 1 has already run by then — so it is noted rather than carried here. Raised by @brennanb2025 in review.Line budget
native-chat-pending-occurrence.tsis close to itsmax-linesceiling (the ratchet passes, no new bypass), though2697c8ff31brought it back down slightly. #10102 and #10639 both add tonative-chat-pending.tsin the same area, so whichever lands last may need a split there — flagging it so it is not a surprise in a rebase.