Cache
cache
¶
Clone-cache workspace seeding for faster task startup.
When a gate mirror has been synced (terok gate-sync or
AgentRunner._setup_gate), a non-bare clone cache may exist on the
host. Copying that cache into the task workspace before container
launch replaces the slow in-container git clone with a fast file
copy followed by a lightweight git fetch + reset.
The public entry point is seed_workspace_from_clone_cache.
seed_workspace_from_clone_cache(workspace_path, scope, *, origin_url=None, cfg=None)
¶
Pre-populate workspace_path from the clone cache for scope.
Returns True if the workspace was successfully seeded.
After copying, rewrites the git origin remote to origin_url so that
the in-container init script's sanity check (which compares origin
against CODE_REPO) passes — the cache's origin points to a local
file:// URL that won't match.
Skips seeding when the cache doesn't exist, the workspace already
contains a .git directory, or the copy fails. Failures are
logged and swallowed — the container falls back to a full clone.