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

推荐订阅源

大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
博客园 - 叶小钗
Hugging Face - Blog
Hugging Face - Blog
博客园 - 司徒正美
Last Week in AI
Last Week in AI
罗磊的独立博客
量子位
Jina AI
Jina AI
T
Tailwind CSS Blog
Apple Machine Learning Research
Apple Machine Learning Research
IT之家
IT之家
美团技术团队
雷峰网
雷峰网
爱范儿
爱范儿
S
SegmentFault 最新的问题
小众软件
小众软件
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报

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): match stop by stored session id · openclaw/...
steipete · 2026-05-16 · via Recent Commits to openclaw:main

@@ -16,6 +16,7 @@ type TranscriptLine = {

1616

const sessionEntryState = vi.hoisted(() => ({

1717

transcriptPath: "",

1818

sessionId: "",

19+

hasEntry: true,

1920

}));

20212122

vi.mock("../session-utils.js", async () => {

@@ -26,10 +27,12 @@ vi.mock("../session-utils.js", async () => {

2627

loadSessionEntry: () => ({

2728

cfg: {},

2829

storePath: path.join(path.dirname(sessionEntryState.transcriptPath), "sessions.json"),

29-

entry: {

30-

sessionId: sessionEntryState.sessionId,

31-

sessionFile: sessionEntryState.transcriptPath,

32-

},

30+

entry: sessionEntryState.hasEntry

31+

? {

32+

sessionId: sessionEntryState.sessionId,

33+

sessionFile: sessionEntryState.transcriptPath,

34+

}

35+

: undefined,

3336

canonicalKey: "main",

3437

}),

3538

};

@@ -142,9 +145,10 @@ function expectPersistedAbortMessage(

142145

expect(abort.runId).toBe(expected.runId);

143146

}

144147145-

function setMockSessionEntry(transcriptPath: string, sessionId: string) {

148+

function setMockSessionEntry(transcriptPath: string, sessionId: string, hasEntry = true) {

146149

sessionEntryState.transcriptPath = transcriptPath;

147150

sessionEntryState.sessionId = sessionId;

151+

sessionEntryState.hasEntry = hasEntry;

148152

}

149153150154

async function createTranscriptFixture(prefix: string) {

@@ -156,6 +160,14 @@ async function createTranscriptFixture(prefix: string) {

156160

return { transcriptPath, sessionId };

157161

}

158162163+

async function createMissingEntryFixture(prefix: string) {

164+

const dir = await fs.mkdtemp(path.join(os.tmpdir(), prefix));

165+

const transcriptPath = path.join(dir, "missing.jsonl");

166+

const sessionId = "client-supplied-session";

167+

setMockSessionEntry(transcriptPath, sessionId, false);

168+

return { sessionId };

169+

}

170+159171

afterEach(() => {

160172

vi.restoreAllMocks();

161173

});

@@ -334,6 +346,73 @@ describe("chat abort transcript persistence", () => {

334346

expect(context.chatAbortControllers.has("run-stop-canonical")).toBe(false);

335347

});

336348349+

it("plain stop aborts raw-alias runs for the same backing session", async () => {

350+

const { sessionId } = await createTranscriptFixture("openclaw-chat-stop-raw-alias-");

351+

const respond = vi.fn();

352+

const active = createActiveRun("alias-main", { sessionId });

353+

const context = createChatAbortContext({

354+

chatAbortControllers: new Map([["run-stop-raw-alias", active]]),

355+

removeChatRun: vi.fn().mockReturnValue({

356+

sessionKey: "alias-main",

357+

clientRunId: "run-stop-raw-alias",

358+

}),

359+

dedupe: {

360+

get: vi.fn(),

361+

},

362+

});

363+364+

await chatHandlers["chat.send"]({

365+

params: {

366+

sessionKey: "main",

367+

message: "stop",

368+

idempotencyKey: "idem-stop-raw-alias",

369+

},

370+

respond,

371+

context: context as never,

372+

req: {} as never,

373+

client: null,

374+

isWebchatConnect: () => false,

375+

});

376+377+

const [ok, payload] = requireLastRespondCall(respond);

378+

expect(ok).toBe(true);

379+

expectAbortPayload(payload, { runIds: ["run-stop-raw-alias"] });

380+

expect(active.controller.signal.aborted).toBe(true);

381+

expect(context.chatAbortControllers.has("run-stop-raw-alias")).toBe(false);

382+

});

383+384+

it("does not match stop targets by client-supplied session id without a stored entry", async () => {

385+

const { sessionId } = await createMissingEntryFixture("openclaw-chat-stop-client-session-");

386+

const respond = vi.fn();

387+

const active = createActiveRun("third-session", { sessionId });

388+

const context = createChatAbortContext({

389+

chatAbortControllers: new Map([["run-stop-client-session", active]]),

390+

dedupe: {

391+

get: vi.fn(),

392+

},

393+

});

394+395+

await chatHandlers["chat.send"]({

396+

params: {

397+

sessionKey: "other-session",

398+

sessionId,

399+

message: "stop",

400+

idempotencyKey: "idem-stop-client-session",

401+

},

402+

respond,

403+

context: context as never,

404+

req: {} as never,

405+

client: null,

406+

isWebchatConnect: () => false,

407+

});

408+409+

const [ok, payload] = requireLastRespondCall(respond);

410+

expect(ok).toBe(true);

411+

expect(expectRecord(payload, "abort payload").aborted).toBe(false);

412+

expect(active.controller.signal.aborted).toBe(false);

413+

expect(context.chatAbortControllers.has("run-stop-client-session")).toBe(true);

414+

});

415+337416

it("skips run-scoped transcript persistence when partial text is blank", async () => {

338417

const { transcriptPath, sessionId } = await createTranscriptFixture(

339418

"openclaw-chat-abort-run-blank-",