Skip to content

fix(git): retain authentication guidance for push failures - #32078

Merged
nwparker merged 2 commits into
mainfrom
nwparker/git-auth-diagnostic
Oct 23, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/git-auth-diagnostic

Conversation

@nwparker

@nwparker nwparker commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​34 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​34
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​25 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​23

ELI5

When Git couldn't log in to your remote, Orca hid the real reason. Push, Publish Branch, Force Push and Sync said "Check your connection and try again". Pull said something like Error invoking remote method 'git:pull': Error: fatal: unable to get password from user. Now every remote action says what actually went wrong:

Push failed. Authentication failed. Check your remote credentials.

What was broken

  1. New Git wording wasn't recognized. Orca runs Git with prompts turned off (credential.interactive=false). Under that setting Git 2.55 prints fatal: unable to get password from user. Older Git (2.43 on Ubuntu 24.04) prints fatal: could not read Password for '<url>': terminal prompts disabled when the remote URL includes a username. The shared normalizer recognized neither one.
  2. The renderer threw the normalized message away. Even when the main process produced Authentication failed. Check your remote credentials., the toast formatter only kept fatal:/remote: lines, so the toast fell back to generic text. Pull, fetch, fast-forward and rebase printed the raw IPC-wrapped string instead.

What changed

  • src/shared/git-remote-error.ts: two more phrases now map to the canonical auth message (unable to get password from user, could not read Password). The message itself is exported as GIT_AUTHENTICATION_FAILED_MESSAGE.
  • src/renderer/src/lib/source-control-remote-error.ts: when an error contains that canonical message (wrapped or not), the toast becomes <Operation> failed. Authentication failed. Check your remote credentials. Operation is one of Publish Branch, Sync, Force Push, Push, Fetch, Fast-forward, Rebase or Pull. Conflict, submodule, hook, non-fast-forward and local-changes messages still win because they're checked first.

No changes to Git prompt policy, RPC shape or IPC.

Verification

  • Real Git, real production code, before/after. A throwaway vitest started a loopback HTTP server that always returns 401. It ran the real gitPush/gitPull/gitFetch from src/main/git/remote.ts (with Orca's credential guard env), wrapped the error the way Electron IPC does, and passed it through resolveRemoteOperationErrorMessage. macOS, Git 2.55.0:

    Base (a45bd06) This PR
    main gitPush error fatal: unable to get password from user Authentication failed. Check your remote credentials.
    Publish toast Publish Branch failed. Check your remote access and try again. Publish Branch failed. Authentication failed. Check your remote credentials.
    Push / Force Push / Sync toast … failed. Check your connection and try again. … failed. Authentication failed. Check your remote credentials.
    Fetch toast Fetch failed. unable to get password from user Fetch failed. Authentication failed. Check your remote credentials.

    Results were the same for a remote URL with and without user@.

  • Linux Git wording. Ran the same 401 probe with Orca's exact guard env (GIT_TERMINAL_PROMPT=0, credential.interactive=false, credential.guiPrompt=false) on two Linux hosts:

    • omarchy (Arch, Git 2.55.0): fatal: unable to get password from user, with and without a username in the URL.
    • openclaw (Ubuntu 24.04, Git 2.43.0): fatal: could not read Username …, and fatal: could not read Password … when the URL has a username. The original version of this PR missed the could not read Password case; it's covered now.
  • Windows Git, real machine. On a Windows box (Git 2.55.0.windows.3 with Git Credential Manager as the helper, plus WSL Ubuntu-24.04 Git 2.43.0), a throwaway vitest ran the real gitPush/gitFetch/gitPull through Orca's runner (which adds the prompt guard env), then fed the IPC-wrapped error into resolveRemoteOperationErrorMessage. Same probe, before and after:

    • GCM's real stderr (both a loopback 401 server and real https://gitlab.com/... with no saved login): fatal: Cannot prompt because user interactivity has been disabled. / fatal: unable to get password from user.
    • On main: Push toast Push failed. Check your connection and try again., Pull toast Error invoking remote method 'git:pull': Error: fatal: unable to get password from user.
    • On this PR: Push/Publish Branch/Sync/Fetch/Pull failed. Authentication failed. Check your remote credentials., with and without user@ in the URL.
    • WSL Git 2.43 with the same guard prints could not read Username ... and, with user@ in the URL, could not read Password .... Both are matched now.
    • For comparison, an SSH key failure (git@gitlab.com: Permission denied (publickey).) still shows the last stderr line, and the repository exists., on both main and this PR. That's the known SSH gap listed below. A GitHub URL where GCM had a saved login gave repository ... not found, which is unchanged.
    • The three changed test files pass on Windows (78 tests).
  • pnpm test on src/shared/git-remote-error.test.ts, src/renderer/src/lib/source-control-remote-error.test.ts, src/shared/git-clone-failure-message.test.ts, src/main/git/remote.test.ts, src/main/git/fetch-error-classification.test.ts, src/main/github/pr-start-point.test.ts, the editor store slice tests and source-control sync tests: 55 files / 549 tests passed.

  • oxlint, oxfmt and pnpm run check:code-quality:changed pass.

Visual proof

The original author clicked Publish Branch in a hidden Electron instance (ORCA_BACKGROUND_LAUNCH=1, CDP screenshots) against a disposable repo and a loopback HTTP 401 server.

Before:

(screenshot removed: contained real product data)

After:

(screenshot removed: contained real product data)

There are no screenshots for the Pull/Fetch/Fast-forward/Rebase labels added in the review commit. They use the same toast and were checked with the real-Git probe above.

Compatibility and risks

  • Mixed versions. A new client talking to an older server or host that still sends raw fatal: unable to get password from user shows Push failed. unable to get password from user. Check your remote access and try again. That's readable and no worse than today. An older client talking to a new server is unchanged (generic toast).
  • Remote/SSH/paired/mobile. Normalization runs wherever Git runs, so SSH-hosted and paired-server workspaces get it once that host updates. Mobile shows the server's normalized RPC message directly. Folder workspaces have no remotes, so nothing changes there.
  • Tradeoff. The canonical message no longer includes the remote URL or host. Raw fatal: Authentication failed for '<url>' lines from older hosts still show the URL through the existing fatal: detail path.
  • Not exercised: real GitHub authentication with no saved login (the Windows box had GCM credentials for github.com). SSH-key failures (Permission denied (publickey)) are out of scope. On every platform they still show and the repository exists.

Linked issue

Partial fix for #25341 (reported by @matbrgz). Which host or remote failed, SSH failure classification, and recovery actions are still open. Related context: #7986 (GCM popup suppression, the reason Git runs non-interactively). No contributor code was adopted.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 60e0f0a2-9c23-4f7c-8ccb-44fa686b39ba
📥 Commits

Reviewing files that changed from the base of the PR and between a45bd06 and c2715a0.

📒 Files selected for processing: 4
  • src/renderer/src/lib/source-control-remote-error.test.ts
  • src/renderer/src/lib/source-control-remote-error.ts
  • src/shared/git-remote-error.test.ts
  • src/shared/git-remote-error.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

📝 Walkthrough

The shared Git error normalizer now maps “fatal: unable to get password from user” to a shared authentication-failure message. The renderer uses that message to return operation-labeled failures for publish, sync, force push, and push. Tests cover normalization across remote operations and renderer handling of direct and wrapped errors.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to c2715

The authentication guidance change appears mergeable after normal checks; no actionable risk was established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: preserving authentication guidance for Git push failures.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is complete enough to review. It explains the user impact, changes, rationale, linked issue, visual proof, verification steps, platform coverage, compatibility, and known limitations. …
Full details: Description check

Explanation

The description is complete enough to review. It explains the user impact, changes, rationale, linked issue, visual proof, verification steps, platform coverage, compatibility, and known limitations. It does not use every template heading, including Testing, Review, Notes, Agent skill upstream boundary, and Checklist, but the required information is largely present under equivalent sections.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Pull, fetch, fast-forward and rebase toasts leaked the IPC wrapper around the
normalized auth message; Git <2.46 also reports 'could not read Password' for
remotes whose URL carries a username.

Co-Authored-By: Claude <noreply@anthropic.com>
@nwparker
nwparker merged commit 6c38b40 into main Oct 23, 2026
63 of 65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant