t3code icon indicating copy to clipboard operation
t3code copied to clipboard

A briefly unparseable settings.json turns on auto-settle defaults and settles every idle thread at once

Open Bishi opened this issue 1 day ago • 0 comments

What happened

Auto-settle is off on this server (sidebarAutoSettleAfterDays: null, sidebarAutoSettleOnMerge: false). Even so, 5 open threads that the user was still working on were settled in several projects within about one second. The same sweep also settled 23 side chats whose parent threads were already settled. Nobody clicked settle, and no setting was changed in the UI.

At that moment, an agent running in another thread was editing ~/.t3/userdata/settings.json by hand (perl and sed) to change a project script command. The file was invalid JSON for a few seconds during the edit. Seconds later it was valid again, still with auto-settle off, but the threads stayed settled.

Diagnosis

Two behaviors combine. References are to v0.1.13; the same code is on main today.

  1. The parse-failure fallback enables auto-settle. When settings.json fails to decode, decodeSettingsFile (apps/server/src/serverSettings.ts:428) returns managed.defaults with a few overrides "so opt-in behaviour stays off" (line 445). Auto-settle is not among those overrides, so the server gets the schema defaults: sidebarAutoSettleAfterDays: 7 (packages/contracts/src/settings.ts:99) and sidebarAutoSettleOnMerge: true (settings.ts:1545).
  2. A settings change starts a full sweep immediately. ThreadSettlementServiceV2 subscribes to settings changes. When autoSettlementSettingsKey changes, it enqueues a full sweep right away (apps/server/src/orchestration-v2/ThreadSettlementService.ts:925-933). With the fallback settings, autoSettlementConfigured returns true, and every candidate idle for more than 7 days, or with a PR that merged after the latest user message, is dispatched thread.auto-settle.

When the file becomes valid again, auto-settle turns off, but nothing reverts the settles. A file that is unparseable for a few seconds therefore applies a bulk action that cannot be undone, using defaults the user had explicitly turned off.

The data matches: every settledAt equals the last run completion to the millisecond (what resolveAutoSettlementAt writes), the cutoff falls between 6.3 and 7.0 days idle, and the three threads idle under 7 days had PRs merged after the last user message. 5 were regular threads and 23 were side chats.

Suggested fix: see the first comment.

Steps to reproduce

  1. In settings, set auto-settle to "never" and turn off settle-on-merge.
  2. Have at least one unsettled thread with no activity for more than 7 days.
  3. While the server is running, make ~/.t3/userdata/settings.json invalid JSON (for example, delete a closing brace) and save.
  4. Within a few seconds, the idle thread is settled. The server logs failed to parse settings.json, using defaults.
  5. Fix the JSON and save. The thread stays settled.

Version

0.1.13 (server reports serverVersion: 0.1.13, database migration 119). The bug happened on this build. The relevant code is unchanged on main as of 2026-11-30.

Environment

  • Windows 10 x64, T3 Code desktop app with its local server
  • Node v26.13.1
  • Triage CLI 0.1.13 (npx t3 triage)

Evidence

- All 28 settled threads (5 regular, 23 side chats) show `updatedAt` between 2026-11-29T16:01:57.350Z and 16:01:58.459Z, with `settledOverride: "settled"` and `settledAt` backdated to each thread's last activity.
- The agent's file edits: perl at 16:01:55-16:01:59Z, a failed sed at 16:02:05Z, and a corrected write at 16:02:12Z. The agent's own message afterwards: "The file was briefly invalid JSON while I fixed the backslash escaping."
- `settings.json` mtime: 16:02:12Z. Now has `sidebarAutoSettleAfterDays: null`, `sidebarAutoSettleOnMerge: false`, and no per-project auto-settle overrides.
- No UI settle action in the desktop trace; no mobile client connected.
- The v2 event log was compacted the next morning, so the settle events and that minute's server trace are gone.

Related issues

None found. Loosely related auto-settle data issues: #9600, #10937.

Fix applied or workaround

The user unsettled the affected threads by hand in the sidebar. Workaround: don't let agents edit settings.json directly, and avoid saving it in a broken state while the server is running.

Filed by

Claude Code (Claude Opus 5.5, claude-opus-5-5) via t3 triage.

Bishi avatar Nov 30 '26 10:11 Bishi