Skip to main content

Module build_cache_service

Module build_cache_service 

Source
Expand description

Runs the build-cache cleanup (build_cache.rs) on a schedule and on a finished task, and warns agents when the disk runs low (docs/specs/SPEC_BUILD_CACHE_CLEANUP_2026_10_26.md).

  • Every 5 minutes: the free space of the disk that holds the agents’ workspaces. When it is low, a pass prunes orphans and abandoned clones at once; if it is still low afterwards, the agents whose own workspace is large hear of it, about their own folders, and the host’s steward gets the summary for the whole computer. A note goes out again only after free space falls a further few GB or the level gets worse, never on a timer alone, and only a critical level starts a turn (disk_notice.rs; a file in the shared locks folder keeps the last note, so two AgentMux channels do not both warn).
  • Every hour: the orphan pass over every local workspace.
  • When an agent completes a Kanban task: its own clones lose their incremental folders.

Structs§

LocalAgent
An agent running here, as the cleanup needs to know it.
WorkspaceSize
One workspace’s build folders, as the note needs them.

Functions§

agent_task_done
An agent completed a task: clear its own clones’ incremental folders. agent is the id the task was completed under. Runs in the background; never fails the completion.
agents_root
Where the agents’ workspaces are: ~/.agentmux/agents.
big_owners
The agents whose own workspace is large (build folders over BIG_WORKSPACE, or incremental caches over BIG_INCREMENTAL): they are the ones who can free the space, so they hear of it. A small workspace never does, however few others there are.
clean_when_asked
The cleanup a disk_cleanup request runs once its countdown ended unvetoed: the pass a low disk runs (orphan incremental folders, and the whole target of a clone nobody built in for the policy’s stale days), over every workspace, skipping a clone with a build running in it. Only an srv that cleans the real agents’ folder does it, as on a schedule; it blocks, so call it from spawn_blocking. Says what it removed, in words, or why it did not run.
install
Starts the schedule. Safe to call once at boot.
stewards
The stewards, each once: an agent with panes in two folders is listed twice by local_agents, and a critical note would start two turns for it.
this_srv_may_clean
[may_clean] for this process.