Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

chore(import): heldPaths takes a Set snapshot; function-size baseline +3 for the held-rename skip (#5988)

garrytan471cf3e3f953
diff --git a/scripts/function-size-baseline.tsv b/scripts/function-size-baseline.tsv
index c0a91caed2..8bae8e70b9 100644
--- a/scripts/function-size-baseline.tsv
+++ b/scripts/function-size-baseline.tsv
@@ -19,7 +19,7 @@ src/commands/eval-longmemeval.ts runEvalLongMemEval 740 seed: W5 baseline, refac
src/commands/extract-conversation-facts.ts processPage 308 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1); +1 #5918: one read of the page's conversation_segment_gap_minutes shared by both splitIntoSegments calls (validation lives in pageSegmentGapMinutes)
src/commands/extract-conversation-facts.ts runExtractConversationFactsCore 378 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1); +1 #5757: managed flag threaded into ExtractCoreState; +4 #5823: shared default-cap wiring and structured budget reason/model; decision logic is in facts/conversation-budget.ts; +2 #5330: strict-eligibility read and the enumeration filter through the shared predicate (rule lives in facts/conversation-types.ts)
src/commands/extract.ts runExtract 398 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1)
-src/commands/import.ts runImport 969 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1); +4 GBRA-40 F4b: planner-stats refresh every import.analyze_every_pages files (logic in planner-stats.ts); +6 #5988: onFileResult hook so full sync holds content refusals (logic in commands/sync/holds.ts)
+src/commands/import.ts runImport 972 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1); +4 GBRA-40 F4b: planner-stats refresh every import.analyze_every_pages files (logic in planner-stats.ts); +6 #5988: onFileResult hook so full sync holds content refusals (logic in commands/sync/holds.ts); +3 #5988: heldPaths skip so a full sync never imports a rename destination it held this run (logic in commands/sync/holds.ts)
src/commands/mcp-expose.ts runPublish 443 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1)
src/commands/migrate-engine.ts runMigrateEngine 405 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1)
src/commands/serve.ts installStdioLifecycle 315 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1)
diff --git a/src/commands/import.ts b/src/commands/import.ts
index 9df53b4215..de014316d7 100644
--- a/src/commands/import.ts
+++ b/src/commands/import.ts
@@ -221,7 +221,7 @@ export async function runImport(
sourceId?: string;
managedBookmark?: boolean;
/** #5988: paths the caller already held this run; they are skipped without importing (not failures). */
- heldPaths?: ReadonlySet<string> | readonly string[];
+ heldPaths?: ReadonlySet<string>;
/** #5988: each file's outcome (a throw arrives as `{ status: 'error', error }`); `'held'` = the caller held it, not a failure. */
onFileResult?: (path: string, filePath: string, result: Pick<ImportResult, 'status' | 'error' | 'refusal' | 'frontmatter_recovery'>) => Promise<'held' | undefined>;
/**
@@ -669,7 +669,6 @@ export async function runImport(
// never plans against the empty tables it started with (O-CEO-17).
const analyzeEvery = await importAnalyzeEveryPages(engine);
- const heldPaths = new Set(opts.heldPaths ?? []);
async function processFile(eng: BrainEngine, filePath: string) {
if (signal?.aborted) return;
const relativePath = singleFile ? basename(filePath) : relative(dir, filePath);
@@ -678,10 +677,7 @@ export async function runImport(
// relative (matching the incremental path's git-diff paths). The
// checkpoint (`completed`) stays dir-relative.
const importRelPath = opts.slugRoot ? relative(opts.slugRoot, filePath) : relative(importRoot, filePath);
- if (heldPaths.has(importRelPath)) {
- skipped++; completed.add(relativePath); processed++; tickProgress();
- return;
- }
+ if (opts.heldPaths?.has(importRelPath)) { skipped++; completed.add(relativePath); processed++; tickProgress(); return; }
// v0.31.2 (D5): per-file slow-path log. Fires only when a single
// file takes >5s. The user's hang surfaces as one file taking
// forever — without this, the agent can't see which file.
diff --git a/src/commands/sync/full.ts b/src/commands/sync/full.ts
index 2d6bab8534..3a683357f2 100644
--- a/src/commands/sync/full.ts
+++ b/src/commands/sync/full.ts
@@ -115,7 +115,7 @@ export async function performFullSync(
// shared gate below; don't let runImport double-record or write its own.
managedBookmark: true,
// #5988: a held rename destination whose old page changed is held, never imported as a new page.
- heldPaths: holds?.heldPaths,
+ heldPaths: new Set(holds?.heldPaths),
// #5988: content refusals are held, not failed (never gating the bookmark).
onFileResult: async (path, filePath, fileResult) => {
noteScreenedImport(holds, path, fileResult);