Move session metadata from keychain to plain file to prevent credential loss
The current-session-metadata keychain entry was getting wiped by transient
errors (e.g. network failure on wake) in the resumeSession() catch block,
forcing users to re-authenticate unnecessarily.
Changes:
- Store session metadata in ~/.config/tangled/session.json (not keychain)
so it survives sleep/wake cycles and keychain lock events
- Don't clear metadata on transient agent.resumeSession() failures — only
clear when loadSession() definitively returns null (no stored credentials)
- Update session.test.ts to mock node:fs/promises with in-memory storage
- Update api-client.test.ts to reflect new non-clearing behavior
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
authored by
markbennett.ca
tangled.org
42af5942
265ca911