Keep the fetch-failure handler alive when the forge API is down #2

Merged
soksanichenko merged 2 commits from fix-fetch-handler into main 2026-09-30 12:00:54 +00:00

Summary

cli._handle_fetch_error counts consecutive failed runs and opens an issue after repeated fetch failures. Both steps call the Forgejo API, and the API being unavailable is exactly when a fetch failure is most likely. A requests.RequestException from those calls used to crash the handler with a traceback.

With this change:

  • If the streak lookup or the issue report fails, the handler logs the original fetch error, then logs Could not check or report repeated failures: <redacted error>, and returns exit code 1.
  • When the lookup succeeds, the log line is unchanged (<error> (previous consecutive failed runs: N)). The issue threshold (streak >= 2) is also unchanged.

Tests

  • New test: the forge API is down (failed_run_streak raises ConnectionError). The handler returns 1 without raising.
  • New test: the success path keeps the streak count in the log.
  • Both tests failed before the fix. The full suite passes: 84 tests.

🤖 Generated with Claude Code

## Summary `cli._handle_fetch_error` counts consecutive failed runs and opens an issue after repeated fetch failures. Both steps call the Forgejo API, and the API being unavailable is exactly when a fetch failure is most likely. A `requests.RequestException` from those calls used to crash the handler with a traceback. With this change: - If the streak lookup or the issue report fails, the handler logs the original fetch error, then logs `Could not check or report repeated failures: <redacted error>`, and returns exit code 1. - When the lookup succeeds, the log line is unchanged (`<error> (previous consecutive failed runs: N)`). The issue threshold (`streak >= 2`) is also unchanged. ## Tests - New test: the forge API is down (`failed_run_streak` raises `ConnectionError`). The handler returns 1 without raising. - New test: the success path keeps the streak count in the log. - Both tests failed before the fix. The full suite passes: 84 tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep the streak count in the fetch-failure log
Some checks failed
ci / test (pull_request) Has been cancelled
9ddd50793c
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
soksanichenko deleted branch fix-fetch-handler 2026-09-30 12:00:54 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
autopatch/pungi!2
No description provided.