From be406f193ba6501e0516b86d221ea9fbbbe5c37d Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 10 Apr 2026 22:02:27 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20bug:=20dev-bot/.profile=20push=20fails?= =?UTF-8?q?=20with=20auth=20error=20=E2=80=94=2091=20journal=20commits=20s?= =?UTF-8?q?tranded=20locally=20since=20~2026-04-08=20(#652)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/formula-session.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/formula-session.sh b/lib/formula-session.sh index f472e78..7136952 100644 --- a/lib/formula-session.sh +++ b/lib/formula-session.sh @@ -123,6 +123,9 @@ ensure_profile_repo() { # Check if already cached and up-to-date if [ -d "${PROFILE_REPO_PATH}/.git" ]; then log "Pulling .profile repo: ${agent_identity}/.profile" + # Always refresh the remote URL to ensure it's clean (no baked credentials) + # This fixes auth issues when old URLs contained the wrong username (#652) + git -C "$PROFILE_REPO_PATH" remote set-url origin "$clone_url" 2>/dev/null || true if git -C "$PROFILE_REPO_PATH" fetch origin --quiet 2>/dev/null; then git -C "$PROFILE_REPO_PATH" checkout main --quiet 2>/dev/null || \ git -C "$PROFILE_REPO_PATH" checkout master --quiet 2>/dev/null || true @@ -312,6 +315,15 @@ _profile_commit_and_push() { ( cd "$PROFILE_REPO_PATH" || return 1 + # Refresh the remote URL to ensure credentials are current (#652) + # This ensures we use the correct bot identity and fresh credentials + local forge_url="${FORGE_URL:-http://localhost:3000}" + local agent_identity="${AGENT_IDENTITY:-}" + if [ -n "$agent_identity" ]; then + local remote_url="${forge_url}/${agent_identity}/.profile.git" + git remote set-url origin "$remote_url" 2>/dev/null || true + fi + if [ ${#files[@]} -gt 0 ]; then git add "${files[@]}" else