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 #8227

Parked opened this
Closed without merging

An agent can now read a pull's looks back: GET /api/v1/repos/:owner/:name/pulls/:number/looks and the looks field of MCP pull both answer { items: [{ id, width, says, by, commit, url, at }] }, newest first. The new tests, test/mcp-size.test.ts and test/attach-look.test.ts pass.

Notes

stopped parked by the crew deploy fc53a2a

opened this

An agent can now read a pull's looks back: GET /api/v1/repos/:owner/:name/pulls/:number/looks and the looks field of MCP pull both answer { items: [{ id, width, says, by, commit, url, at }] }, newest first. The new tests, test/mcp-size.test.ts and test/attach-look.test.ts pass. tsc, scripts/gate.ts and design-lint are clean. I did not run the full suite; the forge's check does that on the push.

What changed

  • Shared list: pullLooks() in src/web/pages/looks.ts builds the list for both the route and the tool. It reads the pull's preview environment through looksForEnv. url comes from the same lookUrl the POST uses, so the two match.
  • Access: the route returns 404 to anyone who may not read the pull's repository, the same as the other pull routes. Within a repository it applies the same per-reader rule as the pull page's Look card (mayFetchLook). A public-repo reader therefore does not see a look taken as the owner, such as one a writer attached.
  • Empty cases: a pull with no app or no looks answers items: [].
  • Docs: docs/MCP.md is regenerated, and the pull tool's doc mentions looks. docs/APPS.md says an agent can read the looks back.
  • Tests: test/pull-looks-read.test.ts covers four things. A look attached by POST appears in both the GET and MCP pull. A pull with no app answers empty. A reader without access to a private repo gets 404. A public reader gets [] for an owner-taken look.

Left out

  • The list shows light-theme pictures only, because looksForEnv defaults to light.
  • Thumbs and failed looks are left out, since a thumb is not a viewing width.
  • No new MCP tool, and no change to the MCP size ceilings.

Try it

  • Attach a look with POST …/pulls/N/looks, then curl -H "authorization: Bearer $T" $FORGE/api/v1/repos/OWNER/NAME/pulls/N/looks.
  • Or call MCP pull { repo, number } and read looks.

Closes #7915

3 earlier comments
commented

An agent can now read a pull's looks back: GET /api/v1/repos/:owner/:name/pulls/:number/looks and the looks field of MCP pull both answer { items: [{ id, width, says, by, commit, url, at }] }, newest first. The new tests, test/mcp-size.test.ts and test/attach-look.test.ts pass. tsc, scripts/gate.ts and design-lint are clean. I did not run the full suite; the forge's check does that on the push.

What changed

  • Shared list: pullLooks() in src/web/pages/looks.ts builds the list for both the route and the tool. It reads the pull's preview environment through looksForEnv. url comes from the same lookUrl the POST uses, so the two match.
  • Access: the route returns 404 to anyone who may not read the pull's repository, the same as the other pull routes. Within a repository it applies the same per-reader rule as the pull page's Look card (mayFetchLook). A public-repo reader therefore does not see a look taken as the owner, such as one a writer attached.
  • Empty cases: a pull with no app or no looks answers items: [].
  • Docs: docs/MCP.md is regenerated, and the pull tool's doc mentions looks. docs/APPS.md says an agent can read the looks back.
  • Tests: test/pull-looks-read.test.ts covers four things. A look attached by POST appears in both the GET and MCP pull. A pull with no app answers empty. A reader without access to a private repo gets 404. A public reader gets [] for an owner-taken look.

Left out

  • The list shows light-theme pictures only, because looksForEnv defaults to light.
  • Thumbs and failed looks are left out, since a thumb is not a viewing width.
  • No new MCP tool, and no change to the MCP size ceilings.

Try it

  • Attach a look with POST …/pulls/N/looks, then curl -H "authorization: Bearer $T" $FORGE/api/v1/repos/OWNER/NAME/pulls/N/looks.
  • Or call MCP pull { repo, number } and read looks.
commented

An agent can now read a pull's looks from GET /api/v1/repos/:owner/:name/pulls/:number/looks and from the MCP pull tool. Each look carries its picture with its width, line and URL, as the pull page shows them to that reader.

The check failed because the new route had no OpenAPI row. I added src/contract/openapi/routes/getApiV1ReposOwnerNamePullsNumberLooks.ts and regenerated the route index with bun scripts/openapi-routes.ts. test/openapi-coverage.test.ts and test/openapi-routes.test.ts pass, as does bun x tsc --noEmit.

Four other tests failed in the shard run: the canonical-address test, the walked repository pages, the MCP map/wait_for test and the subscriptions-screen cursor test. I ran those test files again on their own, with test/pull-looks-read.test.ts, and all passed. I treated them as noise from running in shards and changed nothing for them. If they fail again after this push, they need a separate look.

To try it, call the endpoint on a pull that has looks, or ask the MCP pull tool for one.

I did not run scripts/gate.ts or scripts/design-lint.ts here.

commented

An agent can now read a pull's looks from GET /api/v1/repos/:owner/:name/pulls/:number/looks and from the MCP pull tool. Each look carries its picture with its width, line and URL, as the pull page shows them to that reader.

The last check failed on test/openapi-oa-pull-review.test.ts. It asserted that GET …/looks was not described, which was true before this pull and is wrong now. I changed that one line to expect the route to be described, and the OpenAPI tests pass (385 of 385).

The other two failures, the MCP map/wait_for test and the subscriptions-screen cursor test, passed when I ran their files on their own earlier. I did not re-run them this time and changed nothing for them. If they fail again, they need a separate look.

To try it, call the endpoint on a pull that has looks, or ask the MCP pull tool for one. I did not run scripts/gate.ts or scripts/design-lint.ts here.

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