Skip to content

fix(ssh): answer every MFA stage, stop dialling an unclaimed alias, and say where a clone failed - #17946

Merged
nwparker merged 6 commits into
mainfrom
fix/ssh-auth-mfa-and-alias
Sep 2, 2026
Merged

nwparker merged 6 commits into
mainfrom
fix/ssh-auth-mfa-and-alias

Conversation

@nwparker

@nwparker nwparker commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​499 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​497
Prod 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​276 $\color{#cf222e}{\Huge{\mathbf{−}}}$​13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​263

Three connect-path failures. The first two are "the user cannot get in at all".

#8622 + #16820 are the same bug — and were half-fixed yesterday

Both are ssh2 never being told to try keyboard-interactive. It builds authsAllowed at ssh2/lib/client.js:836-844 and only pushes keyboard-interactive when config.tryKeyboard is set; with the list exhausted it emits the reporters' exact string at :863.

Every released tag through v1.4.194 lacks tryKeyboard. It landed on main in fbe94ceff68 yesterday and is in no tag (git merge-base --is-ancestor fbe94ceff68 v1.4.194 fails). So both reporters were right, and both are fixed by an unreleased commit.

What was still broken. ssh2 walks one flat method list exactly once (makeSimpleAuthHandler, client.js:2047-2057), so keyboard-interactive can only ever be offered once per connection. An AuthenticationMethods ladder ending in a second challenge partial-succeeds stage one and then finds the list empty. Orca's own handler (ssh-private-key-authentication.ts:50) had the same defect — it ignored its partialSuccess argument entirely, and only ran when keys.length > 1.

Now it runs for every target, and on a SSH_MSG_USERAUTH_FAILURE carrying partial success it rebuilds its queue narrowed to the methods the host still offers (bounded to 4 stages); SSH_KEYBOARD_INTERACTIVE_MAX_ROUNDS goes 4 → 8 to cover them. No new prompt surface — SshPassphraseDialog.tsx:110 already handles kind === 'keyboard-interactive'.

Proved against a real ssh2 server, not the mock harness:

BEFORE  × answers a second keyboard-interactive stage after the first partially succeeds
        × reaches the MFA stage without burning the host auth-try budget on rejected keys
        Caused by: Error: All configured authentication methods failed
          at doNextAuth ssh2/lib/client.js:863
        expected [ 'publickey', 'publickey' ] to have a length of +0 but got 2
        Tests  2 failed | 1 passed (3)
AFTER   Tests  3 passed (3)

#11746 — reproduced by execution, fixed for system-SSH, honestly scoped

Bundled the real modules and ran them against the issue's exact inputs: buildSshArgs emits ["-o","BatchMode=no","-T",…,"--","prod"] — byte-identical to the report. The stored 10.0.0.5:2222/deploy is discarded because a Host * block makes the target look config-backed.

hostBlockMatch does not exist anywhere and PR #11707 is still open, so this could not be fixed as written. ssh -G cannot supply the signal either — it prints the merged config and answers for unknown aliases too. The config file is the only source of truth.

Reusing the existing configHostMatches was not safe: parseSshConfig drops glob'd Host prod.* lines and Match blocks, so it would call a real config absent. New parseSshConfigAliasClaims retains raw patterns and flags Match; sshConfigMayClaimAlias is sound in the negative direction only — an unreadable file, any Match block, or any non-catch-all pattern that might match all answer "claimed". Only a proven-unclaimed alias licenses the override, and then only Hostname/Port/User — never -i, -J or ProxyCommand.

The verdict is injected into buildSshArgs, not read there: an arg builder that stats ~/.ssh/config answers differently on every machine, including in tests. Default is today's behaviour.

The conflicting test did not need rewriting. ssh-system-fallback.test.ts:249-269 passes no resolved and no verdict, so it now exercises the safe default — and what it was protecting (a real Host block staying authoritative) is exactly what that default means. It stays green unchanged, with three new sibling cases beside it.

Scope: system-SSH transport only, via getSystemSshBuildArgsOptions() — exec, file transfer, relay deploy, the GitHub probe, the relay transport spawn. Port-forward processes build their own options and keep today's behaviour. The ssh2 half (#11707) is untouched and still live.

One consequence to weigh before merge: -o Hostname=<stored> moves OpenSSH's known_hosts lookup from the alias to the real host. That is stricter — checking the endpoint we actually reach — but a first connection after the fix can prompt. HostKeyAlias was deliberately not added, since it would pin the check to a name that no longer designates anything.

#14533 — the title is wrong; fixed the diagnosis, not the forwarding

SSH_AUTH_SOCK/HOME/PATH are inherited through orca serve, and no agent forwarding to a paired runtime exists anywhere — because that transport is Orca's own E2EE runtime RPC, with no ssh connection to hang agentForward off.

The real mechanism: nonInteractiveGitEnv() sets GIT_SSH_COMMAND='ssh -o BatchMode=yes' plus empty SSH_ASKPASS, so a passphrase-protected key with no agent loaded fails under Orca while the same git clone typed by hand on that box succeeds — and the error never says why.

Fixed in the one shared builder, git-clone-failure-message.ts, so the relay path and the runtime path both get it: publickey refusal → name BatchMode and say ssh-add on that machine; host-key failure → point at that machine's known_hosts; any other SSH failure → still state where it ran. Non-SSH failures untouched, and the builder is re-entrant so re-parsing a relay message cannot double-append.

Not done, deliberately: agent forwarding (a feature and a security decision, worth its own issue), and weakening BatchMode=yes — making it interactive would trade a clear failure for a silent hang.

Verification

src/main/ssh/          129 passed | 2 skipped (131)   1800 passed | 16 skipped
src/relay/ + ipc/repos/ + runtime/                    697 passed
src/shared/                                           604 passed
pnpm tc:node                                          clean
check:code-quality:changed          0 new findings across 11 files
sync:localization-catalog           no diff

Fixes #8622, #16820
Refs #11746, #14533, #11707

@coderabbitai

coderabbitai Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 26480e6f-3e89-427f-931a-ab77fa3782b0

📥 Commits

Reviewing files that changed from the base of the PR and between db8308b and fb30636.

📒 Files selected for processing (1)
  • src/renderer/src/i18n/locales/en.json

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 6141d43a-10d9-4eb9-a013-cc40749f06ca

📥 Commits

Reviewing files that changed from the base of the PR and between 817827b and db8308b.

📒 Files selected for processing (11)
  • src/main/ssh/ssh-config-alias-claim.test.ts
  • src/main/ssh/ssh-config-alias-claim.ts
  • src/main/ssh/ssh-config-parser.ts
  • src/main/ssh/ssh-connection.ts
  • src/main/ssh/ssh-multi-factor-authentication.test.ts
  • src/main/ssh/ssh-multi-key-authentication.test.ts
  • src/main/ssh/ssh-private-key-authentication.ts
  • src/main/ssh/ssh-system-fallback.test.ts
  • src/main/ssh/system-ssh-args.ts
  • src/shared/git-clone-failure-message.test.ts
  • src/shared/git-clone-failure-message.ts
🚧 Files skipped from review as they are similar to previous changes (8)
  • src/main/ssh/system-ssh-args.ts
  • src/shared/git-clone-failure-message.test.ts
  • src/shared/git-clone-failure-message.ts
  • src/main/ssh/ssh-private-key-authentication.ts
  • src/main/ssh/ssh-config-parser.ts
  • src/main/ssh/ssh-system-fallback.test.ts
  • src/main/ssh/ssh-connection.ts
  • src/main/ssh/ssh-config-alias-claim.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The SSH configuration parser now preserves raw host patterns and Match-block presence. Alias detection loads, expands, caches, and evaluates user SSH configuration claims. System SSH arguments use stored endpoint values when an alias is unclaimed. SSH authentication now handles partial-success method queues and supports more keyboard-interactive rounds. New tests cover alias routing, multi-factor authentication, and SSH-specific Git clone failure guidance.

Merge Risk: 🟡 Moderate · up to db830

This change improves MFA handling, SSH alias fallback, and clone diagnostics, but a specific combination of wildcard and negated Host patterns can still prevent the fallback and leave some connections using an invalid alias route; the new SSH guidance also bypasses localization. Merge should wait for the alias-matching issue to be resolved or explicitly accepted.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The MFA changes address linked issue #8622, but the system-SSH alias fallback and Git clone failure-message changes are unrelated to the only directly linked issue provided. Link the relevant issues for the alias and Git clone changes, or split those changes into separate pull requests. Keep this pull request limited to the MFA behavior required by #8622.
Docstring Coverage ⚠️ Warning Docstring coverage is 29.63% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 27 functions across 11 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the three primary SSH changes: multi-stage MFA handling, unclaimed-alias fallback, and improved clone failure messages.
Description check ✅ Passed The description provides detailed change rationale, linked issue references, scope, exclusions, and verification results. It does not follow the template headings fully and does not explicitly provide…
Linked Issues check ✅ Passed The implementation satisfies issue #8622 by supporting password-to-keyboard-interactive MFA and repeated partial-success stages. New real-server tests verify the MFA behavior and prevent rejected keys…
Full details: Description check

Explanation

The description provides detailed change rationale, linked issue references, scope, exclusions, and verification results. It does not follow the template headings fully and does not explicitly provide the required Visual Proof N/A statement or checklist details.

Full details: Linked Issues check

Explanation

The implementation satisfies issue #8622 by supporting password-to-keyboard-interactive MFA and repeated partial-success stages. New real-server tests verify the MFA behavior and prevent rejected keys from consuming the host authentication budget.

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 4ddf4d30-e690-467b-b9fe-010782c7c565

📥 Commits

Reviewing files that changed from the base of the PR and between 26dfa46 and 842c611.

📒 Files selected for processing (11)
  • src/main/ssh/ssh-config-alias-claim.test.ts
  • src/main/ssh/ssh-config-alias-claim.ts
  • src/main/ssh/ssh-config-parser.ts
  • src/main/ssh/ssh-connection.ts
  • src/main/ssh/ssh-multi-factor-authentication.test.ts
  • src/main/ssh/ssh-multi-key-authentication.test.ts
  • src/main/ssh/ssh-private-key-authentication.ts
  • src/main/ssh/ssh-system-fallback.test.ts
  • src/main/ssh/system-ssh-args.ts
  • src/shared/git-clone-failure-message.test.ts
  • src/shared/git-clone-failure-message.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.

Comment thread src/main/ssh/ssh-config-alias-claim.ts Resolved
Comment thread src/shared/git-clone-failure-message.ts Resolved
Comment thread src/shared/git-clone-failure-message.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The alias-claim predicate is not sound in the negative direction when a Host block carries a negated pattern: Host * !prod returns false for any alias other than prod, licensing the -o Hostname/Port/User override against a block OpenSSH actually applies. See the inline comment. Everything else reads correct and is well-tested against a real ssh2 server.

Reviewed changes

  • MFA partial-success handling — configurePrivateKeyAuthentication now installs Orca's auth queue for every target (not just multi-key), re-arms it on partial success narrowed to the methods the host still offers, and bounds it at four stages; SSH_KEYBOARD_INTERACTIVE_MAX_ROUNDS doubles to 8.
  • Unclaimed-alias routing — new parseSshConfigAliasClaims and sshConfigMayClaimAlias prove that no Host/Match block claims a stored alias, and only then does buildSshArgs restore the stored Hostname/Port/User; the verdict is injected from SshConnection so the arg builder stays filesystem-free.
  • Clone failure diagnostics — getGitCloneFailureMessage names BatchMode=yes, points publickey/host-key failures at the machine that runs the clone, and is re-entrant so relay re-parsing can't double-append.

ℹ️ Port-forward scope in the PR body doesn't match the code

The description says "Port-forward processes build their own options and keep today's behaviour", but system-ssh-port-forward-provider.ts:24 passes conn.getSystemSshBuildArgsOptions(), which now includes aliasClaimedByConfig: false. Port-forwards will inherit the unclaimed-alias override; confirm whether that's intended.

Technical details
# Port-forward inherits the alias override despite the PR-body scope claim

## Affected sites
- src/main/ssh/system-ssh-port-forward-provider.ts:24 — forwards `conn.getSystemSshBuildArgsOptions()` into `startSystemSshPortForwardProcess`.
- src/main/ssh/ssh-connection.ts:1307 — `getSystemSshBuildArgsOptions()` now sets `aliasClaimedByConfig = false` when the alias is unclaimed.
- src/main/ssh/system-ssh-forward-process.ts:34 — `buildSshArgs` consumes that option and applies the `-o Hostname/Port/User` override.

## Open questions for the human
- Is applying the override to port-forwards intended (arguably also fixes #11746 for forwards), or should they be excluded as the description states?

ℹ️ Nitpicks

  • SSH_KEYBOARD_INTERACTIVE_MAX_ROUNDS = 8 in ssh-connection.ts is coupled to MAX_PARTIAL_SUCCESS_STAGES = 4 in ssh-private-key-authentication.ts, but the two constants live in different modules and neither is derived from the other; a cross-referencing comment would keep them from drifting.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Comment thread src/main/ssh/ssh-config-alias-claim.ts Resolved
@nwparker
nwparker force-pushed the fix/ssh-auth-mfa-and-alias branch from 842c611 to 476c4f0 Compare September 2, 2026 20:41

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found. The negated-pattern soundness gap from my prior review is now fixed, and the new HTTPS-detection gate on clone guidance is correct.

Reviewed changes

  • Negated Host groups treated as uncertainty — sshConfigMayClaimAlias now returns true for any group carrying a negated pattern (Host * !prod), closing the negative-direction soundness hole in a conservative direction; tests cover both the non-negated (stage) and negated (prod) aliases plus the no-negation absence case.
  • HTTPS clone guidance gating — getGitCloneFailureMessage only appends the SSH host/key note when an SSH-transport diagnostic is present, so an HTTPS auth failure no longer receives ssh-add/BatchMode advice.

ℹ️ Unrelated formatting churn bundled into the final commit

Commit 476c4f0 also rewraps and re-italicizes ten files outside this PR's scope (docs/reference/*, terminal-attach-cancellation.ts, worktree-create-preparation-pool.ts, UpdateCard.tsx, ssh-docker-transport-drop-recovery.spec.ts). No behavior changes, but it pollutes the diff and will conflict with in-flight work touching those files; splitting it out (or dropping it) would keep the review surface clean.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

ssh2 walks one flat auth-method list exactly once, so keyboard-interactive
could only ever be offered a single time. A host running
`AuthenticationMethods keyboard-interactive,keyboard-interactive` (or any
ladder ending in a second challenge) partial-succeeds the first stage and
then finds the list exhausted, which the user sees as "All configured
authentication methods failed" — the reports in #8622 and #16820.

Orca's own auth handler now runs for every target instead of only multi-key
ones, and rebuilds its queue on each SSH_MSG_USERAUTH_FAILURE that carries
partial success, narrowed to the methods the host still offers. Narrowing
also stops keys being re-offered after the host has moved past publickey,
which is what exhausts MaxAuthTries before the challenge is ever shown.

Covered by a real ssh2 server fixture that stages partial success.
Clones go through nonInteractiveGitEnv, so `ssh` runs with BatchMode=yes and an
emptied SSH_ASKPASS. On a remote or paired-runtime clone that produces
`fatal: Could not read from remote repository.` while the same `git clone`
typed by hand on that box succeeds — the divergence in #14533. Nothing in the
message said the clone ran on the other machine, under its keys, with the
prompt deliberately disabled.

getGitCloneFailureMessage now appends that fact, and names the two recognisable
shapes: a publickey refusal (load the key into an agent there) and a host-key
failure (record the key in that machine's known_hosts). Unrecognised SSH
failures still get the where-it-ran note; non-SSH failures are untouched.

One builder, so the SSH-target relay path and the runtime path both get it.
A wildcard `Host *` block supplies ProxyCommand/ProxyJump for every alias, so
shouldUseSystemSshTransport picks the system transport for an alias whose own
Host block was renamed or deleted, and buildSshArgs then dials that alias
verbatim: no -l, no -p, no Hostname. Orca connects as the wildcard's user to
the wildcard's host and discards the endpoint it stored (#11746).

The signal #11746 assumed (hostBlockMatch, from the still-open #11707) does not
exist, and `ssh -G` cannot supply it — it prints the merged config and answers
for unknown aliases too. The config file is the only source of truth, so:

- parseSshConfigAliasClaims retains raw Host patterns and flags Match blocks,
  which parseSshConfig discards because it mints importable targets.
- sshConfigMayClaimAlias is sound in the negative direction only: an unreadable
  file, any Match block, or any non-catch-all pattern that might match all
  answer "claimed", so absence of evidence is never read as evidence of
  absence. Only a proven-unclaimed alias licenses an override.
- buildSshArgs then states Hostname/Port/User, and only those: the wildcard is
  still the route, and -o Hostname does not change block selection, so the
  proxy keeps applying and %h expands to the host we mean.

The verdict is injected rather than read inside buildSshArgs, so an arg builder
does not answer differently per machine. Default is today's behaviour.

Scoped to the system-SSH transport and the connection's own command/transport
path. Port-forward processes and the ssh2 transport (#11707) are unchanged.
…H guidance

`Host * !prod` applies to every alias but `prod`, yet skipping both the catch-all
and the `!` pattern answered "unclaimed" for `stage` — which licences overriding
Hostname/Port/User against a block the user wrote. Any negation now makes the
whole group uncertain; the function is only sound in the negative direction.

Also require an ssh(1) diagnostic beside "could not read from remote repository"
before appending the SSH clone note: git prints that same line for the HTTP
remote helper, where advice about keys and agents is simply wrong.
@nwparker
nwparker force-pushed the fix/ssh-auth-mfa-and-alias branch from 476c4f0 to db8308b Compare September 2, 2026 21:09
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@nwparker

nwparker commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main. One blocker fixed, plus one of the two lower-severity notes; the third is answered inline with a justification rather than a change.

Blocker — negated Host patterns broke the function's own soundness contract. Host * !prod returned false for stage, though OpenSSH applies that block to it, which licensed -o Hostname/Port/User against config the user wrote. Any group containing a negation is now uncertainty. Details and the test diff are in the reply on that thread.

Fixed — SSH clone guidance fired on a line git also emits for HTTPS. appendCloneTransportGuidance matched could not read from remote repository alone; that branch now also requires an ssh(1) diagnostic beside it, so an HTTPS auth failure no longer gets advice about keys and agents. Regression test added (withholds SSH guidance when the failing transport was HTTPS), and it fails without the gate.

Not fixed — localization of the three new strings. Answered on that thread: the module runs in the main process and on the relay host with no i18n runtime, and translating only these three sentences would staple localized copy onto git's own English stderr and an untranslated pre-existing sibling in the same function. Doing it properly needs an error-code protocol for the clone-failure path, which is its own change.

MFA verification against real OpenSSH

Re-ran the multi-stage sshd container check. Debian bookworm, AuthenticationMethods publickey,keyboard-interactive,keyboard-interactive, real PAM (pam_pwdfile), driving the actual configurePrivateKeyAuthentication:

baseline ssh2 (no authHandler):     ok=false kiRounds=1  err=All configured authentication methods failed
orca authHandler, correct answers:  ok=true  kiRounds=2
orca authHandler, wrong 2nd answer: ok=false kiRounds=2  err=All configured authentication methods failed
orca authHandler, wrong 1st answer: ok=false kiRounds=1  err=All configured authentication methods failed

The baseline reproduces the bug — ssh2 walks its flat method list once, so the second challenge is never offered and it stops at kiRounds=1. The handler reaches kiRounds=2 and succeeds. No auth bypass: a wrong answer at either stage still fails, and a wrong first answer never advances to the second stage.

(Note for anyone reproducing: keyboard-interactive:pam1 is not a valid submethod — OpenSSH only knows the pam device, not a PAM service name — so a ladder written that way never starts the challenge at all.)

Verification

pnpm tc, pnpm run check:code-quality:changed (0 findings), pnpm test src/main/ssh src/shared — 8,662 passing. Each fix has a test that fails before it.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Restored the activityOptions i18n key — the single new commit re-adds ActivityPrototypePage.activityOptions (and the trailing comma it orphans) to en.json, which the rebase onto a newer main had dropped; the value and position now match main exactly, so the activity-options menu label resolves again.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit 278f9ee into main Sep 2, 2026
27 of 28 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…nd say where a clone failed (stablyai#17946)

* fix(ssh): answer every MFA stage, not just the first

ssh2 walks one flat auth-method list exactly once, so keyboard-interactive
could only ever be offered a single time. A host running
`AuthenticationMethods keyboard-interactive,keyboard-interactive` (or any
ladder ending in a second challenge) partial-succeeds the first stage and
then finds the list exhausted, which the user sees as "All configured
authentication methods failed" — the reports in stablyai#8622 and stablyai#16820.

Orca's own auth handler now runs for every target instead of only multi-key
ones, and rebuilds its queue on each SSH_MSG_USERAUTH_FAILURE that carries
partial success, narrowed to the methods the host still offers. Narrowing
also stops keys being re-offered after the host has moved past publickey,
which is what exhausts MaxAuthTries before the challenge is ever shown.

Covered by a real ssh2 server fixture that stages partial success.

* fix(git): say where a failing clone ran and why nothing could prompt

Clones go through nonInteractiveGitEnv, so `ssh` runs with BatchMode=yes and an
emptied SSH_ASKPASS. On a remote or paired-runtime clone that produces
`fatal: Could not read from remote repository.` while the same `git clone`
typed by hand on that box succeeds — the divergence in stablyai#14533. Nothing in the
message said the clone ran on the other machine, under its keys, with the
prompt deliberately disabled.

getGitCloneFailureMessage now appends that fact, and names the two recognisable
shapes: a publickey refusal (load the key into an agent there) and a host-key
failure (record the key in that machine's known_hosts). Unrecognised SSH
failures still get the where-it-ran note; non-SSH failures are untouched.

One builder, so the SSH-target relay path and the runtime path both get it.

* fix(ssh): stop dialling a bare alias no ssh_config block claims

A wildcard `Host *` block supplies ProxyCommand/ProxyJump for every alias, so
shouldUseSystemSshTransport picks the system transport for an alias whose own
Host block was renamed or deleted, and buildSshArgs then dials that alias
verbatim: no -l, no -p, no Hostname. Orca connects as the wildcard's user to
the wildcard's host and discards the endpoint it stored (stablyai#11746).

The signal stablyai#11746 assumed (hostBlockMatch, from the still-open stablyai#11707) does not
exist, and `ssh -G` cannot supply it — it prints the merged config and answers
for unknown aliases too. The config file is the only source of truth, so:

- parseSshConfigAliasClaims retains raw Host patterns and flags Match blocks,
  which parseSshConfig discards because it mints importable targets.
- sshConfigMayClaimAlias is sound in the negative direction only: an unreadable
  file, any Match block, or any non-catch-all pattern that might match all
  answer "claimed", so absence of evidence is never read as evidence of
  absence. Only a proven-unclaimed alias licenses an override.
- buildSshArgs then states Hostname/Port/User, and only those: the wildcard is
  still the route, and -o Hostname does not change block selection, so the
  proxy keeps applying and %h expands to the host we mean.

The verdict is injected rather than read inside buildSshArgs, so an arg builder
does not answer differently per machine. Default is today's behaviour.

Scoped to the system-SSH transport and the connection's own command/transport
path. Port-forward processes and the ssh2 transport (stablyai#11707) are unchanged.

* fix(ssh): read a negated Host group as uncertainty, and gate clone SSH guidance

`Host * !prod` applies to every alias but `prod`, yet skipping both the catch-all
and the `!` pattern answered "unclaimed" for `stage` — which licences overriding
Hostname/Port/User against a block the user wrote. Any negation now makes the
whole group uncertain; the function is only sound in the negative direction.

Also require an ssh(1) diagnostic beside "could not read from remote repository"
before appending the SSH clone note: git prints that same line for the HTTP
remote helper, where advice about keys and agents is simply wrong.

* fix(i18n): restore the activity-options key the rebase dropped

* fix(i18n): union en.json with main so the rebase cannot drop keys
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.

[Bug]: SSH connection fails after password when host requires keyboard-interactive MFA

1 participant