fix(clients): native subagent threads show status instead of a composer #13624
Mergedjuliusmarmingemerged 8 commits into
t3code/codex-turn-mapping fromrefs/pull/13624/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/mobile/src/features/threads/ProviderSubagentBar.tsx lines 33 to 35OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +15,21 @@15+ * model is working, for how long, and leads back to the parent.16+ */17+export function ProviderSubagentBar(props: {18+ readonly modelLabel: string;19+ readonly status: ProviderSubagentStatus;20+ readonly onOpenParent: (() => void) | null;21+}) {22+ const live = isOrchestrationV2WorkActive(props.status.status);23+ const [nowMs, setNowMs] = useState(() => Date.now());24+ useEffect(() => {25+ if (!live) return;26+ const id = setInterval(() => setNowMs(Date.now()), 1_000);27+ return () => clearInterval(id);28+ }, [live]);29+ const statusLabel = formatProviderSubagentStatus(props.status, nowMs);30+31+ return (32+ <View33+ accessible34+ accessibilityRole="summary"35+ accessibilityLabel={`${props.modelLabel} subagent, ${statusLabel}. It runs on its own and cannot take messages.`}apps/web/src/components/chat/ProviderSubagentBar.tsx lines 41 to 41OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +21,21 @@21+ const statusRef = useRef<HTMLSpanElement>(null);22+ const { status } = props;23+ const live = isOrchestrationV2WorkActive(status.status);24+25+ // The label is written from an effect, and live bars tick through DOM26+ // writes, so a running timer never re-renders the chat view.27+ useLayoutEffect(() => {28+ const update = () => {29+ if (statusRef.current) {30+ statusRef.current.textContent = formatProviderSubagentStatus(status, Date.now());31+ }32+ };33+ update();34+ if (!live) return;35+ const id = setInterval(update, 1_000);36+ return () => clearInterval(id);37+ }, [live, status]);38+39+ return (40+ <div41+ role="status"apps/web/src/components/ChatView.tsx line 10634OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -10759,20 +10634 @@10759- onPreviousActivePendingUserInputQuestion={10760- onPreviousActivePendingUserInputQuestion10761- }10762- onChangeActivePendingUserInputCustomAnswer={10763- onChangeActivePendingUserInputCustomAnswer10764- }10765- onProviderModelSelect={onProviderModelSelect}10766- onOpenProviderSetup={openProviderSetup}10767- getModelDisabledReason={getModelDisabledReason}10768- toggleInteractionMode={toggleInteractionMode}10769- handleRuntimeModeChange={handleRuntimeModeChange}10770- handleInteractionModeChange={handleInteractionModeChange}10771- focusComposer={focusComposer}10772- scheduleComposerFocus={scheduleComposerFocus}10773- setThreadError={setThreadError}10774- onExpandImage={onExpandTimelineImage}10775- onFileOpen={openFileAttachment}10776- editingQueuedAttachments={composerEditingQueuedAttachments}10777- onRemoveEditingQueuedAttachment={removeEditingQueuedAttachment}10778- />10634+ {showProviderSubagentBar && providerSubagentStatus ? (apps/server/src/orchestration-v2/Orchestrator.ts line 4011OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -3997,3 +4008,4 @@39974008 ) =>39984009 Effect.gen(function* () {39994010 let projection = yield* getProjectionWithPendingEvents(command.threadId, events);4011+ if (isProviderNativeSubagentThread(projection.thread)) {
- @@ -8767,4 +8778,15 @@87678778 case "provider-session.detach":87688779 yield* dispatchProviderSessionDetach(command, events, effects);87698780 break;8770- case "message.dispatch":8781+ case "message.dispatch": {8782+ // The provider owns a native subagent's conversation, so a sent8783+ // message has nowhere to go. Only sends are refused: answers to the8784+ // subagent's own questions reuse dispatchMessage and must still land.8785+ const thread = yield* projectionStore8786+ .getThread(command.threadId)8787+ .pipe(8788+ Effect.mapError(8789+ (cause) => new OrchestratorProjectionError({ threadId: command.threadId, cause }),8790+ ),8791+ );8792+ if (isProviderNativeSubagentThread(thread)) {
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- @@ -1251,20 +1233 @@1251- }1252- }1253- bottomInset={composerBottomInset}1254- onChangeDraftMessage={props.onChangeDraftMessage}1255- onPickDraftMedia={props.onPickDraftMedia}1256- onPickDraftFiles={props.onPickDraftFiles}1257- onNativePasteImages={props.onNativePasteImages}1258- onNativePasteText={props.onNativePasteText}1259- onRemoveDraftImage={props.onRemoveDraftImage}1260- onStopThread={props.onStopThread}1261- onSendMessage={handleSendMessage}1262- onShowUsageLimits={showUsageLimits}1263- canSwitchProvider={props.canSwitchThreadProvider}1264- onUpdateModelSelection={props.onUpdateThreadModelSelection}1265- onUpdateRuntimeMode={props.onUpdateThreadRuntimeMode}1266- onUpdateInteractionMode={props.onUpdateThreadInteractionMode}1267- onExpandedChange={setComposerExpanded}1268- onEditorFocusChange={handleComposerFocusChange}1269- />1270- </>1233+ {isProviderNativeSubagentThread(props.selectedThread.source) ? (
juliusmarminge merged thisd3179b6
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed