mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 12:56:01 -06:00
test(gateway): await runtime ownership before lifecycle events (#130632)
This commit is contained in:
committed by
GitHub
parent
4041937d5a
commit
ed79e67276
@@ -2664,6 +2664,7 @@ describe("gateway server chat", () => {
|
||||
await withMainSessionStore(async () => {
|
||||
const runId = "idem-wait-chat-active-with-agent-lifecycle";
|
||||
const blockedReply = createDeferred();
|
||||
const runtimeStarted = createDeferred();
|
||||
mockGetReplyFromConfigOnce(async (_ctx, opts) => {
|
||||
opts?.onAgentRunStart?.(runId);
|
||||
const runtimeOwner = claimAgentRunContext(
|
||||
@@ -2677,6 +2678,7 @@ describe("gateway server chat", () => {
|
||||
{ ownsContext: true, trackOwner: true },
|
||||
);
|
||||
expect(runtimeOwner).toBeDefined();
|
||||
runtimeStarted.resolve();
|
||||
try {
|
||||
await blockedReply.promise;
|
||||
} finally {
|
||||
@@ -2688,6 +2690,8 @@ describe("gateway server chat", () => {
|
||||
const subscribeRes = await rpcReq(ws, "sessions.subscribe", {});
|
||||
expect(subscribeRes.ok).toBe(true);
|
||||
await sendChatAndExpectStarted(runId, "hold chat run open");
|
||||
// The ACK precedes dispatch; emit lifecycle only after the runtime owns this run.
|
||||
await runtimeStarted.promise;
|
||||
|
||||
const terminalSessionChange = onceMessage(
|
||||
ws,
|
||||
|
||||
Reference in New Issue
Block a user