fix(cli): coalesce overlapping history refreshes - #563
Open
Dante-dan wants to merge 2 commits into
Open
Conversation
Replace the project-wide fail-fast lease with request coalescing and ordered execution so renderer remounts do not surface a synthetic sync error. Model: gpt-5.6-sol
Model: gpt-5.6-sol
Dante-dan
marked this pull request as ready for review
September 10, 2026 02:03
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Related issue
Closes #553
Problem / pressure
Opening an imported conversation can trigger overlapping refresh effects from separate renderer lifecycles. The CLI currently protects the local project with a fail-fast process lease, so the second equivalent request surfaces
history sync is already runningeven though the first request is already doing the required work.Summary
Replace the fail-fast lease with a process-local per-project coordinator. Equivalent catalog, import, or conflict-resolution requests share the in-flight result; distinct operations or targets wait for the project's current operation. Request cleanup runs after success or failure, so later refreshes execute normally and genuine provider or persistence failures still reach callers.
The import request identity normalizes duplicate and reordered ACP session IDs while retaining the original first caller's execution inputs. Replay comparison, catalog persistence, and conflict-resolution rules are unchanged.
Visual explanation
flowchart TD A[History request] --> B{Equivalent request active?} B -- yes --> C[Return its result or error] B -- no --> D[Wait for local-project tail] D --> E[Run existing sync/import/resolve implementation] E --> F[Publish result or error] F --> G[Remove request and idle coordinator]Before / after
finally, but callers cannot join work already in progress.Test plan
corepack pnpm --filter lody exec vitest run tests/local-project-history-sync-service.test.ts— 33 tests passed.corepack pnpm --filter lody run typecheck— passed.corepack pnpm format— passed; an unrelated pre-existing formatting difference was excluded from this PR.corepack pnpm run docs check— passed with existing Agent instruction size and translation warnings.corepack pnpm check— passed, including repository typechecks, lint, test suites, i18n, and boundary guards.Context handoff
Instructions for reviewing agents
local-project-history-sync-service.ts, especially cleanup ordering after rejection.Authoring context