mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-10 22:43:37 +00:00
Materializing an automation run cloned the full repo fresh into a tempdir on every click — 5–15s of git activity on the HTTP request thread, paid in full for every run, then thrown away. Add a per-`(owner, repo)` bare-clone cache under `<Storage::cache_dir>/automation-repos/<owner>/<repo>.git`, and replace the per-call clone+fetch+checkout dance with: 1. `KeyedMutex` lock on `(owner, repo)` so concurrent calls serialize per repo and parallelize across repos. 2. If the bare clone is missing, `git clone --bare --depth 1`. Otherwise `git worktree prune` to clean up any admin entries leaked by previous `TempDir` drops. 3. `git fetch --depth 1 origin <ref>` against the bare clone. 4. `git rev-parse FETCH_HEAD` for the SHA. 5. `git worktree add --detach --force <temp>/repo FETCH_HEAD` into the per-call scratch dir, then build the manifest as today. First run for a repo still pays the clone cost. Every subsequent run for any ref or automation against that repo pays only the fetch delta plus a near-free worktree add (~100–500ms). Corruption recovery: if the bare clone's `HEAD` file is missing or zero-length after a failure, the cache wipes the directory and retries once before surfacing `CloneFailed` as before. Auth and network errors do not trigger a wipe. Promote `fabro_store::KeyedMutex` and its guard to `pub` so the server can reuse the existing primitive instead of duplicating it. Tests: - `bare_clone_reused_across_calls` seeds a local upstream, runs `prepare_worktree` twice, and asserts the bare clone's `objects/` tree is identical before and after the second call (i.e., no re-clone). - `bare_clone_recovers_from_corruption` truncates `HEAD` between calls and asserts the cache rebuilds and succeeds. - The existing plan-builder argv/timeout assertions are updated to cover the new bare-clone, bare-fetch, worktree-add, worktree-prune, and rev-parse FETCH_HEAD plans. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| build-support | ||
| fabro-acp | ||
| fabro-agent | ||
| fabro-api | ||
| fabro-auth | ||
| fabro-automation | ||
| fabro-checkpoint | ||
| fabro-cli | ||
| fabro-client | ||
| fabro-config | ||
| fabro-core | ||
| fabro-dev | ||
| fabro-dump | ||
| fabro-github | ||
| fabro-graphviz | ||
| fabro-hooks | ||
| fabro-http | ||
| fabro-install | ||
| fabro-interview | ||
| fabro-llm | ||
| fabro-macros | ||
| fabro-manifest | ||
| fabro-mcp | ||
| fabro-mcp-server | ||
| fabro-model | ||
| fabro-oauth | ||
| fabro-options-metadata | ||
| fabro-proc | ||
| fabro-redact | ||
| fabro-sandbox | ||
| fabro-server | ||
| fabro-slack | ||
| fabro-spa | ||
| fabro-static | ||
| fabro-store | ||
| fabro-telemetry | ||
| fabro-template | ||
| fabro-test | ||
| fabro-tool | ||
| fabro-tracker | ||
| fabro-types | ||
| fabro-util | ||
| fabro-validate | ||
| fabro-variable | ||
| fabro-vault | ||
| fabro-workflow | ||