Skip to content

'add_labels' does not seem to work anymore since a couple weeks #50631

Closed

Description

@dsibilio

Last evidence of the add_labels on PR working for me points to about ~2w ago: ~Jul 22.

I have a GitHub Agentic Workflow configured as you can see here: https://github.com/Alfresco/alfresco-build-tools/blob/29e190715067f149eb7e54ddbadc153d16a35e72/.github/workflows/supply-chain-review.md

Safe outputs:

safe-outputs:
  add-comment:
    hide-older-comments: true
  add-labels:
    allowed: [security:low, security:medium, security:high]
  remove-labels:
    allowed: [security:low, security:medium, security:high]
  submit-pull-request-review:

Suddenly the GitHub Agentic Workflow stopped labeling PRs successfully. There are no clear errors in the logs, in fact the safe_outputs step logs e.g.:

Requested labels: [{"name":"security:low","rationale":"Dependency upgrades address the fast-uri host-confusion advisory; no malicious supply-chain indicators found. Remaining concerns are limited to missing provenance and fast-uri Scorecard data.","confidence":"HIGH","suggest":true}]
Adding 1 labels to issue #18545 in myOrg/myRepo: [{"name":"security:low","rationale":"Dependency upgrades address the fast-uri host-confusion advisory; no malicious supply-chain indicators found. Remaining concerns are limited to missing provenance and fast-uri Scorecard data.","confidence":"HIGH","suggest":true}]
Successfully added 1 labels to issue #18545 in myOrg/myRepo
📝 Manifest: logged add_labels #18545

The safe-output-items.jsonl artifact looks like this:

{"type":"remove_labels","number":18545,"timestamp":"2026-07-24T15:14:18.115Z"}
{"type":"add_labels","number":18545,"repo":"Alfresco/hxp-frontend-apps","before_state":{"title":"AAE-48934 Bump fast-uri package","body_hash":"23949c393504614aa58fadb6b5f326334c5b0fe159331f8e8baabfa5129ad720","state":"open","labels":[],"assignees":[]},"after_state":{"title":"AAE-48934 Bump fast-uri package","body_hash":"23949c393504614aa58fadb6b5f326334c5b0fe159331f8e8baabfa5129ad720","state":"open","labels":[],"assignees":[]},"labelsAdded":["security:low"],"timestamp":"2026-07-24T15:14:18.799Z"}
{"type":"add_comment","url":"https://github.com/Alfresco/hxp-frontend-apps/pull/18545#issuecomment-5071401093","number":18545,"repo":"Alfresco/hxp-frontend-apps","timestamp":"2026-07-24T15:14:20.011Z"}

but no label is added.

I have also tried recompiling the GH AW with the latest version 0.84.3 and invoking it once more but with no success.

Activity

  1. locked and limited conversation to collaborators on Aug 5, 2026
  2. unlocked this conversation on Aug 5, 2026
  3. linked a pull request that will close this issueFix add_labels silently applying no labels #50637on Aug 5, 2026
  4. pelikhan commented on Aug 5, 2026

    @pelikhan
    Collaborator

    could you run an agent to debug one of your runs asking why it does not generate new labels. The issue team has been adding a new feature "issue intent" and may have messed things up. We have labels added in this repo but also there may be a feature flag enabled that hides a bug.

  5. dsibilio commented on Aug 5, 2026

    @dsibilio
    Author

    could you run an agent to debug one of your runs asking why it does not generate new labels. The issue team has been adding a new feature "issue intent" and may have messed things up. We have labels added in this repo but also there may be a feature flag enabled that hides a bug.

    Comparing a run that worked vs one that didn't work, a Copilot agent using Opus 4.8 produced the following:

    Root cause
    
    This is not a model/prompt problem and not an ingestion-drop problem. The agent correctly emitted remove_labels + add_labels + add_comment in both runs, and all 3 messages were reported "Successful" (matching the Total messages: 3 / Successful: 3 summary in the job log).
    
    The failure is at the actual GitHub API write in the newer gh-aw runtime (v0.84.3):
    
        The add_labels safe-output handler computed labelsAdded: ["security:low"] (its intended change), but when it re-read the PR state to build after_state, the labels array came back empty — i.e. the POST .../issues/{number}/labels call did not actually add the label, yet the handler did not treat this as a failure.
        In the working v0.81.6 run, the same handler's after_state correctly reflected the added label, proving the write landed.
    
    The most likely underlying cause is a permissions/token regression in the label-writing step in the newer lock file. Notice the difference between the two agent jobs:
    
        The agent job in both versions declares:
        YAML
    
        permissions:
          contents: read
          pull-requests: read      ← read-only
    
        Adding/removing labels requires issues: write (labels live on the issues API), which is only granted in the activation job (issues: write, pull-requests: write) — not in the job that runs the safe-output writes in the new topology.
    
    Between v0.81.6 and v0.84.3, gh-aw restructured where/how the safe-output GitHub writes are executed and which token/permission set they use. In the broken run the label write is being attempted with a token that lacks effective issues: write on the PR (or the write is being silently no-op'd by the guard/lockdown sink), so the API call succeeds-without-effect and after_state.labels stays empty — while add_comment (which only needs pull-requests/issues comment scope) still works, which is why the comment posted fine.
    
    The security:low label existing/being empty on before_state is not the issue — the working PR also had security:low absent in before_state; the difference is purely that the write took effect in the old version and did not in the new one.
    Why the comment worked but the label didn't
    
    add_comment writes via the issue-comment path (allowed by the token in the new topology), whereas add_labels/remove_labels require the issues-write scope on the label sub-resource. Only the label operations lost their effective write permission in the v0.84.3 restructure — hence comment posts, label doesn't, and no hard error is surfaced.
    Recommended fix
    
    This must be fixed in the shared source workflow, not in hxp-frontend-apps: Alfresco/alfresco-build-tools/.github/workflows/supply-chain-review.md → recompiled to supply-chain-review.lock.yml.
    
    Options, in order of preference:
    
        Confirm the empty-write is a permission issue: check the "Ingest agent output" / label-application step log in run 30104073037 for a 403/404 or a "resource not accessible by integration" that's being swallowed. If present, this confirms the token/scope regression.
    
        Pin the gh-aw compiler back to the v0.81.x line that produced the working lock file (AWF v0.27.11) until the label-write regression in the newer runtime is fixed, then gh aw compile.
    
        Report upstream to github/gh-aw: the add_labels safe-output handler should treat "requested label not present in after_state" as a failure rather than reporting success with labelsAdded populated — the silent success is what masked this. This is a genuine bug regardless of the permission root cause.
    
        If the new runtime intentionally splits jobs, ensure the job that performs the label safe-output write is granted issues: write (labels require issues-write, not just pull-requests-write)
    

    I guess the Agent is suggesting to put permissions write for both pull-request/issue on the GH AW markdown file I maintain, but these were not necessary before. Is it intended @pelikhan? If so, I can try it and report back.

  6. locked and limited conversation to collaborators on Aug 5, 2026
  7. unlocked this conversation on Aug 5, 2026
  8. dsibilio commented on Aug 5, 2026

    @dsibilio
    Author

    P.S. @pelikhan in previous run that succeeded I did not have these name/rationale fields in the add_labels step in the logs, see successful run:

    Requested labels: ["security:low"]
    Adding 1 labels to issue #18472 in Alfresco/hxp-frontend-apps: ["security:low"]
    Successfully added 1 labels to issue #18472 in Alfresco/hxp-frontend-apps
    📝 Manifest: logged add_labels #18472
    ✓ Message 2 (add_labels) completed successfully
    

    vs failed run:

    Requested labels: [{"name":"security:low","rationale":"Dependency upgrades address the fast-uri host-confusion advisory; no malicious supply-chain indicators found. Remaining concerns are limited to missing provenance and fast-uri Scorecard data.","confidence":"HIGH","suggest":true}]
    Adding 1 labels to issue #18545 in myOrg/myRepo: [{"name":"security:low","rationale":"Dependency upgrades address the fast-uri host-confusion advisory; no malicious supply-chain indicators found. Remaining concerns are limited to missing provenance and fast-uri Scorecard data.","confidence":"HIGH","suggest":true}]
    Successfully added 1 labels to issue #18545 in myOrg/myRepo
    📝 Manifest: logged add_labels #18545
    

    not sure if related / may be a better guess than what the agent had 😄

  9. locked and limited conversation to collaborators on Aug 5, 2026
  10. unlocked this conversation on Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions