Keep Google service enabled when token mount is read-only

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>
This commit is contained in:
2026-10-12 22:42:37 -04:00
parent 3ab7faf139
commit 9214afb206
+5 -2
View File
@@ -25,8 +25,11 @@ class GoogleService:
creds = Credentials.from_authorized_user_file(token_path, SCOPES)
if creds.expired and creds.refresh_token:
creds.refresh(Request())
with open(token_path, "w") as f:
f.write(creds.to_json())
try:
with open(token_path, "w") as f:
f.write(creds.to_json())
except OSError:
pass # read-only mount; refreshed creds live in memory
self._creds = creds
self._calendar = build("calendar", "v3", credentials=creds)