From cd35284e3192934c54c0fe4f83c7dcdc5bd7f97d Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman Date: Sun, 5 Apr 2026 06:56:24 +0000 Subject: [PATCH] =?UTF-8?q?chore(agents):=20improve=20ca-test-infra-improv?= =?UTF-8?q?er=20=E2=80=94=20graceful=20handling=20of=20clone=20and=20tool?= =?UTF-8?q?=20failures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Approved proposal: #1809 Pattern: prompt_improvement — infrastructure failure misreporting Evidence: Agent filed 10+ issues about its own infrastructure failures (clone failures using wrong hostname, tool crashes, environment limitations) instead of handling them gracefully. Issues #1673, #1686, #1691, #1694, #1699, #1713, #1732 were all clone failures; #1695, #1726, #1727, #1740 were tool failures. Fix: Add hostname resolution guidance, clone failure handling with retry logic, tool failure handling with graceful degradation, and explicit scope restriction against filing issues about own environment. ISSUES CLOSED: #1809 --- .opencode/agents/ca-test-infra-improver.md | 45 +++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/.opencode/agents/ca-test-infra-improver.md b/.opencode/agents/ca-test-infra-improver.md index e4dc21936..6e9bb6176 100644 --- a/.opencode/agents/ca-test-infra-improver.md +++ b/.opencode/agents/ca-test-infra-improver.md @@ -248,11 +248,19 @@ LOOP: **CRITICAL: You MUST work in your own isolated clone. NEVER operate in /app.** +**HOSTNAME WARNING:** The Forgejo host is NOT necessarily +`git..com`. You MUST derive the git clone hostname from the +Forgejo base URL or PAT URL provided in your prompt — NOT from the +organization name. For example, if the Forgejo URL is +`https://git.cleverthis.com`, use `git.cleverthis.com` as the host, even +if the org is named `cleveragents`. + ```bash INSTANCE_ID="test-infra-$$-$(date +%s)" CLONE_DIR="/tmp/ca-${INSTANCE_ID}" -git clone https://@//.git "$CLONE_DIR" +# Clone — use the host from FORGEJO_URL, NOT from the org name +git clone https://@//.git "$CLONE_DIR" cd "$CLONE_DIR" git config user.name "" git config user.email "" @@ -260,6 +268,36 @@ git config user.email "" **CLEANUP on exit: `rm -rf "$CLONE_DIR"`** — always, even on error. +### Clone Failure Handling + +If `git clone` fails: + +1. **Check the hostname.** Verify you are using the host from the Forgejo + base URL (e.g., `git.cleverthis.com`), NOT a hostname derived from the + organization name (e.g., `git.cleveragents.com`). +2. **Retry once** with the corrected hostname if it was wrong. +3. **If still failing after retry, EXIT gracefully.** Report the clone + failure in your return value and move on. Do NOT file a Forgejo issue + about the clone failure — it is an agent environment problem, not a + test infrastructure issue. +4. **NEVER file issues about TLS, DNS, or network failures** encountered + during your own clone operation. These are infrastructure issues in + your execution environment, not problems with the project's test + infrastructure. + +### Tool Failure Handling + +If any tool (bash, read, etc.) fails with environment errors (ENOENT, +stack overflow, permission denied, maximum call stack size exceeded, etc.): + +1. **Log the error** internally. +2. **Skip the affected analysis step** and continue with remaining analysis + if possible. +3. **NEVER file a Forgejo issue about tool failures.** These are agent + runtime issues, not test infrastructure issues. Issues like "Unable to + analyze CI execution time due to tool execution failures" or "Worker + tools are failing" are NOT actionable test infrastructure findings. + ### Analysis Process For the assigned `focus_area`, perform the corresponding analysis: @@ -369,6 +407,11 @@ No exceptions — every comment, every issue body, every PR description. Every improvement should follow industry best practices. - **In Worker Mode, exit promptly.** Analyze the assigned area and exit so the pool supervisor can dispatch new work. +- **NEVER file issues about your own infrastructure.** You analyze the + PROJECT's test infrastructure. Infrastructure failures in YOUR OWN + execution environment (clone failures, tool crashes, API errors, TLS + handshake failures, "unable to clone" errors) are OUT OF SCOPE. Never + file issues about your own environment — exit gracefully instead. ---