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

推荐订阅源

C
Check Point Blog
GbyAI
GbyAI
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 叶小钗
U
Unit 42
Engineering at Meta
Engineering at Meta
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
Vercel News
Vercel News
美团技术团队
雷峰网
雷峰网
Recent Announcements
Recent Announcements
有赞技术团队
有赞技术团队
D
DataBreaches.Net
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks
罗磊的独立博客
MyScale Blog
MyScale Blog
博客园_首页
IT之家
IT之家
F
Fortinet All Blogs
博客园 - Franky

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: pin embedded harness selection per session · opencla...
steipete · 2026-04-23 · via Recent Commits to openclaw:main

@@ -5,10 +5,11 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

55

import type { SessionEntry } from "../../config/sessions.js";

66

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

77

import { FailoverError } from "../failover-error.js";

8-

import type { EmbeddedPiRunResult } from "../pi-embedded.js";

8+

import { runEmbeddedPiAgent, type EmbeddedPiRunResult } from "../pi-embedded.js";

99

import { persistCliTurnTranscript, runAgentAttempt } from "./attempt-execution.js";

10101111

const runCliAgentMock = vi.hoisted(() => vi.fn());

12+

const runEmbeddedPiAgentMock = vi.hoisted(() => vi.fn());

1213

const ORIGINAL_HOME = process.env.HOME;

13141415

vi.mock("../cli-runner.js", () => ({

@@ -21,7 +22,7 @@ vi.mock("../model-selection.js", () => ({

2122

}));

22232324

vi.mock("../pi-embedded.js", () => ({

24-

runEmbeddedPiAgent: vi.fn(),

25+

runEmbeddedPiAgent: runEmbeddedPiAgentMock,

2526

}));

26272728

function makeCliResult(text: string): EmbeddedPiRunResult {

@@ -73,6 +74,7 @@ describe("CLI attempt execution", () => {

7374

tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-cli-attempt-"));

7475

storePath = path.join(tmpDir, "sessions.json");

7576

runCliAgentMock.mockReset();

77+

runEmbeddedPiAgentMock.mockReset();

7678

});

77797880

afterEach(async () => {

@@ -386,3 +388,102 @@ describe("CLI attempt execution", () => {

386388

);

387389

});

388390

});

391+392+

describe("embedded attempt harness pinning", () => {

393+

let tmpDir: string;

394+395+

beforeEach(async () => {

396+

tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-embedded-attempt-"));

397+

runEmbeddedPiAgentMock.mockReset();

398+

});

399+400+

afterEach(async () => {

401+

await fs.rm(tmpDir, { recursive: true, force: true });

402+

});

403+404+

it("treats legacy sessions with history as PI-pinned", async () => {

405+

const sessionEntry: SessionEntry = {

406+

sessionId: "legacy-session",

407+

updatedAt: Date.now(),

408+

};

409+

runEmbeddedPiAgentMock.mockResolvedValueOnce({

410+

meta: { durationMs: 1 },

411+

} satisfies EmbeddedPiRunResult);

412+413+

await runAgentAttempt({

414+

providerOverride: "openai",

415+

modelOverride: "gpt-5.4",

416+

cfg: {} as OpenClawConfig,

417+

sessionEntry,

418+

sessionId: sessionEntry.sessionId,

419+

sessionKey: "agent:main:main",

420+

sessionAgentId: "main",

421+

sessionFile: path.join(tmpDir, "session.jsonl"),

422+

workspaceDir: tmpDir,

423+

body: "continue",

424+

isFallbackRetry: false,

425+

resolvedThinkLevel: "medium",

426+

timeoutMs: 1_000,

427+

runId: "run-legacy-pi-pin",

428+

opts: { senderIsOwner: false } as Parameters<typeof runAgentAttempt>[0]["opts"],

429+

runContext: {} as Parameters<typeof runAgentAttempt>[0]["runContext"],

430+

spawnedBy: undefined,

431+

messageChannel: undefined,

432+

skillsSnapshot: undefined,

433+

resolvedVerboseLevel: undefined,

434+

agentDir: tmpDir,

435+

onAgentEvent: vi.fn(),

436+

authProfileProvider: "openai",

437+

sessionHasHistory: true,

438+

});

439+440+

expect(runEmbeddedPiAgent).toHaveBeenCalledWith(

441+

expect.objectContaining({

442+

agentHarnessId: "pi",

443+

}),

444+

);

445+

});

446+447+

it("leaves a fresh unpinned session on config-selected harness resolution", async () => {

448+

const sessionEntry: SessionEntry = {

449+

sessionId: "fresh-session",

450+

updatedAt: Date.now(),

451+

};

452+

runEmbeddedPiAgentMock.mockResolvedValueOnce({

453+

meta: { durationMs: 1 },

454+

} satisfies EmbeddedPiRunResult);

455+456+

await runAgentAttempt({

457+

providerOverride: "openai",

458+

modelOverride: "gpt-5.4",

459+

cfg: {} as OpenClawConfig,

460+

sessionEntry,

461+

sessionId: sessionEntry.sessionId,

462+

sessionKey: "agent:main:main",

463+

sessionAgentId: "main",

464+

sessionFile: path.join(tmpDir, "session.jsonl"),

465+

workspaceDir: tmpDir,

466+

body: "start",

467+

isFallbackRetry: false,

468+

resolvedThinkLevel: "medium",

469+

timeoutMs: 1_000,

470+

runId: "run-fresh-no-pin",

471+

opts: { senderIsOwner: false } as Parameters<typeof runAgentAttempt>[0]["opts"],

472+

runContext: {} as Parameters<typeof runAgentAttempt>[0]["runContext"],

473+

spawnedBy: undefined,

474+

messageChannel: undefined,

475+

skillsSnapshot: undefined,

476+

resolvedVerboseLevel: undefined,

477+

agentDir: tmpDir,

478+

onAgentEvent: vi.fn(),

479+

authProfileProvider: "openai",

480+

sessionHasHistory: false,

481+

});

482+483+

expect(runEmbeddedPiAgent).toHaveBeenCalledWith(

484+

expect.objectContaining({

485+

agentHarnessId: undefined,

486+

}),

487+

);

488+

});

489+

});