Skip to content

Repo maintenance from the hub: fetch/pull the base checkout, configurable scan depth #21

Description

@xerhab

Context

scan_repos() in agent/hub-agent.py lists non-dot directories exactly one level deep under REPOS_ROOT that contain a .git entry. New sessions branch off that checkout's current HEAD. The hub displays each repo's branch and dirty count but offers no repo-level actions — only session-level ones.

Problem

  1. Stale bases: if nobody pulls the checkout on the host, every new session starts from an old HEAD and the first thing each agent does is work on stale code (or waste tokens fetching/rebasing). There's no way to freshen a repo from the dashboard.
  2. Fixed layout: repos nested deeper than one level (e.g. git/work/foo) or grouped in subdirectories are invisible. The depth is hardcoded.

Proposal

  • Repo commands: add repo-scoped commands alongside the session ones — {type:"repo-fetch", repo} and {type:"repo-pull", repo} (git pull --ff-only to guarantee it never creates merge states on the shared checkout; refuse with a reported error if not fast-forwardable or dirty). Queued and acked exactly like session commands. UI: a small ↻ action in the repo header row, showing ahead/behind against origin (one git rev-list --count pair per repo per beat, matching what's proposed per-session in the unpushed-work issue).
  • Scan depth: REPOS_SCAN_DEPTH env (default 1, as today) with scan_repos() walking up to that depth, skipping dot-dirs at each level (.agenthub stays excluded by the existing dot-dir rule). Repo name becomes the relative path (work/foo) so names stay unique; slugify() already makes that safe for rcName use.
  • Clone (stretch): a {type:"repo-clone", url} command would let a brand-new repo be added to a host from the hub. Bigger security surface (arbitrary URL → command line), so keep it a separate decision; listing it here for completeness.

Touchpoints

  • agent/hub-agent.pyscan_repos(), repo_entry() ahead/behind, new commands
  • agent-hub/server.js — endpoints
  • agent-hub/public/index.html — repo header actions + freshness display

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions