Fix archived agent reload failures
Unarchive provider storage before clearing Paseo's archived flag so failed native restores keep the snapshot archived. Keep initial history sync errors visible instead of falling back to the loading state.
This commit is contained in:
@@ -53,6 +53,10 @@ import {
|
||||
import { useArchiveAgent } from "@/hooks/use-archive-agent";
|
||||
import { useKeyboardShiftStyle } from "@/hooks/use-keyboard-shift-style";
|
||||
import { useContainerWidthBelow } from "@/hooks/use-container-width";
|
||||
import {
|
||||
clearHistorySyncErrorAfterSuccessfulSync,
|
||||
reconcileMissingAgentStateWithPresentAgent,
|
||||
} from "@/panels/agent-panel-load-state";
|
||||
import { usePaneContext, usePaneFocus } from "@/panels/pane-context";
|
||||
import type { PanelDescriptor, PanelRegistration } from "@/panels/panel-registry";
|
||||
import { RenderProfile } from "@/utils/render-profiler";
|
||||
@@ -847,9 +851,15 @@ function ChatAgentContent({
|
||||
if (!agentId) {
|
||||
return;
|
||||
}
|
||||
ensureAgentIsInitialized(agentId).catch((error) => {
|
||||
handleHistorySyncFailure({ origin, error });
|
||||
});
|
||||
ensureAgentIsInitialized(agentId)
|
||||
.then(() => {
|
||||
setMissingAgentState(clearHistorySyncErrorAfterSuccessfulSync);
|
||||
return undefined;
|
||||
})
|
||||
.catch((error) => {
|
||||
handleHistorySyncFailure({ origin, error });
|
||||
return undefined;
|
||||
});
|
||||
},
|
||||
[agentId, ensureAgentIsInitialized, handleHistorySyncFailure],
|
||||
);
|
||||
@@ -1011,8 +1021,8 @@ function ChatAgentContent({
|
||||
return;
|
||||
}
|
||||
if (agentState.id) {
|
||||
if (missingAgentState.kind !== "idle") {
|
||||
setMissingAgentState({ kind: "idle" });
|
||||
if (missingAgentState.kind === "resolving" || missingAgentState.kind === "not_found") {
|
||||
setMissingAgentState(reconcileMissingAgentStateWithPresentAgent);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user