feat(server): show OpenCode subagents in the Agents panel and work log #11262
Closednoueii(GitHub profile, opens in a new tab)wants to merge 3 commits into
main fromrefs/pull/11262/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- @@ -2234,8 +2385,12 @@22342385 }22352386 }22362387 }2388+ const isChildEvent =2389+ payloadSessionId !== undefined &&2390+ payloadSessionId !== context.openCodeSessionId &&2391+ context.relatedSessionIds.has(payloadSessionId);22372392 const isChildRequestEvent =22382393 payloadSessionId !== undefined &&22392394 isOpenCodeChildRequestEvent(event) &&22402395 (context.relatedSessionIds.has(payloadSessionId) || isKnownPendingTerminalEvent);2241- if (!isParentEvent && !isChildRequestEvent) {2396+ if (!isParentEvent && !isChildEvent && !isChildRequestEvent) {@@ -1654,0 +1756,21 @@1756+ turnId: context.activeTurnId,1757+ raw: event,1758+ })),1759+ type: "task.updated",1760+ payload: {1761+ taskId,1762+ status: status === "idle" ? "idle" : "running",1763+ ...linkage,1764+ },1765+ });1766+ return;1767+ }1768+ case "session.deleted": {1769+ yield* emit({1770+ ...(yield* buildEventBase({1771+ threadId: context.session.threadId,1772+ turnId: context.activeTurnId,1773+ raw: event,1774+ })),1775+ type: "task.updated",1776+ payload: { taskId, status: "interrupted", ...linkage },@@ -235,4 +282,8 @@235282 }),236283 ),237284 );238- const context = selectProviderContext(remotes.remotes);285+ const candidates = yield* Effect.forEach(remotes.remotes, (remote) =>286+ Effect.gen(function* () {287+ let provider = detectSourceControlProviderFromRemoteUrl(remote.url);288+ if ((provider === null || provider.kind === "unknown") && isSshRemoteUrl(remote.url)) {289+ const host = parseRemoteHost(remote.url);@@ -2462 +2625,21 @@24622625 if (part.type === "tool") {2626+ if (part.tool === "task") {2627+ const metadata =2628+ "metadata" in part.state &&2629+ typeof part.state.metadata === "object" &&2630+ part.state.metadata !== null2631+ ? part.state.metadata2632+ : undefined;2633+ const childSessionId =2634+ metadata && "sessionId" in metadata && typeof metadata.sessionId === "string"2635+ ? trimText(metadata.sessionId)2636+ : undefined;2637+ const metadataParentSessionId =2638+ metadata &&2639+ "parentSessionId" in metadata &&2640+ typeof metadata.parentSessionId === "string"2641+ ? trimText(metadata.parentSessionId)2642+ : undefined;2643+ const hasValidParent =2644+ metadataParentSessionId === undefined ||2645+ context.relatedSessionIds.has(metadataParentSessionId);
- apps/server/src/provider/Layers/OpenCodeAdapter.ts lines 2355 to 2358OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -2203,3 +2352,7 @@22032352 const session = event.properties.info;22042353 if (session.parentID && context.relatedSessionIds.has(session.parentID)) {22052354 addRelatedOpenCodeSession(context, session.id);2355+ const title = trimText(session.title);2356+ rememberOpenCodeChildTask(context, session.id, {2357+ title: title && !isOpenCodeDefaultTitle(title) ? title : undefined,2358+ });
- @@ -2034,3 +2203,18 @@20342203 retry.fiber = yield* run.pipe(Effect.forkIn(context.sessionScope));20352204 });203622052206+ /**2207+ * A resumed child session emits events without a preceding `session.created`,2208+ * so its first event does not match `relatedSessionIds` and would otherwise be2209+ * dropped. Resolve its ancestry once and replay that event as child activity.2210+ */2211+ const scheduleChildRelationDiscovery = Effect.fn("scheduleChildRelationDiscovery")(function* (2212+ context: OpenCodeSessionContext,2213+ event: OpenCodeSubscribedEvent,2214+ sessionId: string,2215+ ) {2216+ if (2217+ context.relatedSessionIds.has(sessionId) ||2218+ context.childRelationDiscoverySessionIds.has(sessionId)2219+ ) {2220+ return;
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed