Skip to content

[WIP] Fix logging issues and TypeError in AutoControlBot#11

Draft
Copilot wants to merge 1 commit intomainfrom
copilot/fix-autocontrolbot-logging-issues
Draft

[WIP] Fix logging issues and TypeError in AutoControlBot#11
Copilot wants to merge 1 commit intomainfrom
copilot/fix-autocontrolbot-logging-issues

Conversation

Copy link
Contributor

Copilot AI commented Dec 28, 2025

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

The user reported issues with AutoControlBot after PR #10.
Logs indicate two problems:

  1. services.gsheets:sheet_changed logs warnings with %d and %s placeholders which are not replaced, indicating incorrect usage of loguru (which expects {}).
  2. Repeated "Unexpected error" in sheet_changed suggests a persistent exception. A likely cause is TypeError when comparing offset-aware now with potentially offset-naive creds.expiry in _get_creds.

The fix should:

  1. Update src/services/gsheets.py to use {} formatting for logger calls.
  2. In _get_creds, ensure expiry and now are comparable (handle timezone awareness) to prevent TypeError.
  3. Improve logging for failed REST API calls (status != 200) by including the response body (await response.text()).

Ref:

326|                 logger.warning(
327|                     "⚠️ Не удалось получить modifiedTime через REST API: %d", 
328|                     response.status
329|                 )

and

335|         logger.warning("⚠️ Неожиданная ошибка при проверке modifiedTime: %s", exc)

And the expiry check:

90|         or now >= _creds_cache["expiry"]

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants