Skip to content

Commit 8cb0cf1

Browse files
fix(ssh): run SSHConnectionParams auth validator on pydantic >=2.12
check_auth_method_provided used @classmethod together with @model_validator(mode=after). That combination is deprecated and silently skipped on pydantic >= 2.12, so the auth-method/host/username checks never ran. Make it an instance-method mode=after validator, supported across pydantic 2.x and 3.0. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 0fe026b commit 8cb0cf1

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

  • python/coinbase-agentkit/coinbase_agentkit/action_providers/ssh

python/coinbase-agentkit/coinbase_agentkit/action_providers/ssh/connection.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,20 @@ class SSHConnectionParams(BaseModel):
2828
)
2929
port: int = Field(22, description="SSH port number")
3030

31-
@classmethod
3231
@model_validator(mode="after")
33-
def check_auth_method_provided(cls):
32+
def check_auth_method_provided(self):
3433
"""Ensure at least one authentication method is provided."""
35-
if not any([cls.password, cls.private_key, cls.private_key_path]):
34+
if not any([self.password, self.private_key, self.private_key_path]):
3635
raise ValueError(
3736
"At least one authentication method must be provided (password, private_key, or private_key_path)"
3837
)
3938

40-
if not cls.host:
39+
if not self.host:
4140
raise ValueError("Host must be provided")
42-
if not cls.username:
41+
if not self.username:
4342
raise ValueError("Username must be provided")
4443

45-
return cls
44+
return self
4645

4746

4847
class SSHConnectionError(Exception):

0 commit comments

Comments
 (0)