Show friendly native subagent names and hide finished work (#2073)

* feat(subagents): archive finished children and show native names

Keep native provider sessions intact while letting users clear completed children from the track. Persist dismissed provider child IDs so history replay does not restore them.

* fix(subagents): cover persistence and naming edge cases

* fix(subagents): preserve active descendants and native names

* fix(subagents): retain dismissed timelines and trim paths

* fix(subagents): retain history across hydration

* test(subagents): expect normalized native descriptions

* fix(subagents): separate hidden rows from retained history

* fix(subagents): preserve restored hidden tabs safely

* fix(subagents): integrate archive with run state

* test(codex): expect normalized child name

* fix(subagents): retain dismissed tabs on reload

* fix(subagents): hide finished native agents locally

Keep the header action presentation-only so it does not mutate agent lifecycle or expand the runtime protocol.

* fix(subagents): humanize native agent names

* fix(subagents): preserve names in Codex history

* fix(subagents): retain hidden rows across reloads
This commit is contained in:
Mohamed Boudra
2026-07-15 11:58:31 +02:00
committed by GitHub
parent 38e4d9ad5d
commit abfe955867
28 changed files with 600 additions and 49 deletions
+28 -4
View File
@@ -32,6 +32,8 @@ export interface ProviderSubagentTimelineState {
interface ProviderSubagentState {
descriptors: Map<string, ProviderSubagentDescriptorPayload>;
timelines: Map<string, ProviderSubagentTimelineState>;
hiddenFromTrack: Set<string>;
hideFinishedForParent(serverId: string, parentAgentId: string): void;
replaceList(
serverId: string,
parentAgentId: string,
@@ -193,14 +195,32 @@ function buildTimelineResponseRows(
export const useProviderSubagentStore = create<ProviderSubagentState>((set) => ({
descriptors: new Map(),
timelines: new Map(),
hiddenFromTrack: new Set(),
hideFinishedForParent(serverId, parentAgentId) {
set((state) => {
const prefix = parentPrefix(serverId, parentAgentId);
const hiddenFromTrack = new Set(state.hiddenFromTrack);
for (const [key, subagent] of state.descriptors) {
if (key.startsWith(prefix) && subagent.status !== "running") {
hiddenFromTrack.add(key);
}
}
return { hiddenFromTrack };
});
},
replaceList(serverId, parentAgentId, subagents) {
set((state) => {
const prefix = parentPrefix(serverId, parentAgentId);
const descriptors = new Map(
[...state.descriptors].filter(([key]) => !key.startsWith(prefix)),
);
const hiddenFromTrack = new Set(state.hiddenFromTrack);
for (const subagent of subagents) {
descriptors.set(providerSubagentKey(serverId, parentAgentId, subagent.id), subagent);
const key = providerSubagentKey(serverId, parentAgentId, subagent.id);
descriptors.set(key, subagent);
if (subagent.status === "running") {
hiddenFromTrack.delete(key);
}
}
const retainedKeys = new Set(descriptors.keys());
const timelines = new Map(
@@ -217,7 +237,7 @@ export const useProviderSubagentStore = create<ProviderSubagentState>((set) => (
);
}
}
return { descriptors, timelines };
return { descriptors, timelines, hiddenFromTrack };
});
},
applyUpdate(serverId, payload) {
@@ -229,8 +249,12 @@ export const useProviderSubagentStore = create<ProviderSubagentState>((set) => (
payload.subagent.id,
);
const descriptors = new Map(state.descriptors);
const hiddenFromTrack = new Set(state.hiddenFromTrack);
const previous = descriptors.get(key);
descriptors.set(key, payload.subagent);
if (payload.subagent.status === "running") {
hiddenFromTrack.delete(key);
}
let timelines = state.timelines;
const current = state.timelines.get(key);
if (current && previous?.status !== payload.subagent.status) {
@@ -240,13 +264,13 @@ export const useProviderSubagentStore = create<ProviderSubagentState>((set) => (
buildTimelineState(current.rows, current.epoch, payload.subagent, current.hasOlder),
);
}
return { descriptors, timelines };
return { descriptors, timelines, hiddenFromTrack };
}
if (payload.kind === "remove") {
const key = providerSubagentKey(serverId, payload.parentAgentId, payload.subagentId);
const descriptors = new Map(state.descriptors);
const timelines = new Map(state.timelines);
descriptors.delete(key);
const timelines = new Map(state.timelines);
timelines.delete(key);
return { descriptors, timelines };
}