feat: provider-agnostic push outputs for review (stdout/file/webhook/slack)#2510
feat: provider-agnostic push outputs for review (stdout/file/webhook/slack)#2510shmulc8 wants to merge 3 commits into
Conversation
…slack)
Emit /review output to external sinks without calling any git-provider API,
gated behind a disabled-by-default [push_outputs] config section. Channels:
stdout, file (JSONL), generic webhook, and slack (POST {"text": ...} to a
Slack Incoming Webhook — no relay service needed). Non-fatal on error.
Resolves The-PR-Agent#2025
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VcpPDpXKuSesj5xoFqJyfS
PR Summary by QodoAdd provider-agnostic push outputs for /review (stdout/file/webhook/slack)
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
Context used 1. push_outputs unvalidated webhook URLs
|
- Treat env-supplied "false"/"0"/"no"/"" as disabled (mirrors github_action_output), so push_outputs can't be turned on by a string-valued enable flag. - Add teardown fixture to restore global settings after each test. - Use an obviously-fake webhook host in the slack test to avoid secret-scanner noise. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VcpPDpXKuSesj5xoFqJyfS
|
Code review by qodo was updated up to the latest commit bce2968 |
A repo's .pr_agent.toml could otherwise enable push_outputs and set webhook_url/slack_webhook_url/file_path, allowing a malicious repo on a shared PR-Agent host to exfiltrate review data to an arbitrary host, reach internal endpoints (SSRF), or append to arbitrary host files. - Add [push_outputs] to the host-only allowlist with an empty key set, so the whole section can only be configured by the operator (same mechanism as skills.paths). - allow_redirects=False on the webhook/slack POSTs. - Log only the exception type on failure; requests errors embed the secret-bearing URL in their message. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VcpPDpXKuSesj5xoFqJyfS
|
Code review by qodo was updated up to the latest commit 9d4616b |
Description
Resolves #2025 — push PR-Agent review output to external sinks (Slack, a file, or a generic webhook) without calling any git-provider API.
This is a leaner take on the same idea as #2043: it drops the bundled FastAPI relay server. Slack Incoming Webhooks accept
{"text": ...}directly, so a dedicated"slack"channel POSTs to the webhook itself — no extra service to deploy.What changed
pr_agent/algo/utils.py—push_outputs(message_type, payload, markdown). No-op unless[push_outputs].enableis true. Channels:stdout— one JSON linefile— append a JSONL recordwebhook— POST the generic record towebhook_urlslack— POST{"text": markdown}to a Slack Incoming Webhook (slack_webhook_url)Non-fatal: any failure is logged as a warning and never interrupts the run.
pr_agent/settings/configuration.toml— new[push_outputs]section, disabled by default.pr_agent/tools/pr_reviewer.py— emits the review after the markdown is built, independent ofconfig.publish_output(so you still get a Slack ping even when the PR comment is suppressed, e.g. "no major issues").tests/unittest/test_push_outputs.py— disabled-by-default no-op, file channel, slack channel payload, and non-fatal error handling.Meets the issue requirements
type, ISO-UTCtimestamp, structuredpayload, and human-readablemarkdown.Configuration example
Scope / follow-ups
/review(the issue's primary motivation). Extending to/describe,/improve,/askis a one-linepush_outputs(...)call at each tool's final-output site — happy to add if maintainers want it in this PR.🤖 Generated with Claude Code