Skip to content

TestWorkflowSHAUsesAreTrusted fails on main after #9206 #9720

Closed

Description

@waynesun09

Problem

TestWorkflowSHAUsesAreTrusted (internal/scaffold/pr_trigger_test.go) fails on main at e2bf219, so test is red on every PR and merge-queue entry.

--- FAIL: TestWorkflowSHAUsesAreTrusted/.github/workflows/reusable-dispatch.yml
    pr_trigger_test.go:150: ... should not contain "job.workflow_sha"
    Messages: job.workflow_sha must be read through the trusted expression: if encoded="$(gh api "repos/${{ job.workflow_repository }}/contents/.github/scripts/report-agent-startup-failure.sh?ref=${{ job.workflow_sha }}" --jq .content)"; then
--- FAIL: TestWorkflowSHAUsesAreTrusted/.github/workflows/reusable-prioritize.yml

Cause

The two PRs merged one after the other, and each was green alone:

The trusted expression is the one every checkout ref and CLI version input already uses:

(github.event_name == 'pull_request' && job.workflow_sha == github.sha && github.event.pull_request.base.sha || job.workflow_sha)

On a same-repo pull_request run of fullsend's own workflows, job.workflow_sha is the PR's merge commit (github.sha). The bare read therefore runs the failure reporter from the PR's code, not from the base branch.

The nine lines with the bare read are all if encoded="$(gh api ".../report-agent-startup-failure.sh?ref=${{ job.workflow_sha }}" --jq .content)"; then:

  • .github/workflows/reusable-dispatch.yml: 1653, 1828, 2044, 2352, 2505, 2636, 2835, 3106
  • .github/workflows/reusable-prioritize.yml: 243

Fix

In those nine lines, replace ${{ job.workflow_sha }} with ${{ (github.event_name == 'pull_request' && job.workflow_sha == github.sha && github.event.pull_request.base.sha || job.workflow_sha) }}, matching the checkout refs.

Scope for the code agent

Nothing under .github/workflows/. The workflow edits follow in the same PR after a maintainer takes it over.

  • Improve the failure message in TestWorkflowSHAUsesAreTrusted: name the workflow file and the 1-based line number, so the next failure points at the exact line.
  • Keep the test's rule unchanged.

Done when

  • go test ./internal/scaffold/... passes on the PR, and test is green.
  • No ${{ job.workflow_sha }} read in either reusable workflow bypasses the trusted expression.

Relates to #9206, #9230.

Activity

  1. waynesun09 commented on Nov 19, 2026

    @waynesun09
    MemberAuthor

    /fs-code
    Do not sign off. No git commit -s, no Signed-off-by trailer.

  2. fullsend-ai-triage commented on Nov 19, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 9:57 PM UTC · Completed 9:59 PM UTC

    Commit: e2bf219 · View workflow run →

    Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.17

  3. fullsend-ai-coder commented on Nov 19, 2026

    @fullsend-ai-coder
    Contributor

    🤖 Code · ❌ Terminated · Started 9:58 PM UTC · Ended 10:08 PM UTC

    Commit: e2bf219 · View workflow run →

  4. added
    triaged
    on Nov 19, 2026
  5. fullsend-ai-triage commented on Nov 19, 2026

    @fullsend-ai-triage

    Triage confirmed the report against main at e2bf219. The nine bare job.workflow_sha reads sit at the lines listed in the issue, and the test's rule is as described.

    Warning: workflow changes required. The core fix edits files under .github/workflows/. The code agent cannot modify those files under current permissions, so a maintainer or human PR has to make that edit. Until then test stays red.

    Code-agent scope (no workflow edits): improve the TestWorkflowSHAUsesAreTrusted failure message in internal/scaffold/pr_trigger_test.go so it names the workflow file and the 1-based line number. The rule stays unchanged.

    No open PR addresses this issue yet.

    Proposed test case:

    Given a workflow with a bare job.workflow_sha read on a known line,
    when TestWorkflowSHAUsesAreTrusted runs, then the failure message
    includes the workflow file name and that line's 1-based number.
    Given the fixed reusable-dispatch.yml and reusable-prioritize.yml,
    the test passes and still counts at least one job.workflow_sha use.
    

    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
  6. fullsend-ai-coder commented on Nov 19, 2026

    @fullsend-ai-coder
    Contributor

    🤖 Finished Code · ✅ Success · Started 9:58 PM UTC · Completed 10:08 PM UTC

    Commit: e2bf219 · View workflow run →

    Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $0.80

  7. added a commit that references this issue on Nov 19, 2026
    141c9a3
  8. added a commit that references this issue on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtriaged

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions