t3code icon indicating copy to clipboard operation
t3code copied to clipboard

Add provider thread IDs and safe cross-thread reads

Open basilk15 opened this issue 4 months ago โ€ข 1 comments

Summary

  • Persist and expose provider-native thread IDs alongside T3 Code thread IDs without changing the existing T3 ID action.
  • Add explicit Copy Codex Thread ID / Copy Provider Thread ID context-menu actions in both sidebar variants.
  • Register a read-only read_thread MCP tool that resolves either a T3 thread ID or a provider-native ID and returns bounded recent messages/activity without resuming, steering, or mutating the target thread.
  • Preserve the existing preview MCP toolkit and require an explicit thread-read capability on issued same-environment MCP credentials.

Compatibility and safeguards

  • The orchestration field is optional and the existing nullable projection column is reused, so no migration is required.
  • Legacy rows with a SQL NULL provider thread ID continue to decode.
  • Existing Copy Thread ID behavior remains available and distinct.
  • Cross-thread results are bounded (1โ€“200 items per category, default 50), read-only, and limited to the authenticated T3 server environment.

Verification

  • vp run --filter @t3tools/contracts --filter t3 --filter @t3tools/web typecheck
  • Targeted formatting and lint on all 21 changed files (lint under the repository-pinned Node 24.13.1 runtime)
  • 19 focused web/MCP/projection tests passed
  • Focused provider runtime ingestion test passed
  • 5 MCP HTTP/preview registration and transport tests passed with local socket permission
  • Isolated test-t3-app environment launched successfully, migrations completed, and the pairing route was produced. Automated UI interaction could not be completed because the native preview bridge required authentication and the fallback in-app browser reported no available browser surfaces; no alternate browser was used to bypass that authentication constraint.

[!NOTE]

Add provider thread IDs to sessions and expose a read_thread MCP tool

  • Captures providerThreadId (e.g. Codex, Claude) on thread start and propagates it through session state changes, projections, and the OrchestrationSession contract.
  • Persists provider_thread_id in the projection_thread_sessions table and surfaces it via ProjectionSnapshotQuery.
  • Adds a read_thread MCP tool in a new ThreadControlToolkit that fetches thread metadata and bounded message/activity history by T3 or provider thread ID, enforcing a thread-read capability check.
  • Newly issued MCP credentials include the thread-read capability alongside preview.
  • Adds "Copy Provider Thread ID" context menu items to both Sidebar and SidebarV2 in the web UI.
๐Ÿ“Š Macroscope summarized d86586d. 13 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

๐Ÿ—‚๏ธ Filtered Issues

No issues evaluated.

basilk15 avatar Jul 26 '26 13:07 basilk15

[!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: bd4c49e2-66b5-4db4-9529-80f8963e785e

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
โœจ Finishing Touches
๐Ÿงช Generate unit tests (beta)
  • [ ] Create PR with unit tests

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.

coderabbitai[bot] avatar Jul 26 '26 13:07 coderabbitai[bot]

Closing in favor of #2829 (orchestration V2).

#2829 replaces the V1 orchestration engine wholesale, and the behavior this PR adds already landed there natively โ€” so this change is a no-op against the new base.

Thanks for the work here, and sorry for the churn on a long-lived branch. Once #2829 merges, please rebase onto main and reopen if the behavior is still missing โ€” happy to take it.

juliusmarminge avatar Jul 30 '26 15:07 juliusmarminge

@juliusmarminge Thanks captain, roger that.

basilk15 avatar Jul 31 '26 05:07 basilk15