fix: pass resolved model to session.create so sub-agent sessions use the correct model
Sub-agent sessions created via the task tool or call_omo_agent tool were
being created without a model. The resolved model was only passed as a
promptAsync body override, which opencode core ignores, causing fallback
to the client's system default model (often a reasoning model that hangs).
OpenCode's session.create API supports model: { id, providerID, variant }
at creation time. This fix ensures the resolved category/agent model is
passed during session creation across all paths:
- createSyncSession() (delegate task / category-based)
- createOrGetSession() (call_omo_agent / direct agent calls)
- BackgroundManager.startTask() (background tasks)
This guarantees each sub-agent session is created with the correct model
regardless of whether promptAsync honors its model override.
This commit is contained in:
@@ -567,6 +567,15 @@ export class BackgroundManager {
|
||||
parentID: input.parentSessionId,
|
||||
title: `${input.description} (@${input.agent} subagent)`,
|
||||
...(input.sessionPermission ? { permission: input.sessionPermission } : {}),
|
||||
...(input.model
|
||||
? {
|
||||
model: {
|
||||
id: input.model.modelID,
|
||||
providerID: input.model.providerID,
|
||||
...(input.model.variant ? { variant: input.model.variant } : {}),
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
} as Record<string, unknown>,
|
||||
query: {
|
||||
directory: parentDirectory,
|
||||
|
||||
Reference in New Issue
Block a user