fix(server): project updates reach folded settings #22827
t3_project_update saves scripts and project defaults on the project aggregate after settings have been folded, while Settings and runtime read project overrides. Fixes #14991.
Reproduced on 1688f96568: a Codex thread saved a setup action and model default; t3_project_read returned them, Settings showed no action and another default, and a new worktree skipped setup. Saving the same command through Settings made the next worktree run it.
Project service updates now merge these fields into project settings overrides under the existing settings write lock. Folded reads return the settings runtime consumes. Explicit overrides survive unrelated edits, and clearing the workspace default restores inheritance. Existing aggregate-only saves remain inactive after folding; re-saving through the tool applies them.
Validation: 154 focused tests pass across five suites; server typecheck and targeted formatting/lint pass (existing warnings only). Five regression cases failed on baseline. The retry follow-up passes 21 project-service tests plus 49 project-command/settings tests, one-shot server typecheck and targeted lint. The lock-order correction at f05e15112d passes 71 focused tests and targeted lint. Its SQL-reader regression fails against the prior implementation. Final Codex review: FIX_FIRST. A no-event command receipt writer in Orchestrator.ts bypasses the EventSink command-ID lock: a colliding thread.stop can win the receipt after project settings were written, leaving a rejected update with side effects. Needs shared receipt serialization and a Deferred-controlled collision regression. Both proof audits are INSUFFICIENT. Work stopped at dispatcher deadline; this PR is not merge-ready.
The settings-file write runs before the SQL transaction, after receipt checks, under a command-ID lock shared by project/thread receipt writers. A failed settings write leaves the command retryable; successful replay preserves later Settings edits. This avoids holding the SQL writer while waiting for the settings lock. This does not claim atomicity across a successful settings-file write followed by a later SQL commit failure.
Evidence: final focused checks, fixture matrix, baseline runtime transcript.

Evidence follow-up: runtime transcript at 1c79962060, 1440/390 light/dark capture index. These precede the final lock correction.

Unverified: matched baseline captures and image diffs/thresholds; committed capture seed; remaining fixture-matrix branches; final lock-correction runtime; full production-settings concurrency interleaving and command-collision race; mobile settings and desktop. Proof pass 1 and pass 2: INSUFFICIENT. Do not treat this as evidence-complete.
Model: GPT-6.1-Sol. Harness: Codex in T3 Code.
- 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
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
Approvability#
Verdict: Needs Human Approval
Macroscope's review found this PR requires human approval — This patch makes project updates persist and expose effective model, environment, auto-pull, and setup-script defaults after settings folding, with additional command-lock and cross-store persistence behavior. Because it changes customer-visible default behavior and its persistence path, the change merits 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.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
6378f6d0-fe58-4ed1-a76d-76f86a94fea1
📥 Commits
-
Reviewing files that changed from the base of the PR and between 1688f965682d331da16a8c39f049592361f69c8d and f05e15112d6e70ec9f9c8aa5c100e361411805a1.
📒 Files selected for processing: 8
-
apps/server/src/device/DeviceService.test.tsapps/server/src/orchestration-v2/EventSink.tsapps/server/src/orchestration-v2/ThreadSettlementService.test.tsapps/server/src/project/ProjectService.test.tsapps/server/src/project/ProjectService.tsapps/server/src/provider/ProviderRegistry.test.tsapps/server/src/serverSettings.test.tsapps/server/src/serverSettings.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
-
📝 Walkthrough
-
The server now accepts functional settings patches, serializes command commits by command ID, and resolves folded project settings during project reads and updates.
Changes: Project settings flow
Layer / File(s) Summary Functional settings patches
apps/server/src/serverSettings.ts,apps/server/src/serverSettings.test.ts,apps/server/src/device/DeviceService.test.ts,apps/server/src/orchestration-v2/ThreadSettlementService.test.ts,apps/server/src/provider/ProviderRegistry.test.tsupdateSettingsaccepts an object patch or a function that derives a patch from current settings. Implementations and test fixtures resolve functional patches before applying them. A concurrency test checks that independent project overrides are retained.Serialized command commits
apps/server/src/orchestration-v2/EventSink.tsProject command commits check receipts before starting a transaction and can run an optional beforeCommiteffect. Accepted and rejected thread and project command commits are serialized by command ID.Folded project settings
apps/server/src/project/ProjectService.ts,apps/server/src/project/ProjectService.test.tsHydration resolves folded project settings and scripts. Project metadata updates persist provided overrides before command commit. Tests cover settings-write failures, effective settings, reset behavior, replay, and read consistency. Priority: ⬇️ Low
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix · Severity of issue fixed: Low
Sequence Diagram(s)#
sequenceDiagram participant ProjectService participant EventSinkV2 participant ServerSettingsService participant Database ProjectService->>EventSinkV2: Commit project command with beforeCommit EventSinkV2->>EventSinkV2: Check project receipt and command ID EventSinkV2->>ProjectService: Run beforeCommit effect ProjectService->>ServerSettingsService: Persist project settings overrides ServerSettingsService-->>ProjectService: Return update result EventSinkV2->>Database: Commit project command transactionSuggested reviewers:
t3dotgg,yordis
Merge Risk: ⚪ Minimal · up to
f05e1-
No actionable merge-blocking issue remains from this review; the change is mergeable after normal checks.
Pre-merge checks:
4-
Check name Status Explanation Title check The title clearly identifies the main change: making project updates reach folded settings. It is concise, specific, and uses the conventional commit format. Description check The description explains the problem, implementation, linked issue, verification results, limitations, and remaining risks. It is substantially complete, although it does not explicitly document maint… Linked Issues check Issue #14991is open and directly linked.ProjectServicenow reads folded settings and scripts throughresolveProjectSettingsandresolveProjectScripts. Project updates write `defaultProjectScri…Out of Scope Changes check The changes stay within issue #14991. The functionalupdateSettingsAPI supports safe merging of project overrides. EventSink command locks support settings-write ordering and retry behavior. The mo…Full details: Description check
-
Explanation
The description explains the problem, implementation, linked issue, verification results, limitations, and remaining risks. It is substantially complete, although it does not explicitly document maintainer approval or explain why approval is exempt under the Scope and approval requirements.
Full details: Linked Issues check
-
Explanation
Issue
#14991is open and directly linked.ProjectServicenow reads folded settings and scripts throughresolveProjectSettingsandresolveProjectScripts. Project updates writedefaultProjectScripts,defaultModelSelection,defaultThreadEnvMode, anddefaultAutoPullintoprojectSettingsOverridesbefore the project command commit. ClearingdefaultThreadEnvModeremoves the override and restores inheritance. Settings-write failures map toProjectOperationErrorwithupdate-settings, so the update does not report success.ProjectService.test.tscovers folded reads, persistence failures, retries, resets, and preservation of later settings edits.
Full details: Out of Scope Changes check
-
Explanation
The changes stay within issue
#14991. The functionalupdateSettingsAPI supports safe merging of project overrides. EventSink command locks support settings-write ordering and retry behavior. The modified test fixtures and added concurrency tests support these changes. No unrelated production feature or excluded-file change is present.
-
✨ Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Baseline:
1688f96· PR result:f05e151· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.