The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(credential_pool): collapse the stale-writer early returns
kshitijk4poor754ea7253801
diff --git a/agent/credential_pool.py b/agent/credential_pool.pyindex 6f86519d76e..1c493d95b60 100644--- a/agent/credential_pool.py+++ b/agent/credential_pool.py@@ -1143,7 +1143,7 @@ class CredentialPool(CredentialPoolAdminMixin, CredentialPoolModelCooldownMixin)# unchanged row would replace the live object (and pull peer cooldown state# merged into the written row) on every ordinary flush.if pair != (entry.access_token, entry.refresh_token):- self._entries[index] = PooledCredential.from_dict(self.provider, row)+ self._replace_entry(entry, PooledCredential.from_dict(self.provider, row))def _adopt(self, entry: PooledCredential, *, persist: bool = True, **updates: Any) -> PooledCredential:"""``replace(entry, **updates)``, swap it into the pool, optionally persist."""diff --git a/hermes_cli/auth.py b/hermes_cli/auth.pyindex ffe7773f7b7..c68cfa1137e 100644--- a/hermes_cli/auth.py+++ b/hermes_cli/auth.py@@ -939,10 +939,8 @@ def _merge_pool_row_generation(from agent.credential_pool import STATUS_DEADmerge_disk = None if status_cleared else disk_entry- if not isinstance(disk_entry, dict) or base_pair is None:- return _merge_disk_cooldown_state(entry, merge_disk, provider_id)disk_pair = _credential_token_pair(disk_entry)- if not any(disk_pair) or disk_pair == base_pair:+ if base_pair is None or not any(disk_pair) or disk_pair == base_pair:return _merge_disk_cooldown_state(entry, merge_disk, provider_id)merged = dict(entry)