Skip to content

fix(notifications): read gh token param in PR notifier - #114

Merged
lelia merged 1 commit into
mainfrom
lelia/github-pr-notifier-token-config
Sep 15, 2026
Merged

lelia merged 1 commit into
mainfrom
lelia/github-pr-notifier-token-config

Conversation

@lelia

@lelia lelia commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

What

The GitHub PR notifier resolved its credential from a token key:

self.token = self.config.get('token') or get_github_token()

The notifier parameter is declared as github_token in notifications.yaml, and that is the key the notification manager resolves dashboard configuration and the GITHUB_TOKEN environment variable into, so self.config.get('token') was always None.

Effect

A token set through dashboard config enabled the notifier (manager.py checks app_config.get('github_token') when deciding whether to load it) but the value never reached the GitHub API call. The notifier loaded, then returned at the if not self.token guard in _send_pr_comment, logging no GitHub token available and posting nothing.

Runs that configure the token through the environment were unaffected, because the notifier fell back to reading GITHUB_TOKEN directly.

Change

Look up github_token first, then token, then the environment. Keeping token means callers that construct the notifier directly are unaffected.

Precedence now matches the manager's documented parameter resolution (app_config over env var) and the pattern the other notifiers already follow — SlackNotifier reads slack_webhook_url, its own parameter name.

Tests

tests/test_github_pr_notifier_params.py, mirroring test_slack_notifier_params.py: direct construction and the manager flow, each covering params, environment fallback, and precedence, plus the legacy token key. Four of the eight fail without the change.


Note

Medium Risk
Changes how the GitHub PR notifier resolves API credentials; behavior shifts for dashboard-configured tokens while env and legacy token paths stay supported and are covered by new tests.

Overview
Fixes GitHub PR comments silently failing when the token is supplied through Socket dashboard / app_config as github_token. The notifier now resolves self.token from github_token first, then the legacy token key, then get_github_token() — matching notifications.yaml and the same pattern as SlackNotifier.

Dashboard-configured tokens previously enabled the notifier in NotificationManager but never reached the API, so runs logged no GitHub token available and posted nothing; GITHUB_TOKEN-only setups were unaffected.

Adds tests/test_github_pr_notifier_params.py (direct construction and manager load: params, env fallback, precedence, legacy key) and an [Unreleased] Fixed entry in CHANGELOG.md.

Reviewed by Cursor Bugbot for commit 1ec5579. Configure here.

The GitHub PR notifier resolved its credential from a `token` key, but
the notifier parameter is declared as `github_token` in
notifications.yaml, which is the key the notification manager resolves
dashboard configuration and the GITHUB_TOKEN environment variable into.

A token supplied through dashboard configuration was enough to enable
the notifier but never reached the GitHub API call, so the run logged
`no GitHub token available` and posted no comment. Runs configuring the
token through the environment were unaffected, because the notifier
fell back to reading GITHUB_TOKEN directly.

`token` is still accepted so callers constructing the notifier directly
keep working.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@lelia
lelia requested a review from a team as a code owner September 14, 2026 07:34
@lelia lelia changed the title fix(notifications): read github_token param in GitHub PR notifier fix(notifications): read gh token param in PR notifier Sep 14, 2026
@lelia

lelia commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 1ec5579. Configure here.

@lelia lelia mentioned this pull request Sep 15, 2026
7 tasks
@lelia
lelia merged commit aa57c78 into main Sep 15, 2026
28 checks passed
lelia added a commit that referenced this pull request Sep 15, 2026
#114 landed on main while this branch was open. Both sides added entries
under CHANGELOG [Unreleased] and nothing else overlapped, so the two
sections are kept side by side in Keep a Changelog order: Added and
Changed from this branch, Fixed from #114.
lelia added a commit that referenced this pull request Sep 15, 2026
Release prep for 3.3.0, bundling #114 and #115. #115 adds the
`--scan-all` / `--no-scan-all` CLI flags, so this is a minor bump
rather than a patch.

Bumps pyproject.toml, socket_basics/version.py, socket_basics/__init__.py,
action.yml and uv.lock to 3.3.0, synchronizes 83 current-release references
across README.md and docs/**, and stamps [Unreleased] as [3.3.0] - 2026-09-15.

Also pins the Socket Python CLI to 2.9.0 in Dockerfile.heavy and
app_tests/Dockerfile, ahead of that release publishing to PyPI.
lelia added a commit that referenced this pull request Sep 15, 2026
Release prep for 3.3.0, bundling #114 and #115. #115 adds the
`--scan-all` / `--no-scan-all` CLI flags, so this is a minor bump
rather than a patch.

Bumps pyproject.toml, socket_basics/version.py, socket_basics/__init__.py,
action.yml and uv.lock to 3.3.0, synchronizes 83 current-release references
across README.md and docs/**, and stamps [Unreleased] as [3.3.0] - 2026-09-15.

Also pins the Socket Python CLI to 2.9.0 in Dockerfile.heavy and
app_tests/Dockerfile, ahead of that release publishing to PyPI.
@lelia lelia mentioned this pull request Sep 18, 2026
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