Skip to content

[Visual Test] Label preflight pagination skips Lavapipe screenshot capture on run #30689332702 #964

Description

@MichaelFisher1997

Workflow

https://github.com/OpenStaticFish/ZigCraft/actions/runs/30689332702

Failure output

The workspace post-run contained only weston.log; both build-output.log and screenshot.png were absent, indicating the screenshot step never executed. The visual-test step outputs read:

screenshot_exists=false
exists=false   # build-output.log check

No screenshot path error, no Vulkan/device/swapchain output, no Zig compile output, no Lavapipe ICD resolution output were captured, because the workflow short-circuited before the Setup Lavapipe Vulkan and Run menu screenshot capture steps ran.

The visual-test-diagnose.md prompt's hypothesis (screenshot.ppm rejected by screenshot.zig:detectScreenshotFormat) is stale for this run: the workflow on dev already uses -Dscreenshot-path=screenshot.png (.github/workflows/visual-test.yml:81), and modules/engine-graphics/src/vulkan/screenshot.zig:262-268 (detectScreenshotFormat) accepts that extension. The Zig/Vulkan/screenshot code is never exercised because the preflight short-circuits the job first. I verified this by reading the staged 8d205ff (the commit pinned on dev) — visual-test.yml:81 reads zig build run -Dscreenshot-path=screenshot.png -Dskip-present=true, and the only .ppm references left in the source tree are stb_image.h, the unrelated worldgen-climate-snapshot writer, and the stale visual-test-diagnose.md prompt itself.

Diagnosis

Same root cause as #916, #931, #935, #942, #944, #945, #946, #947, #949, #950, #952, #954, #956, #958, #960, #962 (reproduces of the same preflight bug, with PR #953 still proposing the fix on dev). .github/workflows/visual-test.yml:55-68 is the offending step:

- name: Ensure visual-test label exists
  run: |
    if ! gh label list --json name --jq '.[].name' | grep -q '^visual-test$'; then
      gh label create "visual-test" \
        --description "Issues from automated visual regression tests" \
        --color "E06C75"
    fi
    if ! gh label list --json name --jq '.[].name' | grep -q '^run-visual-test$'; then
      gh label create "run-visual-test" \
        --description "Run deterministic visual regression workflow on a PR" \
        --color "E06C75"
    fi
  env:
    GH_TOKEN: ${{ secrets.OPENCODE_PAT }}
  • gh label list --json name defaults to 30 entries per page. The repository now has 41 labels, so visual-test (alphabetical position 21) is still returned, but run-visual-test (alphabetical position 41) is not. I confirmed this locally:

    $ gh label list --json name --jq '.[].name' | grep -E 'visual-test|run-visual-test'
    visual-test
    $ gh label list --json name --limit 100 --jq '.[].name' | grep -E 'visual-test|run-visual-test'
    visual-test
    run-visual-test
    
  • The second if ! ... | grep -q '^run-visual-test$' guard therefore evaluates true and the script tries to create the label.

  • gh label create returns label with name "run-visual-test" already exists; use --force to update its color and description and exits 1.

  • The step has no continue-on-error: true, so all subsequent steps are skipped: Setup Lavapipe Vulkan, Run menu screenshot capture (line 73-87), Check screenshot exists (line 89-97), Check build log exists (line 117-120). Only Start headless Wayland compositor (line 32-33) had already run, leaving weston.log as the sole artifact.

The diagnose prompt's screenshot.ppm hypothesis is stale for this run for two independent reasons:

  1. .github/workflows/visual-test.yml:81 already passes -Dscreenshot-path=screenshot.png, not .ppm.
  2. Even if the workflow did pass .ppm, the screenshot capture path is never reached because the label preflight exits 1 first.

Suggested fix

Two-line fix that resolves the recurring failure and stops future diagnosis agents from being misdirected by the stale prompt:

  1. Make the label preflight idempotent and paginated in .github/workflows/visual-test.yml:55-68:

    - name: Ensure visual-test labels exist
      run: |
        for label in visual-test run-visual-test; do
          if ! gh label list --paginate --json name --jq '.[].name' | grep -q "^${label}$"; then
            gh label create "${label}" \
              --description "Issues from automated visual regression tests" \
              --color "E06C75" || true
          fi
        done
      env:
        GH_TOKEN: ${{ secrets.OPENCODE_PAT }}
  2. Update .github/prompts/visual-test-diagnose.md:7,42 so the prompt no longer assumes -Dscreenshot-path=screenshot.ppm (the workflow has been using .png for a while):

    - 2. Builds and runs the game with Lavapipe (software Vulkan): `zig build run -Dscreenshot-path=screenshot.ppm -Dskip-present=true`
    - 3. The game should render the HomeScreen menu for 5 frames, capture a screenshot as PPM, and exit
    - 4. The PPM is then converted to PNG
    + 2. Builds and runs the game with Lavapipe (software Vulkan): `zig build run -Dscreenshot-path=screenshot.png -Dskip-present=true`
    + 3. The game should render the HomeScreen menu for 5 frames, capture a screenshot as PNG, and exit
    - The game uses `-Dscreenshot-path=screenshot.ppm` which sets `build_options.screenshot_path`
    - This enables screenshot mode: loads HomeScreen instead of WorldScreen, counts frames, captures PPM via Vulkan, then exits
    + The game uses `-Dscreenshot-path=screenshot.png` which sets `build_options.screenshot_path`
    + This enables screenshot mode: loads HomeScreen instead of WorldScreen, counts frames, captures PNG via Vulkan, then exits

    And remove the .ppm-flavored items from the failure-pattern checklist (lines 17-23), or replace them with the actual failure that dominates the workflow today (Ensure visual-test label exists exit 1 with label with name "run-visual-test" already exists).

PR #953 already proposes the workflow fix; the only change needed for this run is merging it and removing the stale .ppm references from the diagnose prompt.

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghotfixquestionFurther information is requestedvisual-testIssues from automated visual regression tests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions