Fix: Reset invalid accounts on startup and improve project discovery logging

Fixes #33 - Accounts marked as invalid were permanently stuck because
the isInvalid flag was persisted to disk but never reset on startup.

Changes:
- Reset isInvalid flag for all accounts on server startup, giving them
  a fresh chance to refresh their OAuth tokens
- Add logging for project discovery failures (was silently failing)
- Add success logging when project is discovered
- Add warning message when falling back to default project

Bug introduced in 01cda83 (2025-12-25) when isInvalid persistence was
added without corresponding reset logic on load.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Badri Narayanan S
2026-01-02 12:34:35 +05:30
parent 77089e0360
commit 2d05dd5b62
2 changed files with 13 additions and 3 deletions

View File

@@ -28,7 +28,10 @@ export async function loadAccounts(configPath = ACCOUNT_CONFIG_PATH) {
...acc,
isRateLimited: acc.isRateLimited || false,
rateLimitResetTime: acc.rateLimitResetTime || null,
lastUsed: acc.lastUsed || null
lastUsed: acc.lastUsed || null,
// Reset invalid flag on startup - give accounts a fresh chance to refresh
isInvalid: false,
invalidReason: null
}));
const settings = config.settings || {};