fix(checkpoint): narrow SSH auth-failure detection needles · Entire

fix(checkpoint): narrow SSH auth-failure detection needles

1433628→main·

suhaanthayyil·2d ago·2 files·+7 added/-4 removed

Drop generic "Could not read from remote repository" and speculative passphrase/banner needles so network outages don't get an ssh-agent hint.

Co-authored-by: Cursor cursoragent@cursor.com

Changes

2

77 unmodified lines

78
79
80
81
82
83
84
85
86
87
88
89
90
87
88
89
91
92
93

77 unmodified lines

return false
    }
lower := strings.ToLower(errText)
// Keep needles auth-specific. Do not match git's generic
// "Could not read from remote repository" epilogue — that also appears on
// network failures where an ssh-agent hint would be wrong. Real auth
// failures always include a Permission denied / auth-methods line too.
needles := []string{
    "permission denied (publickey)",
    "permission denied (keyboard-interactive",
    "permission denied (password)",
    "too many authentication failures",
    "no more authentication methods to try",
    "could not read from remote repository",
    "enter passphrase for key",          // should not appear under BatchMode, but keep
    "error reading ssh protocol banner", // sometimes accompanies aborted auth
}
for _, n := range needles {
    if strings.Contains(lower, n) {

Mcmd/entire/cli/checkpoint/remote/git.go+4/-3

1253 unmodified lines

1254
1255
1256
1257
1257
1258
1259
1260
1261
1262

1253 unmodified lines

{"git push: Permission denied (publickey).", true},
    {"Permission denied (publickey,password).", true},
    {"ERROR: Permission denied (publickey).
fatal: Could not read from remote repository.", true},
    {"fatal: Could not read from remote repository.", true},
    {"fatal: Could not read from remote repository.", false}, // generic transport epilogue, not auth
    {"ssh: connect to host example.com port 22: Connection refused\nfatal: Could not read from remote repository.", false},
    {"enter passphrase for key '/home/me/.ssh/id_rsa':", false},
    {"non-fast-forward", false},
    {"Connection timed out", false},
    {"", false},

Mcmd/entire/cli/checkpoint/remote/git_test.go+3/-1