Closed
fix(add_comment): remove expired AWI_MAINTENANCE_TOKEN, add 401 fallback to step-level token#48725
Conversation
Copilot
AI
changed the title
[WIP] Fix add_comment credential path in PR Sous Chef
fix(add_comment): remove expired AWI_MAINTENANCE_TOKEN, add 401 fallback to step-level token
Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add_commentin PR Sous Chef was failing 401 Bad Credentials on every run whileupdate_pull_requestanddismiss_pull_request_reviewsucceeded against the same PR in the same job — becauseadd_commentwas the only handler configured with an explicitgithub-token: ${{ secrets.AWI_MAINTENANCE_TOKEN }}(expired/revoked), while the other handlers fell through to the step-level token.Changes
Root cause fix —
pr-sous-chef.md+pr-sous-chef.lock.ymlgithub-token: ${{ secrets.AWI_MAINTENANCE_TOKEN }}from theadd-comment:handler config. No other handler needed this override; the step-levelGH_AW_GITHUB_TOKEN || GITHUB_TOKENis sufficient and already works for all other safe-output types in this workflow.Resilience —
add_comment.cjsglobal.githubclient at factory init asstepLevelGithub, tracks whether a per-handler token is in use (usingPerHandlerToken).error.status === 401with a per-handler token active, retries comment creation (both issue/PR and discussion paths) usingstepLevelGithubinstead of propagating the failure.Regression tests —
add_comment.test.cjsFour new tests in
"401 Bad Credentials fallback (per-handler token)":update_pull_requestsucceeds thenadd_commentfalls back and succeeds