← Back to PRs

#6875: test: add coverage for sessions_spawn model + agentId (#6817)

by whoknowsmann open 2026-02-02 04:28 View on GitHub →
gateway agents
## Summary Adds regression tests for issue #6817 to verify that `sessions_spawn` correctly applies explicit model overrides even when `agentId` is provided. ## Test Coverage Three new tests: 1. **`sessions_spawn uses explicit model even when agentId is also provided`** - Passes both `model: "openrouter/deepseek/deepseek-chat"` AND `agentId: "research"` - Verifies `sessions.patch` receives the explicit model, not the agent's `subagents.model` 2. **`sessions_spawn explicit model overrides global subagents.model default`** - Verifies explicit model takes precedence over `agents.defaults.subagents.model` 3. **`sessions_spawn applies model when only task, model, and label are provided`** - Baseline test for the "working" case per the issue ## Results All tests pass. This confirms that the `sessions_spawn` tool correctly: - Extracts the explicit model from params - Calls `sessions.patch` with the correct model - Prioritizes explicit model over config defaults ## Implications for #6817 Since the tool-level code works correctly, the bug likely exists elsewhere: 1. **`sessions.patch` handler** — Model may not be persisted correctly 2. **`agent` method** — May not read `modelOverride` from the session entry 3. **Race condition** — Between `sessions.patch` completing and `agent` reading the session 4. **Model allowlist** — Silent rejection if the model isn't in the agent's allowlist The tests narrow down the investigation area for whoever picks up the fix. Refs: #6817 --- 🤖 *Built together with Claude. Fully tested, code reviewed and understood.*

Most Similar PRs