Root Cause Analysis
In src/commands/interactive/connection.rs:74-76, the password fallback condition:
Err(SshError::KeyAuthFailed)
if allow_password_fallback && atty::is(atty::Stream::Stdin) =>
This condition only matches KeyAuthFailed error, but different errors are returned when SSH agent authentication fails:
AgentAuthenticationFailed - SSH agent authentication failed (most common)
AgentNoIdentities - No identities in SSH agent
AgentConnectionFailed - SSH agent connection failed
AgentRequestIdentitiesFailed - Identity request failed
Requested Fix
-
In establish_connection function in src/commands/interactive/connection.rs:
- Include SSH agent-related authentication failure errors in the password fallback condition
- Extend pattern matching to
SshError::KeyAuthFailed | SshError::AgentAuthenticationFailed | SshError::AgentNoIdentities, etc.
-
Verify error type definitions (src/ssh/tokio_client/error.rs):
- Confirmed that required error types are already defined
-
Post-fix testing:
- Run
cargo check
- Run
cargo clippy
- Run
cargo test
Reference Files
src/commands/interactive/connection.rs - Target for modification
src/ssh/tokio_client/error.rs - Error type definitions
src/ssh/tokio_client/authentication.rs - Authentication logic (for reference)
Root Cause Analysis
In
src/commands/interactive/connection.rs:74-76, the password fallback condition:This condition only matches
KeyAuthFailederror, but different errors are returned when SSH agent authentication fails:AgentAuthenticationFailed- SSH agent authentication failed (most common)AgentNoIdentities- No identities in SSH agentAgentConnectionFailed- SSH agent connection failedAgentRequestIdentitiesFailed- Identity request failedRequested Fix
In
establish_connectionfunction insrc/commands/interactive/connection.rs:SshError::KeyAuthFailed | SshError::AgentAuthenticationFailed | SshError::AgentNoIdentities, etc.Verify error type definitions (
src/ssh/tokio_client/error.rs):Post-fix testing:
cargo checkcargo clippycargo testReference Files
src/commands/interactive/connection.rs- Target for modificationsrc/ssh/tokio_client/error.rs- Error type definitionssrc/ssh/tokio_client/authentication.rs- Authentication logic (for reference)