From 76ba73e05f1244cb682cdda5a59e7d9ddcfd4c7f Mon Sep 17 00:00:00 2001 From: qer Date: Tue, 14 Jul 2026 16:54:46 +0800 Subject: [PATCH] test(agent-core-v2): add lifecycle create stub to sessionLegacy status test SessionLegacyService.status() now resolves the main agent through ensureMainAgent() -> IAgentLifecycleService.create() (since d158e0a7a), but the scenario's hand-rolled lifecycle stub only implemented whenReady, so the test errored with 'create is not a function' before any assertion ran. Return the existing main agent from create, matching the real service's create-or-get contract for explicit ids. --- .../agent-core-v2/test/app/sessionLegacy/sessionLegacy.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/agent-core-v2/test/app/sessionLegacy/sessionLegacy.test.ts b/packages/agent-core-v2/test/app/sessionLegacy/sessionLegacy.test.ts index 921fe7d4fc..993faea68f 100644 --- a/packages/agent-core-v2/test/app/sessionLegacy/sessionLegacy.test.ts +++ b/packages/agent-core-v2/test/app/sessionLegacy/sessionLegacy.test.ts @@ -83,6 +83,9 @@ describe('Session legacy status (best-effort runtime state)', () => { dispose: () => {}, }; const agents = { + // create is create-or-get for explicit ids: this session's main agent + // already exists, so return it as-is (same as whenReady). + create: () => Promise.resolve(agent), whenReady: () => Promise.resolve(agent), } as unknown as IAgentLifecycleService; const session: ISessionScopeHandle = {