Skip to content

feat(mcp): target thread launches by project - #8678

Open
juliusmarminge wants to merge 2 commits into
agents/mcp-projects/managementfrom
agents/mcp-projects/targeted-threads
Open

feat(mcp): target thread launches by project#8678
juliusmarminge wants to merge 2 commits into
agents/mcp-projects/managementfrom
agents/mcp-projects/targeted-threads

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Aug 29, 2026

Copy link
Copy Markdown
Member

Problem

Creating a project over MCP is incomplete when a new top-level thread cannot be launched there, and existing thread tools can only resolve targets in the caller's current project.

Change

  • Add optional projectId and typed root, existing-worktree, or new-worktree launch strategies to create_threads and t3_thread_start.
  • Route new threads through ThreadLaunchService so provisioning, setup scripts, receipts, provenance, attachments, and idempotency follow the application workflow.
  • Authorize and persist the target project when recording a created thread on the parent timeline.
  • Canonicalize existing-worktree paths and verify Git repository identity before launch.
  • Treat root and existing-worktree branch values as expected-branch constraints and persist the checkout's actual branch.
  • Add optional same-environment project selection to thread list, read, send, wait, and interrupt.
  • Advertise project targeting and workspace launch strategies through orchestration capabilities.

Behavior

Omitted project selection keeps the current project. Omitted workspace selection reuses the caller checkout only in that project; another selected project starts at its configured root and never inherits the caller's worktree path. Existing-worktree launches accept canonical or symlink paths only when they resolve to a Git worktree root of the selected repository. Root launches preserve configured repository subdirectory roots, and root/existing-worktree launches never switch branches. Provider/model/runtime settings still inherit from the caller, and runtime/interaction permission ceilings remain enforced. No arbitrary environment selection is accepted.

Validation

  • Real MCP, ThreadLaunchService, and orchestrator integration covering a recorded cross-project launch.
  • Real Git repository tests covering sibling worktrees, canonical symlinks, nested project roots, unrelated repositories, plain directories, and root/existing branch mismatches.
  • Focused project-targeting, activity, registration, thread-management, and contract tests: 35 passed.
  • @t3tools/contracts and server targeted typechecks; targeted lint for changed orchestrator MCP and contract files.

Dependency

Depends on #8677 for project contracts, persistence plumbing, and ProjectService-backed selection. It is the upper layer of native stack #8710, whose trunk is the immutable agents/mcp-controls/base-490318a. Cross-project organization remains a coordinated follow-up on the same resolver and is intentionally not implemented here.

Implemented by GPT-5.6-Sol via Codex in T3 Code.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

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: 0f6b74c5-2ee2-465a-9458-01f5233b670e

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

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

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 29, 2026
Comment thread apps/server/src/mcp/OrchestratorMcpService.ts Outdated
Comment thread packages/contracts/src/orchestratorMcp.ts
@github-actions

github-actions Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for f17378f.

This comment will update automatically after the next completed run.

@juliusmarminge
juliusmarminge force-pushed the agents/mcp-projects/targeted-threads branch from 6b41e5d to 27d9ea3 Compare August 29, 2026 21:51
@juliusmarminge
juliusmarminge force-pushed the agents/mcp-projects/targeted-threads branch from 27d9ea3 to e1994f8 Compare August 29, 2026 21:53
@juliusmarminge
juliusmarminge force-pushed the agents/mcp-projects/targeted-threads branch from e1994f8 to baad86f Compare August 29, 2026 22:14
Comment thread apps/server/src/orchestration-v2/Orchestrator.ts Outdated

@macroscopeapp macroscopeapp 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.

Effect service conventions review: two import-namespace deviations around the new VcsDriverRegistry dependency. Everything else (environment-based dependency acquisition in make, the updated layer requirement type, ThreadLaunchService consumption, and the test seams) follows the conventions.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/mcp/OrchestratorMcpService.ts Outdated
Comment thread apps/server/src/mcp/OrchestratorMcpService.targeting.test.ts Outdated
@juliusmarminge
juliusmarminge force-pushed the agents/mcp-projects/targeted-threads branch from baad86f to 192e70c Compare August 29, 2026 22:18
@juliusmarminge
juliusmarminge force-pushed the agents/mcp-projects/targeted-threads branch from 192e70c to 1f90503 Compare August 29, 2026 22:28
@github-actions github-actions Bot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 29, 2026
@juliusmarminge
juliusmarminge force-pushed the agents/mcp-projects/targeted-threads branch from 1f90503 to b0bd679 Compare August 29, 2026 22:40
@juliusmarminge
juliusmarminge marked this pull request as ready for review August 29, 2026 22:44
@macroscopeapp

macroscopeapp Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR adds cross-project thread access and workspace launch workflows, including Git worktree provisioning, setup execution, branch validation, and a new orchestration authorization boundary. It also routes existing thread creation through a materially different launch path, creating broader runtime impact than a small optional API addition.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge
juliusmarminge force-pushed the agents/mcp-projects/targeted-threads branch 2 times, most recently from c278983 to 1a5ea57 Compare August 29, 2026 23:06
@juliusmarminge
juliusmarminge force-pushed the agents/mcp-projects/targeted-threads branch from 1a5ea57 to 13bd326 Compare August 29, 2026 23:11

@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 high effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but a cloud agent failed to start.

Reviewed by Cursor Bugbot for commit 13bd326. Configure here.

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

Labels

size:XL 500-999 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.

1 participant