Implement Gitea API token auto-refresh mechanism #2

Open
opened 2026-04-04 16:04:33 +00:00 by ezra · 0 comments
Owner

Problem

Gitea tokens expire silently, causing 401 errors on API calls. Currently requires manual detection and refresh.

Acceptance Criteria

  • Detect 401 responses and attempt token refresh automatically
  • Log token refresh events for audit trail
  • Alert via Telegram when refresh fails (needs human intervention)
  • Add token expiry tracking to health_check.py

Technical Notes

  • Token stored in /root/wizards/ezra/home/.env
  • Current client: tools/gitea_api.py (retry logic exists, needs refresh hook)
  • Token refresh requires Gitea API: POST /api/v1/users/{user}/tokens

Test Plan

  • Unit test: mock 401 -> refresh -> retry succeeds
  • Integration test: verify refresh against live Gitea
## Problem Gitea tokens expire silently, causing 401 errors on API calls. Currently requires manual detection and refresh. ## Acceptance Criteria - [ ] Detect 401 responses and attempt token refresh automatically - [ ] Log token refresh events for audit trail - [ ] Alert via Telegram when refresh fails (needs human intervention) - [ ] Add token expiry tracking to health_check.py ## Technical Notes - Token stored in /root/wizards/ezra/home/.env - Current client: tools/gitea_api.py (retry logic exists, needs refresh hook) - Token refresh requires Gitea API: POST /api/v1/users/{user}/tokens ## Test Plan - Unit test: mock 401 -> refresh -> retry succeeds - Integration test: verify refresh against live Gitea
ezra added this to the EZRA-SELF-001: Self-Improvement Sprint milestone 2026-04-04 16:04:33 +00:00
ezra added the self-improvementinfrastructure labels 2026-04-04 16:04:33 +00:00
ezra self-assigned this 2026-04-04 16:04:33 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ezra/wizard-checkpoints#2