Fix: list_google_accounts also shows flat primary secret

This commit is contained in:
daniel
2026-05-09 14:17:53 -05:00
parent bf89f7255a
commit aaecbcfa02

View File

@@ -127,6 +127,15 @@ def list_google_accounts() -> str:
accounts[label] = val.get('email', s['Name']) accounts[label] = val.get('email', s['Name'])
except Exception: except Exception:
accounts[label] = s['Name'] accounts[label] = s['Name']
# Also check flat path as 'primary' if not already in labeled list
if 'primary' not in accounts:
flat = f'agent-claw/google-credentials/{safe_actor_id}'
try:
import json as _json2
val = _json2.loads(sm.get_secret_value(SecretId=flat)['SecretString'])
accounts['primary'] = val.get('email', flat)
except Exception:
pass
if accounts: if accounts:
parts = [f'{label} ({email})' for label, email in accounts.items()] parts = [f'{label} ({email})' for label, email in accounts.items()]
return 'Connected Google accounts: ' + ', '.join(parts) return 'Connected Google accounts: ' + ', '.join(parts)