Skip to content

Changing a project's repositories while Claude runs background work blocks every message with a "model or setting change" error #40477

Open

Description

@dawsonpvosburg-cmyk

What happened

Since updating to the latest nightly, sending a message to a Claude thread that is waiting on a long-running background Bash command (a test run) fails almost every time with:

Claude is still running background agents or commands, and this model or setting change would end them. Wait for them to finish, or press Stop, then send the message again.

Nothing was changed in the composer: model, effort, fast mode, and permission mode were all the same as on the previous turn.

Diagnosis

The real change was the project's repository list, not a model or setting.

Since #35925 ("a project covers several repositories"), claudeEffectiveQueryPolicyKey includes turnInput.runtimePolicy.workspace (apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts, ~L3690 and ~L13116). That workspace is recomputed on every turn by RuntimePolicy → WorkspaceFolders.forThread → projectFolders → discoverFolders. It scans the project's first two folder levels for nested repos and drops those listed in t3.json ignoreRepositories. When folders is empty, workspace is left out entirely (RuntimePolicy.ts ~L208).

So any change to the discovered repos after the Claude process opened changes queryPolicyKey. That includes editing t3.json, cloning or removing a nested repo, or editing a .code-workspace file. Both reuse branches in startTurn then miss, and the code falls through to the replacement check. If liveProcessRunsBackgroundWork is true, it throws ClaudeBackgroundWorkBlocksQueryReplacementError. The process keeps its old key, so every later send fails the same way until the background work ends or the user presses Stop. With no background work, the process is silently replaced on every repository-list change instead.

What happened on this machine:

  1. Run 403 opened the Claude process at 16:04 UTC. Discovery found six gitignored vendored checkouts under vendor/.
  2. At 16:08 UTC, t3.json was written with those six repos in ignoreRepositories. That was the workaround for Auto-discovered gitignored vendor repos break worktree creation when a checkout hook links them (path_already_exists) #40406. Discovery now returns [], so workspace is omitted from the key.
  3. At 17:51 UTC, run 404 used the same model selection (claude-fable-5-2, effort high, fastMode false) while a background test command was running. It was refused with the error above.

The error message makes this hard to diagnose, because it blames a model or setting change the user never made.

Steps to reproduce

  1. Have a project whose root contains a nested git repo one or two levels down, for example vendor/foo/.git, not listed in t3.json.
  2. Start a Claude thread and send a message, so the Claude process opens.
  3. Ask the agent to start a long-running background Bash command (run_in_background, e.g. sleep 600) and end its turn.
  4. Add t3.json with {"ignoreRepositories": ["vendor/foo"]}. Removing or adding a nested repo works too.
  5. Send any follow-up message without touching the composer. It is refused with the "model or setting change" error, and every later send fails the same way until the command exits or you press Stop.

Version

0.1.12-nightly.20261121.5051 (the desktop app's version and the local server's serverVersion). I see no relevant change on main since that tag.

Environment

macOS (Darwin 27.2.0, arm64), T3 Code (Nightly) desktop app with a local server, Node v24.22.1, provider claudeAgent.

Evidence

Server trace (server.trace.ndjson), span ClaudeAdapterV2.startTurn, 17:51:42 UTC:

ProviderAdapterTurnStartError: Failed to start run run:thread:c0e3c266-…:ordinal:404 on claudeAgent provider thread …
  [cause]: ClaudeBackgroundWorkBlocksQueryReplacementError: Claude is still running background agents or commands, and this model or setting change would end them. …

orchestration_v2_projection_runs shows identical modelSelection on runs 403 (completed 16:05 UTC), 404 (failed 17:51 UTC) and 405:

{"instanceId":"claudeAgent","model":"claude-fable-5-2","options":[{"id":"effort","value":"high"},{"id":"fastMode","value":false}]}

The project row's updated_at is 16:08:55 UTC, and the t3.json mtime is 16:08:15 UTC. Both fall between run 403 and run 404. The server process ran the whole time, from 15:56 UTC, so this was the same live Claude process.

Related issues

Possible directions:

  • Don't let repository-list changes force a replacement while background work runs. Apply the change at the next natural restart, or grant new roots live where possible.
  • Name the actual difference in the error (here: "the project's repositories changed").

Fix applied or workaround

Nothing was changed on the machine. Workaround: once the background command finishes (or after pressing Stop), send one message. Claude restarts with the new repository list, and later sends work again.

Filed by

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

Activity

  1. hahasagined commented on Nov 22, 2026

    @hahasagined

    Same refusal on 0.1.12-nightly.20261121.5051 (Linux, background service), on a project that does not edit t3.json. Here the trigger is other agent threads cloning repos into the shared project root, so the discovered folders change several times an hour and any thread with background work gets refused.

    What happened, all times UTC 2026-11-22. The Claude thread had a guarded deploy command and a Monitor running in the background:

    1. 11:34:05: another thread cloned a repo at <project>/one-thread-per-task-20261122/k3s, two levels below the project root, so discovery picks it up.
    2. 11:40:17: a background-task notification started run 2, with the same model, effort and permission mode. ClaudeAdapterV2.startTurn failed with ClaudeBackgroundWorkBlocksQueryReplacementError and the run was marked failed.
    3. 11:48:34: another thread cloned <project>/daily-review-inputs-20261122/k3s.
    4. 11:48:36: the user sent "Continue" from mobile. Run 3 failed with the same error.

    Two side effects that make this worse than the message suggests:

    • The live Claude process kept working, and none of it shows in the thread. The provider event log has turns from that process at 11:40:17 and 11:46:55, driven by its own task notifications. In them it handled the finished deploy and started a new 5-minute Monitor. T3 shows none of these turns, because no T3 run owned them. The thread shows "failed" while the agent is still making changes.
    • The thread roster went stale. pendingBackgroundTasks still lists the command and Monitor that the process reported as completed at 11:46:52–56 (task_updated status completed, then background_tasks_changed with tasks: []).

    Project shape that makes this frequent: a single non-git project root with about 590 nested git checkouts at depth 1–2. Agents create a dated work folder and clone into it for nearly every task, so the repository list changes constantly. Putting them all in ignoreRepositories is not practical, because new names appear all the time.

    Suggestion: keep the workspace out of the replacement decision, or only add new folders as extra dirs, for a process that has live background work. Also ingest provider events from a process that no T3 run owns, so roster clears and self-started turns are not lost.

    Written by Claude Opus 5.5 (Claude Code in T3) on behalf of the reporter, following the t3 triage playbook.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions