From 55021880e0c6c8e8cebbd87820dc3770e8228888 Mon Sep 17 00:00:00 2001 From: 777genius Date: Thu, 23 Apr 2026 02:08:56 +0300 Subject: [PATCH] fix(team): preserve opencode member diagnostics --- .../opencode/bridge/OpenCodeBridgeCommandContract.ts | 1 + .../team/runtime/OpenCodeTeamRuntimeAdapter.ts | 1 + .../services/team/OpenCodeTeamRuntimeAdapter.test.ts | 12 +++++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/services/team/opencode/bridge/OpenCodeBridgeCommandContract.ts b/src/main/services/team/opencode/bridge/OpenCodeBridgeCommandContract.ts index 7fb84fe6..d61f522b 100644 --- a/src/main/services/team/opencode/bridge/OpenCodeBridgeCommandContract.ts +++ b/src/main/services/team/opencode/bridge/OpenCodeBridgeCommandContract.ts @@ -64,6 +64,7 @@ export interface OpenCodeTeamMemberLaunchCommandData { sessionId: string; launchState: OpenCodeTeamMemberLaunchBridgeState; pendingPermissionRequestIds?: string[]; + diagnostics?: string[]; model: string; runtimePid?: number; evidence: Array<{ kind: string; observedAt: string }>; diff --git a/src/main/services/team/runtime/OpenCodeTeamRuntimeAdapter.ts b/src/main/services/team/runtime/OpenCodeTeamRuntimeAdapter.ts index e6565935..d5e9ec9b 100644 --- a/src/main/services/team/runtime/OpenCodeTeamRuntimeAdapter.ts +++ b/src/main/services/team/runtime/OpenCodeTeamRuntimeAdapter.ts @@ -393,6 +393,7 @@ function mapOpenCodeLaunchDataToRuntimeResult( : [ `OpenCode bridge response did not include ${member.name}; keeping the member pending until lane state materializes.`, ]), + ...(bridgeMember?.diagnostics ?? []), ...(bridgeMember?.evidence ?? []).map( (evidence) => `${evidence.kind} at ${evidence.observedAt}` ), diff --git a/test/main/services/team/OpenCodeTeamRuntimeAdapter.test.ts b/test/main/services/team/OpenCodeTeamRuntimeAdapter.test.ts index c2cd7845..eef382e0 100644 --- a/test/main/services/team/OpenCodeTeamRuntimeAdapter.test.ts +++ b/test/main/services/team/OpenCodeTeamRuntimeAdapter.test.ts @@ -252,6 +252,7 @@ describe('OpenCodeTeamRuntimeAdapter', () => { sessionId: 'oc-session-1', launchState: 'permission_blocked', pendingPermissionRequestIds: ['perm-1', 'perm-1', 'perm-2'], + diagnostics: ['waiting for permission approval'], runtimePid: 123, model: 'openai/gpt-5.4-mini', evidence: [ @@ -278,7 +279,9 @@ describe('OpenCodeTeamRuntimeAdapter', () => { { launchMode: 'dogfood' } ); - await expect(adapter.launch(launchInput())).resolves.toMatchObject({ + const result = await adapter.launch(launchInput()); + + expect(result).toMatchObject({ teamLaunchState: 'partial_pending', members: { alice: { @@ -292,6 +295,13 @@ describe('OpenCodeTeamRuntimeAdapter', () => { }, }, }); + expect(result).toMatchObject({ + members: { + alice: { + diagnostics: expect.arrayContaining(['waiting for permission approval']), + }, + }, + }); }); });