singularity-forge/packages
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
..
native perf: optimize discovery and interactive hot paths 2026-03-14 16:03:44 -05:00
pi-agent-core fix(agent-core): await event queue in tool hooks for safe parallel execution (#439) 2026-03-14 21:16:17 -06:00
pi-ai feat: update ollama cloud provider models (#578) 2026-03-15 22:22:29 -06:00
pi-coding-agent fix: prevent model config bleed between concurrent GSD instances (#650) (#652) 2026-03-16 10:59:12 -06:00
pi-tui fix: arrow key cursor not updating + Shift+Enter not inserting newlines (#485) 2026-03-15 19:47:49 -06:00