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

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
Vercel News
Vercel News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
量子位
Y
Y Combinator Blog
IT之家
IT之家
博客园 - 聂微东
L
LangChain Blog
爱范儿
爱范儿
H
Help Net Security
GbyAI
GbyAI
F
Fortinet All Blogs
B
Blog
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
C
Check Point Blog
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
D
DataBreaches.Net
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
宝玉的分享
宝玉的分享

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(gateway): clear CLI bindings on session reset · openc...
jasonyliu · 2026-05-18 · via Recent Commits to openclaw:main

@@ -482,3 +482,159 @@ test("sessions.create without emitCommandHooks does not fire command:new hook (#

482482

expect(sessionLifecycleHookMocks.runSessionEnd).not.toHaveBeenCalled();

483483

expect(sessionLifecycleHookMocks.runSessionStart).not.toHaveBeenCalled();

484484

});

485+486+

test("sessions.reset drops cli session bindings so the next turn does not --resume the old claude-cli session", async () => {

487+

const { dir } = await createSessionStoreDir();

488+

await writeSingleLineSession(dir, "sess-with-binding", "hello");

489+490+

await writeSessionStore({

491+

entries: {

492+

main: sessionStoreEntry("sess-with-binding", {

493+

claudeCliSessionId: "claude-cli-old-session",

494+

cliSessionBindings: {

495+

"claude-cli": { sessionId: "claude-cli-old-session" },

496+

},

497+

cliSessionIds: { "claude-cli": "claude-cli-old-session" },

498+

}),

499+

},

500+

});

501+502+

const [{ getRuntimeConfig }, { resolveGatewaySessionStoreTarget }, { loadSessionStore }] =

503+

await Promise.all([

504+

import("../config/config.js"),

505+

import("./session-utils.js"),

506+

import("../config/sessions.js"),

507+

]);

508+

const gatewayStorePath = resolveGatewaySessionStoreTarget({

509+

cfg: getRuntimeConfig(),

510+

key: "main",

511+

}).storePath;

512+513+

const reset = await directSessionReq<{ ok: true; key: string }>("sessions.reset", {

514+

key: "main",

515+

reason: "new",

516+

});

517+

expect(reset.ok).toBe(true);

518+519+

const store = loadSessionStore(gatewayStorePath, { skipCache: true });

520+

const nextEntry = store["agent:main:main"];

521+

expect(nextEntry).toBeDefined();

522+

expect(nextEntry?.sessionId).not.toBe("sess-with-binding");

523+

expect(nextEntry?.claudeCliSessionId).toBeUndefined();

524+

expect(nextEntry?.cliSessionBindings).toBeUndefined();

525+

expect(nextEntry?.cliSessionIds).toBeUndefined();

526+

});

527+528+

test("sessions.reset clears cli session bindings for parent-linked non-subagent sessions (e.g. dashboard children)", async () => {

529+

const { dir } = await createSessionStoreDir();

530+

const dashboardTranscript = path.join(dir, "sess-dashboard-child.jsonl");

531+

await fs.writeFile(

532+

dashboardTranscript,

533+

`${JSON.stringify({

534+

type: "message",

535+

id: "m-dashboard",

536+

message: { role: "user", content: "hello from dashboard child" },

537+

})}\n`,

538+

"utf-8",

539+

);

540+541+

await writeSessionStore({

542+

entries: {

543+

"dashboard:child:42": sessionStoreEntry("sess-dashboard-child", {

544+

sessionFile: dashboardTranscript,

545+

// parentSessionKey is set but the session key carries no `:subagent:`

546+

// marker, so this is a user-facing parent-linked session, not a

547+

// spawned subagent. The tighter predicate should still clear the

548+

// CLI binding here so /reset matches user intuition.

549+

parentSessionKey: "agent:main:main",

550+

claudeCliSessionId: "claude-cli-dashboard-session",

551+

cliSessionBindings: {

552+

"claude-cli": { sessionId: "claude-cli-dashboard-session" },

553+

},

554+

cliSessionIds: { "claude-cli": "claude-cli-dashboard-session" },

555+

}),

556+

},

557+

});

558+559+

const [{ getRuntimeConfig }, { resolveGatewaySessionStoreTarget }, { loadSessionStore }] =

560+

await Promise.all([

561+

import("../config/config.js"),

562+

import("./session-utils.js"),

563+

import("../config/sessions.js"),

564+

]);

565+

const gatewayStorePath = resolveGatewaySessionStoreTarget({

566+

cfg: getRuntimeConfig(),

567+

key: "dashboard:child:42",

568+

}).storePath;

569+570+

const reset = await directSessionReq<{ ok: true; key: string }>("sessions.reset", {

571+

key: "dashboard:child:42",

572+

reason: "new",

573+

});

574+

expect(reset.ok).toBe(true);

575+576+

const store = loadSessionStore(gatewayStorePath, { skipCache: true });

577+

const nextEntry = store["agent:main:dashboard:child:42"];

578+

expect(nextEntry).toBeDefined();

579+

expect(nextEntry?.sessionId).not.toBe("sess-dashboard-child");

580+

expect(nextEntry?.claudeCliSessionId).toBeUndefined();

581+

expect(nextEntry?.cliSessionBindings).toBeUndefined();

582+

expect(nextEntry?.cliSessionIds).toBeUndefined();

583+

});

584+585+

test("sessions.reset preserves cli session bindings for spawned subagents (Tak Hoffman's fa56682b3ced contract)", async () => {

586+

const { dir } = await createSessionStoreDir();

587+

const childTranscript = path.join(dir, "sess-spawned-child.jsonl");

588+

await fs.writeFile(

589+

childTranscript,

590+

`${JSON.stringify({

591+

type: "message",

592+

id: "m-child",

593+

message: { role: "user", content: "hello from spawned child" },

594+

})}\n`,

595+

"utf-8",

596+

);

597+598+

await writeSessionStore({

599+

entries: {

600+

"subagent:child": sessionStoreEntry("sess-spawned-child", {

601+

sessionFile: childTranscript,

602+

parentSessionKey: "agent:main:main",

603+

spawnedBy: "agent:main:main",

604+

subagentRole: "orchestrator",

605+

claudeCliSessionId: "claude-cli-child-session",

606+

cliSessionBindings: {

607+

"claude-cli": { sessionId: "claude-cli-child-session" },

608+

},

609+

cliSessionIds: { "claude-cli": "claude-cli-child-session" },

610+

}),

611+

},

612+

});

613+614+

const [{ getRuntimeConfig }, { resolveGatewaySessionStoreTarget }, { loadSessionStore }] =

615+

await Promise.all([

616+

import("../config/config.js"),

617+

import("./session-utils.js"),

618+

import("../config/sessions.js"),

619+

]);

620+

const gatewayStorePath = resolveGatewaySessionStoreTarget({

621+

cfg: getRuntimeConfig(),

622+

key: "subagent:child",

623+

}).storePath;

624+625+

const reset = await directSessionReq<{ ok: true; key: string }>("sessions.reset", {

626+

key: "subagent:child",

627+

reason: "new",

628+

});

629+

expect(reset.ok).toBe(true);

630+631+

const store = loadSessionStore(gatewayStorePath, { skipCache: true });

632+

const nextEntry = store["agent:main:subagent:child"];

633+

expect(nextEntry).toBeDefined();

634+

expect(nextEntry?.sessionId).not.toBe("sess-spawned-child");

635+

expect(nextEntry?.claudeCliSessionId).toBe("claude-cli-child-session");

636+

expect(nextEntry?.cliSessionBindings).toEqual({

637+

"claude-cli": { sessionId: "claude-cli-child-session" },

638+

});

639+

expect(nextEntry?.cliSessionIds).toEqual({ "claude-cli": "claude-cli-child-session" });

640+

});