fix: re-apply git identity every run, drive from env vars (#1242)

* fix: re-apply git identity on every agent invocation, source from env

Cached/reconnected sandboxes weren't getting `git config --global` re-applied
(the call was gated on new-sandbox creation), so commits picked up whatever
identity the sandbox happened to have — sometimes an email not associated
with any GitHub account, which Vercel rejects on preview deploys.

Move the git config call out of the new-sandbox branch so it runs on every
get_agent, and source the values from OPEN_SWE_GIT_AUTHOR_NAME /
OPEN_SWE_GIT_AUTHOR_EMAIL env vars (defaulting to the existing bot identity)
so forks can override without code changes.

* cleanup

---------

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
This commit is contained in:
Johannes du Plessis 2026-05-05 14:53:27 -07:00 • committed by GitHub
parent 6cecf429c7
commit 7d4d7e5833
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -257,10 +257,10 @@ async def get_agent(config: RunnableConfig) -> Pregel:
metadata={"sandbox_id": sandbox_backend.id},
)
await asyncio.to_thread(
sandbox_backend.execute,
"git config --global user.name 'open-swe[bot]' && git config --global user.email 'open-swe@users.noreply.github.com'",
)
await asyncio.to_thread(
sandbox_backend.execute,
"git config --global user.name 'open-swe[bot]' && git config --global user.email 'open-swe@users.noreply.github.com'",
)
linear_issue = config["configurable"].get("linear_issue", {})
linear_project_id = linear_issue.get("linear_project_id", "")