Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: prevent false positive in Secret.get_plaintext() for plaintext values (#6566)
jnjpngfd14657e842e
diff --git a/letta/schemas/secret.py b/letta/schemas/secret.pyindex 118b249d3..2790c4aa6 100644--- a/letta/schemas/secret.py+++ b/letta/schemas/secret.py@@ -143,8 +143,14 @@ class Secret(BaseModel):if self.encrypted_value is None:return None- # Use cached value if available+ # Use cached value if available, but only if it looks like plaintext+ # or we're confident we can decrypt itif self._plaintext_cache is not None:+ # If this was explicitly created as plaintext, trust the cache+ # This prevents false positives from is_encrypted() heuristic+ if not self.was_encrypted:+ return self._plaintext_cache+ # For encrypted values, trust the cache (already decrypted previously)return self._plaintext_cache# Try to decrypt