BACK-624 - Make shared cross-branch task loading fast and incremental - #899
Conversation
|
You have reached your Codex usage limits for security reviews. Please try again later. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce4f32fadb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48ecde4dc3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A standalone corpus load (ID allocation, statistics, a TUI board read) no longer advances the shared active-branch fingerprint, so a task creation between a branch tip move and the next read can no longer freeze a stale cross-branch corpus in a watcher-backed process. Task ID allocation now forces a fresh remote snapshot instead of honouring the 60s read refresh window, restoring per-allocation fetch freshness and closing the duplicate numeric ID window; ordinary reads keep the coalesced window. Cancellation is also checked before the remote refresh so an aborted load no longer waits out the fetch timeout, and allocation reuses the completed tasks its own corpus load already listed.
48ecde4 to
ce14a40
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce14a40243
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… cross-branch reads BACK-623 added a test asserting the default /api/tasks list performs no filesystem.listTasks() call, because on main the working-copy reconciliation only ran on Core.getTask. This branch moves that reconciliation into the shared refreshTasksForTaskRead path so every cross-branch read - including the browser list - stays correct when a watcher event is missed, which the PR body and the web warm benchmark already call out. The response is still built from the store's cross-branch corpus, so the intent of the original assertion is unchanged: the branch-only task is present by default and absent under crossBranch=false. Only the cost proxy moves, from zero working-copy passes to exactly one cache-validated reconciliation pass, and the local view must still add a scan of its own.
|
Ruling on the rebase note: the relaxed cost assertion stands (1 reconciliation scan on the default list path, local view must add its own). The zero-scan pin from #898 predated this PR's per-read working-copy reconciliation, which is intentional so missed watcher events self-heal in the browser; the intent assertions (store-served corpus, branch-only inclusion/exclusion) are unchanged. |
Summary
Stack
mainafter BACK-623 - Make common task commands avoid unnecessary cross-branch work #898 (BACK-623) merged as aca8007; this PR now contains only theBACK-624deltaBACK-624(included and finalized in this PR)Benchmark
Synthetic corpus: 80 active tasks, 20 completed tasks, 6 branches × 12 variants, 3 samples. Every sample validates exact counts, IDs, required/forbidden sentinels, and stable digests.
The Web warm path intentionally performs exact working-copy reconciliation so missed watcher events remain visible; it still performs no tree, history, or hydration work.
Review fix round
Three defects found in review, each reproduced before the fix and pinned by a regression test in
src/test/core-task-corpus-regressions.test.ts:ContentStore. In a watcher-backed (Web/MCP) process, a task creation between a branch-tip move and the next read published the moved refs on the store's behalf, so every later read compared equal fingerprints, concluded it was fresh, and served the older corpus until the next ref or config change. Only theContentStorecorpus loader now advances shared freshness state.Allocation also reuses the completed tasks its own corpus load already listed instead of listing them a second time.
Rebase note — needs a ruling
BACK-623's post-review fix round added a test asserting the now-default cross-branch/api/taskslist performs zerofilesystem.listTasks()calls. That held onmainbecause the working-copy reconciliation only ran insideCore.getTask. This PR moves that reconciliation into the sharedrefreshTasksForTaskReadpath so every cross-branch read — including the browser list — stays correct when a watcher event is missed, which is the behaviour the Web warm benchmark row above already reflects.The two are deliberate and they collide. The assertion was relaxed from zero working-copy passes to exactly one cache-validated reconciliation pass; the test's intent is untouched (the branch-only task is still present by default and still absent under
crossBranch=false, and the local view must still add a scan of its own). If the zero-scan property should win instead, the reconciliation has to move back off the list path and the missed-watcher-event staleness returns.Testing
bun run test— 2,245 passed, 6 interactive skips, 0 failuresbunx tsc --noEmitbun run check .bun run buildbun run benchmark:task-loading— correctness and stability gates green on every sample; warm Git process counts unchanged after the fix round (Core 3, Web 1, MCP 0) with identical digests