fix: supervise repository clone lifecycle - #2059
Open
mistercrunch wants to merge 1 commit into
Open
Conversation
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
clone_errorand prevent late executor events from overwriting the timeout outcomeRoot cause
The observed ~300-second boundary was not a
simple-gitclone timeout. Remote clone executors inherited the default five-minute scoped service-token lifetime. The daemon launched the executor fire-and-forget and only observed the direct process, while the actual clone could continue in descendant Git transport/index-pack processes. Once the token expired, long clones could no longer report a truthful terminal state, and direct-process handling did not guarantee descendant termination or partial-directory cleanup.Design
taskkill /Ton Windows).clone_error.category: timeoutwith exit code 124 and messages that truthfully distinguish successful cleanup, cleanup failure, and inability to prove process-tree termination.readyor generic failure patches cannot replace a timeout state.Issue #2031
This also captures failed clone state and prevents branch creation against repositories whose clone is still in progress or failed. API/MCP and all current UI branch-creation entry points now surface the durable clone error instead of proceeding against an absent or partial checkout.
Verification
pnpm ipnpm checkpnpm --filter @agor/git exec vitest run src/clone-error.test.ts— 1 testpnpm --filter @agor/core exec vitest run src/db/repositories/repos.test.ts src/db/repositories/branches.test.ts src/git/index.test.ts— 198 testspnpm --filter @agor/daemon exec vitest run src/services/repos.test.ts src/utils/process-tree.test.ts src/utils/repo-clone-supervisor.test.ts src/utils/spawn-executor.configured.test.ts— 29 testspnpm --filter agor-ui exec vitest run src/utils/repoReadiness.test.ts src/components/CreateDialog/tabs/BranchTab.test.tsx src/components/NewBranchModal/NewBranchModal.test.tsx src/components/SettingsModal/BranchesTable.test.tsx src/components/SettingsModal/ReposTable.test.tsx— 16 testsCloses #2030
Closes #2031