can1357/oh-my-pi · error · HTTPException

git {fn.__name__} timed out

Error message

git {fn.__name__} timed out

What it means

`_run_git_op` wraps proxy-side git operations (clone, fetch, fetch_ref, fetch_pr_head, push, push_release) with a timeout from `settings.gh_proxy_git_timeout_seconds`. When the git subprocess exceeds that budget, the proxy logs a warning and returns HTTP 504 with this message. It means the git operation did not complete in the configured time, not that it failed for a git-level reason.

Source

Thrown at python/robomp/src/proxy/server.py:827

    # event loop until the subprocess returns; a hung git would freeze the
    # whole proxy. We bridge with `asyncio.to_thread` (work on a threadpool
    # worker) wrapped in `asyncio.wait_for` (hard wall-clock cap, returns
    # 504 on timeout). The subprocess itself can outlive the timeout — a
    # proper subprocess.kill plumbing would have to live inside
    # `git_ops._run_git`; flagged for follow-up.

    async def _run_git_op(fn, *args, **kwargs):  # type: ignore[no-untyped-def]
        try:
            return await asyncio.wait_for(
                asyncio.to_thread(fn, *args, **kwargs),
                timeout=settings.gh_proxy_git_timeout_seconds,
            )
        except TimeoutError as exc:
            log.warning(
                "gh-proxy: git op exceeded timeout",
                extra={"op": fn.__name__, "timeout": settings.gh_proxy_git_timeout_seconds},
            )
            raise HTTPException(504, f"git {fn.__name__} timed out") from exc

    @app.post("/gh/v1/git/clone")
    async def git_clone_endpoint(request: Request) -> JSONResponse:
        data = await _json_body(request)
        repo = _require_str(data.get("repo"), "repo")
        clone_url = _require_str(data.get("clone_url"), "clone_url")
        default_branch = _require_str(data.get("default_branch"), "default_branch")
        remote = _clone_remote_auth(clone_url, repo, _resolve_token(settings))
        target = _pool_dir(settings, repo)
        try:
            await _run_git_op(
                git_clone,
                target,
                clone_url=remote.url,
                default_branch=default_branch,
                token=remote.token,
                auth_url=remote.auth_url,
            )

View on GitHub (pinned to 9690622007)

Solutions

  1. Increase `settings.gh_proxy_git_timeout_seconds` to a value that accommodates your largest repos/network
  2. Retry the operation — transient slowness often succeeds on a second attempt
  3. Reduce data transferred: shallow clone / narrower ref fetches where the API allows
  4. Check network path between proxy host and GitHub (proxy, DNS, bandwidth) for bottlenecks

Example fix

# before
gh_proxy_git_timeout_seconds = 60
# after
gh_proxy_git_timeout_seconds = 600
Defensive patterns

Strategy: retry

Validate before calling

// estimate required timeout from repo size / network before calling
const minTimeoutSeconds = 300; // pick based on your largest repo
if (settings.gh_proxy_git_timeout_seconds < minTimeoutSeconds) {
  throw new Error(`git timeout ${settings.gh_proxy_git_timeout_seconds}s too low for this repo`);
}

Try / catch

try:
    proxy.git_clone(repo=repo, clone_url=url)
except HTTPError as e:
    if e.response.status_code == 504 and "timed out" in e.response.text:
        time.sleep(backoff)
        retry_with_longer_budget()  # or raise actionable error about repo size/network
    else:
        raise

Prevention

When it happens

Trigger: Any POST to /gh/v1/git/clone, git/fetch, git/fetch_ref, git/fetch_pr_head, git/push, or git/push_release where the underlying git command (e.g. cloning a huge repo over a slow network, or a push of a large release) takes longer than `gh_proxy_git_timeout_seconds`.

Common situations: Cloning large monorepos or repos with big LFS/history, slow or flaky network between proxy and github.com, GitHub slowness, or the timeout setting tuned too aggressively low for your repo sizes.

Understand the failure class

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/37216fcd7acc7ea8. Report an issue: GitHub.