Skip to content

bug: git maintenance and git-health stats only run inside auto-sync — self-pushing agents bloat with no repack and no alert #4000

Closed

Description

@obasilakis

Problem

Agents that commit and push their own work (auto_sync_enabled=0) get no git maintenance, no git-health measurements and no bloat alert. Their .git grows without bound and nothing reports it.

The base image turns git's own auto-maintenance off (docker/base-image/Dockerfile:64-76, maintenance.auto=false, gc.auto=0), on the stated basis that the agent server's registered maintenance pass owns repo maintenance. That pass only runs inside the auto-sync cycle:

  • _maybe_run_git_maintenance is called only after a successful push (docker/base-image/agent_server/routers/git.py:1484).
  • _collect_git_object_stats / _git_dir_bytes, which feed agent_sync_state.git_dir_bytes / pack_count / loose_objects / maintenance_failures, are also only called in the sync cycle (routers/git.py:1384-1385, 1487-1489).
  • With auto-sync off the loop logs auto-sync: off (auto_sync_enabled=0), skipping cycle (agent_server/auto_sync.py:171) and returns before either.

So for these agents:

  1. nothing ever repacks the repo;
  2. the four git-health columns stay NULL;
  3. the git_bloat alert in sync_health_service.py (.git ≥ GIT_DIR_ALERT_BYTES, or 3 consecutive maintenance failures) can never fire.

Evidence (eu2, dev 01707a1e)

  • All 13 self-pushing agents (oracle-*, cleon, cornelius-oracle) have agent_sync_state.git_dir_bytes / pack_count / loose_objects = NULL and last_sync_status=never.
  • oracle-2-markets reached 48,773 loose objects / ~19.8 GB of loose data (about +1,150 objects/day) with no alert. Its .git was ~23 GB against the 10 GiB alert threshold.
  • The host disk reached 94–95% used. It was recovered only by manual out-of-band git gc.

Proposed fix

  1. Decouple maintenance from push. On every auto-sync tick, including when auto-sync is off, take the repo lock, run the existing _reap_stale_git_litter + _collect_git_object_stats + _maybe_run_git_maintenance, and write the stats to sync-state.json. Then skip the sync steps as today. Thresholds, backoff, timeout (GIT_MAINTENANCE_TIMEOUT_SECONDS) and the repo lock are unchanged.
  2. Canary invariant — measurement blindness. A running agent with a git repo whose agent_sync_state git stats are NULL, or older than 24 h. This would have caught the current state on day one.
  3. Canary invariant — maintenance not keeping up. loose_objects above a multiple of GIT_MAINTENANCE_LOOSE_THRESHOLD (e.g. 3×), or pack_count above a multiple of the pack threshold. Fire while the condition persists. The existing git_bloat alert is edge-triggered and fires once per crossing.

Notes

  • Do not re-enable git's own auto-maintenance as the fix. On eu2 a repo-local maintenance.auto=true was killed every minute by the status poll's 30 s fetch timeout (separate issue) and twice left a stale objects/maintenance.lock that disables auto-maintenance silently and permanently.
  • The platform repack uses git repack, which takes no maintenance.lock, so it has no stale-lock failure mode.
  • Open question: whether a 4–5 GB repack fits the 1800 s default on a busy host. Unmeasured; GIT_MAINTENANCE_TIMEOUT_SECONDS covers it if not.

Activity

  1. added
    priority-p1
    type-bug
    theme-reliability
    on Oct 27, 2026
  2. self-assigned this
    on Oct 27, 2026
  3. obasilakis commented on Oct 27, 2026

    @obasilakis
    ContributorAuthor

    /claim

  4. github-actions commented on Oct 27, 2026

    @github-actions

    @obasilakis This issue is already assigned to obasilakis. Use /unclaim first if you want to take over.

  5. added
    status-in-dev
    on Oct 28, 2026
  6. removed
    status-in-dev
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority-p1theme-reliabilitytype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions