fix: bug: dev-bot/.profile push fails with auth error — 91 journal commits stranded locally since ~2026-04-08 (#652)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful

This commit is contained in:
Claude 2026-04-10 22:02:27 +00:00
parent fb4ae1ebba
commit be406f193b

View file

@ -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