惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
The GitHub Blog
The GitHub Blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
小众软件
小众软件
博客园_首页
G
Google Developers Blog
Apple Machine Learning Research
Apple Machine Learning Research
MyScale Blog
MyScale Blog
Engineering at Meta
Engineering at Meta
Jina AI
Jina AI
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
D
Docker
B
Blog
雷峰网
雷峰网
WordPress大学
WordPress大学
Stack Overflow Blog
Stack Overflow Blog
宝玉的分享
宝玉的分享

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(agents): honor embedded run default model (#93439) · ...
harjothkhara · 2026-06-16 · via Recent Commits to openclaw:main

@@ -312,6 +312,43 @@ const runDefaultEmbeddedTurn = async (sessionFile: string, prompt: string, sessi

312312

});

313313

};

314314315+

const addAnthropicProvider = (

316+

cfg: ReturnType<typeof createEmbeddedAgentRunnerOpenAiConfig>,

317+

modelIds: string[],

318+

) => ({

319+

...cfg,

320+

models: {

321+

providers: {

322+

...cfg.models?.providers,

323+

anthropic: {

324+

api: "anthropic-messages" as const,

325+

apiKey: "sk-test",

326+

baseUrl: "https://example.com",

327+

models: modelIds.map((id) => ({

328+

id,

329+

name: `Mock ${id}`,

330+

reasoning: false,

331+

input: ["text" as const],

332+

cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },

333+

contextWindow: 16_000,

334+

maxTokens: 2048,

335+

})),

336+

},

337+

},

338+

},

339+

});

340+341+

const mockSuccessfulEmbeddedAttempt = () => {

342+

runEmbeddedAttemptMock.mockResolvedValueOnce(

343+

makeEmbeddedRunnerAttempt({

344+

assistantTexts: ["ok"],

345+

lastAssistant: buildEmbeddedRunnerAssistant({

346+

content: [{ type: "text", text: "ok" }],

347+

}),

348+

}),

349+

);

350+

};

351+315352

function firstMockCall(mock: { mock: { calls: unknown[][] } }, label: string): unknown[] {

316353

const call = mock.mock.calls[0];

317354

if (!call) {

@@ -338,14 +375,7 @@ describe("runEmbeddedAgent", () => {

338375

list: [{ id: "research", model: "openrouter/research-default" }],

339376

},

340377

};

341-

runEmbeddedAttemptMock.mockResolvedValueOnce(

342-

makeEmbeddedRunnerAttempt({

343-

assistantTexts: ["ok"],

344-

lastAssistant: buildEmbeddedRunnerAssistant({

345-

content: [{ type: "text", text: "ok" }],

346-

}),

347-

}),

348-

);

378+

mockSuccessfulEmbeddedAttempt();

349379350380

await runEmbeddedAgent({

351381

sessionId: "configured-default-model",

@@ -383,14 +413,7 @@ describe("runEmbeddedAgent", () => {

383413

},

384414

};

385415

setRuntimeConfigSnapshot(cfg);

386-

runEmbeddedAttemptMock.mockResolvedValueOnce(

387-

makeEmbeddedRunnerAttempt({

388-

assistantTexts: ["ok"],

389-

lastAssistant: buildEmbeddedRunnerAssistant({

390-

content: [{ type: "text", text: "ok" }],

391-

}),

392-

}),

393-

);

416+

mockSuccessfulEmbeddedAttempt();

394417395418

await runEmbeddedAgent({

396419

sessionId: "runtime-config-default-model",

@@ -415,6 +438,85 @@ describe("runEmbeddedAgent", () => {

415438

);

416439

});

417440441+

it("uses the session-key agent default when agentId is inferred", async () => {

442+

const sessionFile = nextSessionFile();

443+

const cfg = {

444+

...addAnthropicProvider(createEmbeddedAgentRunnerOpenAiConfig(["mock-1"]), [

445+

"claude-opus-4-7",

446+

]),

447+

agents: {

448+

defaults: {

449+

model: { primary: "openai/mock-1" },

450+

},

451+

list: [

452+

{

453+

id: "research",

454+

model: { primary: "anthropic/claude-opus-4-7" },

455+

},

456+

],

457+

},

458+

};

459+

mockSuccessfulEmbeddedAttempt();

460+461+

await runEmbeddedAgent({

462+

sessionId: "session-key-agent-default",

463+

sessionKey: "agent:research:embedded:session-key-agent-default",

464+

sessionFile,

465+

workspaceDir,

466+

config: cfg,

467+

prompt: "hello",

468+

timeoutMs: 5_000,

469+

agentDir,

470+

runId: nextRunId("session-key-agent-default"),

471+

enqueue: immediateEnqueue,

472+

});

473+474+

expect(resolveModelAsyncMock).toHaveBeenNthCalledWith(

475+

1,

476+

"anthropic",

477+

"claude-opus-4-7",

478+

agentDir,

479+

cfg,

480+

expect.objectContaining({ skipAgentDiscovery: true }),

481+

);

482+

expect(

483+

(firstRunEmbeddedAttemptParams() as { model?: { provider?: string; id?: string } }).model,

484+

).toEqual(expect.objectContaining({ provider: "anthropic", id: "claude-opus-4-7" }));

485+

});

486+487+

it("resolves model-only provider refs instead of prefixing the default provider", async () => {

488+

const sessionFile = nextSessionFile();

489+

const cfg = addAnthropicProvider(createEmbeddedAgentRunnerOpenAiConfig(["mock-1"]), [

490+

"claude-sonnet-4-6",

491+

]);

492+

mockSuccessfulEmbeddedAttempt();

493+494+

await runEmbeddedAgent({

495+

sessionId: "model-only-provider-ref",

496+

sessionFile,

497+

workspaceDir,

498+

config: cfg,

499+

prompt: "hello",

500+

model: "anthropic/claude-sonnet-4-6",

501+

timeoutMs: 5_000,

502+

agentDir,

503+

runId: nextRunId("model-only-provider-ref"),

504+

enqueue: immediateEnqueue,

505+

});

506+507+

expect(resolveModelAsyncMock).toHaveBeenNthCalledWith(

508+

1,

509+

"anthropic",

510+

"claude-sonnet-4-6",

511+

agentDir,

512+

cfg,

513+

expect.objectContaining({ skipAgentDiscovery: true }),

514+

);

515+

expect(

516+

(firstRunEmbeddedAttemptParams() as { model?: { provider?: string; id?: string } }).model,

517+

).toEqual(expect.objectContaining({ provider: "anthropic", id: "claude-sonnet-4-6" }));

518+

});

519+418520

it("skips models.json generation when dynamic model resolution succeeds", async () => {

419521

const sessionFile = nextSessionFile();

420522

const cfg = createEmbeddedAgentRunnerOpenAiConfig([]);