Merge pull request #3872 from x-x-gpu/dev
fix: pass resolved model to session.create so sub-agent sessions use the correct model
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { CallOmoAgentArgs } from "./types"
|
||||
import type { PluginInput } from "@opencode-ai/plugin"
|
||||
import type { DelegatedModelConfig } from "../../shared/model-resolution-types"
|
||||
import { subagentSessions, syncSubagentSessions } from "../../features/claude-code-session-state"
|
||||
import { log } from "../../shared"
|
||||
|
||||
@@ -12,7 +13,8 @@ export async function createOrGetSession(
|
||||
abort: AbortSignal
|
||||
metadata?: (input: { title?: string; metadata?: Record<string, unknown> }) => void
|
||||
},
|
||||
ctx: PluginInput
|
||||
ctx: PluginInput,
|
||||
model?: DelegatedModelConfig,
|
||||
): Promise<{ sessionID: string; isNew: boolean }> {
|
||||
if (args.session_id) {
|
||||
log(`[call_omo_agent] Using existing session: ${args.session_id}`)
|
||||
@@ -39,6 +41,15 @@ export async function createOrGetSession(
|
||||
body: {
|
||||
parentID: toolContext.sessionID,
|
||||
title: `${args.description} (@${args.subagent_type} subagent)`,
|
||||
...(model
|
||||
? {
|
||||
model: {
|
||||
id: model.modelID,
|
||||
providerID: model.providerID,
|
||||
...(model.variant ? { variant: model.variant } : {}),
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
} as Record<string, unknown>,
|
||||
query: {
|
||||
directory: parentDirectory,
|
||||
|
||||
@@ -78,7 +78,7 @@ export async function executeSync(
|
||||
let appliedFallbackChain = false
|
||||
|
||||
try {
|
||||
const session = await deps.createOrGetSession(args, toolContext, ctx)
|
||||
const session = await deps.createOrGetSession(args, toolContext, ctx, model)
|
||||
sessionID = session.sessionID
|
||||
createdSessionForExecution = session.isNew
|
||||
subagentSessions.add(sessionID)
|
||||
|
||||
Reference in New Issue
Block a user