The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 23:15 UTC
fix(web): show a supervisor waiting on its worker as running in Lineage (#18603)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Scott Norteman committed
Oct 20, 2026 at 01:05 UTC
321b86b05d9c1c59df044fbc0b8a39f0b983c209
3 files changed
+85
-8
apps/web/src/components/chat/ThreadRelationshipsControl.agents.browser.test.tsx
+73
-1
@@ -92,7 +92,7 @@ vi.mock(import("../ui/tooltip"), async () => {
92
TooltipTrigger: (({ render, children }: { render: ReactElement; children: ReactNode }) =>
93
cloneElement(render, {}, children)) as never,
94
TooltipPopup: (({ children }: { children: ReactNode }) =>
95
- state.showTooltips ? children : null) as never,
95
+ state.showTooltips ? <div role="tooltip">{children}</div> : null) as never,
96
};
97
});
98
@@ -739,6 +739,78 @@ it("shows the matching child agent details and refreshes them when the agent set
739
expect(text()).toContain("Lineage · 1 running");
740
});
741
742
+it("keeps active supervisor status, progress, and task timing after its child turn ends", async () => {
743
+ using _now = vi.spyOn(Date, "now").mockReturnValue(Date.parse("2026-09-16T12:05:15Z"));
744
+ state.showTooltips = true;
745
+ // The child request follows task creation by milliseconds, but finishing that
746
+ // turn does not settle a supervisor still waiting on its worker.
747
+ state.shells = [
748
+ {
749
+ environmentId: "test",
750
+ source: {
751
+ id: "child-1",
752
+ title: "Supervisor",
753
+ status: "completed",
754
+ activityRunStatus: null,
755
+ latestRunId: "run-child-1",
756
+ latestRunRequestedAt: DateTime.makeUnsafe("2026-09-16T12:00:00.003Z"),
757
+ latestRunStartedAt: DateTime.makeUnsafe("2026-09-16T12:00:01Z"),
758
+ latestRunCompletedAt: DateTime.makeUnsafe("2026-09-16T12:02:09Z"),
759
+ lineage: { parentThreadId: "parent", relationshipToParent: "subagent" },
760
+ },
761
+ },
762
+ ];
763
+ const projection = {
764
+ thread: {
765
+ id: "parent",
766
+ lineage: { relationshipToParent: null },
767
+ activeProviderThreadId: null,
768
+ },
769
+ runs: [],
770
+ providerThreads: [],
771
+ providerSessions: [],
772
+ contextTransfers: [],
773
+ subagents: [
774
+ {
775
+ id: "agent-1",
776
+ origin: "app_owned",
777
+ driver: "claudeAgent",
778
+ providerInstanceId: "claudeAgent",
779
+ childThreadId: "child-1",
780
+ title: "Supervisor",
781
+ prompt: "Coordinate the worker",
782
+ model: "claude-opus-5-5",
783
+ status: "running",
784
+ progress: "Waiting for the worker to finish",
785
+ result: null,
786
+ startedAt: DateTime.makeUnsafe("2026-09-16T12:00:00Z"),
787
+ completedAt: null,
788
+ updatedAt: DateTime.makeUnsafe("2026-09-16T12:00:00Z"),
789
+ },
790
+ ],
791
+ };
792
+ for (const status of ["pending", "running", "waiting"]) {
793
+ state.projection = {
794
+ ...projection,
795
+ subagents: [{ ...projection.subagents[0], status }],
796
+ };
797
+ await render(
798
+ <ThreadRelationshipsPanel
799
+ environmentId={EnvironmentId.make("test")}
800
+ threadId={ThreadId.make("parent")}
801
+ />,
802
+ );
803
+
804
+ expect(heading()).toBe(status === "running" ? "Lineage · 1 running" : "Lineage");
805
+ expect(textNodes(" ")).not.toContain("Previous agents");
806
+ expect(buttons().some((button) => button.textContent?.includes("Supervisor"))).toBe(true);
807
+ const tooltip = container.querySelector('[role="tooltip"]')?.textContent;
808
+ expect.soft(tooltip).toContain(status);
809
+ expect.soft(tooltip).toContain("Waiting for the worker to finish");
810
+ expect.soft(tooltip).toContain("5m 15s");
811
+ }
812
+});
813
+
814
it("shows readable models and only differing workspace details in agent tooltips", async () => {
815
state.showTooltips = true;
816
const parent = {
apps/web/src/components/chat/ThreadRelationshipsControl.tsx
+3
-2
@@ -28,6 +28,7 @@ import {
28
resolveLatestMergeBackRun,
29
} from "@t3tools/client-runtime/state/thread-workflows";
30
import {
31
+ isOrchestrationV2WorkActive,
32
isProviderNativeSubagentThread,
33
NodeId,
34
type EnvironmentId,
@@ -179,9 +180,9 @@ function currentSubagent<Agent extends RuntimeSubagent>(
180
agent: Agent | undefined,
181
childThread: OrchestrationV2ThreadShell | null | undefined,
182
): Agent | undefined {
183
+ if (!agent || !childThread || isOrchestrationV2WorkActive(agent.status)) return agent;
184
const liveStatus =
183
- childThread?.activityRunStatus ?? (childThread?.status === "queued" ? "queued" : null);
184
- if (!agent || !childThread) return agent;
185
+ childThread.activityRunStatus ?? (childThread.status === "queued" ? "queued" : null);
186
const newerRun =
187
childThread.latestRunRequestedAt &&
188
DateTime.toEpochMillis(childThread.latestRunRequestedAt) >
packages/client-runtime/src/state/threadRelationships.ts
+9
-5
@@ -1,7 +1,8 @@
1
-import type {
2
- OrchestrationV2ThreadProjection,
3
- OrchestrationV2ThreadShell,
4
- ThreadId,
1
+import {
2
+ isOrchestrationV2WorkActive,
3
+ type OrchestrationV2ThreadProjection,
4
+ type OrchestrationV2ThreadShell,
5
+ type ThreadId,
6
} from "@t3tools/contracts";
7
import * as DateTime from "effect/DateTime";
8
@@ -103,7 +104,10 @@ export function deriveThreadRelationshipGraph(input: {
104
targetThreadId: subagent.childThreadId,
105
kind: "subagent",
106
status:
106
- child?.activityRunStatus ?? (child?.latestRunId != null ? child.status : subagent.status),
107
+ child?.activityRunStatus ??
108
+ (child?.latestRunId != null && !isOrchestrationV2WorkActive(subagent.status)
109
+ ? child.status
110
+ : subagent.status),
111
});
112
}
113
for (const transfer of input.projection.contextTransfers) {