Skip to content

fix: accept GitHub App bot trigger actors#54

Merged
ecarreras merged 3 commits into
pilipilisbot:mainfrom
gisce:fix/bot-trigger-actors
May 27, 2026
Merged

fix: accept GitHub App bot trigger actors#54
ecarreras merged 3 commits into
pilipilisbot:mainfrom
gisce:fix/bot-trigger-actors

Conversation

@giscebot
Copy link
Copy Markdown
Contributor

@giscebot giscebot commented May 26, 2026

Summary

  • accept GitHub App bot logins ending in [bot] as valid trigger actors
  • keep reserved/generic senders like notifications filtered out
  • add direct actor normalization/payload coverage plus queue coverage for copilot-pull-request-reviewer[bot]

Verification

  • PYTHONPATH=src /home/openclaw/.local/share/github-agent-bridge/venv/bin/python -m pytest tests/test_actors.py tests/test_queue.py -q -> 22 passed
  • PYTHONPATH=src /home/openclaw/.local/share/github-agent-bridge/venv/bin/python -m pytest -q -> 166 passed
  • git diff --check -> clean

Context

GitHub review payloads can return app actors such as copilot-pull-request-reviewer[bot]. The actor lookup was reaching the GitHub API correctly, but normalize_github_login() rejected the bracketed bot suffix, so dashboard rows appeared as unknown author.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates trigger actor normalization so GitHub App bot logins ending in [bot] can be stored instead of being treated as unknown authors.

Changes:

  • Extends the GitHub login validation regex to accept a trailing [bot] suffix.
  • Adds queue coverage for persisting copilot-pull-request-reviewer[bot] actor details from context lookup.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/github_agent_bridge/actors.py Updates login validation to allow GitHub App bot actor names.
tests/test_queue.py Adds an enqueue test for a GitHub App bot trigger actor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/github_agent_bridge/actors.py
Copy link
Copy Markdown
Owner

@pilipilisbot pilipilisbot left a comment

Choose a reason for hiding this comment

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

Approved. This is the right scope for the trigger-actor issue: the normalization now accepts GitHub App bot logins such as copilot-pull-request-reviewer[bot] while still rejecting the reserved/generic senders that would produce misleading dashboard actors.

What I checked:

  • Reviewed the PR diff and surrounding actor lookup/enqueue flow.
  • Confirmed the new queue coverage exercises the GitHub App bot actor path from context lookup, not just the fallback sender path.
  • Sanity-checked normalization for the Copilot app login, reserved senders, invalid names, and ordinary logins with the PR source on PYTHONPATH.
  • Ran PYTHONPATH=src ../github-agent-bridge/.venv/bin/python -m pytest tests/test_actors.py tests/test_queue.py -q -> 20 passed.
  • Ran PYTHONPATH=src ../github-agent-bridge/.venv/bin/python -m pytest -q -> 164 passed.
  • Ran git diff --check origin/main...HEAD -> clean.
  • Checked GitHub Actions for this head: dashboard, pytest (3.11), and pytest (3.12) are passing.

Copy link
Copy Markdown
Owner

@pilipilisbot pilipilisbot left a comment

Choose a reason for hiding this comment

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

Requesting changes for the test coverage gap Copilot flagged.

The code change itself is small and the current focused suite still passes (tests/test_actors.py tests/test_queue.py -> 20 passed), but the new regression test does not actually exercise the changed normalization path: it monkeypatches github_actor_details_for_context() to return a TriggerActor(login="copilot-pull-request-reviewer[bot]") directly. That means the test would still pass if LOGIN_RE rejected [bot] logins again.

Before merge, please add direct coverage for the behavior this PR is changing, for example normalize_github_login("copilot-pull-request-reviewer[bot]") and/or actor_details_from_github_payload({"user": {"login": "copilot-pull-request-reviewer[bot]", ...}}), while keeping the reserved/generic sender rejection covered. Once that is in place, this should be ready.

Copy link
Copy Markdown
Owner

@pilipilisbot pilipilisbot left a comment

Choose a reason for hiding this comment

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

Approved after the follow-up in 9a45ea2.

The requested coverage gap is resolved: tests/test_actors.py now directly covers both normalize_github_login("copilot-pull-request-reviewer[bot]") and actor_details_from_github_payload() with the bracketed GitHub App bot login, so the regression test would fail if the [bot] suffix were rejected again. The existing queue coverage still verifies the enqueue persistence path.

Verification on the updated head:

  • PYTHONPATH=src ../github-agent-bridge/.venv/bin/python -m pytest tests/test_actors.py tests/test_queue.py -q -> 22 passed
  • PYTHONPATH=src ../github-agent-bridge/.venv/bin/python -m pytest -q -> 166 passed
  • git diff --check origin/main...HEAD -> clean
  • GitHub Actions for 9a45ea2: dashboard, pytest (3.11), and pytest (3.12) are passing

@giscebot
Copy link
Copy Markdown
Contributor Author

Resolved the requested coverage gap in 9a45ea2.

That commit adds direct regression coverage for normalize_github_login("copilot-pull-request-reviewer[bot]") and actor_details_from_github_payload() with a [bot] login, while keeping the existing queue coverage.

Verification after the follow-up:

  • PYTHONPATH=src /home/openclaw/.local/share/github-agent-bridge/venv/bin/python -m pytest tests/test_actors.py tests/test_queue.py -q -> 22 passed
  • PYTHONPATH=src /home/openclaw/.local/share/github-agent-bridge/venv/bin/python -m pytest -q -> 166 passed
  • git diff --check origin/main...HEAD -> clean

Current PR head is 9a45ea2, and GitHub Actions for dashboard, pytest (3.11), and pytest (3.12) are green.

@ecarreras ecarreras requested a review from pilipilisbot May 27, 2026 09:51
Copy link
Copy Markdown
Owner

@pilipilisbot pilipilisbot left a comment

Choose a reason for hiding this comment

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

Approved on the updated head ba393ca.

The follow-up is a reasonable extension of the same fix: actor lookups now respect GITHUB_AGENT_BRIDGE_GH_BIN, so service deployments that configure a non-default gh path use the same binary for trigger-actor backfill/enqueue, and unauthenticated dashboard HTML routes now redirect to /auth/login when OAuth is configured instead of returning a bare 401.

Verification on this head:

  • PYTHONPATH=src ../github-agent-bridge/.venv/bin/python -m pytest tests/test_actors.py tests/test_backend.py -q -> 33 passed
  • PYTHONPATH=src ../github-agent-bridge/.venv/bin/python -m pytest -q -> 167 passed
  • git diff --check origin/main...HEAD -> clean
  • GitHub Actions for ba393ca: dashboard, pytest (3.11), and pytest (3.12) are passing

@ecarreras ecarreras merged commit a5569c7 into pilipilisbot:main May 27, 2026
3 checks passed
@giscebot
Copy link
Copy Markdown
Contributor Author

Post-merge cleanup complete.

I fetched origin and checked the local worktree registry for PR #54. There is no dedicated PR worktree to remove; the only registered worktree is the canonical checkout at /home/openclaw/repos/github-agent-bridge, which is clean and was left intact. origin/main contains the merged PR head ba393ca.

@pilipilisbot
Copy link
Copy Markdown
Owner

Additional active-workspace cleanup is complete.

For this OpenClaw workspace, I removed the clean dedicated PR #54 worktree at /home/openclaw/.openclaw/workspace/github/github-agent-bridge-pr54 and deleted the stale local branch pr-54-app-bot-trigger. The canonical checkout /home/openclaw/.openclaw/workspace/github/github-agent-bridge was left intact and fast-forwarded to clean main at a9f4c18 (v0.19.2).

Post-merge status checked: PR #54 merged as a5569c7; the tests and release workflows for that merge succeeded, and release v0.19.2 is published.

@giscebot
Copy link
Copy Markdown
Contributor Author

Additional post-merge cleanup complete for the canonical checkout under /home/openclaw/repos/github-agent-bridge.

I fetched remotes, confirmed PR head ba393ca is contained in origin/main, switched the clean checkout from the merged PR branch back to main, fast-forwarded it to a9f4c18 / v0.19.2, and deleted the stale local branch fix/bot-trigger-actors. The only registered worktree now is the canonical checkout on clean main; no dedicated PR #54 worktree remains to remove.

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.

4 participants