Skip to content

make way for thirdshift to add screenshots / recordings to PR bodies #1092

Closed

Description

@JacobStephens2

Problem Statement

When a Ticket run or Spec run implements a change that touches rendered UI, HTML, CSS, templates, or visual layout, the resulting pull request body almost never includes before-and-after screenshots or recordings unless the issue body explicitly commands it, even when the agent captures screenshots into /tmp during implementation to inspect its own work.

Three gaps in the Factory skills and Day shift skills cause this:

  1. Test output satisfies the ## Evidence slot in thirdshift-pr and pr: The PR template uses a single - **Before:** <screenshot/output/failing test run> / **After:** <screenshot/output/passing test run> slot and tells the agent to show the failing and passing test "using pseudocode". Because the agent already has test output in context when it reaches the PR step, it fills the slot with test output or DOM measurements instead of visual captures.
  2. No documented headless mechanism to host /tmp screenshots or recordings for GitHub PR bodies: gh pr create and gh pr edit cannot upload local files to github.com/user-attachments/assets/... (which requires browser session cookies), and committing PR-evidence images to the repository bloats git history or triggers unnecessary full-suite test selection. Agents have no standard recipe to turn /tmp/*.png or /tmp/*.gif into permanent HTTPS URLs that render inline in GitHub Markdown.
  3. The "Before" state is already overwritten when the PR skill runs: By the time the agent reads thirdshift-pr (or pr), the Worktree and built binary already reflect the After state on the Issue branch or Spec branch, and neither the implementation skill nor the bug-diagnosis skill instructs the agent to capture the unpatched baseline before editing code.

Solution

Update the Factory skills (thirdshift-pr, thirdshift-implement, thirdshift-diagnosing-bugs) and their Day shift counterparts (pr, implement, diagnosing-bugs), following the writing-for-agents discipline, and regenerate thePrompts and skills page:

  1. Upfront Before and After visual capture during implementation and bug diagnosis: Instruct the agent that when a task touches rendered UI, HTML, CSS, templates, or visual layout and a headless browser is available, it captures /tmp/before-*.png (or .gif for interactive/animated flows) against the unpatched baseline before editing code, and captures matching /tmp/after-*.png (or .gif) from the same viewport and state when verifying the change (1440×900 desktop, plus 390×844 mobile when responsive layout is affected).
  2. Separate Execution Evidence from Visual Evidence in the PR body: Restructure ## Evidence in thirdshift-pr and pr so real failing-before and passing-after execution output (removing "using pseudocode") is always required, and embedded Before and After screenshots or .gif recordings (![Before](...) and ![After](...)) are a separate required item whenever the change is visual and a headless browser is available.
  3. Inline detached-worktree fallback and secret git-pushed Gist hosting recipe in thirdshift-pr and pr: If /tmp/before-* was not captured before editing (for instance, during a Spec review), instruct the agent to capture Before from the Base branch commit using a temporary detached worktree in /tmp and clean it up afterward. Provide the exact shell workflow to publish /tmp .png and .gif captures via a secret git-pushed Gist (gh gist create, git clone, copy binary files, commit, push, and embed https://gist.githubusercontent.com/<owner>/<gist-id>/raw/<commit-sha>/<filename>) so images and animations render natively in GitHub PR bodies without committing binary blobs to the repository branch.

User Stories

  1. As the Day shift reviewing a pull request from a Ticket run or Spec run that changes rendered UI, I want to see embedded Before and After .png screenshots in ## Evidence, so that I can verify the visual change at a glance without checking out the Issue branch locally.
  2. As the Day shift reviewing an interactive, animated, or multi-step UI change, I want to see embedded Before and After .gif recordings in ## Evidence, so that I can see the motion or interaction inline in GitHub Markdown (since raw non-attachment video URLs do not render inline players on GitHub).
  3. As the Day shift reviewing a responsive UI change, I want to see both desktop (1440×900) and mobile (390×844) Before and After captures when responsive layout is affected, so that mobile regressions are caught before merge.
  4. As the Day shift reviewing any pull request, I want ## Evidence to show actual failing-before and passing-after test or command output rather than pseudocode, and to keep execution evidence distinct from visual evidence so passing tests never substitute for screenshots on UI changes.
  5. As an agent running the implement session or bug diagnosis session on a visual issue, I want clear upfront instructions to capture /tmp/before-* against the unpatched baseline before changing code and /tmp/after-* from the identical state and viewport after the change, so that both artifacts are ready when writing the PR body.
  6. As an agent running thirdshift-pr (including during a Spec review where implementation happened in earlier sessions), I want a fallback instruction to capture the Before state from the Base branch in a temporary detached /tmp worktree if /tmp/before-* is not already present, so that Before evidence is never skipped.
  7. As an agent running thirdshift-pr or pr, I want a concrete, copyable shell workflow to host binary .png and .gif files in a secret git-pushed Gist and construct raw gist.githubusercontent.com URLs pinned to the Gist commit SHA, so that images render reliably in GitHub pull requests without leaving stale branches or binary blobs in the repository.
  8. As a maintainer reading the public Prompts and skills page, I want the generated Factory skills section to stay in sync with the updated embedded Factory skills.

Implementation Decisions

  • Apply to both Factory skills and Day shift skills: Update thirdshift-pr, thirdshift-implement, and thirdshift-diagnosing-bugs alongside their Day shift counterparts (pr, implement, and diagnosing-bugs) so headless sessions and interactive sessions share the same standard.
  • Keep Session prompt templates and GLOSSARY.md unchanged: thirdshift's compiled prompts already invoke the implement, diagnosing-bugs, and PR skills (including in Spec review); no new domain terms or ADRs are needed.
  • Follow writing-for-agents principles:
    • Co-locate the visual evidence rules, detached-worktree fallback, and secret git-pushed Gist recipe directly under ### Evidence in the PR skills rather than splitting into a separate reference file.
    • Keep the upfront capture step in the implementation and bug-diagnosis skills to a tight, positive 2-sentence instruction with a clear completion criterion (/tmp/before-* and /tmp/after-* captured at matching viewports and states when the change is visual).
    • Frame instructions positively: state the exact target behavior (embed ![Before](<raw gist URL>) and ![After](<raw gist URL>) from a secret git-pushed Gist; keep repository branches free of PR-evidence media files).
  • Separate Execution and Visual slots in the PR template:
    • In ## Evidence, separate execution evidence (actual command/test output before and after, removing "using pseudocode") from visual evidence (![Before](...) and ![After](...) screenshots or .gif recordings when the change is visual and a headless browser is available).
  • Standardize the secret git-pushed Gist hosting workflow:
    • Because gh gist create rejects binary files over the REST API, instruct the agent to create a secret Gist with a placeholder text file (gh gist create --desc "..."), clone its git URL into a temporary /tmp directory, copy the /tmp/before-* and /tmp/after-* .png or .gif files into the clone, commit and push them, read the Gist owner and HEAD commit SHA, remove the temporary clone, and embed https://gist.githubusercontent.com/<gist-owner>/<gist-id>/raw/<commit-sha>/<filename>.
  • Standardize the detached-worktree fallback for missing Before captures:
    • When writing the PR body for a visual change where /tmp/before-* was not captured beforehand, instruct the agent to create a temporary detached worktree at the Base branch (git worktree add --detach /tmp/before-wt <base>), capture /tmp/before-* from the same viewport and state, and remove the temporary worktree (git worktree remove --force /tmp/before-wt).
  • Regenerate the Prompts and skills page:
    • Run the prompt/skills page generator so the checked-in HTML fragment reflects the updated embedded Factory skills.

Testing Decisions

  • What makes a good test: Verify external, observable contracts—that all embedded Factory skills are valid UTF-8, include their required frontmatter and credits where applicable, and match the generated Prompts and skills page fragment byte-for-byte without drift.
  • Modules and seams to test:
    • Use the existing prompts_page test seam (UPDATE_PROMPTS=1 cargo test prompts_page and cargo test --bin thirdshift prompts_page) to regenerate and verify the checked-in Prompts and skills page against the embedded skills/ directory.
    • Run the existing skill and packaging unit/integration tests (cargo test --bin thirdshift skills::tests and cargo test --test packaging) and site checks (scripts/affected-tests main) to confirm the updated skills and generated site page pass all checks.

Out of Scope

  • Changes to the Rust binary, CLI subcommands, Session prompt functions, or scripts/affected-tests.
  • Downloading or proxying inbound private-repo github.com/user-attachments/assets/... URLs referenced inside issue bodies (.thirdshift-issue.md).
  • External cloud object storage (S3/R2) or orphan media branches in the target repository.

Activity

  1. added
    enhancement
    needs-triage
    on Oct 25, 2026
  2. JacobStephens2 commented on Nov 4, 2026

    @JacobStephens2
    OwnerAuthor

    Retrospective findings from host run traces (local, lima:thirdshift, thirdshift.app, stephens.page, test, orchestrate, dev)

    Checking ~/.thirdshift/logs across the configured hosts and the last 100 PRs in JacobStephens2/thirdshift (plus 60 in Educational-Travel-Adventures/tourbot) shows why screenshots aren't appearing in Ticket-run PR bodies even when agents already capture them during implementation:

    • In the last 100 thirdshift PRs, only 3 (#1603, #1616, #1624) embedded ![...](...) images—and in all 3 cases, the GitHub issue body explicitly instructed the agent to put screenshots in the PR body (#1598: "Screenshot the new view into the PR body"; #1614: "Show Console Inbox and Waterfall screenshots in documentation"; #1623: "Include before and after screenshots in the PR body.").
    • When the issue body does not explicitly command it, 0% of thirdshift UI Ticket runs embed screenshots, even when the agent takes screenshots into /tmp during implementation.

    Root causes

    1. skills/thirdshift-pr/SKILL.md (and .agents/skills/pr/SKILL.md) makes test output satisfy the ## Evidence slot

    • Lines 21–22 of skills/thirdshift-pr/SKILL.md:
      - **Before:** <screenshot/output/failing test run>
        **After:** <screenshot/output/passing test run>
    • Lines 160–162:

      "Screenshots are S-tier - when the environment is set up for it and the change is visual. Execution-based evidence is A-tier. Test results, console output. Show the exact test that now fails and passes, using pseudocode."

    • Because skills/thirdshift-implement/SKILL.md already requires the agent to collect red/green test runs and scripts/affected-tests output, the agent already has test output in context when it reaches /thirdshift-pr and uses it to satisfy <screenshot/output/failing test run>.
    • By contrast, when skills/thirdshift-pr/SKILL.md made ## Test seams, ## Review coverage, and ## Unaddressed findings required sections with concrete completion criteria, compliance across traces was ~100%.

    2. Agents have no documented mechanism to turn a local /tmp/*.png into an HTTPS URL that renders in gh pr create

    gh pr create --body-file / gh pr edit cannot upload local files to github.com/user-attachments/assets/.... Traces across hosts show agents repeatedly taking screenshots into /tmp/*.png, visually inspecting them with Read, and then replacing them with prose or DOM measurements in the PR body because they have no way to attach /tmp/*.png:

    • local (kolotammaman/saint-party issues #2, #5, #7, #8):
      • In 2-20261027T004403-0400~FOtBADqy1eyaEg9L-implement.logs.jsonl, 5-20261027T014658-0400~9D8wO3R2zWDSaO2l-implement.logs.jsonl, and 7-20261027T030633-0400~6b0wN6m5Y37kI5xV-implement.logs.jsonl, the agent launched headless Chrome, saved /tmp/sp-shots/1-revealed.png, /tmp/sp-shots/2-voted.png, /tmp/sp7/run/host.png, and /tmp/sp7/run/editor.png, and called Read on each PNG to verify layout. When writing /tmp/sp-pr-body.md and /tmp/sp7/pr.md, it replaced the screenshots with prose ("headless Chrome over DevTools, emulating a 390×844 mobile viewport... scrollWidth was 390") and markdown tables.
    • [email protected] (JacobStephens2/chart35 issue #335):
      • In 335-20261026T171031-0400~nbwqdhASB4anUhYG-implement.logs.jsonl, the agent added await page.screenshot({ path: process.env.CHART35_HINT_SCREENSHOT }) and ran CHART35_HINT_SCREENSHOT=/tmp/chart35-335-hint-mobile.png node scripts/cycle-start-hint-browser-smoke.mjs, inspected the screenshot, and then wrote only text test assertions in the PR body.
    • jstephens@dev (Educational-Travel-Adventures/tourbot issue #2006):
      • In 2006-20261103T104301-0500~nj4p6oaLzt1OQcen-implement.logs.jsonl, the agent extracted the Playwright screenshot attachment to /tmp/tourbot-2006-after.png, noted "I've inspected the 625px screenshot", and then wrote only npx playwright test pass counts into /tmp/tourbot-2006-pr.md.
    • jstephens@orchestrate (JacobStephens2/thirdshift issue #1262 & Educational-Travel-Adventures/orchestration issue #783):
      • In 1262-20261024T160201+0000~NvY58JsRptj4z1cM-implement.logs.jsonl ("make the stages console web ui view able to take all or nearly the full width of the viewport"), the agent wrote /tmp/ts1262/measure.cjs launching Playwright Chromium against /?page=stages, measured bounding boxes in JS instead of calling page.screenshot(), and put the pixel numbers into /tmp/pr-1262.md.
      • In 783-20261027T155002-0400~r7FOtn59FyMYn4Rn-implement.logs.jsonl, the agent rendered 6 PNGs into /tmp/issue-783-render-mb4o/*.png, then had to run gh pr list --limit 60 --jq '... scan("!\\[[^]]*\\]\\(([^)]+)\\)")' to discover how any prior PR had linked an image. Finding only 1 match in 60 PRs (#1577, which committed docs/evidence/issue-1571/desktop.png and linked ?raw=true), it committed docs/evidence/orchestration-783/*.png and linked https://github.com/.../blob/<sha>/docs/evidence/...?raw=true.

    3. The "Before" state is already overwritten by the time /thirdshift-pr is read

    • src/prompt.rs (prompts/fresh.md) and skills/thirdshift-implement/SKILL.md only direct the agent to skills/thirdshift-pr/SKILL.md after implementation, commits, and thirdshift-code-review are finished.
    • At that point, the worktree and built binary already reflect the After state; capturing a Before screenshot requires checking out <base> (or extracting <base> files into a scratch directory, as the agent in orchestration#783 had to script by hand) and rebuilding.

    4. scripts/affected-tests penalizes docs/screenshots/** with a full Rust suite run

    • In scripts/affected-tests, committing files under docs/screenshots/issue-<n>/*.png hits the else: areas.add("full") fallback (Conservative full-suite selection).
    • In PR #1603 (#1598), committing docs/screenshots/issue-1598/overview-{1440,390}.png forced a full Rust test suite run (2050.14 s / 34 minutes).
    • In PR #1624 (#1623), to stay inside the fast site test area, the agent committed its 6 PR-evidence screenshots under site/screenshots/issue-1623/*.png, which causes site_deploy to deploy PR evidence images to the live site.

    5. Related finding: private-repo github.com/user-attachments/assets/... URLs in .thirdshift-issue.md return 404 to curl

    • On jstephens@dev in tourbot/commands/pickup/2064-20261104T143301-0500~AW2zZTf18bILm8MY-implement.logs.jsonl, the agent tried to fetch the issue's attached screenshot (curl --fail --location ... https://github.com/user-attachments/assets/8ba4089a-0f06-4bd5-ac44-1344d844d5c0 --output /tmp/issue-2064.png), got HTTP 404 because user-attachments on private repos requires browser session/auth cookies, and had to proceed without seeing the issue's screenshot.

    Proposed changes for this issue

    1. Provide a concrete hosting/linking mechanism for PR screenshots (and recordings):
      • Either document a standard repo path (e.g. docs/screenshots/issue-<n>/<name>.png referenced via https://raw.githubusercontent.com/<owner>/<repo>/<head-sha>/docs/screenshots/issue-<n>/<name>.png) and exempt docs/screenshots/** in scripts/affected-tests so it adds no test area of its own;
      • Or provide a small CLI helper / external asset bucket / orphan branch so agents can upload /tmp/*.png and receive a permanent HTTPS URL without committing binary blobs into main.
    2. Move "Before" and "After" screenshot capture into skills/thirdshift-implement/SKILL.md (and skills/thirdshift-diagnosing-bugs/SKILL.md):
      • When an issue touches rendered UI, HTML, CSS, or visual layout, capture the Before screenshot (at desktop 1440×900 and mobile 390×844 when responsive) against the unpatched baseline before/during reproduction, and capture the matching After screenshot when verifying the fix.
    3. Make Before/After screenshots a hard requirement for visual changes in skills/thirdshift-pr/SKILL.md and .agents/skills/pr/SKILL.md:
      • Separate visual evidence from test evidence in ## Evidence so passing test output does not replace ![Before](...) / ![After](...) on UI changes, and remove the "using pseudocode" instruction for test evidence.
      • Regenerate prompts/ and site/prompts/index.html with UPDATE_PROMPTS=1 cargo test prompts_page.
  3. added
    ready-for-agent
    in-progress
    and removed
    needs-triage
    ready-for-agent
    on Nov 4, 2026
  4. removed
    in-progress
    on Nov 5, 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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions