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

推荐订阅源

J
Java Code Geeks
月光博客
月光博客
D
DataBreaches.Net
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
T
The Blog of Author Tim Ferriss
Stack Overflow Blog
Stack Overflow Blog
Blog — PlanetScale
Blog — PlanetScale
aimingoo的专栏
aimingoo的专栏
U
Unit 42
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
MyScale Blog
MyScale Blog
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
B
Blog
博客园_首页
G
Google Developers Blog
Recent Announcements
Recent Announcements
博客园 - 【当耐特】
P
Proofpoint News Feed
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
MongoDB | Blog
MongoDB | Blog
Last Week in AI
Last Week in AI

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: cover CLI session prompt hash reuse (#69236) (thanks...
obviyus · 2026-04-25 · via Recent Commits to openclaw:main

@@ -6,6 +6,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

66

import type { OpenClawConfig } from "../../config/types.openclaw.js";

77

import { getGlobalHookRunner } from "../../plugins/hook-runner-global.js";

88

import { __testing as cliBackendsTesting } from "../cli-backends.js";

9+

import { hashCliSessionText } from "../cli-session.js";

910

import { buildActiveMusicGenerationTaskPromptContextForSession } from "../music-generation-task-status.js";

1011

import { buildActiveVideoGenerationTaskPromptContextForSession } from "../video-generation-task-status.js";

1112

import {

@@ -52,11 +53,15 @@ const mockBuildActiveMusicGenerationTaskPromptContextForSession = vi.mocked(

5253

buildActiveMusicGenerationTaskPromptContextForSession,

5354

);

545555-

function createCliBackendConfig(params: { systemPromptOverride?: string } = {}): OpenClawConfig {

56+

function createCliBackendConfig(

57+

params: { systemPromptOverride?: string | null } = {},

58+

): OpenClawConfig {

5659

return {

5760

agents: {

5861

defaults: {

59-

systemPromptOverride: params.systemPromptOverride ?? "test system prompt",

62+

...(params.systemPromptOverride !== null

63+

? { systemPromptOverride: params.systemPromptOverride ?? "test system prompt" }

64+

: {}),

6065

cliBackends: {

6166

"test-cli": {

6267

command: "test-cli",

@@ -308,7 +313,7 @@ describe("shouldSkipLocalCliCredentialEpoch", () => {

308313

model: "test-model",

309314

timeoutMs: 1_000,

310315

runId: "run-test-legacy-merge",

311-

config: createCliBackendConfig(),

316+

config: createCliBackendConfig({ systemPromptOverride: null }),

312317

});

313318314319

expect(context.params.prompt).toBe("prompt prepend\n\nlegacy prepend\n\nlatest ask");

@@ -355,6 +360,63 @@ describe("shouldSkipLocalCliCredentialEpoch", () => {

355360

}

356361

});

357362363+

it("uses explicit static prompt text for CLI session reuse hashing", async () => {

364+

const { dir, sessionFile } = createSessionFile();

365+

try {

366+

const context = await prepareCliRunContext({

367+

sessionId: "session-test",

368+

sessionFile,

369+

workspaceDir: dir,

370+

prompt: "latest ask",

371+

provider: "test-cli",

372+

model: "test-model",

373+

timeoutMs: 1_000,

374+

runId: "run-test-static-prompt",

375+

extraSystemPrompt: "## Inbound Context\nchannel=telegram",

376+

extraSystemPromptStatic: "",

377+

cliSessionBinding: {

378+

sessionId: "cli-session",

379+

},

380+

config: createCliBackendConfig({ systemPromptOverride: null }),

381+

});

382+383+

expect(context.systemPrompt).toContain("## Inbound Context\nchannel=telegram");

384+

expect(context.extraSystemPromptHash).toBeUndefined();

385+

expect(context.reusableCliSession).toEqual({ sessionId: "cli-session" });

386+

} finally {

387+

fs.rmSync(dir, { recursive: true, force: true });

388+

}

389+

});

390+391+

it("ignores volatile prompt text when static prompt text matches", async () => {

392+

const { dir, sessionFile } = createSessionFile();

393+

try {

394+

const staticPrompt = "## Direct Context\nYou are in a Telegram direct conversation.";

395+

const context = await prepareCliRunContext({

396+

sessionId: "session-test",

397+

sessionFile,

398+

workspaceDir: dir,

399+

prompt: "latest ask",

400+

provider: "test-cli",

401+

model: "test-model",

402+

timeoutMs: 1_000,

403+

runId: "run-test-volatile-prompt",

404+

extraSystemPrompt: `## Inbound Context\nchannel=heartbeat\n\n${staticPrompt}`,

405+

extraSystemPromptStatic: staticPrompt,

406+

cliSessionBinding: {

407+

sessionId: "cli-session",

408+

extraSystemPromptHash: hashCliSessionText(staticPrompt),

409+

},

410+

config: createCliBackendConfig(),

411+

});

412+413+

expect(context.extraSystemPromptHash).toBe(hashCliSessionText(staticPrompt));

414+

expect(context.reusableCliSession).toEqual({ sessionId: "cli-session" });

415+

} finally {

416+

fs.rmSync(dir, { recursive: true, force: true });

417+

}

418+

});

419+358420

it("applies direct-run prepend system context helpers on the CLI path", async () => {

359421

const { dir, sessionFile } = createSessionFile();

360422

try {