Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(memory): show the move the core starts after an import

M3gA-Mind1f8f5779b0b8
diff --git a/app/src/components/memory/MemoryImportBanner.test.tsx b/app/src/components/memory/MemoryImportBanner.test.tsx
index edf686fd22..b0fdfed009 100644
--- a/app/src/components/memory/MemoryImportBanner.test.tsx
+++ b/app/src/components/memory/MemoryImportBanner.test.tsx
@@ -201,6 +201,18 @@ describe('MemoryImportBanner', () => {
expect(hoisted.mStart).not.toHaveBeenCalled();
});
+ it('shows the move the core starts once the import is done', async () => {
+ hoisted.status.mockResolvedValue({ state: { phase: 'done', imported: 9, total: 9 } });
+ // At mount nothing was left to move; the finished import changed that.
+ hoisted.mScan
+ .mockResolvedValueOnce({ needed: false, shared: false })
+ .mockResolvedValue({ needed: true, shared: false });
+ hoisted.mStatus.mockResolvedValueOnce(MOVE_IDLE).mockResolvedValue(moving(5));
+ renderWithProviders(<MemoryImportBanner engineLabel="TinyHumans" />);
+ expect(await screen.findByTestId('memory-migration-running')).toHaveTextContent('5');
+ expect(hoisted.mStart).not.toHaveBeenCalled();
+ });
+
it('takes a shared tree only after the takeover is confirmed', async () => {
hoisted.scan.mockResolvedValue({ found: false });
hoisted.mScan.mockResolvedValue({ needed: true, shared: true });
diff --git a/app/src/components/memory/MemoryImportBanner.tsx b/app/src/components/memory/MemoryImportBanner.tsx
index dd52e8dfe4..20c5f1064c 100644
--- a/app/src/components/memory/MemoryImportBanner.tsx
+++ b/app/src/components/memory/MemoryImportBanner.tsx
@@ -215,6 +215,23 @@ export default function MemoryImportBanner({ engineLabel }: MemoryImportBannerPr
};
const importDone = state?.phase === 'done';
+ // The core starts the move when the import finishes: look again, since the
+ // scan at mount may have found nothing to move before the import landed.
+ useEffect(() => {
+ if (!importDone) return;
+ let cancelled = false;
+ Promise.all([memoryMigrationScan(), memoryMigrationStatus()])
+ .then(([found, current]) => {
+ if (cancelled) return;
+ mlog('after import: needed=%s running=%s', found?.needed, current?.running);
+ setMScan(found ?? null);
+ setMStatus(current ?? null);
+ })
+ .catch(err => mlog('scan after import failed: %o', err));
+ return () => {
+ cancelled = true;
+ };
+ }, [importDone]);
const mState = mStatus?.state;
const left = (mState?.failures?.length ?? 0) + (mState?.incomplete?.length ?? 0);