fix(acp-core): clear stale active run lookups (#96427) · openclaw/openclaw@1ba1fec
lin-hongkuan
·
2026-06-25
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -34,6 +34,19 @@ describe("acp session manager", () => {
|
34 | 34 | expect(store.getSessionByRunId("run-1")).toBeUndefined(); |
35 | 35 | }); |
36 | 36 | |
| 37 | +it("removes stale run lookup entries when rebinding an active run", () => { |
| 38 | +const session = store.createSession({ |
| 39 | +sessionKey: "acp:rebind", |
| 40 | +cwd: "/tmp", |
| 41 | +}); |
| 42 | + |
| 43 | +store.setActiveRun(session.sessionId, "run-old", new AbortController()); |
| 44 | +store.setActiveRun(session.sessionId, "run-new", new AbortController()); |
| 45 | + |
| 46 | +expect(store.getSessionByRunId("run-old")).toBeUndefined(); |
| 47 | +expect(store.getSessionByRunId("run-new")?.sessionId).toBe(session.sessionId); |
| 48 | +}); |
| 49 | + |
37 | 50 | it("deletes sessions and aborts active runs on close", () => { |
38 | 51 | const session = store.createSession({ |
39 | 52 | sessionId: "close-me", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -150,6 +150,9 @@ export function createInMemorySessionStore(options: AcpSessionStoreOptions = {})
|
150 | 150 | if (!session) { |
151 | 151 | return; |
152 | 152 | } |
| 153 | +if (session.activeRunId && session.activeRunId !== runId) { |
| 154 | +runIdToSessionId.delete(session.activeRunId); |
| 155 | +} |
153 | 156 | session.activeRunId = runId; |
154 | 157 | session.abortController = abortController; |
155 | 158 | runIdToSessionId.set(runId, sessionId); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。