Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(web): render AskUserQuestion exchanges as a stylized Q&A list #5867

Closedzacksmash(GitHub profile, opens in a new tab)wants to merge 8 commits intomain fromrefs/pull/5867/headopened View on GitHub

Summary

AskUserQuestion-style tool calls previously showed up in the timeline as a raw JSON tool row (AskUserQuestion: {"questions":[...]}) plus two bare "User input requested/submitted" rows with no content. This PR renders each exchange as a collapsible accordion card: a header row over a nested question card listing every question bolded with its answer beneath it, divider-separated.

Screenshot 2026-08-09 at 2 33 39 PM

Approach

Q&A exchanges are first-class timeline entries, following the existing proposed-plan pattern rather than living inside the work log:

  • session-logic.ts — new deriveUserInputExchanges pairs the user-input.requested / user-input.resolved activities by requestId into one UserInputExchangeEntry per interaction (anchored where the questions appeared; tolerant of unrelated rows landing in between, empty-string answers treated as unanswered, resolved-without-request history still renders from the answer keys). deriveTimelineEntries emits them as a new user-input entry kind. The work log skips the user-input.* activities and the redundant raw-JSON AskUserQuestion: tool rows (same pattern as ExitPlanMode rows).
  • MessagesTimeline.logic.ts / MessagesTimeline.tsx — the user-input row passes through like proposed plans and renders UserInputExchangeTimelineRow: a single bordered accordion whose header (icon + label + chevron; expanded by default, keyboard-accessible) toggles the nested question card. Hovering the trigger tints the whole accordion via a has- variant so expanded sections don't show a two-tone seam. Pending exchanges show a "Waiting for your answer…" placeholder; resolved exchanges with no recorded answer show "No answer recorded".

Because the exchange is its own entry kind, it keeps its true chronological position, never folds behind the settled-turn "Worked for …" row (fold grouping only tracks message/work entries), and can't split or relabel the Work Log section — no special cases in the fold or overflow logic.

Every provider adapter (Claude, Codex, Cursor, Grok, OpenCode) funnels question tools through the same user-input.* runtime events, so this one client-side change covers all of them.

Testing

  • deriveUserInputExchanges: pairing across interleaved rows, pending-only, empty-string answers, resolved-without-request fallback
  • deriveWorkLogEntries: user-input activities and raw AskUserQuestion tool rows omitted
  • deriveMessagesTimelineRows: exchanges pass through as standalone rows and keep their slot while the settled turn folds
  • Render tests: stylized card markup (no raw JSON), collapsible header affordance, waiting placeholder
  • Full web unit suite passes (220 files / 2003 tests), typecheck and lint clean

Known follow-up: the mobile app has a parallel timeline implementation in apps/mobile/src/lib/threadActivity.ts with the same raw-JSON display; this PR scopes to the web UI.

🤖 Generated with Claude Code


Note

Low Risk UI and timeline derivation only; no auth or persistence changes. Main behavioral shift is hiding AskUserQuestion rows from the work log in favor of Q&A cards.

Overview AskUserQuestion interactions stop appearing as raw JSON tool rows and empty “User input requested/submitted” lines. The PR models each exchange as a first-class user-input timeline entry (like proposed plans), derived in deriveUserInputExchanges from user-input.requested / user-input.resolved (plus stale provider.user-input.respond.failed), with pairing across out-of-order events, missing requestId, and empty answers treated as unanswered.

deriveTimelineEntries merges those exchanges with messages, plans, and work; same-createdAt ordering uses activity sequence. The work log drops user-input.* activities and redundant AskUserQuestion tool rows.

MessagesTimeline renders UserInputExchangeTimelineRow: a collapsible Q&A card with waiting/submitted states and live composer draft previews via pendingUserInputDraftAnswersByRequestId. Exchanges stay outside turn folds; a pending card suppresses the thinking shimmer while the agent waits on the user.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 6ac81b92bb3194ecf21417aa609799420e16539c. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Render AskUserQuestion exchanges as Q&A cards in MessagesTimeline

  • Adds UserInputExchangeEntry and pairs user-input activities in session-logic.ts to produce resolved, pending, or settled states.
  • Excludes raw AskUserQuestion tool data from deriveWorkLogEntries so it only appears through the new structured exchange path.
  • Renders exchanges as collapsible cards in MessagesTimeline.tsx with formatted answers, live draft previews, and waiting placeholders.
  • Sorts equal-timestamp activity-backed entries by source sequence using compareTimelineEntrySequences.
  • Risk: Removes raw AskUserQuestion JSON rendering from the timeline; out-of-tree consumers expecting raw tool rows for this activity will break.
Macroscope summarized 6ac81b9.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. 💡 Codex Review

      Here are some automated review suggestions for this pull request.

      Reviewed commit: c4d5f1e1cb

      ℹ️ 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".

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This PR introduces a new production web timeline capability and changes how existing AskUserQuestion activity is derived, filtered, ordered, and rendered, with over 1,200 lines added across shared timeline logic and UI. An unresolved medium-severity thread also documents an ordering edge case around stale user-input requests, so the change warrants human review.

      Not approved because:

      • 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity
      Adjust the Minimum Blocking Severity for this repo — including turning it Off — in [Settings](https://app.macroscope.com/pingdotgg/settings#Repos). You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 5cb23b05-ddd6-492c-bf8e-22e7a45fd198

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      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.
    5. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      https://github.com/pingdotgg/t3code/blob/a2dbabe60c4e319436ae4ac63f2706eb5a4e3e4b/apps/web/src/session-logic.ts#L501

      deriveUserInputExchanges silently drops user-input.requested activities whose questions have empty options arrays, even though the UserInputQuestion contract allows that. A free-form question with zero options never produces a timeline exchange, and its later resolution can only show as an orphan with no question context. This happens because parseUserInputQuestions rejects questions with options.length === 0 and then returns null for the whole activity, so the early continue at the call site skips it entirely. Consider accepting zero-option questions in parseUserInputQuestions instead of discarding them.

      ✅ Resolved in d423eed038dd1fd4aa73e876469720f6e0c832a7

    6. Fixed in d423eed0 — parseUserInputQuestions now takes an allowEmptyOptions flag, and deriveUserInputExchanges opts in: free-form questions with zero options produce a timeline exchange and render normally in the card. The composer-panel path (derivePendingUserInputs) keeps the strict parse, since it needs options to offer. Covered by a new test.

    7. Sorry, I'm unable to act on this request because you do not have permissions within this repository.

    8. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      https://github.com/pingdotgg/t3code/blob/44ac3584ac953c3264c283ed7314473e331a1dd1/apps/web/src/components/ChatView.tsx#L3935

      pendingUserInputAnswersByRequestId is keyed only by requestId and is never cleared when the active thread changes. Provider request IDs are thread-local, so after switching threads, a pending Q&A exchange in the new thread whose requestId collides with one from the previous thread displays the old thread's draft answers. This leaks stale user input from one thread into another. Consider resetting pendingUserInputAnswersByRequestId and pendingUserInputQuestionIndexByRequestId in the existing activeThread?.id cleanup effect, or keying the maps by thread key alongside requestId.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/web/src/components/ChatView.tsx around line 3935:
      
      `pendingUserInputAnswersByRequestId` is keyed only by `requestId` and is never cleared when the active thread changes. Provider request IDs are thread-local, so after switching threads, a pending Q&A exchange in the new thread whose `requestId` collides with one from the previous thread displays the old thread's draft answers. This leaks stale user input from one thread into another. Consider resetting `pendingUserInputAnswersByRequestId` and `pendingUserInputQuestionIndexByRequestId` in the existing `activeThread?.id` cleanup effect, or keying the maps by thread key alongside `requestId`.
    9. pendingUserInputAnswersByRequestId predates this PR — it's existing ChatView state that the composer panel already keys drafts by; this PR only reads it for the timeline preview. On the collision risk: request ids are provider-generated per interaction (the Claude adapter mints a fresh randomUUIDv4 per exchange), so a cross-thread key collision isn't reachable in practice. Clearing the map on thread switch would also discard a user's in-progress draft when they hop to another thread and back, which the current behavior deliberately survives. If the retention itself is worth revisiting, that seems like a follow-up on the existing composer state rather than part of this display change.

    10. Sorry, I'm unable to act on this request because you do not have permissions within this repository.

    11. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 08fc988e3240bc5575a1e36080fa15aad61e98b2. Configure [here](https://www.cursor.com/dashboard/bugbot).
    12. UI Consistency: 1 finding

      The new Q&A timeline card hand-rolls a disclosure trigger (div role="button" + tabIndex + manual Enter/Space handling) instead of using a native <button> / the shared Collapsible primitives that every other disclosure in this timeline and the sibling pending-user-input panel use. Details inline.

      Rest of the diff looks consistent: the <section aria-label> + -mx-1 px-1 py-0.5 wrapper, text-[12px] leading-5 typography, text-icon-muted icon tone, bg-card/50 + border-border/60 card surface, and the stopRowToggle guard on the expanded body all match existing timeline row conventions, and the logic changes are pure TS with focused tests.

      Posted via Macroscope — UI Consistency
    13. @t3dotgg @juliusmarminge let me know if this is something you'd consider. I would love to have this kind of output in the feed.

      Thanks!

    14. t3-code-bot[bot](GitHub profile, opens in a new tab)commented

      posted at the request of @StiensWout.

      recommendation: keep this open for a smaller revision. a readable Q&A transcript is worth adding, but this is not ready to merge as written.

      before merging:

      • use one lifecycle calculation for the composer and transcript. in the reported mixed-sequence scenario, the composer still has a pending question while the transcript marks it resolved. both views need to agree.
      • remove live draft previews, or subscribe to them only in the relevant Q&A row. putting draft answers in the shared timeline context makes unrelated consumers rerender while the user types.
      • keep this focused on transcript rendering. leave thinking-indicator changes out, simplify the nested bordered cards, and replace repetitive markup assertions with focused lifecycle and accordion interaction tests.
      • resolve the conflicts with main and run the web tests, typecheck, and lint on the updated branch.

      mobile support can remain a follow-up, as the description explicitly scopes this change to web.

      i would not close this solely because of conflicts or excess scope. give the author a chance to narrow it; consider closing in favor of a smaller replacement if one is taken on, or if the author does not want to revise this approach.

    15. closing this version as part of a pr cleanup at the request of @StiensWout.

      the readable question-and-answer history is useful, but this version introduces a second request-state calculation that can disagree with the composer, plus live draft updates through the shared timeline context. a smaller change showing submitted answers in existing rows is a better direction; #10417 is an open cross-client alternative, not a merged replacement.

      thanks for the contribution. if you disagree with this decision, you are welcome to open a new pr, link back to this one, and explain how your proposal addresses these concerns or why a different approach is warranted.

Sign in to join this conversation.