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
Commits
414b0d8af - fix(ai): skip no-op primary-dev KB cascades (#11783)
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-heavynpm run ai:sync-kbpath, 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
PrimaryRepoSyncServicealready skips whenorigin/devhas no new commits; this patch removes the expensive cascade after a successful pull whose changed files cannot affect the KB corpus.Test Evidence
git diff --checknode --check ai/daemons/services/PrimaryRepoSyncService.mjsnode --check test/playwright/unit/ai/daemons/services/PrimaryRepoSyncService.spec.mjsnpm run test-unit -- test/playwright/unit/ai/daemons/services/PrimaryRepoSyncService.spec.mjs-> 21 passedSourceRegistrydefault sources andai/mcp/server/knowledge-base/config.template.mjssourcePathsbefore finalizing the path predicate.Post-Merge Validation
no-kb-relevant-changeswithout spawningnpm run ai:sync-kb.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)