Summary
safe-outputs.mentions.allowed-teams works in Process Safe Outputs but fails during Ingest agent output (collect_ndjson_output.cjs). Mentions are backtick-escaped there with the default GITHUB_TOKEN, so by the time add_comment runs with the correct allowlist, the body is already `@user` and GitHub never notifies.
This is a follow-on to #42225 / #42313: that fix correctly honors pre-resolved aliases in add_comment, but an earlier sanitize path undoes it.
Expected
When safe-outputs.github-token is set (PAT with read:org), both:
- Ingest agent output (
collect_ndjson_output), and
- Process Safe Outputs /
add_comment
should use that token to resolve mentions.allowed-teams and preserve raw @login mentions for team members.
Actual
| Stage |
Token |
Team members |
Mention form |
Agent MCP / safeoutputs.jsonl |
n/a |
n/a |
raw @login |
Ingest agent output (collect_ndjson) |
default GITHUB_TOKEN |
404 on GET /orgs/.../teams/.../members → allowlist collapses to dispatch actor only |
body rewritten to `@login` |
Process Safe Outputs / add_comment |
safe-outputs.github-token |
full team list (e.g. 31 members) |
cannot unwrap already-backticked mentions → posted as `@login` |
Compiled lockfile pattern:
- Ingest agent output: no
github-token: override → GITHUB_TOKEN
- Process Safe Outputs:
github-token: ${{ secrets.… }} from safe-outputs.github-token
Evidence (repro)
Private control-repo workflow with:
safe-outputs:
github-token: ${{ secrets.MY_GH_TOKEN }} # PAT with read:org
mentions:
allowed-teams:
- my-org/my-team
add-comment:
# ...
Ingest logs:
[MENTIONS] Fetching members for 1 configured team(s)
GET /orgs/my-org/teams/my-team/members → 404
[MENTIONS] Cannot access team my-org/my-team (HTTP 404)
[OUTPUT COLLECTOR] Allowed mentions: <dispatch-actor>
Process Safe Outputs logs (same run): team fetch succeeds with the configured PAT; member is on the allowlist; posted comment still has `@member` because agent_output.json was already escaped at ingest.
Related: #42225 / #42313 (add_comment second-pass allowlist). Not caused by the allow-team-members → allowed-collaborators rename.
Suggested fix
One of:
- Wire
safe-outputs.github-token into the Ingest agent output actions/github-script step (same as Process Safe Outputs), so resolve_mentions_from_payload can list team members before sanitizing; or
- Defer mention sanitization until Process Safe Outputs / handlers (where the configured token already runs), and keep ingest as structural validation only.
Option 1 is the smaller behavioral change if ingest must keep sanitizing.
Summary
safe-outputs.mentions.allowed-teamsworks in Process Safe Outputs but fails during Ingest agent output (collect_ndjson_output.cjs). Mentions are backtick-escaped there with the defaultGITHUB_TOKEN, so by the timeadd_commentruns with the correct allowlist, the body is already`@user`and GitHub never notifies.This is a follow-on to #42225 / #42313: that fix correctly honors pre-resolved aliases in
add_comment, but an earlier sanitize path undoes it.Expected
When
safe-outputs.github-tokenis set (PAT withread:org), both:collect_ndjson_output), andadd_commentshould use that token to resolve
mentions.allowed-teamsand preserve raw@loginmentions for team members.Actual
safeoutputs.jsonl@logincollect_ndjson)GITHUB_TOKENGET /orgs/.../teams/.../members→ allowlist collapses to dispatch actor only`@login`add_commentsafe-outputs.github-token`@login`Compiled lockfile pattern:
github-token:override →GITHUB_TOKENgithub-token: ${{ secrets.… }}fromsafe-outputs.github-tokenEvidence (repro)
Private control-repo workflow with:
Ingest logs:
Process Safe Outputs logs (same run): team fetch succeeds with the configured PAT; member is on the allowlist; posted comment still has
`@member`becauseagent_output.jsonwas already escaped at ingest.Related: #42225 / #42313 (add_comment second-pass allowlist). Not caused by the
allow-team-members→allowed-collaboratorsrename.Suggested fix
One of:
safe-outputs.github-tokeninto the Ingest agent outputactions/github-scriptstep (same as Process Safe Outputs), soresolve_mentions_from_payloadcan list team members before sanitizing; orOption 1 is the smaller behavioral change if ingest must keep sanitizing.