feat(settings): allow per-project override of usage-limit auto-resume #26378
main fromrefs/pull/26378/head·opened View on GitHubProblem#
"Resume after usage limits" (autoResumeLimitedThreads) is environment-wide: either every limited thread resumes at reset, or none do. I want unattended work to resume automatically in some projects, while threads in other projects wait for me to choose "Resume at reset". Today the only options are flipping the global switch back and forth or clicking each banner.
Change#
autoResumeLimitedThreads joins the project-scoped server settings, so a project can turn auto-resume on or off. The project value wins over the environment value; with no override, the environment value applies as before.
- Contracts: add the key to
PROJECT_SCOPED_SERVER_SETTING_KEYSandProjectSettingsOverrides. - Server:
resolveLimitRecoveryPolicy(UsageLimitRecoveryWorker.ts) now makes the per-thread decision, resolving the project's settings. Before, the SQL andlimitRecoveryCommandeach applied the global flag.getLimitRecoveryCandidatesfilters unarmed candidates by project id in SQL, so the 5 s sweep still loads only threads that may arm. With no overrides, the query behaves as before.- A user's own "Resume at reset" is unaffected by a project override of off.
- Web/desktop: no row code needed.
SettingsRow/ScopedSwitchpick up project scope generically, including the inheritance popover and reset. The settings search entry getsscope: "project-defaults". - Mobile: the Usage limits section now also shows in project scope. Resume writes the project override; Snooze stays environment-wide and is disabled there with the existing "Environment-wide setting" hint. "Use defaults" clears the override.
- Docs: one line in
docs/user/thread-sidebar.md.
snoozeLimitedThreads stays environment-only to keep this focused.
Scope and approval#
This is a focused configuration option for an established capability. Auto-resume after usage limits already exists as an environment setting with a persisted per-thread recovery state and a sweep. This PR only lets the existing switch be set per project, through the existing project-override mechanism (the same one continueThreadsAfterServerUpdate uses). It adds no new command, event, or thread state, and leaves the default unchanged (off).
Discussion: https://github.com/pingdotgg/t3code/discussions/26124. No maintainer approval yet; I'm happy to adjust scope or close this if you'd rather not take it.
Verification#
runtimeLayer.test.ts, "usage-limit recovery project policy": 4 cases run the real sweep (makeSweep→getLimitRecoveryCandidates→ arm):- project on, env off → only that project's limited thread is armed;
- env on, project off → that project's thread is skipped;
- a thread the user armed manually still resumes when its project is off;
- project off with snooze on → snooze-only arm.
The first two failed before the change (
expected [] to deeply equal [ 'limit-policy:enabled-project' ], and a two-element result where one was expected).ProjectionStore.test.ts: candidates carryprojectId.settings-scoped-server.test.ts(mobile): Resume writes the project override, and Snooze stays environment-wide.vp run check:changed: format, lint, knip, graphql, typecheck (32 packages) and tests (197) pass.Manual: ran
vp run devin a worktree with isolated state and checked Settings → Threads in project scope (screenshots below).Not checked: the mobile UI on a device or simulator (covered by the planner test only).
Before (main, project scope: both rows read-only)

After (project scope: Resume editable with inheritance; Snooze stays environment-wide)

After, override on (the inheritance popover shows the project layer winning)

🤖 Generated with Claude Code (Claude Opus 5.5)
- 1
- 2
- 3
Pushed15d6d2e
github-actions[bot](GitHub profile, opens in a new tab) removed labelsneeds-rebase
Sign in to join this conversation.