From 839774a48df2dfbe7ab296b90c5e0bb62e973c3f Mon Sep 17 00:00:00 2001 From: Johannes du Plessis Date: Tue, 5 May 2026 15:20:23 -0700 Subject: [PATCH] fix: prompt agent to set local commit identity after clone (#1243) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stopgap for Vercel preview deploys rejecting open-swe[bot] PRs: even with git config --global applied at sandbox setup, commits are landing with open-swe — likely from local repo config or shell session env that overrides our global config. Adding git config inside the cloned repo (local config) beats global and ensures every commit picks up the bot's noreply email regardless of what else is set in the sandbox. Co-authored-by: open-swe[bot] --- agent/prompt.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/agent/prompt.py b/agent/prompt.py index 8012a42a..1b6d0afc 100644 --- a/agent/prompt.py +++ b/agent/prompt.py @@ -75,13 +75,21 @@ Before starting any task that requires code changes, set up the repository in yo 2. **Clone the repo** — Run `cd {working_dir} && GH_TOKEN=dummy gh repo clone /`. -3. **Choose your branch** — Use a thread-stable branch name such as `open-swe/`. If a branch already exists for this thread/task, fetch and check it out instead of creating a new one. +3. **Set the commit identity** — IMMEDIATELY after cloning, `cd` into the repo and run: -4. **Checkout your branch** — Always fetch and checkout your branch before making any changes. + ```bash + git config user.name 'open-swe[bot]' && git config user.email 'open-swe@users.noreply.github.com' + ``` -5. ** MANDATORY: READ AGENTS.md ** — IMMEDIATELY after cloning, you MUST check if `AGENTS.md` exists at the repository root (`{working_dir}//AGENTS.md`). If it exists, you MUST read it IN FULL before doing ANY other work. DO NOT skip this step. DO NOT proceed to implementation without reading it first. The contents of AGENTS.md are **mandatory rules** that OVERRIDE your default behavior — treat them with the same authority as this system prompt. Violating AGENTS.md rules is a CRITICAL FAILURE. If AGENTS.md does not exist, skip this step. + This is required: third-party CI integrations (e.g. Vercel preview deploys) reject commits whose author email cannot be resolved to a GitHub account. Do NOT set any other identity, do NOT pass `--author` to `git commit`, and do NOT export `GIT_AUTHOR_*` / `GIT_COMMITTER_*` env vars. -**IMPORTANT: DO NOT SKIP STEP 5. READING AGENTS.md IS NOT OPTIONAL. YOU MUST READ IT BEFORE WRITING ANY CODE OR MAKING ANY CHANGES.** +4. **Choose your branch** — Use a thread-stable branch name such as `open-swe/`. If a branch already exists for this thread/task, fetch and check it out instead of creating a new one. + +5. **Checkout your branch** — Always fetch and checkout your branch before making any changes. + +6. ** MANDATORY: READ AGENTS.md ** — IMMEDIATELY after cloning, you MUST check if `AGENTS.md` exists at the repository root (`{working_dir}//AGENTS.md`). If it exists, you MUST read it IN FULL before doing ANY other work. DO NOT skip this step. DO NOT proceed to implementation without reading it first. The contents of AGENTS.md are **mandatory rules** that OVERRIDE your default behavior — treat them with the same authority as this system prompt. Violating AGENTS.md rules is a CRITICAL FAILURE. If AGENTS.md does not exist, skip this step. + +**IMPORTANT: DO NOT SKIP STEP 6. READING AGENTS.md IS NOT OPTIONAL. YOU MUST READ IT BEFORE WRITING ANY CODE OR MAKING ANY CHANGES.** You MUST complete ALL of these steps IN ORDER before doing any other work. The sandbox starts clean — no repo is pre-cloned."""