Skip to content

fix(web): scheduled task editor shows and changes the task's permissions - #37513

Open
juliusmarminge wants to merge 2 commits into
mainfrom
factory/issue-32237
Open

juliusmarminge wants to merge 2 commits into
mainfrom
factory/issue-32237

Conversation

@juliusmarminge

Copy link
Copy Markdown
Member

Scheduled tasks created by an agent store the creating thread's runtime mode (OrchestratorMcpService schedule_task stores limits.runtimeMode), and unbound runs launch new threads at that stored mode (ScheduledTaskService passes active.runtimeMode). The issue's two remedies are: (1) resolve the current default at launch, or (2) at minimum let the web editor show and change the stored mode. Option 1 would raise runs above the creator's mode, which PR #15219 deliberately caps; that is a maintainer decision, so it is left out (see outOfScope). This change does option 2. The web editor (apps/web/src/components/settings/ScheduledTasksSettings.tsx) had no runtime-mode control even though the mobile editor already has one, so the app contradicted itself and the stored mode could not be seen or changed from web. The fix adds a 'Permissions' Select below Model, built with the same runtimeModeConfig/runtimeModeOptions and managedRuntimeModeDenial pattern as Settings' 'Default permissions' control: same labels, icons and descriptions, with modes above the administrator's limit disabled and the reason shown. It is disabled for thread-bound tasks, as the Model picker is, because those runs use their thread's mode. The existing step that lowers a stored mode above the administrator's limit on save is kept so older tasks still save; only its outdated comment ('Tasks have no mode picker') was corrected. No server or contract change; no new regex or parser.

Fixes #32237

Reproduction on main

Commit 4bf5d53 (origin/main). Ran T3CODE_DEV_SEED=0 vp run dev in a fresh worktree (fresh database) and added a demo git project. Set the server settings defaultRuntimeMode to "auto". Through the server's own MCP endpoint (a short-lived client session, as t3 thread uses), launched a thread on claudeAgent/claude-haiku-5-5 without an explicit mode; it opened with runtimeMode "auto". Its prompt asked the agent to call schedule_task with prompt "Say hello", bindToCurrentThread false, interval 60 minutes. The agent created scheduled-task:598b4cfa…. Its scheduled_tasks row: thread_id NULL, thread_mode new_thread, runtime_mode auto, interaction_mode default, created_by agent, creation_source mcp. Then changed defaultRuntimeMode to "full-access". A control thread launched by hand afterwards opened in runtimeMode "full-access". Ran run_scheduled_task_now on the task: lastRunStatus succeeded, and its new thread "Say hello" opened in runtimeMode "auto", not full-access. Code: schedule_task stores runtimeMode: limits.runtimeMode (the calling thread's mode) at apps/server/src/mcp/OrchestratorMcpService.ts:2039, and unbound runs launch with runtimeMode: active.runtimeMode at apps/server/src/scheduledTasks/ScheduledTaskService.ts:1015. The web scheduled-task editor (apps/web/src/components/settings/ScheduledTasksSettings.tsx) has no runtime-mode control; it only clamps the stored value on save. The mobile editor has one in its model picker.

Evidence

Being captured: before and after in the real app. This section is filled in before the pull request can merge.

Tests

vp run check:changed: pass (format, lint, knip 1/2 and 2/2, typecheck of 2 packages, 1 adjacent test file with 7 tests, react compiler). Manual: T3CODE_DEV_SEED=0 vp run dev, paired the preview browser, opened Settings > Scheduled tasks > New task; the dialog shows 'Permissions: Full access' below Model. Not checked in the app: changing the mode, saving it, or the agent-created repro from the issue.

Not in this change

  • Making unbound scheduled runs use the current defaultRuntimeMode at launch (e.g. storing 'inherit' or null). That would raise agent-created tasks above the creating thread's mode, which PR feat(server): T3 MCP tools take explicit thread and project targets #15219 caps, so it needs a maintainer decision.
  • schedule_task (MCP) has no runtimeMode parameter; agents can only store their own mode.
  • New web tasks seed the editor with a hard-coded 'full-access' (EMPTY_DRAFT) rather than the server's defaultRuntimeMode.
  • Interaction mode (plan/default) is also stored per task and has no web editor control.

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
  • Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5

Run by the t3code factory in T3 Code.

A task created by an agent stores the creating thread's runtime mode, and
every unbound run opens its new thread in that mode. The web editor had no
control for it, so the stored mode could not be seen or changed there (the
mobile editor already has one). Add a Permissions select, disabled for
thread-bound tasks, which run in their thread's mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 16, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 670a07d

Macroscope's review found this PR approvable — The editor now exposes existing permission modes for scheduled tasks not bound to a thread. Defaults and administrator restrictions remain unchanged, keeping the change limited to explicit user selection.

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

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The scheduled-task editor adds a Permissions selector for tasks without a bound thread. It displays runtime-mode options and managed-policy denials. Saving continues to clamp the draft mode to the policy limit.

Changes: Scheduled task permissions

Layer / File(s) Summary
Runtime mode selector
apps/web/src/components/settings/ScheduledTasksSettings.tsx
The editor displays the draft mode’s icon and adds a Permissions selector with configured labels and descriptions. The selector is disabled while saving or disconnected. Managed-policy-denied modes are disabled and show a denial reason. Bound-thread tasks do not show the selector. The existing save-time clamp remains unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

  • pingdotgg/t3code#29067: Adds permissions controls to the same scheduled-task editor, including controls for editing task runtime modes.

Suggested labels: bugfix

Suggested reviewers: maria-rcks, t3dotgg

Merge Risk: Minimal · up to 670a0

The scheduled-task editor gains a Permissions selector for tasks that are not bound to a thread, and the existing managed-policy limit is still applied when saving. No merge-blocking issues were found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the scheduled task editor now shows and changes the task's permissions (runtime mode). It matches the changeset, which adds a Permissions selector to the web scheduled…
Description check Passed The description covers the required template sections. Problem: it explains the stored runtime mode and the missing web control, with the linked issue. Change: it describes the new Permissions selecto…
Linked Issues check Passed [#32237] The issue asks for two outcomes. The primary outcome is that unbound runs open in the current default runtime mode. The stated minimum is that the task editor shows the stored mode and lets t…
Out of Scope Changes check Passed The whole-PR diff for ScheduledTasksSettings.tsx contains four changes. (1) Imports of managedRuntimeModeDenial, runtimeModeConfig, and runtimeModeOptions support the new selector. (2) RuntimeModeIcon…
Full details: Title check

Explanation

The title names the main change: the scheduled task editor now shows and changes the task's permissions (runtime mode). It matches the changeset, which adds a Permissions selector to the web scheduled-task editor. The title uses the conventional commit format and is specific. Its 72-character length is within the usual limit.

Full details: Description check

Explanation

The description covers the required template sections. Problem: it explains the stored runtime mode and the missing web control, with the linked issue. Change: it describes the new Permissions selector, the disabled options for the managed limit, the thread-bound hide behavior, and the kept save-time clamp. Scope: it links issue #32237 and explains why the launch-time default change is excluded. Verification: it lists check:changed results and a manual check, and it states what was not checked. The Evidence section is still a placeholder that says before/after screenshots will be captured before merge, so the UI evidence the template requires for UI changes is missing. The template also asks for a model and harness attribution, which the Who did the work section supplies.

Full details: Linked Issues check

Explanation

[#32237] The issue asks for two outcomes. The primary outcome is that unbound runs open in the current default runtime mode. The stated minimum is that the task editor shows the stored mode and lets the user change it. The whole-PR diff (merge base to head) for apps/web/src/components/settings/ScheduledTasksSettings.tsx adds a 'Permissions' Select below Model. The Select uses runtimeModeConfig and runtimeModeOptions. It disables modes that managedRuntimeModeDenial rejects and shows the denial reason. It renders only when draft.threadId === "". The selected value sets draft.runtimeMode, which reaches the upsert input through the existing clampManagedRuntimeMode step. This meets the minimum editor requirement. The primary launch-time default resolution is not implemented. The PR description treats that as a maintainer decision, so that part of the issue stays unmet by design. Not verified in the app: changing and saving the mode. The PR description reports these steps as unchecked. Limitation: the incremental diff from the previous reviewed head (5ab9628) could not be read because changed blobs are missing from the checkout. This assessment relies on the whole-PR diff, which shows the same change the previous review described.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff for ScheduledTasksSettings.tsx contains four changes. (1) Imports of managedRuntimeModeDenial, runtimeModeConfig, and runtimeModeOptions support the new selector. (2) RuntimeModeIcon is derived from runtimeModeConfig[draft.runtimeMode] for the trigger icon. (3) The comment above the runtimeMode clamp is corrected. The clamp logic is unchanged. (4) The new Permissions Field. All four changes connect to the editor requirement in #32237. The PR description and summary report no server, contract, or other file changes. The whole-PR diff covered only the web editor file that was inspected. The incremental diff from the previous reviewed head could not be read, so changes made in that increment are checked only through the whole-PR file diff.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5ab9628 and 670a07d.

Files selected for processing: 1

  • apps/web/src/components/settings/ScheduledTasksSettings.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Bound runs use their thread's permissions, so a disabled control showing
the task's stored mode reported a mode those runs never use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member Author

The automated pipeline stopped on this pull request and will not merge it:

the reviewers still had findings after 3 rounds (the work is on main...factory/issue-32237):

  1. [major] apps/server/src/scheduledTasks/ScheduledTaskService.ts:1081: Not fixed: the issue's original reproduction still launches Auto threads after the default changes to Full access. The cause lives in the server: OrchestratorMcpService.ts:2261 persists limits.runtimeMode, and this launch passes active.runtimeMode unchanged. The complete diff changes only the web editor. It supplies the issue's explicitly accepted minimum remedy—manual inspection and correction—but does not resolve default inheritance. A maintainer must accept that narrower resolution or authorize changing the creator-mode cap established by #15219; silently removing that cap is not an appropriate smaller fix.
    Fails with: On desktop/macOS with Claude, set default permissions to Auto, have an Auto thread schedule an interval task with bindToCurrentThread:false, change default permissions to Full access, and let it run without manually editing the task. The new thread still receives Auto. The same server sequence affects web, iOS and Android.

It stays open for a person to finish or close.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Scheduled tasks freeze the creating thread's runtime mode, so runs ignore later changes to the default

1 participant