ubiquity / devpool-directory-tasks

Open bounties for the devpool-directory repository
1 stars 3 forks source link

More Robust Server Error Handling #21

Closed 0x4007 closed 6 months ago

0x4007 commented 7 months ago

I was checking the entire flow of how new people perceive our site, and our developer onboarding flow through dao.ubq.fi/devpool etc as I do regularly these days (to ensure seamless onboarding!) and realized that work.ubq.fi only rendered nine tasks. work ubq fi_ (1)

I was quick to assume I got rate limited but realized that there indeed are only nine tasks open in the devpool-directory "backend"

Fortunately GitHub Actions has logs and I was able to discover

Getting ubiquity org repositories failed: HttpError: Server Error

This is a problem because it actually closes all the issues when this occurs!

The script should be smart enough to ignore the @ubiquity org tasks in this situation in case there are 5xx level errors!

ubiquibot[bot] commented 7 months ago
! action has an uncaught error
ubiquibot[bot] commented 7 months ago
! action has an uncaught error
ubiquibot[bot] commented 7 months ago
! action has an uncaught error
ubiquibot[bot] commented 7 months ago
! action has an uncaught error
ubiquibot[bot] commented 7 months ago
! action has an uncaught error
EresDev commented 7 months ago

/start

EresDev commented 7 months ago

/start

ubiquibot[bot] commented 7 months ago
! action has an uncaught error
EresDev commented 7 months ago

/wallet 0xE7a9fdf596D869AF34a130fa9607178B2B9800D9

ubiquibot[bot] commented 7 months ago
! action has an uncaught error
EresDev commented 7 months ago

/start

0x4007 commented 7 months ago

@FernandVEYRIER any ideas?

ubiquibot[bot] commented 7 months ago

@EresDev the deadline is at 2024-03-18T08:08:34.068Z

gentlementlegen commented 7 months ago

@FernandVEYRIER any ideas?

Not really if the bot is using the service role key. Do you have more details on the logs?

0x4007 commented 7 months ago

All logs should be visible in supabase public.logs table!

gentlementlegen commented 7 months ago
{
  "name": "HttpError",
  "caller": "getAllCommitsFromPullRequest",
  "status": 404,
  "request": {
    "url": "https://api.github.com/repos/ubiquity/devpool-directory-bounties/pulls/1145/commits?per_page=100",
    "method": "GET",
    "headers": {
      "accept": "application/vnd.github.v3+json",
      "user-agent": "probot/12.3.3 octokit-core.js/3.6.0 Node.js/20.11.0 (linux; x64)",
      "authorization": "token [REDACTED]"
    },
    "request": {
      "retryCount": 1
    }
  },
  "response": {
    "url": "https://api.github.com/repos/ubiquity/devpool-directory-bounties/pulls/1145/commits?per_page=100",
    "data": {
      "message": "Not Found",
      "documentation_url": "https://docs.github.com/rest/pulls/pulls#list-commits-on-a-pull-request"
    },
    "status": 404,
    "headers": {
      "date": "Mon, 18 Mar 2024 06:13:29 GMT",
      "vary": "Accept-Encoding, Accept, X-Requested-With",
      "server": "GitHub.com",
      "content-type": "application/json; charset=utf-8",
      "referrer-policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
      "x-frame-options": "deny",
      "content-encoding": "gzip",
      "x-ratelimit-used": "149",
      "x-xss-protection": "0",
      "transfer-encoding": "chunked",
      "x-ratelimit-limit": "7200",
      "x-ratelimit-reset": "1710742875",
      "x-github-media-type": "github.v3; format=json",
      "x-github-request-id": "D088:3BDA:2304A49:4162F3C:65F7DB88",
      "x-ratelimit-resource": "core",
      "x-ratelimit-remaining": "7051",
      "x-content-type-options": "nosniff",
      "content-security-policy": "default-src 'none'",
      "strict-transport-security": "max-age=31536000; includeSubdomains; preload",
      "access-control-allow-origin": "*",
      "access-control-expose-headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
      "x-accepted-github-permissions": "pull_requests=read",
      "x-github-api-version-selected": "2022-11-28"
    }
  },
  "revision": null
}

Seems related to the changes made to fetch the data related to a pull request through the locations table contained in the database, not the CLS.

gitcoindev commented 7 months ago

Hi, is it just me noticing because I just got up or simply the pull request URL is wrong? 404 error is correct, because it does not exist. The correct URL is likely https://api.github.com/repos/ubiquity/devpool-directory/pulls/1145

gentlementlegen commented 7 months ago

@gitcoindev Yes the url seems to be wrong. It seems to be using the current repo to create that URL since here we are inside devpool-directory-bounties/issues/21

0x4007 commented 7 months ago

It's searching to see 1. if you aren't assigned to too many other issues simultaneously (we have default limits for 2 concurrent task assignments, so that contributors can stay focused) and 2. to see if you have any recent activity in the form of comments or commits on any of the tasks you are assigned to, in order to see if you were idle for a week and unassign you.

EresDev commented 7 months ago

I was quick to assume I got rate limited but realized that there indeed are only nine tasks open in the devpool-directory "backend"

Fortunately GitHub Actions has logs and I was able to discover

Github API Rate limit error codes are 4xx, timeout error codes are 5xx. This appears to be timeout error.

From the Github API docs

If GitHub takes more than 10 seconds to process an API request, GitHub will terminate the request and you will receive a timeout response and a "Server Error" message.

The script should be smart enough to ignore the @ubiquity org tasks in this situation in case there are 5xx level errors!

This solution looks ok but a better solution is to improve error handling of the function. The above failure occurred when the bot couldn't even fetch a list of repos for the org. This list was important. The function should have ended (waiting for it to restart at next hour), instead of doing the rest of the work and end up closing wrong issues.

I am planning to do this. If a timeout or rate limit error occur, stop the execution of the function. Print more details related to rate limit, response code, and wait for the function to restart at next hour.

ubiquibot[bot] commented 7 months ago
! action has an uncaught error
ubiquibot[bot] commented 7 months ago
+ Evaluating results. Please wait...
ubiquibot[bot] commented 7 months ago

[ 42 WXDAI ]

@pavlovcik
Contributions Overview
ViewContributionCountReward
IssueSpecification124
IssueComment318
Conversation Incentives
CommentFormattingRelevanceReward
I was checking the entire flow of how new people perceive our si...
24
a:
  count: 1
  score: "1"
  words: 8
124
@FernandVEYRIER any ideas?...
0.60.690.6
All logs should be visible in supabase `public.logs` table!...
3
code:
  count: 1
  score: "1"
  words: 2
0.793
It's searching to see 1. if you aren't assigned to too many othe...
14.40.83514.4

[ 37.5 WXDAI ]

@FernandVEYRIER
Contributions Overview
ViewContributionCountReward
IssueComment337.5
Conversation Incentives
CommentFormattingRelevanceReward
> @FernandVEYRIER any ideas? Not really if the bot is using t...
1.90.551.9
```JSON { "name": "HttpError", "caller": "getAllCommitsFr...
31.6
code:
  count: 2
  score: "2"
  words: 1
0.7731.6
@gitcoindev Yes the url seems to be wrong. It seems to be using ...
4
code:
  count: 1
  score: "1"
  words: 5
0.784

[ 5.3 WXDAI ]

@gitcoindev
Contributions Overview
ViewContributionCountReward
IssueComment15.3
Conversation Incentives
CommentFormattingRelevanceReward
Hi, is it just me noticing because I just got up or simply the p...
5.3
a:
  count: 1
  score: "1"
  words: 10
0.845.3
EresDev commented 7 months ago

/wallet 0xE7a9fdf596D869AF34a130fa9607178B2B9800D9

ubiquibot[bot] commented 7 months ago
! action has an uncaught error
ubiquibot[bot] commented 6 months ago
+ Evaluating results. Please wait...
ubiquibot[bot] commented 6 months ago

[ 42 WXDAI ]

@0x4007
Contributions Overview
ViewContributionCountReward
IssueSpecification124
IssueComment318
Conversation Incentives
CommentFormattingRelevanceReward
I was checking the entire flow of how new people perceive our si...
24
a:
  count: 1
  score: "1"
  words: 8
124
@FernandVEYRIER any ideas?...
0.60.620.6
All logs should be visible in supabase `public.logs` table!...
3
code:
  count: 1
  score: "1"
  words: 2
0.713
It's searching to see 1. if you aren't assigned to too many othe...
14.40.8214.4

[ 37.5 WXDAI ]

@gentlementlegen
Contributions Overview
ViewContributionCountReward
IssueComment337.5
Conversation Incentives
CommentFormattingRelevanceReward
> @FernandVEYRIER any ideas? Not really if the bot is using t...
1.90.611.9
```JSON { "name": "HttpError", "caller": "getAllCommitsFr...
31.6
code:
  count: 2
  score: "2"
  words: 1
0.7831.6
@gitcoindev Yes the url seems to be wrong. It seems to be using ...
4
code:
  count: 1
  score: "1"
  words: 5
0.844

[ 212.8 WXDAI ]

@EresDev
Contributions Overview
ViewContributionCountReward
IssueTask1200
IssueComment10
IssueComment112.8
Conversation Incentives
CommentFormattingRelevanceReward
> I was quick to assume I got rate limited but realized that the...
-0.82-
> I was quick to assume I got rate limited but realized that the...
12.80.8212.8

[ 5.3 WXDAI ]

@gitcoindev
Contributions Overview
ViewContributionCountReward
IssueComment15.3
Conversation Incentives
CommentFormattingRelevanceReward
Hi, is it just me noticing because I just got up or simply the p...
5.3
a:
  count: 1
  score: "1"
  words: 10
0.615.3