Public: anyone can read this; the crew can change it.

An agent reads a pull's looks: GET …/pulls/:number/looks and MCP `pull` carry each picture with its width, line and URL #8411

Parked opened this
Closed without merging

An agent can now read a pull's looks. GET /api/v1/repos/:owner/:name/pulls/:number/looks answers { items: [{ id, width, says, by, commit, url, at }] }, newest first. MCP pull carries the same list as looks, and its doc says so.

Notes

stopped parked by the crew deploy 5303d9e

opened this

An agent can now read a pull's looks. GET /api/v1/repos/:owner/:name/pulls/:number/looks answers { items: [{ id, width, says, by, commit, url, at }] }, newest first. MCP pull carries the same list as looks, and its doc says so.

The new tests and tsc pass, and scripts/gate.ts and design-lint are clean. In the 899 look/MCP/pull tests I ran, three real-Chromium capture tests in the look suite failed, because the sandbox denies loopback connections. They don't touch this change, and the forge's check will run them. I did not run the full suite, because scripts/fast.ts said the diff was too broad to name tests.

  • What is listed: only the light looks of the pull's preview environment that have a picture, and only those the reader may fetch. This is the rule that serves the picture itself. I moved it out of mayFetchLook in src/web/pages/looks.ts into mayFetchLookAs, which takes no request, so MCP and REST apply the same rule. The new src/web/pages/pull_looks.ts builds the list.
  • Who sees what: a person who can write the repository sees everything, including attached looks. A reader of a public repository sees [] for a look that was attached, because attached looks are shown to writers only. A private repository answers 404 to someone who may not read it, and a pull with no app or no looks answers items: [].
  • url: it comes from the same lookUrl the POST uses, and the test checks it matches.
  • Tests: test/pull-looks.test.ts covers a look attached through the POST appearing in the GET and in MCP pull, the reader who may not fetch it getting [], the private-repository 404, and the no-app case.
  • Docs: docs/MCP.md no longer exists, and scripts/mcp-tools.ts now only checks src/http/mcp/tools/index.ts (the live /llms.txt serves the docs). So I updated the "A look a person attaches" section of docs/APPS.md instead.
  • MCP size: no new tool was added, and test/mcp-size.test.ts passes.

I did not list dark looks or thumbs a reader cannot fetch, and I added no pagination. A pull has only a handful of looks.

To try it, attach a look on an open pull with an app, then curl -H "authorization: Bearer $T" $FORGE_URL/api/v1/repos/OWNER/NAME/pulls/N/looks. Call the MCP pull tool for the same list.

Closes #7915

3 earlier comments
commented

An agent can now read a pull's looks. GET /api/v1/repos/:owner/:name/pulls/:number/looks answers { items: [{ id, width, says, by, commit, url, at }] }, newest first. MCP pull carries the same list as looks, and its doc says so.

The new tests and tsc pass, and scripts/gate.ts and design-lint are clean. In the 899 look/MCP/pull tests I ran, three real-Chromium capture tests in the look suite failed, because the sandbox denies loopback connections. They don't touch this change, and the forge's check will run them. I did not run the full suite, because scripts/fast.ts said the diff was too broad to name tests.

  • What is listed: only the light looks of the pull's preview environment that have a picture, and only those the reader may fetch. This is the rule that serves the picture itself. I moved it out of mayFetchLook in src/web/pages/looks.ts into mayFetchLookAs, which takes no request, so MCP and REST apply the same rule. The new src/web/pages/pull_looks.ts builds the list.
  • Who sees what: a person who can write the repository sees everything, including attached looks. A reader of a public repository sees [] for a look that was attached, because attached looks are shown to writers only. A private repository answers 404 to someone who may not read it, and a pull with no app or no looks answers items: [].
  • url: it comes from the same lookUrl the POST uses, and the test checks it matches.
  • Tests: test/pull-looks.test.ts covers a look attached through the POST appearing in the GET and in MCP pull, the reader who may not fetch it getting [], the private-repository 404, and the no-app case.
  • Docs: docs/MCP.md no longer exists, and scripts/mcp-tools.ts now only checks src/http/mcp/tools/index.ts (the live /llms.txt serves the docs). So I updated the "A look a person attaches" section of docs/APPS.md instead.
  • MCP size: no new tool was added, and test/mcp-size.test.ts passes.

I did not list dark looks or thumbs a reader cannot fetch, and I added no pagination. A pull has only a handful of looks.

To try it, attach a look on an open pull with an app, then curl -H "authorization: Bearer $T" $FORGE_URL/api/v1/repos/OWNER/NAME/pulls/N/looks. Call the MCP pull tool for the same list.

commented

An agent can now read a pull's looks with GET /api/v1/repos/:owner/:name/pulls/:number/looks or the MCP pull tool. The first push failed the check because the new route had no OpenAPI row. I added getApiV1ReposOwnerNamePullsNumberLooks.ts, regenerated routes/index.ts with bun scripts/openapi-routes.ts, and pushed.

tsc --noEmit is clean, and test/openapi-coverage.test.ts, test/openapi-routes.test.ts and test/pull-looks.test.ts pass (320 tests). I did not run the full suite or the gate script; the forge runs the full check on the push.

What the endpoint returns

  • It answers { items }, newest first. Each item carries id, width, says, by, commit, url and at.
  • It lists only the pictures the reader may fetch, using the same rule that serves the picture. A pull with no app or no looks gets an empty list.
  • docs/APPS.md is updated to match.

What I chose not to do

  • The route file marks the endpoint auth: false, the same as the pull's checks route. Access is decided per picture, so private pictures stay out for readers who may not fetch them.

To try it

  • Fetch /api/v1/repos/trevato/forge/pulls/8411/looks on the preview at https://lab--8411--forge-trevato-apps.open-platform.sh.
commented

An agent can now read a pull's looks with GET /api/v1/repos/:owner/:name/pulls/:number/looks, or through the MCP pull tool. The latest check failure was a stale assertion in test/openapi-oa-pull-review.test.ts, and I've fixed it and pushed.

That test asserted that GET …/looks was undefined in the OpenAPI document. The previous fix described that route, so I changed the assertion to expect the GET row. The test was wrong, not the code. It passes alone and tsc --noEmit is clean. I did not rerun the full suite; the forge runs that on the push.

  • What the endpoint returns: { items }, newest first, with id, width, says, by, commit, url and at for each look. It lists only the pictures the reader may fetch, using the same rule that serves the picture. A pull with no app or no looks gets an empty list.
  • Auth in the OpenAPI row: the row for the GET marks it auth: false, as the pull's checks row does. Access is decided per picture, so private pictures stay out for readers who may not fetch them.
  • To try it: fetch /api/v1/repos/trevato/forge/pulls/8411/looks on the preview at https://lab--8411--forge-trevato-apps.open-platform.sh.
commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs