Skip to content

Conversation

@drazisil-codecov
Copy link
Contributor

@drazisil-codecov drazisil-codecov commented Jan 9, 2026

Summary

Adds error_code and error_message to log.error() calls when TorngitClientError is caught during:

  • PR comment creation/update (bundle analysis + test results)
  • Commit status setting (bundle analysis)

Problem

When these operations fail, we log an error but don't include the actual error details. This makes it impossible to diagnose whether failures are due to:

  • Rate limiting (403/429)
  • Character limits (422 - "body is too long")
  • Permission issues (403 - "resource not accessible by integration")
  • Other API errors

Solution

Capture the exception and log its details:

except TorngitClientError as e:
    log.error(
        "Error creating/updating PR comment",
        extra={
            ...,
            "error_code": getattr(e, "code", None),
            "error_message": str(e),
        },
    )

Impact

  • Better visibility into WORKER-KQ9 (~14K events/week)
  • Better visibility into WORKER-P13 (~138K events/week)

After this is deployed, we can check Sentry logs to determine what's actually causing failures for specific customers (e.g., SquareUp).


Note

Improves diagnostics for provider failures by enriching error logs with exception details.

  • In helpers/notifier.py and bundle analysis comment.py, catch TorngitClientError as e when creating/updating PR comments and log error_code and error_message in log.error extras
  • In bundle analysis commit_status.py, add the same error details when setting commit status fails

No behavior change beyond expanded logging metadata.

Written by Cursor Bugbot for commit d840423. This will update automatically on new commits. Configure here.

@drazisil-codecov drazisil-codecov requested a review from a team January 9, 2026 16:54
@sentry
Copy link

sentry bot commented Jan 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.78%. Comparing base (6915276) to head (d840423).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #643   +/-   ##
=======================================
  Coverage   93.78%   93.78%           
=======================================
  Files        1291     1291           
  Lines       46907    46907           
  Branches     1517     1517           
=======================================
  Hits        43991    43991           
  Misses       2607     2607           
  Partials      309      309           
Flag Coverage Δ
workerintegration 59.14% <0.00%> (ø)
workerunit 91.26% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov-notifications
Copy link

codecov-notifications bot commented Jan 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

…failures

Add error_code and error_message to log.error() calls when TorngitClientError
is caught during PR comment creation/update and commit status setting.

This helps diagnose whether failures are due to:
- Rate limiting (403/429)
- Character limits (422 - body too long)
- Permission issues (403 - resource not accessible)
- Other API errors

Affects WORKER-KQ9 (PR comments) and WORKER-P13 (commit status)
@drazisil-codecov drazisil-codecov force-pushed the joebecher/log-pr-comment-errors branch from 4071df9 to d840423 Compare January 9, 2026 17:15
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