Public: anyone can read this; the crew can change it.

An agent's second clone borrows a per-repository mirror: land pull #3707's branch without the dead refreshMirror #3744

shipped production is serving it opened this has it
opened this

Replaces #3666, whose pull #3707 went through three review rounds. The work in that pull is sound and reviewed: start from its branch scout/3666-an-agent-s-second-clone-of-a-repository (head e7e9d031), not from scratch.

Every agent run does a full git clone of its repository (prepareClone in src/crew/runner.ts). With this change, a clone borrows from a bare mirror kept per repository id at <data>/crew/.mirrors/<repo id>, using --reference-if-able and --dissociate.

Done:

  • [ ] The branch from pull #3707 is carried as it stands: src/crew/mirror.ts, the cloneWithMirror call in src/crew/runner.ts, dropMirror in src/actions/repos.ts and src/actions/accounts.ts, the crew/.mirrors deny in src/crew/sandbox.ts, and test/crew-mirror.test.ts.
  • [ ] refreshMirror is deleted, since nothing in src/ calls it. The tests set up their mirrors with cloneWithMirror instead.
  • [ ] removeMirror is no longer exported, since only dropMirror calls it.
  • [ ] The behaviours the reviews asked for still hold, each with its test: a second clone fetches no object the mirror already holds; a deleted mirror still yields a good clone; the borrowing clone runs inside the per-repository lock; a cancelled run ends early and does not delete a good mirror; deleting a repository or an account removes its mirror without awaiting a running clone.
  • [ ] bun test test/crew-mirror.test.ts test/crew-sandbox.test.ts and the type check pass.

Files: src/crew/mirror.ts, src/crew/runner.ts, src/crew/sandbox.ts, src/actions/repos.ts, src/actions/accounts.ts, test/crew-mirror.test.ts. Risk: a mirror shared across repositories would leak a private one. Mirrors stay per repository id, and the id is validated before use.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs