Repository navigation
Conversation
There was a problem hiding this comment.
Approve (0 findings)
Scope: base main, merge base 77abdcb3; 1 commit, 3 files reviewed (chunk-sync-coordinator.ts, its test, src/memory/README.md). Loaded coderbook. ponytail-review and karpathy-guidelines were not loaded; their checks were applied from the review checklist instead. Reviewed in a separate session.
Findings
None.
Verified as fine
- Root cause fixed. On the base,
Promise.all(workers)rejected as soon as one source failed. That letrunAgent's.finally(chunk-sync-coordinator.ts:121-126) and thewithDirectoryLockwrapper (chunk-index.ts:296-306) release the Agent while sibling workers were still writing, and those workers kept claiming more indices. The fix catches each source's failure inside its worker, stops new claims through!failed(chunk-sync-coordinator.ts:70), and rethrows only after every worker settles (:84-86). The lock now outlives every source write. The change stays in the coordinator, which owns this behavior; no caller changes. - Callers. The only
mapSourcesoperation that can reject per source is#syncRawSources(chunk-index.ts:276-291, invalid projection throws). The full reconciliation's agent loop (chunk-index.ts:484-511) and the per-source loop in#syncAgent(chunk-index.ts:571-600) catch inside the operation, so only the rejection of their own failure-recording SQL can reach the new path.syncMyPagesChunkSourcesalso catches per document (my-pages-chunk-sources.ts:108-140). - Behavior trade-off, accepted. After a failure,
#syncRawSourcesnow skips the remaining unclaimed sources instead of indexing them unlocked in the background. Those sources are still picked up by the next coalesced Raw sync or by the hourly#syncAgentreconciliation, which isolates failures per source (chunk-index.ts:574-598). Indexing them is delayed, not lost. - Error identity. A
failedflag, rather thanfailure !== undefined, keeps even anundefinedrejection; the second test covers it. The first failure wins, matching the README text. - Tests. The new regression test fails on the merge base. I swapped in the base
chunk-sync-coordinator.tsand got 1 failed, 3 passed, then restored it. It passes on the head. The test uses deferred promises plus onesetImmediatetick for its negative assertion; there are no sleeps. - Docs.
src/memory/README.mdstates the new failure semantics in the same PR. - PR body claims. "Fails on base" and "14 tests pass across coordinator and chunk-index suites" were both reproduced.
- Conventions. No CJK in added lines or the commit message. No contract, env, or dependency changes. Conventional commit subject.
Process notes
None. Single commit, no merge or fixup commits.
CI
changes and repository-gate passed. check (web) was still in progress; every other check was skipped by the path plan. CI does not run node-services tests (.github/workflows/ci.yml:11-14), so I ran pnpm --filter @linger/node-services exec vitest run tests/memory/chunk-sync-coordinator.test.ts tests/memory/chunk-index.test.ts locally: 2 files, 14 tests passed. The regression test also fails against the base implementation, as described above.
Automated review by Claude Code
Automated review of 631da2f by Claude Code.
What and why
Stop claiming new source work after the first failure, wait for in-flight source operations and then propagate the original failure. The per-Agent lock and serialized snapshot now outlive every source write.
A failed indexing snapshot cannot leave stale source writes running concurrently with its next snapshot.
How it was verified
Base: 77abdcb. Node 26.5.0, pnpm 11.7.0.
Before: A failed source causes the batch promise to reject and a queued snapshot to start before another source finishes writing; new regression fails on base.
After: All 14 tests pass across coordinator and chunk-index suites. Full node-services typecheck and lint pass; make check reached the 180-second execution bound during the broader test suite and is not established.
Command:
pnpm --filter @linger/node-services exec vitest run tests/memory/chunk-sync-coordinator.test.ts tests/memory/chunk-index.test.ts --maxWorkers=1.Repository-wide gates are not established; the current owning-package fast check is recorded below.
Focused tests for the changed behavior
make check BASE=<target-ref>or all affected fast checksNo contract regeneration required
Current owning-package gate
On exact head
631da2fc624b781076e0f33155e303e55b840423,pnpm --filter @linger/node-services checkcompleted with exit 0 on Linux, Node 26.5.0 and pnpm 11.7.0. Feature-catalog verification, TypeScript checking and lint passed; Vitest finished with 268 files passed, 8 skipped; 2,713 tests passed, 51 skipped. The suite used its normal project configuration, including the real-process lane. Dependencies were installed in this isolated worktree with the frozen lockfile; no source, test, timeout or skip changes were made for the run.This completes the fast check for the only affected app. Repository-wide and live-service/E2E gates are separate and are not claimed here.
Boundary
The owning behavior documentation is updated. No wire contract or dependency change. The patch is based independently on the stated base.