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

推荐订阅源

F
Fortinet All Blogs
有赞技术团队
有赞技术团队
量子位
N
Netflix TechBlog - Medium
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
GbyAI
GbyAI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Blog — PlanetScale
Blog — PlanetScale
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
Martin Fowler
Martin Fowler
Y
Y Combinator Blog
宝玉的分享
宝玉的分享
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
V
V2EX
IT之家
IT之家
L
LangChain Blog
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

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
chore(deadcode): share session model default check · open...
vincentkoc · 2026-06-21 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

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

2929

normalizeAgentId,

3030

parseAgentSessionKey,

3131

} from "../session-key.ts";

32+

import { sessionModelMatchesDefaults } from "../session-model-defaults.ts";

3233

import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "../string-coerce.ts";

3334

import {

3435

formatInheritedThinkingLabel,

@@ -958,16 +959,6 @@ function resolveChatFastModeSelectState(

958959

};

959960

}

960961
961-

function sessionModelMatchesDefaults(

962-

row: SessionsListResult["sessions"][number] | undefined,

963-

defaults: SessionsListResult["defaults"] | undefined,

964-

): boolean {

965-

return (

966-

(!row?.modelProvider || row.modelProvider === defaults?.modelProvider) &&

967-

(!row?.model || row.model === defaults?.model)

968-

);

969-

}

970-
971962

function buildThinkingOptions(

972963

levels: readonly GatewayThinkingLevelOption[],

973964

currentOverride: string,

@@ -1006,18 +997,14 @@ function resolveThinkingLevelOptions(

1006997

model: string | null,

1007998

catalog: readonly ThinkingCatalogEntry[],

1008999

): GatewayThinkingLevelOption[] {

1009-

const sessionModelMatchesDefaultsLocal =

1010-

(!activeRow?.modelProvider || activeRow.modelProvider === defaults?.modelProvider) &&

1011-

(!activeRow?.model || activeRow.model === defaults?.model);

1000+

const modelMatchesDefaults = sessionModelMatchesDefaults(activeRow, defaults);

10121001

const catalogEntry =

10131002

provider && model

10141003

? catalog.find((entry) => entry.provider === provider && entry.id === model)

10151004

: undefined;

10161005

const explicitLevels =

10171006

(activeRow?.thinkingLevels?.length ? activeRow.thinkingLevels : null) ??

1018-

(sessionModelMatchesDefaultsLocal && defaults?.thinkingLevels?.length

1019-

? defaults.thinkingLevels

1020-

: null);

1007+

(modelMatchesDefaults && defaults?.thinkingLevels?.length ? defaults.thinkingLevels : null);

10211008

if (explicitLevels) {

10221009

if (catalogEntry?.reasoning === false && isOffOnlyThinkingLevels(explicitLevels)) {

10231010

return [];

@@ -1026,9 +1013,7 @@ function resolveThinkingLevelOptions(

10261013

}

10271014

const explicitLabels =

10281015

(activeRow?.thinkingOptions?.length ? activeRow.thinkingOptions : null) ??

1029-

(sessionModelMatchesDefaultsLocal && defaults?.thinkingOptions?.length

1030-

? defaults.thinkingOptions

1031-

: null);

1016+

(modelMatchesDefaults && defaults?.thinkingOptions?.length ? defaults.thinkingOptions : null);

10321017

if (catalogEntry?.reasoning === false) {

10331018

if (!explicitLabels || explicitLabels.every(isOffThinkingOption)) {

10341019

return [];

Original file line numberDiff line numberDiff line change

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

99

} from "../chat-model-ref.ts";

1010

import type { GatewayBrowserClient } from "../gateway.ts";

1111

import { DEFAULT_AGENT_ID, DEFAULT_MAIN_KEY, parseAgentSessionKey } from "../session-key.ts";

12+

import { sessionModelMatchesDefaults } from "../session-model-defaults.ts";

1213

import {

1314

normalizeLowercaseStringOrEmpty,

1415

normalizeOptionalLowercaseString,

@@ -594,16 +595,6 @@ function resolveThinkingLevelOptionsForSession(

594595

}));

595596

}

596597
597-

function sessionModelMatchesDefaults(

598-

session: GatewaySessionRow | undefined,

599-

defaults: SessionsListResult["defaults"] | undefined,

600-

): boolean {

601-

return (

602-

(!session?.modelProvider || session.modelProvider === defaults?.modelProvider) &&

603-

(!session?.model || session.model === defaults?.model)

604-

);

605-

}

606-
607598

async function loadCurrentSession(

608599

client: GatewayBrowserClient,

609600

sessionKey: string,

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,14 @@

1+

// Shared helpers for comparing session rows against list defaults.

2+

import type { GatewaySessionRow, SessionsListResult } from "./types.ts";

3+
4+

type SessionModelFields = Pick<GatewaySessionRow, "model" | "modelProvider">;

5+
6+

export function sessionModelMatchesDefaults(

7+

session: SessionModelFields | null | undefined,

8+

defaults: SessionsListResult["defaults"] | undefined,

9+

): boolean {

10+

return (

11+

(!session?.modelProvider || session.modelProvider === defaults?.modelProvider) &&

12+

(!session?.model || session.model === defaults?.model)

13+

);

14+

}

Original file line numberDiff line numberDiff line change

@@ -6,6 +6,7 @@ import { icons } from "../icons.ts";

66

import { pathForTab } from "../navigation.ts";

77

import { formatSessionTokens } from "../presenter.ts";

88

import { formatGoalDetail, formatGoalSummary } from "../session-goal.ts";

9+

import { sessionModelMatchesDefaults } from "../session-model-defaults.ts";

910

import { isSessionRunActive } from "../session-run-state.ts";

1011

import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "../string-coerce.ts";

1112

import {

@@ -97,31 +98,21 @@ function getAgentIdentity(

9798

return Object.hasOwn(agentIdentityById, agentId) ? (agentIdentityById[agentId] ?? null) : null;

9899

}

99100
100-

function rowMatchesSessionDefaults(

101-

row: GatewaySessionRow,

102-

defaults: SessionsListResult["defaults"] | undefined,

103-

): boolean {

104-

return (

105-

(!row.modelProvider || row.modelProvider === defaults?.modelProvider) &&

106-

(!row.model || row.model === defaults?.model)

107-

);

108-

}

109-
110101

function resolveThinkLevelOptions(

111102

row: GatewaySessionRow,

112103

defaults?: SessionsListResult["defaults"],

113104

): readonly { value: string; label: string }[] {

114-

const sessionModelMatchesDefaults = rowMatchesSessionDefaults(row, defaults);

105+

const modelMatchesDefaults = sessionModelMatchesDefaults(row, defaults);

115106

const defaultLabel = formatInheritedThinkingLabel(

116-

row.thinkingDefault ?? (sessionModelMatchesDefaults ? defaults?.thinkingDefault : undefined),

107+

row.thinkingDefault ?? (modelMatchesDefaults ? defaults?.thinkingDefault : undefined),

117108

);

118109

const options: readonly GatewayThinkingLevelOption[] = row.thinkingLevels?.length

119110

? row.thinkingLevels

120-

: sessionModelMatchesDefaults && defaults?.thinkingLevels?.length

111+

: modelMatchesDefaults && defaults?.thinkingLevels?.length

121112

? defaults.thinkingLevels

122113

: (row.thinkingOptions?.length

123114

? row.thinkingOptions

124-

: sessionModelMatchesDefaults && defaults?.thinkingOptions?.length

115+

: modelMatchesDefaults && defaults?.thinkingOptions?.length

125116

? defaults.thinkingOptions

126117

: DEFAULT_THINK_LEVELS

127118

).map((label) => ({