feat(mcp): expose thread organization commands#10554

merged1
agents/mcp-shared/attachment-intake
agents/mcp-thin/thread-organization
openedSep 7, 2026byJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 3d ago

Part 4/16 of the shared-core and MCP stack. Based on #10580. Next: #10555.

Agents cannot invoke the existing pin, snooze, settle, archive and unread commands through MCP. This adds one scoped tool that dispatches those commands through ThreadManagementService.

This bottom layer also adds the shared caller/project/mode checks, fixed public errors and core MCP tests reused above. No lifecycle or command-service implementation changes. Deferred organization is not included.

MCP-only rebuild of #8676, preserving attribution to Julius Marminge's original work. Original branches remain available for separate service follow-ups.

Validation: The composed stack passes 94 tests across 12 focused files, including shared core MCP and real MCP/V2 integration, attachment intake, project RPC/service contracts, and client model command selection. Server/contracts/shared/client-runtime typechecks and targeted format/lint/diff checks pass. New behavior coverage lives with the shared operation; no per-tool mock suite was added. Current-head CI is shown below.

Layer size: 8 files, +308/-3. No domain-service production implementation or documentation files change in this MCP layer.

Prepared with Codex in the OpenAI agent runtime.

Note

Add t3_thread_organize MCP tool to dispatch thread organization commands

  • Adds the t3_thread_organize tool schema and toolkit, then registers live handlers that map pin, unpin, snooze, unsnooze, settle, unsettle, archive, unarchive, and mark-unread actions to orchestration commands
  • Introduces thread-access helpers in threadAccess.ts: caller resolution requires the orchestration capability, thread lookup is scoped to the caller's project, and the active-owner guard rejects archived callers or provider mismatches with parent_not_active\n- Writable-thread validation fails when the target thread's runtime or interaction mode would broaden the caller's mode; missing snoozedUntil returns invalid_request and dispatch failures return the fixed public orchestration_error payload
  • Adds tests for schema uniqueness across toolkits, capability denial before the management service is used, storage-failure boundary behavior, and integration pin/unpin plus cross-project thread_not_found
  • Refactors turn-request launch error handling in ws.ts into tag-specific mappers for AttachmentClaimError, ThreadLaunchError, and ServerRuntimeStartupError
  • Risk: mutation flows now enforce the active-owner guard in assertLiveCaller; any caller lacking an active run or owned by a different provider instance will receive parent_not_active where they previously may have succeeded

Macroscope summarized c03cefc.

Synced from GitHub

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR adds and production-registers a new destructive MCP tool that can mutate thread lifecycle and organization state through multiple commands. The access checks and tests reduce risk, but the new user-facing capability and persisted side effects warrant human review.

No code changes detected at c03cefc. Prior analysis still applies.

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

Synced from GitHub

Thread transfer impact

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

This comment will update automatically after the next completed run.

Added 1 commit

  • feat(mcp): expose existing thread organization commandsc03cefc