Skip to content

feat(web): add find in conversation - #9660

Closed
Lucenx9 wants to merge 6 commits into
pingdotgg:mainfrom
Lucenx9:feat/thread-find
Closed

Lucenx9 wants to merge 6 commits into
pingdotgg:mainfrom
Lucenx9:feat/thread-find

Conversation

@Lucenx9

@Lucenx9 Lucenx9 commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Native browser find only sees the part of a conversation currently mounted in the DOM. Long T3 Code threads are paginated and virtualized, so users could not reliably find text outside the visible window.

Solution

Adds in-conversation find to the web and desktop chat surfaces with Cmd+F on macOS and Ctrl+F elsewhere, plus the same action in the command palette.

The server searches rendered user text and canonical final assistant text through a bounded, capability-gated RPC. The client gets an exact thread-wide count, loads older history when needed, expands folded content, and highlights the active result without hydrating the whole thread.

How It Works

sequenceDiagram
    actor User
    participant Client as Web / Desktop
    participant Server as T3 server
    participant Projection as SQLite projection
    User->>Client: Cmd/Ctrl+F and query
    Client->>Server: findThread(query, result page)
    Server->>Projection: Read canonical text for one thread
    Projection-->>Server: Ordered message rows
    Server-->>Client: Exact count and bounded locators
    Client-->>User: Load, scroll, and highlight active match
Loading

UI Changes

Before

The conversation has no thread-aware find control.

Before: conversation without thread-aware find

After: active result

The find bar reports the exact count and highlights the selected occurrence.

After: find bar showing the third highlighted result

After: unloaded history

The find bar can navigate to a result outside the initially loaded history.

After: server-backed navigation to the oldest unloaded match

After: folded content

Folded details open automatically when they contain the active result.

After: exact highlight inside automatically expanded details

Verification

  • 501 focused tests passed in the final post-merge run across shared search logic, file-link rendering parity, projection querying, RPC transport, timeline behavior, and DOM highlighting.
  • Typechecks passed for contracts, shared, client runtime, web, and server.
  • Interactive web verification covered the shortcut, command-palette focus, unloaded history, next/previous navigation, folded details, no-result state, and Escape cleanup with zero browser errors.
  • Two Daybreak Blue xhigh review passes finished clean after the final fixes.
  • Fallow reviewed the final diff with one worker: all four structural decisions were accepted, with no stale or rejected judgments.

Checklist

  • This PR addresses one focused concern
  • I explained what changed and why
  • I included before/after screenshots
  • No animation or timing behavior requires a video

Built with GPT-5.6-Sol via the Codex harness in T3 Code.


Note

Medium Risk
Touches projection revision semantics, thread-detail paging boundaries, and a new orchestration read RPC, but capability-gated and covered by extensive tests; main risk is edge cases in windowed history and highlight positioning on large threads.

Overview
Adds find in conversation for paginated, virtualized threads: clients call a new orchestration.findThread RPC (read scope, advertised via threadFind: 1 in server config) instead of relying on browser find over only mounted DOM.

Server loads searchable user and canonical assistant text from projections, returns exact totals with paginated locators and opaque targetCursor values. projection_threads.searchable_messages_revision (migration 048) invalidates cached find text when messages change, reverts run, or the canonical assistant message changes; thread-detail keyset paging gains inclusive boundaries and targetAnchorAt so matches can load a tight window (including turnless messages before the first turn).

Web adds ThreadFindBar (debounced query, prev/next, Cmd/Ctrl+F and command palette), useThreadFindTarget / ThreadFindSource for scrolling, loading older or direct windows via requestThreadTurnsAround, expanding folded markdown, and CSS Custom Highlight API highlighting (including diff shadow roots). Citation navigation shares the extended pagination model (hasMore, onLoadWindow).

Reviewed by Cursor Bugbot for commit 4bd22c3. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add thread.find in-conversation search across web, server, and shared packages

  • Adds a full-stack find-in-conversation feature: a ThreadFindBar UI, an orchestration.findThread WebSocket RPC, server-side searchable-message projection with revision tracking, and a shared visible-text presentation module that derives searchable text from the rendered transcript rather than raw message source.
  • The server persists a searchableMessagesRevision on projection thread rows (migration 48) and returns paginated, revisioned match results with cursors that reopen the matching detail window; a bounded LRU text cache avoids re-deriving visible text on repeated searches.
  • The web client resolves matches against the composed DOM (including open shadow roots in review diffs), positions virtualized timeline rows, loads the target history window on demand, and highlights occurrences via the CSS Highlight API with a data-attribute fallback.
  • Moves markdown, citation, directive, artifact-template, provider-skill, and file-path-display utilities from client-runtime/web into packages/shared so the server and client share one visible-text pipeline.
  • Risk: OrchestrationThreadShell gains an optional searchableMessagesRevision field and ThreadDetailPageCursor gains optional direct-target fields; older cursors and shells without these fields still decode, but any out-of-tree consumers reading raw cursor or shell payloads must handle the new optional keys. Migration 48 adds a non-null column with a zero default to the projection thread table.

Macroscope summarized 4bd22c3.

Copilot AI lite review requested due to automatic review settings September 4, 2026 12:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-04T13:16:44.222226Z 82c3af2 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels Sep 4, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cc4b89d461

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

Comment thread packages/shared/src/threadFind.ts Outdated
Comment thread apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts Outdated
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx
Comment thread apps/server/src/ws.ts
Comment thread apps/web/src/index.css Outdated
Comment thread apps/web/src/components/chat/ThreadFindBar.tsx Outdated
Comment thread apps/web/src/components/chat/ThreadFindBar.tsx
Comment thread apps/web/src/components/CommandPalette.tsx
@macroscopeapp

macroscopeapp Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR introduces a substantial server-backed conversation-search capability spanning RPC, persistence, shared Markdown projection, client pagination, virtualization, and new UI behavior. It also adds a default mod+f shortcut and changes auth-related code, so the scope and sensitivity require human review.

Not approved because:

  • Per-review cost limit exceeded (workspace setting). Approvability relies on correctness review in order to determine eligibility

Review your spending limits in Billing settings, or comment @macroscope-app review this PR to bypass the limit and review now. You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment thread apps/web/src/components/chat/ThreadFindBar.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 82c3af2074

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

Comment thread packages/shared/src/threadFind.ts Outdated
Comment thread packages/shared/src/threadFind.ts Outdated
Comment thread docs/internals/thread-find.md Outdated
Comment thread packages/shared/src/threadFind.ts Outdated
Comment thread apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts
Comment thread apps/web/src/components/chat/ThreadFindBar.tsx
Comment thread packages/shared/src/threadFind.ts Outdated
Comment thread packages/shared/src/threadFind.ts Outdated
Comment thread packages/shared/src/threadFind.ts Outdated
@coderabbitai

coderabbitai Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 847c0234-3191-4e07-becd-0ebaabf4e9de

📥 Commits

Reviewing files that changed from the base of the PR and between 01f3e50 and 82c3af2.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (36)
  • apps/server/src/auth/RpcAuthorization.ts
  • apps/server/src/checkpointing/CheckpointDiffQuery.test.ts
  • apps/server/src/orchestration/Layers/OrchestrationEngine.test.ts
  • apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.test.ts
  • apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts
  • apps/server/src/orchestration/Services/ProjectionSnapshotQuery.ts
  • apps/server/src/project/ProjectSetupScriptRunner.test.ts
  • apps/server/src/provider/Layers/ProviderSessionReaper.test.ts
  • apps/server/src/server.test.ts
  • apps/server/src/serverRuntimeStartup.test.ts
  • apps/server/src/ws.ts
  • apps/web/src/components/ChatMarkdown.tsx
  • apps/web/src/components/ChatView.tsx
  • apps/web/src/components/CommandPalette.tsx
  • apps/web/src/components/chat/MessagesTimeline.tsx
  • apps/web/src/components/chat/ThreadFindBar.logic.test.ts
  • apps/web/src/components/chat/ThreadFindBar.logic.ts
  • apps/web/src/components/chat/ThreadFindBar.tsx
  • apps/web/src/components/chat/ThreadFindSource.tsx
  • apps/web/src/components/chat/useThreadFindTarget.ts
  • apps/web/src/index.css
  • apps/web/src/keybindings.test.ts
  • apps/web/src/lib/assistantTextSelection.test.ts
  • apps/web/src/lib/assistantTextSelection.ts
  • apps/web/src/threadFindBus.ts
  • docs/internals/thread-find.md
  • docs/user/keybindings.md
  • packages/client-runtime/src/state/orchestration.ts
  • packages/contracts/src/keybindings.ts
  • packages/contracts/src/orchestration.ts
  • packages/contracts/src/rpc.ts
  • packages/contracts/src/server.ts
  • packages/shared/package.json
  • packages/shared/src/keybindings.ts
  • packages/shared/src/threadFind.test.ts
  • packages/shared/src/threadFind.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Adds a server-backed findThread RPC and a web find-in-conversation interface. The feature searches eligible user and final assistant messages, supports pagination, loads matching history, expands target rows, and highlights occurrences.

Changes

Search contract and server implementation

Layer / File(s) Summary
Search contract and visible-text extraction
packages/contracts/src/orchestration.ts, packages/contracts/src/rpc.ts, packages/contracts/src/server.ts, packages/shared/src/threadFind.ts, packages/shared/package.json
Adds the bounded findThread RPC contract, capability flag, Markdown-to-text conversion, occurrence matching, and shared package exports.
Projection query and WebSocket integration
apps/server/src/orchestration/..., apps/server/src/ws.ts, apps/server/src/auth/RpcAuthorization.ts, apps/server/src/server.test.ts, apps/server/src/**/*.test.ts
Queries eligible thread messages, caches derived text, returns paginated matches, authorizes the RPC, advertises threadFind, and updates test doubles and RPC coverage.

Client find flow

Layer / File(s) Summary
Find controls and navigation
packages/client-runtime/src/state/orchestration.ts, packages/contracts/src/keybindings.ts, packages/shared/src/keybindings.ts, apps/web/src/components/ChatView.tsx, apps/web/src/components/CommandPalette.tsx, apps/web/src/components/chat/ThreadFindBar*, apps/web/src/threadFindBus.ts
Adds capability-gated entry points, the mod+f command, debounced queries, match navigation, pagination, focus handling, and close behavior.
Timeline positioning and highlighting
apps/web/src/components/chat/MessagesTimeline.tsx, apps/web/src/components/chat/ThreadFindSource.tsx, apps/web/src/components/chat/useThreadFindTarget.ts, apps/web/src/lib/assistantTextSelection.ts, apps/web/src/components/ChatMarkdown.tsx, apps/web/src/index.css
Loads and expands matching rows, positions the timeline, resolves DOM ranges, excludes non-message content, and applies custom or fallback highlights.
Validation and documentation
apps/web/src/**/*.test.ts, packages/shared/src/threadFind.test.ts, docs/internals/thread-find.md, docs/user/keybindings.md
Tests text extraction, matching, pagination, keyboard behavior, server results, and rendered-range resolution. Documents the feature contract and controls.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 82c3a

No unresolved merge-blocking risk remains for the conversation find feature.

Suggested reviewers: juliusmarminge, maria-rcks

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 24.24% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 32 files. (4 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description clearly explains the problem, solution, implementation, UI changes, verification, and checklist. It includes the required UI screenshots and addresses the template content despite usin…
Title check ✅ Passed The title is concise and accurately identifies the primary change: adding find in conversation to the web experience.
Full details: Docstring Coverage

Explanation

Docstring coverage is 24.24% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 32 files. (4 skipped: 4 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@macroscopeapp

macroscopeapp Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Macroscope skipped reviewing this pull request. Per-review cost limit exceeded (workspace setting).

This review would cost an estimated $12.18, which exceeds your per-review limit of $10.00.

The top 3 files driving up this estimate:

File Diff Size Estimate
apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts 27.48KB $1.37
apps/web/src/components/chat/MessagesTimeline.tsx 24.98KB $1.25
packages/shared/src/threadFind.ts 20.36KB $1.02

Tip

To get this pull request reviewed, you can:

  1. Comment @macroscope-app on this PR to request a manual review (monthly spend limits still apply).
  2. Exclude the file(s) above from review by adding a pattern to your .macroscope/ignore.md — note that creating this file replaces Macroscope's built-in default ignores rather than extending them.
  3. Raise your cost limit in your workspace billing settings.

Turn off this reminder going forward

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default 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.

Reviewed by Cursor Bugbot for commit 9f5509b. Configure here.

Comment thread packages/shared/src/threadFind.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants