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

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
量子位
H
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
MongoDB | Blog
MongoDB | Blog
小众软件
小众软件
爱范儿
爱范儿
博客园 - 【当耐特】
Vercel News
Vercel News
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
F
Fortinet All Blogs
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
博客园 - 叶小钗
博客园_首页
V
Visual Studio Blog
宝玉的分享
宝玉的分享
B
Blog
MyScale Blog
MyScale Blog
C
Check Point Blog
博客园 - 三生石上(FineUI控件)
L
LangChain Blog
V
V2EX

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(sessions): fast-path qualified row model refs · openc...
2026-05-06 · via Recent Commits to openclaw:main

@@ -19,6 +19,7 @@ import {

1919

import {

2020

inferUniqueProviderFromConfiguredModels,

2121

isCliProvider,

22+

normalizeProviderId,

2223

normalizeStoredOverrideModel,

2324

parseModelRef,

2425

resolveConfiguredModelRef,

@@ -77,6 +78,7 @@ import {

7778

normalizeLowercaseStringOrEmpty,

7879

normalizeOptionalString,

7980

normalizeOptionalLowercaseString,

81+

resolvePrimaryStringValue,

8082

} from "../shared/string-coerce.js";

8183

import { normalizeSessionDeliveryFields } from "../utils/delivery-context.shared.js";

8284

import { estimateUsageCost, resolveModelCostConfig } from "../utils/usage-format.js";

@@ -373,6 +375,7 @@ type SessionListRowContext = {

373375

subagentRuns: ReturnType<typeof buildSubagentRunReadIndex>;

374376

storeChildSessionsByKey: Map<string, string[]>;

375377

selectedModelByOverrideRef: Map<string, ReturnType<typeof resolveSessionModelRef>>;

378+

modelIdentityByEntryKey: Map<string, ReturnType<typeof resolveSessionModelIdentityRef>>;

376379

thinkingLevelsByModelRef: Map<string, ReturnType<typeof listThinkingLevelOptions>>;

377380

};

378381

@@ -491,6 +494,7 @@ function buildSessionListRowContext(params: {

491494

subagentRuns,

492495

storeChildSessionsByKey: buildStoreChildSessionIndex(params.store, params.now, subagentRuns),

493496

selectedModelByOverrideRef: new Map(),

497+

modelIdentityByEntryKey: new Map(),

494498

thinkingLevelsByModelRef: new Map(),

495499

};

496500

}

@@ -499,6 +503,116 @@ function createSessionRowModelCacheKey(provider: string | undefined, model: stri

499503

return `${normalizeLowercaseStringOrEmpty(provider)}\0${normalizeOptionalString(model) ?? ""}`;

500504

}

501505506+

function parseQualifiedModelRefForSessionList(

507+

raw: string | undefined,

508+

): { provider: string; model: string } | undefined {

509+

const trimmed = normalizeOptionalString(raw);

510+

const slash = trimmed?.indexOf("/") ?? -1;

511+

if (!trimmed || slash <= 0 || slash === trimmed.length - 1) {

512+

return undefined;

513+

}

514+

const provider = normalizeProviderId(trimmed.slice(0, slash).trim());

515+

const model = normalizeOptionalString(trimmed.slice(slash + 1));

516+

return model ? { provider, model } : undefined;

517+

}

518+519+

function createSessionDefaultModelCacheKey(cfg: OpenClawConfig, agentId?: string): string {

520+

const normalizedAgentId = normalizeAgentId(agentId);

521+

const primary = normalizedAgentId

522+

? resolveAgentEffectiveModelPrimary(cfg, normalizedAgentId)

523+

: resolvePrimaryStringValue(cfg.agents?.defaults?.model);

524+

return normalizeOptionalString(primary) ?? "";

525+

}

526+527+

function createSessionEntryModelCacheKey(params: {

528+

cfg: OpenClawConfig;

529+

agentId?: string;

530+

entry?:

531+

| SessionEntry

532+

| Pick<SessionEntry, "model" | "modelProvider" | "modelOverride" | "providerOverride">;

533+

fallbackModelRef?: string;

534+

}) {

535+

return [

536+

createSessionDefaultModelCacheKey(params.cfg, params.agentId),

537+

normalizeOptionalString(params.entry?.providerOverride) ?? "",

538+

normalizeOptionalString(params.entry?.modelOverride) ?? "",

539+

normalizeOptionalString(params.entry?.modelProvider) ?? "",

540+

normalizeOptionalString(params.entry?.model) ?? "",

541+

normalizeOptionalString(params.fallbackModelRef) ?? "",

542+

].join("\0");

543+

}

544+545+

function resolveSessionDefaultModelRefForRow(

546+

cfg: OpenClawConfig,

547+

agentId?: string,

548+

): { provider: string; model: string } {

549+

if (agentId) {

550+

const primary = resolveAgentEffectiveModelPrimary(cfg, agentId)?.trim();

551+

const parsed = parseQualifiedModelRefForSessionList(primary);

552+

if (parsed) {

553+

return parsed;

554+

}

555+

return resolveDefaultModelForAgent({ cfg, agentId });

556+

}

557+

return resolveConfiguredModelRef({

558+

cfg,

559+

defaultProvider: DEFAULT_PROVIDER,

560+

defaultModel: DEFAULT_MODEL,

561+

});

562+

}

563+564+

function resolveSessionRowModelIdentityRef(params: {

565+

cfg: OpenClawConfig;

566+

entry?:

567+

| SessionEntry

568+

| Pick<SessionEntry, "model" | "modelProvider" | "modelOverride" | "providerOverride">;

569+

agentId: string;

570+

fallbackModelRef?: string;

571+

rowContext?: SessionListRowContext;

572+

}): ReturnType<typeof resolveSessionModelIdentityRef> {

573+

if (!params.rowContext) {

574+

return resolveSessionModelIdentityRef(

575+

params.cfg,

576+

params.entry,

577+

params.agentId,

578+

params.fallbackModelRef,

579+

);

580+

}

581+

const key = createSessionEntryModelCacheKey({

582+

cfg: params.cfg,

583+

agentId: params.agentId,

584+

entry: params.entry,

585+

fallbackModelRef: params.fallbackModelRef,

586+

});

587+

const cached = params.rowContext.modelIdentityByEntryKey.get(key);

588+

if (cached) {

589+

return cached;

590+

}

591+592+

const runtimeModel = normalizeOptionalString(params.entry?.model);

593+

const runtimeProvider = normalizeOptionalString(params.entry?.modelProvider);

594+

if (

595+

!runtimeModel &&

596+

!runtimeProvider &&

597+

!normalizeOptionalString(params.fallbackModelRef) &&

598+

!normalizeOptionalString(params.entry?.providerOverride) &&

599+

!normalizeOptionalString(params.entry?.modelOverride)

600+

) {

601+

const resolved = resolveSessionDefaultModelRefForRow(params.cfg, params.agentId);

602+

params.rowContext.modelIdentityByEntryKey.set(key, resolved);

603+

return resolved;

604+

}

605+606+

const resolved = resolveSessionModelIdentityRef(

607+

params.cfg,

608+

params.entry,

609+

params.agentId,

610+

params.fallbackModelRef,

611+

);

612+

params.rowContext.modelIdentityByEntryKey.set(key, resolved);

613+

return resolved;

614+

}

615+502616

function resolveSessionSelectedModelRef(params: {

503617

cfg: OpenClawConfig;

504618

entry?: SessionEntry;

@@ -1578,12 +1692,13 @@ export function buildGatewaySessionRow(params: {

15781692

agentId: sessionAgentId,

15791693

rowContext,

15801694

});

1581-

const resolvedModel = resolveSessionModelIdentityRef(

1695+

const resolvedModel = resolveSessionRowModelIdentityRef({

15821696

cfg,

15831697

entry,

1584-

sessionAgentId,

1585-

subagentRun?.model,

1586-

);

1698+

agentId: sessionAgentId,

1699+

fallbackModelRef: subagentRun?.model,

1700+

rowContext,

1701+

});

15871702

const runtimeModelPresent =

15881703

Boolean(entry?.model?.trim()) || Boolean(entry?.modelProvider?.trim());

15891704

const needsTranscriptTotalTokens =