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

推荐订阅源

WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
aimingoo的专栏
aimingoo的专栏
Vercel News
Vercel News
U
Unit 42
L
LangChain Blog
J
Java Code Geeks
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare Blog
F
Fortinet All Blogs
小众软件
小众软件
I
InfoQ
P
Proofpoint News Feed
D
DataBreaches.Net
Martin Fowler
Martin Fowler
H
Help Net Security
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
有赞技术团队
有赞技术团队
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog

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(doctor): skip empty entries and memoize routes in plu...
joeyfrasier · 2026-05-23 · via Recent Commits to openclaw:main
1-

import { describe, expect, it } from "vitest";

1+

import { describe, expect, it, vi } from "vitest";

22

import {

33

applySessionRouteStateRepair,

44

resolveConfiguredDoctorSessionStateRoute,

5+

runPluginSessionStateDoctorRepairs,

56

scanSessionRouteStateOwners,

67

storeMayContainPluginSessionRouteState,

78

} from "./doctor-session-state-providers.js";

8910+

vi.mock("../plugins/doctor-contract-registry.js", async () => {

11+

const actual = await vi.importActual<typeof import("../plugins/doctor-contract-registry.js")>(

12+

"../plugins/doctor-contract-registry.js",

13+

);

14+

return {

15+

...actual,

16+

listPluginDoctorSessionRouteStateOwners: vi.fn(() => [

17+

{

18+

id: "codex",

19+

label: "Codex",

20+

providerIds: ["codex", "codex-cli", "openai-codex"],

21+

runtimeIds: ["codex", "codex-cli"],

22+

cliSessionKeys: ["codex-cli"],

23+

authProfilePrefixes: ["codex:", "codex-cli:", "openai-codex:"],

24+

},

25+

]),

26+

};

27+

});

28+929

const codexOwner = {

1030

id: "codex",

1131

label: "Codex",

@@ -459,4 +479,80 @@ describe("doctor session state provider routes", () => {

459479

expect(entry.agentHarnessId).toBeUndefined();

460480

expect(entry.agentRuntimeOverride).toBe("claude-cli");

461481

});

482+483+

it("skips entries without plugin route state and memoizes routes per agentId", async () => {

484+

// Sentinel cfg makes resolveConfiguredDoctorSessionStateRoute cheap and

485+

// deterministic. The important assertions are observable through the

486+

// resulting scan: entries with no route-state fields contribute no

487+

// repairs/manual-review and the run completes immediately.

488+

const cfg = {

489+

agents: {

490+

defaults: {

491+

model: { primary: "anthropic/claude-sonnet-4" },

492+

},

493+

},

494+

models: {

495+

providers: {

496+

anthropic: {},

497+

},

498+

},

499+

} as unknown as Parameters<typeof runPluginSessionStateDoctorRepairs>[0]["cfg"];

500+501+

// Build a store with 200 entries belonging to one agent. Two carry route

502+

// state that the codex owner cares about; the rest are bare. The old

503+

// implementation resolved a route for all 200; the new one only resolves

504+

// for the 2 that matter, deduplicated by agentId.

505+

const store: Record<string, Record<string, unknown>> = {};

506+

for (let i = 0; i < 198; i += 1) {

507+

store[`agent:main:bare-${i}`] = {

508+

sessionId: `sess-bare-${i}`,

509+

updatedAt: i,

510+

// No providerOverride/model/agentHarnessId/etc. — must be skipped.

511+

};

512+

}

513+

store["agent:main:codex-1"] = {

514+

sessionId: "sess-codex-1",

515+

updatedAt: 1,

516+

agentHarnessId: "codex-cli",

517+

};

518+

store["agent:main:codex-2"] = {

519+

sessionId: "sess-codex-2",

520+

updatedAt: 2,

521+

agentHarnessId: "codex-cli",

522+

};

523+524+

const warnings: string[] = [];

525+

const changes: string[] = [];

526+

const prompter: Parameters<typeof runPluginSessionStateDoctorRepairs>[0]["prompter"] = {

527+

confirmRuntimeRepair: vi.fn(async () => false),

528+

note: vi.fn(),

529+

};

530+531+

const start = Date.now();

532+

await runPluginSessionStateDoctorRepairs({

533+

cfg,

534+

store: store as unknown as Parameters<typeof runPluginSessionStateDoctorRepairs>[0]["store"],

535+

absoluteStorePath: "/tmp/nonexistent-store.json",

536+

prompter,

537+

env: {},

538+

warnings,

539+

changes,

540+

});

541+

const elapsedMs = Date.now() - start;

542+543+

// Two entries flagged for pinned-runtime repair; warning emitted once.

544+

expect(warnings).toHaveLength(1);

545+

expect(warnings[0]).toMatch(/Codex/);

546+

expect(warnings[0]).toMatch(/2 sessions?/);

547+548+

// User declined the repair so no changes applied.

549+

expect(changes).toHaveLength(0);

550+

expect(prompter.confirmRuntimeRepair).toHaveBeenCalledOnce();

551+552+

// Sanity check: even with 200 entries, this should complete near-

553+

// instantly because route resolution is bounded by unique agentIds, not

554+

// by store size. A 200-entry x 1.6s-per-call pre-fix run would exceed

555+

// 5 minutes; the fixed code should run in well under a second.

556+

expect(elapsedMs).toBeLessThan(2000);

557+

});

462558

});