fix(server): subagent runs no longer delay replies #6584
ClosedDeepusleepy(GitHub profile, opens in a new tab)wants to merge 4 commits into
main fromrefs/pull/6584/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
- apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts line 237Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -116,0 +153,21 @@153+ previous.event.type === "task.updated"154+ ) {155+ latestByType.set(input.event.type, {156+ ...input,157+ event: {158+ ...input.event,159+ payload: {160+ ...previous.event.payload,161+ ...input.event.payload,162+ },163+ },164+ });165+ continue;166+ }167+ latestByType.set(input.event.type, input);168+ }169+ return TASK_LIFECYCLE_ORDER.flatMap((eventType) => {170+ const input = latestByType.get(eventType);171+ return input === undefined ? [] : [input];172+ });173+}
- apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts line 206Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -116,0 +135,21 @@135+ );136+}137+138+export function mergeBackgroundIngestion(139+ current: RuntimeIngestionBatch,140+ next: RuntimeIngestionBatch,141+): RuntimeIngestionBatch {142+ const combined = [...current, ...next];143+ if (!combined.every(isTaskLifecycleInput)) {144+ return next;145+ }146+147+ const latestByType = new Map<(typeof TASK_LIFECYCLE_ORDER)[number], RuntimeIngestionInput>();148+ for (const input of combined) {149+ const previous = latestByType.get(input.event.type);150+ if (151+ input.event.type === "task.progress" &&152+ previous?.source === "runtime" &&153+ previous.event.type === "task.progress"154+ ) {155+ latestByType.set(input.event.type, {
- apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts line 214Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -116,0 +146,21 @@146+147+ const latestByType = new Map<(typeof TASK_LIFECYCLE_ORDER)[number], RuntimeIngestionInput>();148+ for (const input of combined) {149+ const previous = latestByType.get(input.event.type);150+ if (151+ input.event.type === "task.progress" &&152+ previous?.source === "runtime" &&153+ previous.event.type === "task.progress"154+ ) {155+ latestByType.set(input.event.type, {156+ ...input,157+ event: {158+ ...input.event,159+ payload: {160+ ...previous.event.payload,161+ ...input.event.payload,162+ },163+ },164+ });165+ continue;166+ }
- @@ -116,0 +128,21 @@128+function isTaskLifecycleInput(input: RuntimeIngestionInput): input is Extract<129+ RuntimeIngestionInput,130+ { source: "runtime" }131+> & {132+ readonly event: Extract<ProviderRuntimeEvent, { type: (typeof TASK_LIFECYCLE_ORDER)[number] }>;133+} {134+ return (135+ input.source === "runtime" &&136+ TASK_LIFECYCLE_ORDER.some((eventType) => eventType === input.event.type)137+ );138+}139+140+function hasTaskProgressActivityState(payload: TaskProgressPayload): boolean {141+ return (142+ payload.typedUsage === undefined ||143+ payload.summary !== undefined ||144+ payload.lastToolName !== undefined ||145+ payload.status !== undefined ||146+ payload.error !== undefined ||147+ payload.phases !== undefined148+ );
juliusmarminge closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
ddaf630e-91fc-4062-8f32-d99ca9ceba52You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share