fix(app): keep agent history visible during catch-up

Visibility catch-up could select the blocking overlay after optimistic continuity cleared, even though history was already hydrated. Keep hydrated content non-blocking and cover the creation handoff with a browser regression test.
This commit is contained in:
Mohamed Boudra
2026-07-21 16:17:56 +02:00
parent a8fb40e689
commit b2139b1400
3 changed files with 47 additions and 6 deletions
@@ -209,7 +209,7 @@ describe("deriveAgentScreenViewState", () => {
expect(sync.ui).toBe("silent");
});
it("covers already-hydrated history while a newly visible agent catches up", () => {
it("keeps already-hydrated history visible while a newly visible agent catches up", () => {
const memory = createBaseMemory({
hasRenderedReady: true,
lastReadyAgent: createAgent("agent-1"),
@@ -225,7 +225,7 @@ describe("deriveAgentScreenViewState", () => {
const ready = expectReadyState(result.state);
const sync = expectCatchingUpSync(ready);
expect(sync.ui).toBe("overlay");
expect(sync.ui).toBe("silent");
});
it("keeps hydrated history readable after a visibility catch-up error", () => {
@@ -150,13 +150,11 @@ function resolveCatchingUpUi(args: {
hasOptimisticCreateContinuity: boolean;
isVisibilityCatchUpPending: boolean;
hasHydratedHistoryBefore: boolean;
needsAuthoritativeSync: boolean;
hadInitialSyncFailure: boolean;
}): "overlay" | "silent" {
if (args.hasOptimisticCreateContinuity) return "silent";
if (args.hasHydratedHistoryBefore && args.needsAuthoritativeSync) return "silent";
if (args.isVisibilityCatchUpPending) return "overlay";
if (args.hasHydratedHistoryBefore) return "silent";
if (args.isVisibilityCatchUpPending) return "overlay";
if (args.hadInitialSyncFailure) return "silent";
return "overlay";
}
@@ -186,7 +184,6 @@ function resolveAgentScreenSync(args: {
hasOptimisticCreateContinuity: hasOptimisticCreateContinuity(input),
isVisibilityCatchUpPending: input.visibilityCatchUpStatus === "pending",
hasHydratedHistoryBefore: input.hasHydratedHistoryBefore,
needsAuthoritativeSync: input.needsAuthoritativeSync,
hadInitialSyncFailure,
}),
};