Fix Google Calendar/Gmail disabled by read-only token mount #72

Merged
ryan merged 1 commits from fix/google-token-readonly into main 2026-10-12 22:46:03 -04:00
Owner

Problem

token.json is mounted read-only (docker-compose.yml). Once the stored access token expires, GoogleService.__init__ refreshes it and tries to write it back, raising PermissionError. The catch-all in agents.py then sets google_calendar_enabled/google_gmail_enabled to False, so the agent loses the Calendar and Gmail tools on every restart.

Fix

Ignore OSError on the write-back; refreshed creds stay in memory (google-auth keeps refreshing them in-process).

Verification

  • Reproduced with an expired, read-only token copy: old code → PermissionError(13), Google disabled.
  • Patched code initializes and lists Calendar events.
  • pytest tests/: 356 passed.

🤖 Generated with Claude Code

## Problem `token.json` is mounted read-only (`docker-compose.yml`). Once the stored access token expires, `GoogleService.__init__` refreshes it and tries to write it back, raising `PermissionError`. The catch-all in `agents.py` then sets `google_calendar_enabled`/`google_gmail_enabled` to False, so the agent loses the Calendar and Gmail tools on every restart. ## Fix Ignore `OSError` on the write-back; refreshed creds stay in memory (google-auth keeps refreshing them in-process). ## Verification - Reproduced with an expired, read-only token copy: old code → `PermissionError(13)`, Google disabled. - Patched code initializes and lists Calendar events. - `pytest tests/`: 356 passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ryan added 1 commit 2026-10-12 22:42:38 -04:00
token.json is mounted :ro, so writing refreshed creds back raised
PermissionError at startup once the stored access token expired. The broad
except in agents.py then disabled Calendar and Gmail tools entirely.
Keep the refreshed creds in memory when the write fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ryan merged commit 030c5d6c21 into main 2026-10-12 22:46:03 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ryan/simbarag#72