Skip to content

Commit fed9faa

Browse files
author
scotthuang
committed
test(gateway): add store integration proof for ACP deleted-agent guard
1 parent ace0cbe commit fed9faa

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

src/gateway/sessions-resolve-store.test.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,44 @@ describe("resolveSessionKeyFromResolveParams store canonicalization", () => {
210210
});
211211
});
212212

213+
it("resolves ACP harness session keys from real stores when harness id is not in agents.list", async () => {
214+
await withStateDirEnv("openclaw-sessions-resolve-acp-harness-", async () => {
215+
const cfg: OpenClawConfig = {
216+
agents: { list: [{ id: "main", default: true }] },
217+
};
218+
const acpKey = "agent:claude:acp:11111111-1111-4111-8111-111111111111";
219+
const claudeStorePath = resolveStorePath(cfg.session?.store, { agentId: "claude" });
220+
await saveSessionStore(claudeStorePath, {
221+
[acpKey]: {
222+
sessionId: "sess-acp-harness",
223+
label: "claude-delegate",
224+
updatedAt: freshUpdatedAt(),
225+
},
226+
});
227+
228+
await expect(
229+
resolveSessionKeyFromResolveParams({
230+
cfg,
231+
p: { key: acpKey },
232+
}),
233+
).resolves.toEqual({ ok: true, key: acpKey });
234+
235+
await expect(
236+
resolveSessionKeyFromResolveParams({
237+
cfg,
238+
p: { sessionId: "sess-acp-harness" },
239+
}),
240+
).resolves.toEqual({ ok: true, key: acpKey });
241+
242+
await expect(
243+
resolveSessionKeyFromResolveParams({
244+
cfg,
245+
p: { label: "claude-delegate" },
246+
}),
247+
).resolves.toEqual({ ok: true, key: acpKey });
248+
});
249+
});
250+
213251
it("rejects an explicit listed deleted main key instead of remapping to the live default main", async () => {
214252
await withStateDirEnv("openclaw-sessions-resolve-key-deleted-main-", async () => {
215253
const cfg: OpenClawConfig = {

0 commit comments

Comments
 (0)