fix(git): scope fetches, dedicate a git thread pool, raise network timeout + instrument

The panel dev's commit/open_pr verbs timed out. Verified it is NOT chown
(node_modules is agent-owned, the walk is sub-second) and the commit even
landed locally; the branch never reached origin. The bottleneck is the
server-side verb path under concurrent load — git status (a 0.044s op) also
timed out, which only happens when the path AROUND git is slow.

Defensible fixes + instrumentation to confirm under load:
- Scope every all-refs 'git fetch origin' to just the refs the path needs
  (base/default/branch). An all-refs fetch on a monorepo with dozens of
  branches is pure network cost on every branch creation/checkout.
- Run git subprocesses + the ownership repair in a dedicated bounded thread
  pool so concurrent agents don't queue behind / starve the event loop's
  shared default executor.
- Give fetch/pull/push a dedicated git_network_timeout_seconds (120s) instead
  of the 30s local-op default — a push on a large private monorepo can
  legitimately exceed it.
- Log any git subprocess or chown slower than 1s so the next run pinpoints
  where the time goes (op vs ownership repair) instead of guessing.
This commit is contained in:
Renn F
2026-06-03 15:55:32 +02:00
parent 5f61ea7b82
commit 8f7e9c09e1
2 changed files with 96 additions and 11 deletions
+11
View File
@@ -267,6 +267,17 @@ class Settings(BaseSettings):
"tree, so the commit choreography uses this longer budget."
),
)
git_network_timeout_seconds: int = Field(
default=120,
ge=30,
description=(
"Timeout in seconds for git ops that talk to origin (fetch / pull "
"/ push). A push or fetch on a large private monorepo from a "
"self-hosted runner can far exceed the sub-second local-op "
"default; short-budgeting it is what made open_pr time out before "
"the branch reached the remote."
),
)
# ==========================================================================
# Agent Guardrails (per-session budgets, loop detection, SLAs)