singularity-forge/src
Tom Boucher cdf42fe001 fix: prevent model config bleed between concurrent GSD instances (#650) (#652)
Two fixes for the model configuration bleeding between simultaneous
GSD instances that share the same global settings.json.

## Root Cause

1. `setDefaultModelAndProvider()` always persisted to `~/.gsd/agent/settings.json`
   (global), so when either instance's interactive mode changed models (via
   Ctrl+P or /model), it overwrote the other instance's saved default.

2. When auto-mode dispatched a new unit (after context wipe), if no
   per-unit-type model preference was configured, the session picked up
   the default from the now-contaminated global settings file.

## Fix 1: Project-scoped model persistence (settings-manager.ts)

`setDefaultModelAndProvider()`, `setDefaultModel()`, and `setDefaultProvider()`
now persist to project-level settings (`.pi/settings.json`) when a project
settings file exists, falling back to global only when no project context
is available. This prevents concurrent instances from overwriting each
other's model choice.

Added `hasProjectSettingsFile()` helper to detect project context.

## Fix 2: Auto-mode model capture (auto.ts)

Captures the session's model at auto-mode start (`autoModeStartModel`).
At each unit dispatch, if no model preference is configured for the unit
type, the captured model is re-applied with `persist: false`. This
ensures each auto-mode session maintains its own model regardless of
what other instances write to the shared settings file.

## Tests

3 new tests covering:
- Project settings file isolates model from global
- Two projects have independent model configs
- autoModeStartModel concept prevents model drift

All 448 existing tests pass.

Fixes #650
2026-03-16 10:59:12 -06:00
..
resources fix: prevent model config bleed between concurrent GSD instances (#650) (#652) 2026-03-16 10:59:12 -06:00
tests fix: guard against newer synced resources (#445) 2026-03-14 22:58:18 -06:00
app-paths.ts Initial commit 2026-03-10 22:28:37 -06:00
bundled-extension-paths.ts Fix packaging verification and path portability (#378) 2026-03-14 12:28:14 -06:00
cli.ts Merge pull request #482 from fluxlabs/fix/tui-resource-leaks-and-quality 2026-03-15 17:32:31 -06:00
loader.ts Perf/gsd startup speed (#497) 2026-03-15 13:33:43 -06:00
logo.ts fix: abort squash-merge on conflict and stop auto-mode instead of looping (#merge-bug-fix) 2026-03-12 15:32:39 -06:00
onboarding.ts fix: multiple open issue bugfixes (#592, #603, #606, #608, #602) (#612) 2026-03-16 06:58:23 -06:00
pi-migration.ts Merge pull request #151 from dbachelder/fix/pi-provider-reuse-and-extension-loading 2026-03-12 22:25:15 -06:00
remote-questions-config.ts fix: multiple open issue bugfixes (#592, #603, #606, #608, #602) (#612) 2026-03-16 06:58:23 -06:00
resource-loader.ts fix: auto-mode worktree path and resource sync bugs (#557) 2026-03-15 18:26:55 -06:00
tool-bootstrap.ts fix: bootstrap managed tools and gh auth 2026-03-11 10:52:45 -06:00
update-check.ts refactor: replace hardcoded ANSI escapes with chalk, add debug logging 2026-03-15 09:56:41 -05:00
update-cmd.ts feat: add gsd update subcommand for self-update 2026-03-13 18:47:33 -03:00
wizard.ts feat: add Ollama Cloud as model and web tool provider (#430) (#434) 2026-03-14 21:03:31 -06:00