feat(settings): configure default permissions for new threads #11346
main fromrefs/pull/11346/head·merged by maria-rcks View on GitHubNew threads can now start with configured permissions: Supervised, Auto-accept edits, Auto, or Full access. The Permissions setting sits below Model in New threads, supports environment defaults and project overrides, and applies to web/desktop drafts, mobile tasks, and startup threads through all six providers' existing permission mappings. Existing threads and explicit draft choices retain their permissions. Switching an implicit draft to another project/environment and implementing a plan in a new thread both use the destination default.
The selected permissions label shows the matching mode icon. All four icons were checked through the real settings dropdown; scoped lint, formatting, and the web typecheck passed after this update.
Verified: 203 focused settings/thread tests, 32 provider permission tests, web/mobile/server typechecks, and scoped lint (existing warnings). In the real web client, a Codex thread inherited Auto and completed a response; project overrides and reset-to-inherit worked. Retargeting changed an implicit draft to the destination default, an explicit Supervised choice survived reopening and reached the provider, and plan implementation started a new Auto session from a Supervised source. The review fixes passed 156 focused web tests. Inspected desktop dark and narrow light layouts. Native mobile runtime and live sessions for the other five providers remain unverified.
Before:

After:



Model: gpt-6. Harness: Codex.
Summary by CodeRabbit#
New Features
- Added configurable default permission modes for new threads in project settings, including project-specific overrides.
- New threads now use the configured project default rather than inheriting permissions from the viewed thread.
- Auto-started and pending tasks now respect the resolved project permission mode.
- Added searchable settings access and clearer permission-mode descriptions.
Bug Fixes
- Preserved existing permissions when reopening drafts or editing pending tasks.
Documentation
- Updated permission-mode guidance, including defaults, overrides, and draft behavior.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- @@ -276,4 +267,4 @@276267 if (workspaceContext) {277268 setDraftThreadContext(emptyStoredDraftThread.draftId, {278269 ...workspaceContext,279- ...(carryRuntimeMode ? { runtimeMode: carryRuntimeMode } : {}),270+ ...(!isDraftAlreadyOpen ? { runtimeMode: defaultRuntimeMode } : {}),
🟠 High
hooks/useHandleNewThread.ts:270Reusing an empty draft that is not currently open overwrites its explicitly selected
runtimeModewithdefaultRuntimeMode, so a choice such as Supervised is lost when New Thread remaps that draft. BothsetDraftThreadContextandsetLogicalProjectDraftThreadIdapply this default; preserve the stored mode unless no explicit mode exists.🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/hooks/useHandleNewThread.ts around line 270: Reusing an empty draft that is not currently open overwrites its explicitly selected `runtimeMode` with `defaultRuntimeMode`, so a choice such as Supervised is lost when New Thread remaps that draft. Both `setDraftThreadContext` and `setLogicalProjectDraftThreadId` apply this default; preserve the stored mode unless no explicit mode exists.Note
Written by
gpt-6on behalf of Mariaexplicit selections are stored separately in composerDraft.runtimeMode and take precedence over the draft seed. verified in the real client: selected supervised, switched projects, left the empty draft, reopened it with new thread, and sent a message. both the persisted thread and the codex session remained approval-required, while the environment default was auto. the final change also resolves implicit defaults from the current project/environment so retargeted drafts use the destination default.
I don’t think this is resolved: the reuse path still passes
runtimeMode: defaultRuntimeModeto both setters whenever the draft is not already open, without checking the composer draft’s explicit runtime-mode selection. That write can overwrite the explicit value before it is used. Would you like me to prepare a fix?Note
Written by
gpt-6on behalf of Mariathese setters update draftThreadsByThreadKey. the explicit composer selection lives in draftsByThreadKey and is written by setRuntimeMode; neither reuse setter overwrites it. ChatView gives that composerRuntimeMode precedence when displaying and sending. the runtime reproduction above exercised this exact reuse path and the resulting provider session stayed supervised. no fix is needed for this finding.
Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — This PR adds a persistent environment/project permission-default setting and routes it into new-thread creation across web, mobile, and server bootstrap, changing the approval and sandbox policy used by new agent sessions. The product-default change and its runtime permission impact warrant human review.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
1aacc99d-cb2d-4ecf-a18a-8af1b6f1b6cc📥 Commits
Reviewing files that changed from the base of the PR and between 56bcbef628af28f8502457d883e5a983eeb5cfcb and 8dc2126864da4ff5c24adbeb9acf73b09dea37b2.
📒 Files selected for processing (1)
apps/web/src/components/settings/ProjectDefaultsSettings.tsx
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.
📝 Walkthrough
Walkthrough#
The change adds a project-scoped default runtime mode, exposes it in project settings, validates its contract, and applies it to web, mobile, pending-task, draft, and auto-bootstrap thread flows.
Changes#
Runtime mode defaults
Layer / File(s) Summary Runtime mode settings contract
packages/contracts/src/settings.ts,packages/contracts/src/settings.test.tsAdds defaultRuntimeModeto server settings, project overrides, and patches. Legacy settings default tofull-access. Tests cover supported and invalid values.Runtime mode settings UI
apps/web/src/components/chat/*,apps/web/src/components/settings/ProjectDefaultsSettings.tsx,apps/web/src/components/settings/settingsSearch.tsCentralizes runtime mode labels and icons. Adds project default-permissions selection, reset, mixed-state, and search support. Client thread runtime defaults
apps/web/src/hooks/useHandleNewThread.ts,apps/web/src/components/ChatView.tsx,apps/mobile/src/features/threads/new-task-flow-provider.tsx,apps/web/src/hooks/useHandleNewThread.test.ts,docs/user/permission-modes.mdNew threads use the resolved project default. Pending tasks preserve stored modes. Documentation describes the updated behavior. Server auto-bootstrap runtime mode
apps/server/src/serverRuntimeStartup.ts,apps/server/src/serverRuntimeStartup.test.tsAuto-bootstrap threads use resolved project settings. Tests verify project modes override machine defaults. Priority: ➖ Normal
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Sequence Diagram(s)#
sequenceDiagram participant ProjectSettings participant useHandleNewThread participant ChatView participant ServerRuntimeStartup participant DraftThreadState ProjectSettings->>useHandleNewThread: resolved defaultRuntimeMode useHandleNewThread->>DraftThreadState: set runtimeMode for new thread ProjectSettings->>ChatView: resolved project settings ChatView->>DraftThreadState: set runtimeMode for draft or implementation thread ProjectSettings->>ServerRuntimeStartup: resolved project settings ServerRuntimeStartup->>DraftThreadState: create auto-bootstrap thread with runtimeModePossibly related PRs
- pingdotgg/t3code#10811: Both changes modify runtime mode selection for new threads. This pull request applies the project-configured default across the supported creation flows.
Suggested reviewers:
juliusmarmingeMerge Risk: ⚪ Minimal · up to
8dc21The configurable permission defaults are ready to merge; the reviewed flows preserve explicit choices and apply the resolved project or environment default to new threads.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
Check name Status Explanation Resolution Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 12 files. Write docstrings for the functions missing them to satisfy the coverage threshold. ✅ Passed checks (4 passed)
Check name Status Explanation Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request. Title check ✅ Passed The title clearly and concisely describes the main change: configuring default permissions for new threads. Description check ✅ Passed The description explains the behavior, scope, UI changes, verification, screenshots, and known validation gaps. It does not use the template headings or include an explicit checklist, but it is mostly… - Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
Comment `@coderabbitai help` to get the list of available commands.maria-rcks merged thiscf1ba3d
maria-rcks closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed