Skip to content

Agents can't attach screenshots to pull requests from a session #40

Closed

Description

@fctl-sh

Intro: This might be an issue on private repos.

What is wrong. An agent in an fctl session can't put a screenshot in a pull request. Since 2.99, gh pr create, gh pr edit and gh pr comment take --attach, which uploads an image or video the way dragging it into GitHub's editor does. In a session it fails before it changes anything:

$ gh pr edit 35 --attach after.png
unsupported authentication type

GitHub accepts these uploads only with a person's token, and a session has the GitHub App's installation token (ghs_…). Calling the upload endpoint (POST https://uploads.github.com/user-attachments/assets) directly with it gets a 404. The only other way to show an image in a private repository's pull request is to commit it, and screenshots are never committed. So pull requests that change how fctl looks describe the change in words: #35 checked its UI in Chromium in both themes and at a phone width but shows none of it, and hyperstructure/fctl-site#4 points at its session for the before and after screenshots, which the session doesn't display.

How it works now.

  • The control plane gives sessions installation tokens (installation_token in crates/fctl-control/src/github.rs), and fctl-agent writes them into gh's hosts.yml (write_github_tokens in crates/fctl-agent/src/workspace.rs).
  • gh 2.102 uploads with OAuth tokens, classic and fine-grained personal access tokens, and some GitHub App user-to-server tokens (ghu_…), and only with write access to the repository (internal/attachments/client.go in cli/cli). It refuses installation tokens before it sends anything.
  • Files go one way, from people to agents (ADR 0008). An agent has no way to show people a file, so nobody sees the screenshots it takes.

What should happen

Compatibility. Options 1 and 2 below give agents a new command in the sandbox, which reaches them with a release of the host and agent (hosts may run one version behind the control plane). Option 3 needs no release.

Decisions for a person. How agents in sessions publish screenshots:

  1. As the person who started the session. People link their GitHub account, the control plane keeps a user-to-server token for them, and uploads with it when the agent asks. The images stay private to the repository, like ones dropped in by hand. gh says only some user-to-server tokens are accepted, so this needs a try first.
  2. Hosted by fctl. The agent publishes a file from the sandbox through the session socket; the control plane stores it with the project's files and serves it at an unguessable URL that GitHub's image proxy can fetch, and the session shows it too. Anyone with the URL can see the image, and fctl.sh's privacy policy needs a matching change.
  3. A project secret. A token that can upload (a machine account's fine-grained token with write access), used only for gh … --attach. No code, but a long-lived token sits in every sandbox of the project, and descriptions edited with it show that account as the editor.

Found while writing the screenshots skills.

Session: https://app.fctl.sh/s/ses_01M56CE8ANDXBDMB930CSXN186

Activity

  1. added
    enhancement
    agents
    on Oct 18, 2026
  2. fctl-sh commented on Oct 18, 2026

    @fctl-sh
    ContributorAuthor

    Progress: #71 implements option 2, "Hosted by fctl", and hyperstructure/fctl-site#11 updates the privacy policy, the terms and that repository's screenshots skill. Neither is merged yet.

    What they do

    • In a session's sandbox, fctl publish shot.png publishes a PNG, JPEG, GIF or WebP image of up to 5 MB at https://app.fctl.sh/api/v1/published/<token>/<name>. The token is 256 random bits, and only its hash is stored. GitHub's image proxy can fetch the image, and the agent puts the Markdown fctl prints into the pull request. ~/AGENTS.md tells agents to try gh … --attach first and publish when GitHub refuses.
    • Links expire after 30 days unless the project chooses between 24 hours and 60 days.
    • It is off by default at two levels: instance admins allow it (Admin → Settings, fctl admin set --publish-screenshots on), and each project turns it on in its settings (fctl projects set --publish-screenshots on). Turning either off takes the screenshots offline.
    • The session's transcript shows each published screenshot. People who manage the session can delete one there or with fctl unpublish <link>.
    • Both screenshots skills describe the fallback.

    What is left

    • Short recordings. .webm and .mp4 files aren't published: GitHub doesn't play videos from other hosts in a description, and Safari needs range requests to play them from a link. Animated GIF and WebP work. A person decides whether link-only recordings are worth adding.
    • After the merge and a release, someone turns it on for app.fctl.sh (Admin → Settings) and in the projects that want it, for example fctl and fctl-site. The checklist above can be ticked then.

    Session: https://app.fctl.sh/s/ses_01M57K8M7GHV0F7BR9NN41P6WZ

  3. fctl-sh commented on Oct 18, 2026

    @fctl-sh
    ContributorAuthor

    Checked end to end from an fctl session today (2026-10-18). Screenshots and short recordings work. One gap was left in the skills, and #78 and hyperstructure/fctl-site#14 fix it.

    What I checked

    The checklist

    The two items left in the comment above

    • Turning it on: done, as checked above.
    • Short recordings: an animated WebP plays in the description, so videos aren't needed for the first box. .webm and .mp4 still aren't published. If anyone wants link-only videos as well, that's a new issue.

    Session: https://app.fctl.sh/s/ses_01M57YJF6VBYJZ93Q1ZVZ10QKG

  4. fctl-sh commented on Oct 18, 2026

    @fctl-sh
    ContributorAuthor

    hyperstructure/fctl-site#14 (hyperstructure/fctl-site@1be056d) and #78 (fd2aaba) are merged. Both screenshots skills now say how to show a recording from a session: turn it into an animated WebP and publish that. Sessions read the skills from main, so they follow them now. #78 is docs only, so a release adds nothing but its line in the notes.

    Both boxes are ticked, and the "What is left" items in the earlier comment are settled (see my comment above). Closing.

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

    agentsenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions