ci: add AI summaries to Slack notifications - #635
Conversation
| repository: ${{ job.workflow_repository }} | ||
| ref: ${{ job.workflow_sha }} |
There was a problem hiding this comment.
Claude AI review
job.workflow_repository and job.workflow_sha are not valid GitHub Actions contexts — the job context only exposes container, services, and status. Both expressions therefore resolve to empty strings.
Impact: the checkout will not pin to the immutable workflow revision as the comment above claims. With an empty ref, actions/checkout falls back to the event's default ref, and an empty repository will either fail the step (making needs.summarize.result != 'success', which skips all three notify jobs and silently drops every Slack notification) or clone an unintended target. Either way the stated "same immutable revision as this workflow" guarantee is not enforced.
Fix: use the documented github contexts. For a workflow defined in this repo, github.repository is the workflow's repository and github.workflow_sha is the commit SHA of the running workflow file.
Also update the corresponding assertions in test_notify_workflow.py (they currently assert the invalid literal strings, so the test passes while the workflow is broken).
| repository: ${{ job.workflow_repository }} | |
| ref: ${{ job.workflow_sha }} | |
| repository: ${{ github.repository }} | |
| ref: ${{ github.workflow_sha }} |
Claude AI reviewThis PR is limited to CI: a new The Python script is generally solid — untrusted GitHub content is passed as user data (not instructions), the model ID is regex-validated, the response is size-bounded, the summary is length-bounded and sanitized (control chars, One confirmed finding (see inline comment): the Residual test risk: Reviewed commit |
| uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0 | ||
| with: | ||
| webhook: ${{ secrets.SLACK_WEBHOOK_URL_PR }} | ||
| webhook-type: incoming-webhook |
There was a problem hiding this comment.
Codex AI review
[P1] Use the webhook-trigger transport for these payloads. An incoming webhook requires text, blocks, or attachments, but all three jobs send only custom workflow variables, so Slack will reject the message as no_text or deliver nothing. Set webhook-type: webhook-trigger in all three jobs, or convert each payload into a valid incoming-webhook message, and assert the transport in the workflow test.
| normalized = normalized.replace("<", "(").replace(">", ")") | ||
| normalized = SLACK_BROADCAST_PATTERN.sub(r"(at \1)", normalized) |
There was a problem hiding this comment.
Codex AI review
[P2] Enforce the no-link/plain-text contract in normalization. Model output may ignore the prompt, and the fallback directly includes the untrusted title. Bare URLs and Slack formatting such as *text* survive these replacements, allowing PR or issue authors to inject clickable or formatted content into Slack. Strip or neutralize URLs and Slack markup in normalize_summary, and add tests covering both model and fallback output.
Codex AI reviewFound two actionable issues, including one that prevents Slack notification delivery. No tests were executed per review constraints. Reviewed commit |
Summary
Testing
hatch run test:all .github/scripts/tests/test_build_lambda_layer.py .github/scripts/tests/test_notify_workflow.py .github/scripts/tests/test_parse_sdk_branch.py .github/scripts/tests/test_summarize_notification.pyhatch fmt --check .github/scripts/summarize_notification.py .github/scripts/tests/test_summarize_notification.py .github/scripts/tests/test_notify_workflow.py