Skip to content

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

fix(memory-sources): the syncing flag follows a run the poll reports

Shanubf32f32de9d0
diff --git a/app/src/components/intelligence/__tests__/memorySyncActivityStore.test.ts b/app/src/components/intelligence/__tests__/memorySyncActivityStore.test.ts
index 874d070118..31dbe43080 100644
--- a/app/src/components/intelligence/__tests__/memorySyncActivityStore.test.ts
+++ b/app/src/components/intelligence/__tests__/memorySyncActivityStore.test.ts
@@ -90,6 +90,14 @@ describe('memorySyncActivityStore', () => {
reconcileWithStatuses([status('src-d', { sync_stage: 'running', sync_detail: 'pass 2' })]);
const s = getMemorySyncActivity();
expect(s.progress.get('src-d')).toEqual({ stage: 'running', detail: 'pass 2', percent: null });
+ // The flag follows the bar on a cold mount: the button must read as
+ // syncing, not only the row.
+ expect(s.syncingIds.has('src-d')).toBe(true);
+ });
+
+ it("marks the connector's `running` stage as syncing like the reader stages", () => {
+ applyStageEvent({ stage: 'running', source_id: 'src-h', detail: null });
+ expect(getMemorySyncActivity().syncingIds.has('src-h')).toBe(true);
});
it('leaves a fresh local entry alone when the core says idle, and clears a stale one', () => {
diff --git a/app/src/components/intelligence/memorySyncActivityStore.ts b/app/src/components/intelligence/memorySyncActivityStore.ts
index 4ba99de720..17307ed25a 100644
--- a/app/src/components/intelligence/memorySyncActivityStore.ts
+++ b/app/src/components/intelligence/memorySyncActivityStore.ts
@@ -121,8 +121,19 @@ type TerminalListener = (event: TerminalSyncEvent) => void;
*/
export const RECONCILE_GRACE_MS = 10_000;
-/** Stages that mean a run is in progress for the button's sake (RC#1, #3295). */
-const SYNCING_STAGES = new Set(['requested', 'fetching', 'stored', 'queued', 'ingesting']);
+/**
+ * Stages that mean a run is in progress for the button's sake (RC#1, #3295).
+ * `running` is the connector's one live stage; the reader path narrates the
+ * rest.
+ */
+const SYNCING_STAGES = new Set([
+ 'running',
+ 'requested',
+ 'fetching',
+ 'stored',
+ 'queued',
+ 'ingesting',
+]);
const EMPTY: MemorySyncActivity = {
syncingIds: new Set(),
@@ -273,6 +284,12 @@ export function reconcileWithStatuses(statuses: SourceStatus[], now = Date.now()
const live = status.sync_stage;
const knownLive = progress.has(rowId) || syncingIds.has(rowId);
if (live) {
+ // The core has the row running: the flag follows, whether the store
+ // learns of the run here (a cold mount) or already had the bar.
+ if (!syncingIds.has(rowId)) {
+ syncingIds.add(rowId);
+ changed = true;
+ }
// A row the button lit optimistically has no bar yet; if its first
// stage event was missed, the poll is what carries the stage.
if (progress.has(rowId)) continue;