For SSH agent failures, print the raw response text
Marco Ricci

Marco Ricci commited on 2026-06-13 07:52:46
Zeige 1 geänderte Dateien mit 2 Einfügungen und 2 Löschungen.


For SSHAgentFailedError, include the raw response text in the error
message.  (Escaped, but not trimmed.)  The response text is seldom
textual in nature, and discarding non-printable parts of the text turns
out to be much more of a hindrance than a help when debugging unexpected
agent behavior.
... ...
@@ -72,8 +72,8 @@ class SSHAgentFailedError(RuntimeError):
72 72
             return "The SSH agent failed to complete the request"
73 73
         elif self.args[1]:  # noqa: RET505  # pragma: no cover [failsafe]
74 74
             code = self.args[0]
75
-            msg = self.args[1].decode("utf-8", "surrogateescape")
76
-            return f"[Code {code:d}] {msg:s}"
75
+            msg = self.args[1]
76
+            return f"[Code {code:d}] {msg!r}"
77 77
         else:  # pragma: no cover [failsafe]
78 78
             return repr(self)
79 79
 
80 80