Skip to content

Commit 9a129af

Browse files
authored
Merge pull request #2267 from netease-youdao/fisherdaddy/fix-im-model-switch
fix(cowork): sync channel session model override from OpenClaw gateway
2 parents 968bb70 + 9ab263f commit 9a129af

11 files changed

Lines changed: 1032 additions & 17 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/src/agents/system-prompt.ts b/src/agents/system-prompt.ts
2+
--- a/src/agents/system-prompt.ts
3+
+++ b/src/agents/system-prompt.ts
4+
@@ -754,8 +754,8 @@ export function buildSystemPrompt(params: BuildSystemPromptParams): string {
5+
sessions_yield: "End this turn and wait for spawned sub-agent completion events",
6+
subagents:
7+
"On-demand list/status visibility for sub-agent runs in this requester session; do not use for wait loops",
8+
session_status:
9+
- "Show a /status-equivalent status card (usage + time + Reasoning/Verbose/Elevated); use for model-use questions (📊 session_status); optional per-session model override",
10+
+ "Show a /status-equivalent status card (usage + time + Reasoning/Verbose/Elevated); must use before answering current-model/model-use questions and answer from the returned status, not from memory or identity; optional per-session model override",
11+
skill_workshop:
12+
"Create, update, revise, list, inspect, apply, reject, or quarantine Skill Workshop proposals",
13+
image: "Analyze an image with the configured image model",
14+
@@ -1118,7 +1118,8 @@ export function buildSystemPrompt(params: BuildSystemPromptParams): string {
15+
? params.modelAliasLines.join("\n")
16+
: "",
17+
params.modelAliasLines && params.modelAliasLines.length > 0 && !isMinimal ? "" : "",
18+
+ "If the user asks what model is currently being used, or asks any equivalent current-model question, run session_status (📊 session_status) first and answer from that status result.",
19+
userTimezone
20+
? "If you need the current date, time, or day of week, run session_status (📊 session_status)."
21+
: "",
22+
"## Workspace",

specs/bugfixes/im-session-model-sync/2026-07-03-im-session-model-bidirectional-sync-design.md

Lines changed: 306 additions & 0 deletions
Large diffs are not rendered by default.

src/main/libs/agentEngine/coworkEngineRouter.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type {
99
CoworkForkCompactionSummary,
1010
CoworkRuntime,
1111
CoworkRuntimeEvents,
12+
CoworkSessionPatchResult,
1213
CoworkStartOptions,
1314
PermissionResult,
1415
} from './types';
@@ -83,13 +84,13 @@ export class CoworkEngineRouter extends EventEmitter implements CoworkRuntime {
8384
return this.runtime.runGoalCommand(sessionId, command);
8485
}
8586

86-
async patchSession(sessionId: string, patch: OpenClawSessionPatch): Promise<void> {
87+
async patchSession(sessionId: string, patch: OpenClawSessionPatch): Promise<CoworkSessionPatchResult | void> {
8788
const engine = this.safeResolveEngine();
8889
this.sessionEngine.set(sessionId, engine);
8990
if (!this.runtime.patchSession) {
9091
throw new Error(`Session patch is not supported by engine: ${engine}`);
9192
}
92-
await this.runtime.patchSession(sessionId, patch);
93+
return this.runtime.patchSession(sessionId, patch);
9394
}
9495

9596
async getContextUsage(sessionId: string): Promise<CoworkContextUsage | null> {

0 commit comments

Comments
 (0)