Skip to content

feat(mcp): run scheduled tasks immediately - #8731

Closed
juliusmarminge wants to merge 9 commits into
t3code/codex-turn-mappingfrom
agents/mcp-scheduled-tasks/run-now
Closed

feat(mcp): run scheduled tasks immediately#8731
juliusmarminge wants to merge 9 commits into
t3code/codex-turn-mappingfrom
agents/mcp-scheduled-tasks/run-now

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Aug 30, 2026

Copy link
Copy Markdown
Member

Problem

Scheduled tasks can be managed through MCP, but agents could not trigger one immediately without bypassing scheduler bookkeeping or risking duplicate work on retry.

Change

  • Add run_scheduled_task_now with a required stable request key.
  • Route manual runs through ScheduledTaskService, ThreadLaunchService, and V2 command receipts.
  • Serialize command identity, task mutation, and caller/target policy checks with the existing thread executor.
  • Resume a partial unbound launch once without rewriting task bookkeeping already owned by another logical run.

Behavior

Fresh calls re-read the task and bound target under admission, enforce current project and runtime/interaction ceilings, and return durable thread, message, run, and receipt identities. Accepted retries return the original effect after task changes or deletion. Conflicting key reuse fails without mutating the losing task. A successful partial-launch resume does not rewrite runCount, nextRunAt, or the latest run summary.

Validation

  • 19 focused scheduler service, MCP/V2 integration, and contract tests.
  • Scoped @t3tools/contracts and t3 typechecks.
  • Formatting and type-aware lint for all changed files.

Base

Standalone PR on t3code/codex-turn-mapping at 415ed0f73b97f1655b6282492f81d0b2bba3a9cc.

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

@coderabbitai

coderabbitai Bot commented Aug 30, 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: a0316b7f-ee1f-45ef-af05-dbf67f1938cb

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

Warning

Your free Security trial is over. An organization admin can activate Security or dismiss this notice.


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

@juliusmarminge
juliusmarminge marked this pull request as ready for review August 30, 2026 02:28
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XL 500-999 changed lines (additions + deletions). labels Aug 30, 2026

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

Reviewed the changed Effect service code (ScheduledTaskService, Orchestrator, ThreadLaunchService, ThreadManagementService, MCP toolkit/handlers, contracts) against the service conventions. Two convention violations found, both in apps/server/src/scheduledTasks/. The new policyCeiling plumbing, getCommandReceipt exposure, and makeKeyedSerialExecutor usage all follow existing module/layer conventions.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/scheduledTasks/ScheduledTaskService.ts Outdated
Comment thread apps/server/src/scheduledTasks/ScheduledTaskService.test.ts Outdated
@github-actions

github-actions Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

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

This comment will update automatically after the next completed run.

Comment thread apps/server/src/scheduledTasks/ScheduledTaskService.ts
Comment thread apps/server/src/scheduledTasks/ScheduledTaskService.ts
Comment thread packages/contracts/src/orchestratorMcp.ts
@macroscopeapp

macroscopeapp Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR introduces a new MCP workflow that can durably create threads, dispatch agent runs, update scheduler state, and replay commands across multiple orchestration layers. It also changes shared policy enforcement and dispatch locking, making the runtime and authorization impact broad enough to require human review.

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

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

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

One convention finding on the new scheduled-task manual-run errors; everything else (namespace imports, layer/service shape, dependency acquisition, test seams) looks consistent with the repo conventions.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/scheduledTasks/ScheduledTaskService.ts Outdated
@juliusmarminge
juliusmarminge force-pushed the agents/mcp-scheduled-tasks/run-now branch from 8ba30b8 to c0b2fe8 Compare August 30, 2026 17:27
@juliusmarminge
juliusmarminge changed the base branch from agents/mcp-controls/base-490318a to t3code/codex-turn-mapping August 30, 2026 17:27
@github-actions github-actions Bot added the 📱 Native Change Changes the native fingerprint; merging blocks production OTAs until a new store build ships. label Aug 30, 2026
Comment thread apps/server/src/orchestration-v2/Orchestrator.ts

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

One convention finding in the Effect service changes: new code in Orchestrator.ts references the standalone CommandReceiptStoreV2Shape type instead of the inferred Foo["Service"] interface. Everything else (tagged manual-run errors with derived messages, namespace imports, keyed serial executor as a pure helper, test-only service seams) looks consistent with the conventions.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/orchestration-v2/Orchestrator.ts Outdated
@github-actions github-actions Bot removed the 📱 Native Change Changes the native fingerprint; merging blocks production OTAs until a new store build ships. label Aug 30, 2026
@juliusmarminge
juliusmarminge force-pushed the t3code/codex-turn-mapping branch from c01ff20 to 9d2539a Compare August 30, 2026 19:57
@juliusmarminge
juliusmarminge force-pushed the agents/mcp-scheduled-tasks/run-now branch from fa0bdb6 to e8823bd Compare August 30, 2026 20:12

@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 e8823bd. Configure here.

Comment thread apps/server/src/scheduledTasks/ScheduledTaskService.ts Outdated
@juliusmarminge
juliusmarminge force-pushed the t3code/codex-turn-mapping branch 8 times, most recently from b82facd to 2ac9bfe Compare September 5, 2026 04:56
@juliusmarminge
juliusmarminge force-pushed the agents/mcp-scheduled-tasks/run-now branch from c3f04e2 to 12fc18b Compare September 5, 2026 06:13
Comment thread packages/contracts/src/orchestratorMcp.ts Outdated
@juliusmarminge

Copy link
Copy Markdown
Member Author

Superseded as the active MCP proposal by #10562 in the rebuilt MCP stack, following the maintainer request to review thin service wrappers separately from service hardening.

This is not a full feature-parity replacement. Requires a full-access/default caller. Each call is a new manual run, not an idempotent retry. Returned bookkeeping is not provider turn completion; durable keyed retries and scheduler hardening are separate.

Closing this mixed proposal without merging. The remote branch agents/mcp-scheduled-tasks/run-now and exact head c5a6c9755adea95bd684df1efd84ec13dfe0e69b are retained so the service changes can be extracted for separate review later.

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