🤖 feat: /btw side-question command + placeholder tip carousel#3293
🤖 feat: /btw side-question command + placeholder tip carousel#3293ammar-agent wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 430261a29b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… carousel Address review feedback on PR #3293: - Render /btw as a single visually-distinct Q/A block: continuous left stripe joins the user question (compact, no bubble, 'Side question' header) and the assistant answer (mt-0 to tuck flush). Reads as one side-branch rather than two adjacent decorations. - Suspend main-agent chat events while a /btw answer streams. While isSideQuestionStreaming() is true, events targeting other messages buffer in sideQuestionEventBuffer and replay on side stream-end. The main agent visually picks up *after* the aside instead of having concurrent tokens shove the side branch around (root cause of the layout flashes). - Side-question pipeline now emits the placeholder MuxMessage envelope before stream-start so the side-question-answer marker reaches the frontend aggregator first. handleStreamStart carries the marker forward across its fresh-envelope construction so both the badge and the suspension layer see it for the full stream. - Remove dismiss button + workspace.dismissSideQuestion RPC + tests. Hard-delete UX wasn't worth the complexity; users can leave the pair in place since the suspension layer keeps them visually contained. - Tip carousel switches to a wall-clock 20-minute bucket so switching workspaces inside the same bucket never reshuffles the visible tip. Drop the now-unused useWorkspaceUserMessageCount hook and the tautological tests (lead-with, length cap, format regex) the reviewer flagged. --- _Generated with `mux` • Model: `anthropic:claude-opus-4-7` • Thinking: `high` • Cost: \0.95_ <!-- mux-attribution: model=anthropic:claude-opus-4-7 thinking=high costs=30.95 -->
|
@codex review Substantial follow-up: the /btw UX moved from "inline pair with dismiss" to a single visually-distinct Q/A block, and the main chat now suspends while a side question streams so concurrent main-agent tokens can't shove the side branch around (root cause of the prior layout flashes). The tip carousel is also rebucketed onto a wall-clock 20-min rotation so switching workspaces inside the same bucket no longer reshuffles the visible tip. PR body refreshed accordingly. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bbec371282
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8e87b45f4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 124a72a496
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Addressed the latest P2 findings:
Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 55e4a0b9ce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Addressed the latest P2: side-question answer streams still render through Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec56bacd94
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Addressed the buffered replay issue: side-question stream starts are now ignored (not reset) in the pending active-stream fallback, so an in-flight main stream remains interruptible/working during hydration even if Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 021fc904d4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Addressed the context reset issue: Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b1c975e80
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Addressed the transcript cap issue: Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a96df87a95
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Addressed the live stream context issue: Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 16c30edd11
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Addressed the live stream snapshot race: Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d8ecc4611b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Addressed the pre-candidate race: Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ba9f11fa2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Addressed the live partial duplication issue: when a live main stream snapshot is merged into the Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aece1b3b19
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Addressed the latest findings and the reported bottom-sticking behavior:
Validation:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bede969e17
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Updated /btw scroll handling after the streaming-order fix: side questions now anchor at the interruption point immediately and release bottom-lock once main output appears below the side branch, so the user can read the aside before opting back into the live tail. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b4bf1881b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Addressed the side-answer stream-start pending-startup regression and the zero-offset non-text split regression with focused tests; |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b339b3ac54
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
b339b3a to
599e39b
Compare
|
@codex review Addressed the side-answer terminal handling: main completions are final even while /btw streams overlap, and side-answer stream-end no longer clears pending main startup. Added focused regressions and |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
599e39b to
bc0356c
Compare
|
@codex review Rebased onto latest main and squashed the branch to a single commit. Local targeted tests and |
There was a problem hiding this comment.
💡 Codex Review
mux/src/browser/utils/messages/StreamingMessageAggregator.ts
Lines 2059 to 2062 in bc0356c
When a side-question stream starts while the main response already has a queued follow-up, this loop still clears hasQueuedFollowUp on every active stream even though /btw is not the queued handoff. That flag is set from queued-message-changed and later feeds buildResponseCompleteMetadata, so the main stream can be treated as final and fire response-complete behavior before the queued turn actually runs. Only reset queued-follow-up state for non-side-question stream starts (or for the actual main stream being started).
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
bc0356c to
c314005
Compare
|
@codex review Rebased on latest main, squashed the branch to one commit, and fixed the queued-follow-up side-answer stream-start regression. Local targeted tests and |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c314005b04
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
c314005 to
af5bdff
Compare
|
@codex review Restored /btw command text on pre-accept RPC failures and removed the tautological placeholder copy test. Local targeted tests and |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af5bdffe8c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
af5bdff to
a63e436
Compare
|
@codex review Guarded the /btw restore so it only repopulates the command while the composer is still empty, avoiding overwriting newer drafts; targeted tests and |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a63e436e47
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
a63e436 to
a4910ff
Compare
|
@codex review Fixed standalone /btw scroll holding so a side answer alone does not release bottom-lock; focused tests and |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4910ff030
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
a4910ff to
51074e4
Compare
|
@codex review Fixed the hydration-time scroll-hold initialization and captured part index metadata so pre-existing non-text parts stay before the /btw split. Focused tests plus |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 51074e478c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
51074e4 to
36fb119
Compare
|
@codex review Skipped main-stream pinned-todo collapse side effects for side-answer stream-end events and added a regression for overlapping /btw completion while main todos remain active. Targeted tests and |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 36fb1195e6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
36fb119 to
5fdb022
Compare
|
@codex review Invalidated pending fire-and-forget slash command tokens when a normal workspace send proceeds, so stale /btw failures cannot restore command text after a newer send. Targeted tests and |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Adds the
/btwslash command — a forked, single-turn, read-only side-question over the current conversation. Tools are denied on both the prompt and schema sides; the question and answer are persisted to chat history with distinct metadata and stream through the existingTypewriterMarkdownpath so the side branch reads as one offset Q/A cycle in the transcript. Also adds a placeholder tip carousel that surfaces/btw(and other slash-command tricks) on a wall-clock rotation, making the new command passively discoverable without flashing across workspace switches.Background
/btwis modeled on Claude Code 2.1.73's command of the same name: a quick "by the way, what was that file you mentioned?" question that runs against the current transcript without invoking tools and without re-anchoring the main agent loop. The persistence/UX iterated through three rounds (overlay → inline pair with dismiss button → single Q/A block with main-chat suspension) based on review feedback before settling on the current shape.Implementation
Backend (
src/node/services/sideQuestionService.ts)<system-reminder>that explicitly tells the model tools are unavailable; callsstreamTextwith notoolsargument so the no-tools contract is enforced on both prompt and schema sides.historyServiceallocates a realhistorySequence), emits it as amessagechat event so the frontend aggregator sees theside-question-answermuxMetadata before stream-start, then drivesstream-start/stream-delta/stream-endthroughsession.emitChatEvent. The frontend'sStreamingMessageAggregatorhandles these identically to a real agent stream —TypewriterMarkdown, smooth-text animation, and replay all just work.updateHistoryfills the placeholder with the streamed text; prior/btwexchanges are filtered out of each new side question's transcript so the model never grounds on its own earlier (possibly wrong) answers.Frontend: Q/A block + suspension
/btwuser question renders as a bare block (no bubble, no right-alignment, no per-row meta) with a compact "Side question" header. The assistant answer tucks flush beneath it (mt-0) and both rows share the same continuous left accent stripe, so the pair reads as one offset side branch rather than two adjacent message rows.WorkspaceStore.processStreamEventconsultsaggregator.isSideQuestionStreaming()and buffers any chat event that targets a different message while a/btwanswer is in flight. On the side-question's terminal event the buffer drains in arrival order, so main-agent text picks up after the aside instead of streaming concurrently underneath it. This is what fixes the layout flashes from the previous iteration.handleStreamStartcarries forward existingmuxMetadatawhen constructing the fresh streaming envelope, so theside-question-answermarker survives the stream-start → stream-end window in both the live and replay paths.workspace.dismissSideQuestionRPC + tests are removed — hard-delete UX wasn't worth the complexity now that the suspension layer keeps the pair visually contained.Placeholder tip carousel
floor(Date.now() / 20min) % tips.length). Same bucket → same tip everywhere, so switching workspaces inside the same bucket never reshuffles the placeholder./btw <question>. Mobile keeps the plain "Type a message..." placeholder.useWorkspaceUserMessageCounthook from the previous iteration was removed.Validation
New tests cover the load-bearing behavioral contracts:
StreamingMessageAggregator.sideQuestion.test.ts):isSideQuestionAnswerMessagediscriminates by storedmuxMetadata,isSideQuestionStreamingflips while a side stream is active, and the marker is preserved acrosshandleStreamStart(regression coverage for the muxMetadata carry-forward).WorkspaceStore.test.ts→ "/btw side-question suspension"): main-agentstream-deltaevents that arrive while a/btwanswer is streaming are buffered (main text stays put), the side-answer's own deltas bypass suspension, and the buffer drains on sidestream-endso the main message picks up where it left off.sideQuestionService.test.ts): the placeholder envelope is emitted before stream-start with the correctside-question-answermuxMetadata, the full event sequence ismessage→message(placeholder) →stream-start→ N ×stream-delta→stream-end, no tools are passed tostreamText, prior side-question turns are filtered from the transcript, and empty answers short-circuit cleanly.placeholderTips.test.ts): rewritten to test only behavior — same tip throughout a bucket, advances on bucket boundary, wraps past the end, and defensive fallback for non-finite inputs. The tautological "leads with /btw", "has between 1 and 11 tips", and "every tip references a slash command" tests called out in review were removed.make typecheck,make lint, andmake static-checkall pass locally.Risks
Concentrated in two places:
WorkspaceStore.processStreamEventnow consultsaggregator.isSideQuestionStreaming()on every event before dispatching. The check is O(active streams) (almost always 1) and bypasses entirely when no/btwis running. Worst-case failure mode would be main-agent events getting stuck in the buffer if a/btwterminal event never fires; the buffer is cleared on workspace removal, but a long-lived "stuck" side stream would block the main agent. In practice the side-question service always emits a terminal event (thetry/catcharoundstreamTextfalls through to an emptystream-end).streamMessagepipeline./btwemits stream events throughsession.emitChatEventdirectly, so the workspace'sstreamingflag, idle-compaction recency, and post-compaction attachments all skip/btw. This is intentional product behavior, but worth a careful eye onStreamingMessageAggregatorinteractions if anything feels off.Discoverability (future)
The tip carousel is tier-1. Right-click → "Ask /btw about this", a selection action chip, an onboarding slide, and a "did you mean /btw?" heuristic can land independently.
Generated with
mux• Model:anthropic:claude-opus-4-7• Thinking:high• Cost:$30.95