fix(deep-enrich): reset stale progress when manifest is newer than last run - #128
Merged
jeff-r2026 merged 2 commits intoJul 3, 2026
Merged
Conversation
added 2 commits
July 3, 2026 11:41
…st run When import regenerates evidence (full rebuild), the old progress.json may survive on the git branch that deep-enrich executes against (since autoPushViaMR checks out master before deep-enrich runs in setImmediate). The 'done' phase caused all generation phases to be skipped, producing an MR with only a timestamp update in progress.json. Now detect staleness via two signals: - docs/ directory is empty (evidence was rebuilt but docs not regenerated) - manifest.generatedAt > progress.startedAt (manifest is fresher) Either condition resets progress to 'pending' so all phases re-execute.
…e single MR Previously deep-enrich ran in setImmediate after autoPushViaMR had already checked out master, causing it to: 1. Read stale evidence/progress from master instead of the freshly extracted data 2. Push a separate MR with incomplete/empty content Move deep-enrich before the push step so: - It executes against the actual freshly-written evidence on disk - All content (extract + enrich) is committed into a single MR - No timing/branch confusion between import and enrich phases This eliminates the root cause; the stale progress guard in deep-enrich.ts remains as defense-in-depth.
m0Nst3r873
force-pushed
the
worktree-fix-deep-enrich-stale-progress
branch
from
July 3, 2026 03:43
5770d82 to
8ca7e33
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes deep-enrich producing empty MRs (only progress.json timestamp update) when running after
teamai import --from-repo.Root cause:
autoPushViaMRcallscheckoutMaster()after committing the import branch. The subsequentsetImmediate-scheduled deep-enrich then runs against the master working tree, where:progress.json(phase="done") causes all generation phases to be skippedFix (two commits):
deep-enrich.ts— Add stale progress guard: reset to "pending" when phase=done but either docs/ is empty or_manifest.jsonis newer than the progress timestamp. Defense-in-depth.import-repo.ts— Move deep-enrich from asyncsetImmediate(after push) to synchronous execution (before push). This ensures:Test plan
npx tsc --noEmitpassesnpx vitest run— 1590 tests passteamai import --from-repo <url>produces a single MR with both evidence and deep-enrich docs