Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(client-runtime): count tile-only images in image-only thread titles #48229

Opensaphid(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/48229/headopened View on GitHub

Problem

Sending a new thread with two attached images and no prose can produce the singular title Attached image instead of Attached images when only one image has an inline chip, and a mobile New Task draft in the same mixed state shows Attached image instead of 2 attachments in the thread list. deriveThreadTitleSeed returned the image-only fallback from threadTitleTextFromPrompt before counting input.attachments, and mobile's deriveUnsentThreadTitle treated image-chip-only text as prose.

Deterministic repro on origin/main (c89933c0f53a5867369b77491889a166ba659ada):

  • Web/desktop path: in a project-selected new-thread draft (apps/web/src/components/chat/useComposerAttachmentIntake.ts), type temporary prose so imageAttachmentsGetChips is true, attach a first image (wait for staging so its inline chip is inserted), delete the prose, and attach a distinct second image (wait for staging; it stays tile-only because stripInlineContextReferences(promptRef.current).trim().length === 0). Sending calls deriveComposerSendTitle -> deriveThreadTitleSeed -> launchThread (packages/client-runtime/src/operations/commands.ts:868) -> thread.created (apps/server/src/orchestration-v2/Orchestrator.ts:4342) -> projected sidebar title (apps/web/src/components/sidebar/SidebarThreadRow.tsx:1255). The singular Attached image is visible as the initial sidebar title (with title generation pending) and remains if regeneration fails or returns no replacement; successful title generation can replace it on both revisions.
  • Mobile draft row path: in New Task, attach a photo with prose present, remove the prose, add a second photo (mobile intake skips the second chip at apps/mobile/src/state/use-composer-drafts.ts:1482), and return to the thread list; deriveUnsentThreadTitle renders Attached image instead of 2 attachments (apps/mobile/src/features/threads/thread-list-v2-items.tsx:723).
  • Fixtures:
    • deriveThreadTitleSeed({ text: "[first.png](t3-context://v1/image/image_one)", attachments: [{ type: "image", name: "first.png" }, { type: "image", name: "second.png" }] }) -> Observed: "Attached image", Expected: "Attached images".
    • deriveUnsentThreadTitle({ text: "![first.png](t3-context://v1/image/image_one)", attachments: [{ name: "first.png" }, { name: "second.png" }] }) -> Observed: "Attached image", Expected: "2 attachments".

Change

Reuse isImageReferencesOnly from @t3tools/shared/composerContextReferences in both deriveThreadTitleSeed (packages/client-runtime/src/operations/threadTitle.ts) and deriveUnsentThreadTitle (apps/mobile/src/lib/projectThreadStartTurn.ts). When the prompt contains only inline image references and attachments are present, deriveThreadTitleSeed counts the attached image records directly (preserving prompt-only reference counting when no image attachments are passed, and avoiding double-counting), while deriveUnsentThreadTitle uses the attachment count label (preserving tile-only count labels and prose titles). All web, desktop, and mobile surfaces are covered with 17 non-test diff lines and no UI copy or contract changes.

Scope

Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.

Verification

  • Base failure (c89933c0f53a5867369b77491889a166ba659ada): vp test run packages/client-runtime/src/operations/threadTitle.test.ts -t "counts tile-only image attachments" failed with AssertionError: expected 'Attached image' to be 'Attached images'.
  • Head pass (4cf69e79fbd459696a8de4c1d7417a187d2ef593): vp test run packages/client-runtime/src/operations/threadTitle.test.ts apps/mobile/src/lib/projectThreadStartTurn.test.ts passed (2/2 files, 10/10 tests, covering mixed chip + tile-only images, single chip + attachment without double-counting, prompt-only inline image references, and mobile unsent draft titles for image-chip-only, tile-only, and prose drafts).
  • vp run check:changed (4cf69e79fbd459696a8de4c1d7417a187d2ef593): exited 0 (format 0.9s, lint 1.6s, knip 17.2s, typecheck 7/7 packages 32.3s, test 2/2 files 6.2s, react compiler 1/1 files 24.8s).
  • Before/after transcript: https://gist.github.com/saphid/48006cf8e5ec1a587da0001f7ed80050
  • Not shown: interactive web/mobile screenshot capture or a live scenarios:prove run (the fix is in pure shared/mobile title-derivation helpers with no layout changes).

Authored by Gemini 4 Neon (Antigravity); reviewed by GPT-6.2 Sol (Codex).

Not shown

  • apps/web/src/components/sidebar/SidebarThreadRow.tsx:1255 — No live web/desktop before-and-after was recorded; a scenario should use the attachment picker and hold title generation pending or make it finish without a replacement, then assert the visible sidebar title.
  • apps/mobile/src/features/threads/thread-list-v2-items.tsx:723 — No live mobile before-and-after was recorded; capture the mixed chip/tile New Task row on both revisions.
  • .github/pull_request_template.md:24 — The linked transcript records the earlier three-test shared run, not the reviewed ten-test head or a mobile base failure; extend it with SHA-stamped head output and a mobile before/after assertion.
    1. tanstack-source added labelsbug

    2. Approvability

      Verdict: Approved at 296873b

      Macroscope's review found this PR approvable — Image-only thread titles now account for tile-only attachments, with mobile previews using attachment counts consistently. The change is confined to generated labels and leaves ordinary text prompts unchanged.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      Thread title derivation now distinguishes image-reference-only prompt text from other prompt text. Mobile unsent-thread titles and client-runtime title seeds use attachment-based titles for the covered image cases. Tests cover image attachments, inline image chips, and text-derived titles.

      Changes: Thread title derivation

      Layer / File(s)Summary
      Client-runtime title seeds
      packages/client-runtime/src/operations/threadTitle.ts, packages/client-runtime/src/operations/threadTitle.test.ts
      deriveThreadTitleSeed checks image attachments and image-reference-only prompt text before deriving a text title. Tests cover matching inline image references and expected attachment-based titles.
      Mobile unsent-thread titles
      apps/mobile/src/lib/projectThreadStartTurn.ts, apps/mobile/src/lib/projectThreadStartTurn.test.ts
      deriveUnsentThreadTitle uses attachment counts when the text contains only image references and attachments are present. Other nonempty text uses the prompt-derived title. Tests cover both paths.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix

      Suggested reviewers: only21mil

      Merge Risk: Minimal · up to 29687

      Image-only thread titles now count tile-only image attachments correctly. The change is small, covered by tests, and easy to revert, so merge-readiness risk is minimal.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe title "fix(client-runtime): count tile-only images in image-only thread titles" names the main change: image-only thread titles now count tile-only image attachments. The raw summary and objective…
      Description checkPassedThe description follows the template well. It has Problem, Change, Scope, and Verification sections. The problem includes expected behavior and a reproduction path. The change explains the fix across …
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Full details: Title check

      Explanation

      The title "fix(client-runtime): count tile-only images in image-only thread titles" names the main change: image-only thread titles now count tile-only image attachments. The raw summary and objectives show the web/desktop title-seed logic in client-runtime and the mobile unsent-title logic both changed for this purpose. The title follows the conventional commit style the template requests. It names only the client-runtime scope, while the diff also touches apps/mobile, so it is partially narrow but still accurate about the primary fix.

      Full details: Description check

      Explanation

      The description follows the template well. It has Problem, Change, Scope, and Verification sections. The problem includes expected behavior and a reproduction path. The change explains the fix across the web/desktop and mobile paths. Scope explains why no issue is linked and states that this is a small bug fix. Verification gives a base failure, a head pass with SHA, and a check run. It also states what was not shown. The description does not include the template's agent attribution line in the required form, since it names the author model as Gemini 4 Neon rather than a model and harness line in the expected format, but this is a minor point. Some Not shown items remain open, so the author should add the live before/after evidence the template asks for under UI changes, but the core template sections are complete.

      Finishing Touches

      Generate unit tests (beta)

      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Recent review info

      Run configuration

      Commits

      Reviewing files that changed from the base of the PR and between 9a08ffb84084c441dcf4a2f595682a44632ecc89 and 296873b5d696f5cc62d423aec87e240cbcb4f68e.

      Files selected for processing: 4

      • apps/mobile/src/lib/projectThreadStartTurn.test.ts
      • apps/mobile/src/lib/projectThreadStartTurn.ts
      • packages/client-runtime/src/operations/threadTitle.test.ts
      • packages/client-runtime/src/operations/threadTitle.ts

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

Sign in to join this conversation.