LearnNewsExamplesServices
Frontmatter
titlefix(ai): skip no-op primary-dev KB cascades (#11783)
authorneo-gpt
stateMerged
createdAtMay 22, 2026, 10:35 PM
updatedAtMay 22, 2026, 11:09 PM
closedAtMay 22, 2026, 11:09 PM
mergedAtMay 22, 2026, 11:09 PM
branchesdevcodex/11783-skip-noop-kb-cascade
urlhttps://github.com/neomjs/neo/pull/11784
Merged
neo-gpt
neo-gpt commented on May 22, 2026, 10:35 PM

Resolves #11783

Authored by GPT-5.5 (Codex Desktop). Session 019e5111-6366-7b01-82e0-df2d9b738841. FAIR-band: over-target [18/30] - taking this lane despite over-target because the operator surfaced live no-op KB cascade logs, Claude was slowed by API issues, and the patch is a narrow daemon optimization that removes immediate orchestrator pressure.

Primary dev sync now snapshots HEAD before and after a successful pull, computes git diff --name-only oldHEAD..newHEAD, and only runs the expensive KB cascade when the changed paths intersect Neo's default KB source roots. Generated metadata-only and other non-KB changes skip the Chroma-heavy npm run ai:sync-kb path, while failed HEAD/diff probes fall back to the existing full cascade.

Evidence: L2 (mock-git command dispatch plus focused unit coverage of cascade/skip/fallback paths) -> L2 required (daemon decision contract). No residuals.

Deltas from Ticket

  • Implemented per-pull revision-diff gating instead of a persistent branch-SHA cache. PrimaryRepoSyncService already skips when origin/dev has no new commits; this patch removes the expensive cascade after a successful pull whose changed files cannot affect the KB corpus.
  • Kept fallback behavior conservative: missing HEADs or failed changed-path detection still run the full KB cascade.
  • Applied the same decision result to configured-root aggregation so one KB-relevant completed root still cascades once from the owning checkout, while all-non-KB completed roots skip.

Test Evidence

  • git diff --check
  • node --check ai/daemons/services/PrimaryRepoSyncService.mjs
  • node --check test/playwright/unit/ai/daemons/services/PrimaryRepoSyncService.spec.mjs
  • npm run test-unit -- test/playwright/unit/ai/daemons/services/PrimaryRepoSyncService.spec.mjs -> 21 passed
  • V-B-A source-root check: verified SourceRegistry default sources and ai/mcp/server/knowledge-base/config.template.mjs sourcePaths before finalizing the path predicate.

Post-Merge Validation

  • Observe one orchestrator primary-dev-sync cycle with only non-KB changed paths and confirm it reports no-kb-relevant-changes without spawning npm run ai:sync-kb.
  • Observe a later KB-relevant pull (src/, learn/, ai/, resources/content/, etc.) and confirm the cascade still runs once.

Commits

  • 414b0d8af - fix(ai): skip no-op primary-dev KB cascades (#11783)