fix(start-work): restore atlas agent and proper model fallback chain

- Restore agent: 'atlas' in start-work command (removed by PR #1201)
- Fix model-resolver to properly iterate through fallback chain providers
- Remove broken parent model inheritance that bypassed fallback logic
- Add model-suggestion-retry for runtime API failures (cherry-pick 800846c1)

Fixes #1200
This commit is contained in:
justsisyphus
2026-01-30 12:52:46 +09:00
parent 351cfed550
commit 52780140fd
7 changed files with 530 additions and 22 deletions
+2 -8
View File
@@ -12,7 +12,7 @@ import { discoverSkills } from "../../features/opencode-skill-loader"
import { getTaskToastManager } from "../../features/task-toast-manager"
import type { ModelFallbackInfo } from "../../features/task-toast-manager/types"
import { subagentSessions, getSessionAgent } from "../../features/claude-code-session-state"
import { log, getAgentToolRestrictions, resolveModel, getOpenCodeConfigPaths, findByNameCaseInsensitive, equalsIgnoreCase } from "../../shared"
import { log, getAgentToolRestrictions, resolveModel, getOpenCodeConfigPaths, findByNameCaseInsensitive, equalsIgnoreCase, promptWithModelSuggestionRetry } from "../../shared"
import { fetchAvailableModels } from "../../shared/model-availability"
import { readConnectedProvidersCache } from "../../shared/connected-providers-cache"
import { resolveModelWithFallback } from "../../shared/model-resolver"
@@ -819,12 +819,6 @@ Create the work plan directly - that's your job as the planning agent.`
// If we can't fetch agents, proceed anyway - the session.prompt will fail with a clearer error
}
// When using subagent_type directly, inherit parent model so agents don't default
// to their hardcoded models (like grok-code) which may not be available
if (parentModel) {
categoryModel = parentModel
modelInfo = { model: `${parentModel.providerID}/${parentModel.modelID}`, type: "inherited" }
}
}
const systemContent = buildSystemContent({ skillContent, categoryPromptAppend, agentName: agentToUse })
@@ -953,7 +947,7 @@ To continue this session: session_id="${task.sessionID}"`
try {
const allowDelegateTask = isPlanAgent(agentToUse)
await client.session.prompt({
await promptWithModelSuggestionRetry(client, {
path: { id: sessionID },
body: {
agent: agentToUse,