From 5c4b4fc9a422359030a8a84fa9356c6efa2ab6bf Mon Sep 17 00:00:00 2001 From: Merge Sim Date: Sat, 5 Sep 2026 01:38:07 -0700 Subject: [PATCH] fix(mobile): point the launch tests at the generalized create API The rebase onto #18697 brought its definitive-refusal tests in cleanly, but they call the pre-rename createMobileStructuredCodexSession, and mobile tsc excludes test files so nothing caught it. Retarget them and give the agent-copy test a code that is actually in the definitive allowlist - agent_session_refused now correctly stays unknown, so it never reached the failure copy it asserted. --- ...le-structured-agent-session-launch.test.ts | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/mobile/src/session/mobile-structured-agent-session-launch.test.ts b/mobile/src/session/mobile-structured-agent-session-launch.test.ts index 2143b7f7a90..8a020d2eea9 100644 --- a/mobile/src/session/mobile-structured-agent-session-launch.test.ts +++ b/mobile/src/session/mobile-structured-agent-session-launch.test.ts @@ -100,7 +100,9 @@ describe('mobile structured agent-session launch', () => { it('names the refusing agent in the failure copy rather than always saying Codex', async () => { const client = clientReturning( { ok: true, result: { supported: true } }, - { ok: false, error: { code: 'agent_session_refused', message: '' } } + // A definitive refusal is the only path that reaches the failure copy; anything else + // stays unknown and never renders a message. + { ok: false, error: { code: 'method_not_found', message: '' } } ) await expect( @@ -234,7 +236,9 @@ describe('mobile structured agent-session launch', () => { { ok: false, error: { code, message: 'structured create unavailable' } } ) - await expect(createMobileStructuredCodexSession(client, 'workspace-1')).resolves.toEqual({ + await expect( + createMobileStructuredAgentSession(client, 'workspace-1', 'codex') + ).resolves.toEqual({ kind: 'failed', message: 'structured create unavailable' }) @@ -249,7 +253,9 @@ describe('mobile structured agent-session launch', () => { { ok: false, error: { code, message: 'create outcome ambiguous' } } ) - await expect(createMobileStructuredCodexSession(client, 'workspace-1')).resolves.toEqual({ + await expect( + createMobileStructuredAgentSession(client, 'workspace-1', 'codex') + ).resolves.toEqual({ kind: 'unknown', message: 'create outcome ambiguous' }) @@ -271,7 +277,9 @@ describe('mobile structured agent-session launch', () => { } ) - await expect(createMobileStructuredCodexSession(client, 'workspace-1')).resolves.toEqual({ + await expect( + createMobileStructuredAgentSession(client, 'workspace-1', 'codex') + ).resolves.toEqual({ kind: 'failed', message: 'structured create unavailable' }) @@ -291,7 +299,9 @@ describe('mobile structured agent-session launch', () => { } ) - await expect(createMobileStructuredCodexSession(client, 'workspace-1')).resolves.toEqual({ + await expect( + createMobileStructuredAgentSession(client, 'workspace-1', 'codex') + ).resolves.toEqual({ kind: 'unknown', message: 'create outcome ambiguous' })