Skip to content

Git Server Management Architecture #31

@akhatua2

Description

@akhatua2

Question

Who should generate the git URL - the runner (coop.py) or the agent adapters?

Current State

How It Works Now

  1. Runner creates git server: coop.py creates the git server using mini_swe_agent.connectors.create_git_server() when --git flag is enabled
  2. URL passed to agents: The git_server_url is passed to all agent adapters
  3. Agents use provided URL: All adapters (including openhands_sdk) use the provided URL

Git Server Implementations

There are two different implementations:

  1. mini_swe_agent.connectors.git_servers.modal.ModalGitServer

    • Used by coop.py (default)
    • Modal app: "cooperbench"
    • Signature: create(app, run_id, timeout) - no agents param
    • URL format: git://{hostname}/repo.git
  2. openhands_agent_sdk.connectors.git_server.ModalGitServer

    • Used internally by OpenHands adapter (fallback)
    • Modal app: "cooperbench-openhands"
    • Signature: create(app, run_id, agents, timeout) - has agents param
    • URL format: git://{hostname}/repo.git

Both implementations are functionally equivalent - they create the same git daemon setup.

Current Flow

CLI (--git flag)
  ↓
coop.py creates git server (mini_swe_agent implementation)
  ↓
git_server_url passed to all agents
  ↓
openhands_sdk adapter uses provided URL (doesn't create its own)

Code References

Runner creates git server:

# src/cooperbench/runner/coop.py:65-66
git_server = create_git_server(backend=backend, run_id=run_id, app=app)
git_server_url = git_server.url

OpenHands adapter uses provided URL:

# src/cooperbench/agents/openhands_agent_sdk/adapter.py:326
git_url = git_server_url

# Only creates own if git_server_url is None:
# src/cooperbench/agents/openhands_agent_sdk/adapter.py:351-353
if git_enabled and not git_server_url:
    git_url = _get_or_create_git_server(run_id, agents, self.timeout)

Architectural Inconsistency

There's an inconsistency in infrastructure management:

  • Redis: OpenHands adapter manages its own (ModalRedisServer)
  • Git: Runner (coop.py) manages it, adapter has fallback

The OpenHands adapter README states:

"No external Redis or Git server needed - adapter creates its own"

But in practice, the runner creates the git server, so the adapter's self-management capability isn't used.

Status: ✅ Works Correctly

The current setup works fine:

  • Git flag is passed correctly through the chain
  • coop.py generates the git URL
  • All agents (including openhands_sdk) use the provided URL
  • Both implementations are compatible (same URL format)

Potential Improvements (Optional)

If we want consistency with the OpenHands adapter's self-contained design:

  1. Option A: Let agents manage their own git servers

    • Only create git server in coop.py for agents that need it (e.g., mini_swe_agent)
    • Let openhands_sdk create its own (like it does for Redis)
  2. Option B: Keep current approach

    • Runner manages git server for all agents
    • Simpler, centralized management
    • Works for all agent types

Recommendation

Keep current approach - it works correctly and provides centralized infrastructure management. The OpenHands adapter's self-management capability serves as a useful fallback if needed in the future.

Related Files

  • src/cooperbench/runner/coop.py - Creates git server
  • src/cooperbench/agents/openhands_agent_sdk/adapter.py - Uses provided URL
  • src/cooperbench/agents/mini_swe_agent/connectors/git_servers/modal.py - Git server implementation (used by runner)
  • src/cooperbench/agents/openhands_agent_sdk/connectors/git_server.py - Git server implementation (fallback)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions