Skip to content

Commit 3c068ed

Browse files
t3dotggclaude
andcommitted
fix(server): Muse workflow agents keep their end time, and a failed launch keeps its row
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 0eb8a5d commit 3c068ed

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/MuseAdapterV2.ts‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte
326326
let active: ActiveTurn | undefined;
327327
// The last finished turn, so context usage reported after it still lands on it.
328328
let lastProviderTurn: OrchestrationV2ProviderTurn | undefined;
329+
const agentEndedAt = new Map<string, DateTime.Utc>();
329330
// "default" is the catalog's default model, from the provider snapshot. Without
330331
// one, Muse keeps whatever model the session already runs.
331332
const resolveModel = Effect.fnUntraced(function* (selection: ModelSelection) {
@@ -459,7 +460,14 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte
459460
) {
460461
// Muse's skill-reminder child runs on every model step; it is housekeeping, not work.
461462
if (item.kind === "userMessage" || item.kind === "reminderChild") return;
462-
if (item.kind === "toolCall" && item.tool && TOOLS_WITH_NATIVE_ROWS.has(item.tool)) return;
463+
// A failed call keeps its row: it may have no native row to show its error.
464+
if (
465+
item.kind === "toolCall" &&
466+
item.tool &&
467+
TOOLS_WITH_NATIVE_ROWS.has(item.tool) &&
468+
item.status !== "failed"
469+
)
470+
return;
463471
const time = yield* DateTime.now;
464472
const status = terminal ?? museItemStatus(item);
465473
if (item.kind === "subagent" || item.kind === "workflow") {
@@ -577,6 +585,9 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte
577585
? "pending"
578586
: "running";
579587
const settled = status !== "running" && status !== "pending";
588+
// Children are re-sent on every workflow change; keep each one's first end time.
589+
const endKey = `${item.itemId}:${child.childId}:${child.attempt}`;
590+
if (settled && !agentEndedAt.has(endKey)) agentEndedAt.set(endKey, time);
580591
const title = child.label?.trim() || `Agent ${index + 1}`;
581592
const result = child.failureReason ?? null;
582593
const subagent: OrchestrationV2Subagent = {
@@ -597,7 +608,7 @@ export function makeMuseAdapterV2(options: MuseAdapterV2Options): ProviderAdapte
597608
status,
598609
result,
599610
startedAt: base.startedAt,
600-
completedAt: settled ? time : null,
611+
completedAt: settled ? (agentEndedAt.get(endKey) ?? time) : null,
601612
updatedAt: time,
602613
};
603614
yield* emit({ type: "subagent.updated", driver: MUSE_PROVIDER, subagent });

0 commit comments

Comments
 (0)