fix(server): deliver subagent results without history handoffs #22117
Mergedjuliusmarmingemerged 4 commits into
main fromrefs/pull/22117/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/server/src/orchestration-v2/Orchestrator.ts lines 601 to 620Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -590,8 +590,15 @@590590 );591591 }592592593-function delegatedCompletionWakeDetail(taskIds: ReadonlyArray<string>): string {594- const taskList = taskIds.join(", ");595- return taskIds.length === 1596- ? `Delegated task ${taskList} reached a terminal state. Use task_status with taskId ${taskList} to read the result.`597- : `Delegated tasks ${taskList} reached terminal states. Use task_status with each taskId to read the results.`;593+function delegatedCompletionWakeDetail(594+ taskIds: ReadonlyArray<string>,595+ tasks: ReadonlyArray<OrchestrationV2Subagent>,596+): string {597+ return taskIds598+ .map((taskId) => {599+ const task = tasks.find((candidate) => candidate.id === taskId);600+ return task?.result == null601+ ? `Delegated task ${taskId} reached a terminal state. Use task_status with taskId ${taskId} to read the result.`602+ : `Delegated task ${taskId}${task.title === null ? "" : ` (${task.title})`} [${task.status}]:\n${task.result}`;603+ })604+ .join("\n\n");
- apps/server/src/orchestration-v2/Orchestrator.ts line 611OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -596,2 +593,19 @@596- ? `Delegated task ${taskList} reached a terminal state. Use task_status with taskId ${taskList} to read the result.`597- : `Delegated tasks ${taskList} reached terminal states. Use task_status with each taskId to read the results.`;593+const DELEGATED_RESULT_INLINE_BYTES = 16_000;594+595+function delegatedCompletionWakeDetail(596+ taskIds: ReadonlyArray<string>,597+ tasks: ReadonlyArray<OrchestrationV2Subagent>,598+): string {599+ let remainingBytes = DELEGATED_RESULT_INLINE_BYTES;600+ return taskIds601+ .map((taskId) => {602+ const task = tasks.find((candidate) => candidate.id === taskId);603+ if (task?.result != null) {604+ const detail = `Delegated task ${taskId}${task.title === null ? "" : ` (${task.title})`} [${task.status}]:\n${task.result}`;605+ const bytes = Buffer.byteLength(detail);606+ if (bytes <= remainingBytes) {607+ remainingBytes -= bytes;608+ return detail;609+ }610+ }611+ return `Delegated task ${taskId} reached a terminal state. Use task_status with taskId ${taskId} to read the result.`;
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge merged this4f5ff17
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed