feat(auto): trigger sift index warmup at start of every autonomous loop
Some checks are pending
CI / detect-changes (push) Waiting to run
CI / docs-check (push) Blocked by required conditions
CI / lint (push) Blocked by required conditions
CI / build (push) Blocked by required conditions
CI / integration-tests (push) Blocked by required conditions
CI / windows-portability (push) Blocked by required conditions
CI / rtk-portability (linux, blacksmith-4vcpu-ubuntu-2404) (push) Blocked by required conditions
CI / rtk-portability (macos, macos-15) (push) Blocked by required conditions
CI / rtk-portability (windows, blacksmith-4vcpu-windows-2025) (push) Blocked by required conditions
Some checks are pending
CI / detect-changes (push) Waiting to run
CI / docs-check (push) Blocked by required conditions
CI / lint (push) Blocked by required conditions
CI / build (push) Blocked by required conditions
CI / integration-tests (push) Blocked by required conditions
CI / windows-portability (push) Blocked by required conditions
CI / rtk-portability (linux, blacksmith-4vcpu-ubuntu-2404) (push) Blocked by required conditions
CI / rtk-portability (macos, macos-15) (push) Blocked by required conditions
CI / rtk-portability (windows, blacksmith-4vcpu-windows-2025) (push) Blocked by required conditions
Previously, sift warmup only ran during sf init/auto-start, which meant repos launched via sf headless or entered mid-session never got their index built. The first sift_search/codebase_search call would then block for minutes while the cold cache was built. Now autoLoop() calls ensureSiftIndexWarmup() at loop entry. The warmup runs detached (background process) and is skipped if already running or if a recent marker exists. This ensures every repo SF operates on gets indexed regardless of entry path. - Best-effort: wrapped in try/catch so warmup failures never block the loop - Lazy import to avoid circular dependencies - Debug-logged for observability Tests: 179 files / 1863 tests pass. Type check: clean. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
8b4123cccc
commit
c42c13b882
2 changed files with 21 additions and 0 deletions
|
|
@ -586,6 +586,26 @@ export async function autoLoop(ctx, pi, s, deps) {
|
|||
cleared: runawayHeal,
|
||||
});
|
||||
}
|
||||
// ── Start sift index warmup if not already running ──
|
||||
// The warmup runs detached and builds the lexical index for the repo.
|
||||
// Once cached, all future sift_search and codebase_search calls are fast.
|
||||
// We do this here (not just in auto-start) so every repo SF enters gets
|
||||
// indexed, including repos launched via `sf headless` or cd'd into mid-session.
|
||||
try {
|
||||
const { ensureSiftIndexWarmup } = await import("../code-intelligence.js");
|
||||
const warmup = ensureSiftIndexWarmup(
|
||||
s.basePath,
|
||||
deps.loadEffectiveSFPreferences?.()?.preferences?.codebase,
|
||||
);
|
||||
if (warmup.status === "started") {
|
||||
debugLog("autoLoop", {
|
||||
phase: "sift-warmup-started",
|
||||
reason: warmup.reason,
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
/* best-effort — never block the loop on warmup */
|
||||
}
|
||||
let iteration = 0;
|
||||
// Load persisted stuck state so counters survive session restarts (#3704)
|
||||
const persisted = loadStuckState(s.basePath);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import {
|
|||
countChangedFiles,
|
||||
resetRunawayGuardState,
|
||||
} from "../uok/auto-runaway-guard.js";
|
||||
import { emitJournalEvent } from "../journal.js";
|
||||
import { swarmDispatchAndWait } from "../uok/swarm-dispatch.js";
|
||||
import { logWarning } from "../workflow-logger.js";
|
||||
import {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue