Restore archived agents from History (#2316)

* fix(app): restore archived agents from History

History navigation lost the explicit archived-agent intent during tab reconciliation, and workspace recovery stopped after restoring the workspace. Preserve the selected tab and recover its provider session as one action while serializing provider resume with timeline hydration.

* fix(app): preserve archived agent recovery invariants

* fix(server): preserve timeline hydration call shape

* fix(app): retain agent tabs through lookup

* fix(server): upgrade in-flight timeline broadcast
This commit is contained in:
Mohamed Boudra
2026-07-22 15:03:09 +02:00
committed by GitHub
parent 68993b7ab3
commit 42ee5a5949
22 changed files with 629 additions and 61 deletions
@@ -1591,6 +1591,66 @@ describe("workspace-layout-store actions", () => {
expect(Array.from(state.pinnedAgentIdsByWorkspace[workspaceKey] ?? [])).toEqual(["agent-1"]);
});
it("keeps an explicitly pinned archived agent before its detail is hydrated", () => {
const workspaceKey = createWorkspaceKey();
const store = workspaceLayoutStore.getState();
store.openTabFocused(workspaceKey, { kind: "agent", agentId: "archived-agent" });
store.pinAgent(workspaceKey, "archived-agent");
store.reconcileTabs(workspaceKey, {
agentsHydrated: true,
terminalsHydrated: true,
activeAgentIds: [],
autoOpenAgentIds: [],
knownAgentIds: [],
standaloneTerminalIds: [],
});
expect(store.getWorkspaceTabs(workspaceKey).map((tab) => tab.tabId)).toEqual([
"agent_archived-agent",
]);
store.reconcileTabs(workspaceKey, {
agentsHydrated: true,
terminalsHydrated: true,
activeAgentIds: [],
autoOpenAgentIds: [],
knownAgentIds: [],
standaloneTerminalIds: [],
});
expect(store.getWorkspaceTabs(workspaceKey).map((tab) => tab.tabId)).toEqual([
"agent_archived-agent",
]);
store.resolvePendingAgent(workspaceKey, "archived-agent");
store.reconcileTabs(workspaceKey, {
agentsHydrated: true,
terminalsHydrated: true,
activeAgentIds: [],
autoOpenAgentIds: [],
knownAgentIds: [],
standaloneTerminalIds: [],
});
expect(store.getWorkspaceTabs(workspaceKey).map((tab) => tab.tabId)).toEqual([]);
store.openTabFocused(workspaceKey, { kind: "agent", agentId: "archived-agent" });
store.pinAgent(workspaceKey, "archived-agent");
store.reconcileTabs(workspaceKey, {
agentsHydrated: true,
terminalsHydrated: true,
activeAgentIds: [],
autoOpenAgentIds: [],
knownAgentIds: [],
standaloneTerminalIds: [],
});
expect(store.getWorkspaceTabs(workspaceKey).map((tab) => tab.tabId)).toEqual([
"agent_archived-agent",
]);
});
it("retargeting a tab to an agent clears hidden intent", () => {
const workspaceKey = createWorkspaceKey();
const store = workspaceLayoutStore.getState();