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

A pull that comes from another forge runs nothing with secrets until a person says so #8985

Parked opened this
Closed without merging

A pull whose author lives on another forge is now a guest. Until a person with write access approves it once, its check and preview run without the repository's secrets and the crew does not review it.

Notes

stopped parked by the crew

opened this

A pull whose author lives on another forge is now a guest. Until a person with write access approves it once, its check and preview run without the repository's secrets and the crew does not review it. A pull counts as a guest when it was brought in from the origin (its issue has an origin_author) or its head is in a fork there (originHeadRepo).

What changed

  • src/origins/guest.ts decides who is a guest and keeps the one-time approval. Only a person with write access can give it, never an agent. It is stored per pull in the new guest_approval table (migration 20261104090000-guest-approval, pinned).
  • Preview (src/apps/runtime.ts): a guest's preview starts with none of the app's variables and no FORGE_TOKEN.
  • Check (src/checks/secrets.ts, used where the check env is built in src/checks/service.ts): after approval, a pull's check gets the same app variables its preview gets (all and preview scopes). A guest's check gets none, and so does a check of a branch with no pull, so production's variables never reach a check. Variables the forge sets itself always override these.
  • Crew (src/crew/review.ts): sendToReview returns held for a waiting guest.
  • Pull page (src/web/pages/pull-guest.ts, shown on both the pull page and the studio change view): everyone sees a "A guest" notice. Only writers see Approve this guest, a form that posts to /:owner/:name/pulls/:number/approve-guest through readForm (same-origin check and the rw scope). The "Approve to run here" text no longer says the code runs with the owner's app token.
  • docs/features/guest-pulls.md describes all of this.

Look at

  • Checks now get secrets. Before this, no check got any of the repository's secrets. To meet "after approval it does", an approved or local pull's check now gets the variables its own preview already gets for the same code. That is a wider exposure than before and the main thing to review.
  • Running at all is unchanged. A guest whose head is in a fork on another forge still needs "Approve to run here" for each new head (src/core/pull_trust.ts), and the guest approval is a separate, one-time step for secrets and the crew. A guest pull with its branch in this repository already ran; it now runs without secrets. I did not loosen the per-head gate.

Not done

  • The crew guard covers only sending to review, not other ways the crew might act on a pull.
  • I couldn't use the keep_plan tool in this run, so the issue has no plan.

Tests test/guest-pull.test.ts: the guest's check env is {}; after one approval it has API_KEY. A reader's approval is refused; a pull opened here is not a guest and gets its variables. The crew holds a waiting guest. On the page, a reader sees the notice without the button and a writer sees both; a cross-origin POST and a reader's POST change nothing.

The gate, tsc --noEmit and design-lint pass. scripts/fast.ts picked 1,551 test files (about 133 minutes), so I ran 12 that cover the change instead, all passing: guest-pull, approve-here, migrate, crew-review, app-env, studio-changes, kept-fork-landing, pull-page-phases, schema-additive, schema-migrations, security-floor-routes and openapi-routes.

Try it: open a pull, set origin_head_repo on it (or origin_author on its issue), then load its page as a writer and as a reader.

🤖 Generated with Claude Code

Closes #8964

3 earlier comments
commented

A pull whose author lives on another forge is now a guest. Until a person with write access approves it once, its check and preview run without the repository's secrets and the crew does not review it. A pull counts as a guest when it was brought in from the origin (its issue has an origin_author) or its head is in a fork there (originHeadRepo).

What changed

  • src/origins/guest.ts decides who is a guest and keeps the one-time approval. Only a person with write access can give it, never an agent. It is stored per pull in the new guest_approval table (migration 20261104090000-guest-approval, pinned).
  • Preview (src/apps/runtime.ts): a guest's preview starts with none of the app's variables and no FORGE_TOKEN.
  • Check (src/checks/secrets.ts, used where the check env is built in src/checks/service.ts): after approval, a pull's check gets the same app variables its preview gets (all and preview scopes). A guest's check gets none, and so does a check of a branch with no pull, so production's variables never reach a check. Variables the forge sets itself always override these.
  • Crew (src/crew/review.ts): sendToReview returns held for a waiting guest.
  • Pull page (src/web/pages/pull-guest.ts, shown on both the pull page and the studio change view): everyone sees a "A guest" notice. Only writers see Approve this guest, a form that posts to /:owner/:name/pulls/:number/approve-guest through readForm (same-origin check and the rw scope). The "Approve to run here" text no longer says the code runs with the owner's app token.
  • docs/features/guest-pulls.md describes all of this.

Look at

  • Checks now get secrets. Before this, no check got any of the repository's secrets. To meet "after approval it does", an approved or local pull's check now gets the variables its own preview already gets for the same code. That is a wider exposure than before and the main thing to review.
  • Running at all is unchanged. A guest whose head is in a fork on another forge still needs "Approve to run here" for each new head (src/core/pull_trust.ts), and the guest approval is a separate, one-time step for secrets and the crew. A guest pull with its branch in this repository already ran; it now runs without secrets. I did not loosen the per-head gate.

Not done

  • The crew guard covers only sending to review, not other ways the crew might act on a pull.
  • I couldn't use the keep_plan tool in this run, so the issue has no plan.

Tests test/guest-pull.test.ts: the guest's check env is {}; after one approval it has API_KEY. A reader's approval is refused; a pull opened here is not a guest and gets its variables. The crew holds a waiting guest. On the page, a reader sees the notice without the button and a writer sees both; a cross-origin POST and a reader's POST change nothing.

The gate, tsc --noEmit and design-lint pass. scripts/fast.ts picked 1,551 test files (about 133 minutes), so I ran 12 that cover the change instead, all passing: guest-pull, approve-here, migrate, crew-review, app-env, studio-changes, kept-fork-landing, pull-page-phases, schema-additive, schema-migrations, security-floor-routes and openapi-routes.

Try it: open a pull, set origin_head_repo on it (or origin_author on its issue), then load its page as a writer and as a reader.

🤖 Generated with Claude Code

commented

A pull whose author lives on another forge is now a guest. Until a person with write access approves it once, its check and preview run without the repository's secrets and the crew does not review it. A pull counts as a guest when it was brought in from the origin (its issue has an origin_author) or its head is in a fork there (originHeadRepo).

What changed

  • src/origins/guest.ts decides who is a guest and keeps the one-time approval. Only a person with write access can give it, never an agent. It is stored per pull in the new guest_approval table (migration 20261104090000-guest-approval, pinned).
  • Preview (src/apps/runtime.ts): a guest's preview starts with none of the app's variables and no FORGE_TOKEN.
  • Check (src/checks/secrets.ts, used where the check env is built in src/checks/service.ts): after approval, a pull's check gets the same app variables its preview gets (all and preview scopes). A guest's check gets none, and so does a check of a branch with no pull, so production's variables never reach a check. Variables the forge sets itself always override these.
  • Crew (src/crew/review.ts): sendToReview returns held for a waiting guest.
  • Pull page (src/web/pages/pull-guest.ts, shown on both the pull page and the studio change view): everyone sees a "A guest" notice. Only writers see Approve this guest, a form that posts to /:owner/:name/pulls/:number/approve-guest through readForm (same-origin check and the rw scope). The "Approve to run here" text no longer says the code runs with the owner's app token.
  • docs/features/guest-pulls.md describes all of this.
  • The first check failed because no commit message had a "Why now:" or "Try:" line. A new empty commit adds them, and the gate now passes locally against the merge base.

Look at

  • Checks now get secrets. Before this, no check got any of the repository's secrets. To meet "after approval it does", an approved or local pull's check now gets the variables its own preview already gets for the same code. That is a wider exposure than before and the main thing to review.
  • Running at all is unchanged. A guest whose head is in a fork on another forge still needs "Approve to run here" for each new head (src/core/pull_trust.ts), and the guest approval is a separate, one-time step for secrets and the crew. A guest pull with its branch in this repository already ran; it now runs without secrets. I did not loosen the per-head gate.

Not done

  • The crew guard covers only sending to review, not other ways the crew might act on a pull.
  • I couldn't use the keep_plan tool in this run, so the issue has no plan.

Tests test/guest-pull.test.ts: the guest's check env is {}; after one approval it has API_KEY. A reader's approval is refused; a pull opened here is not a guest and gets its variables. The crew holds a waiting guest. On the page, a reader sees the notice without the button and a writer sees both; a cross-origin POST and a reader's POST change nothing.

The gate, tsc --noEmit and design-lint pass. scripts/fast.ts picked 1,551 test files (about 133 minutes), so I ran 12 that cover the change instead, all passing: guest-pull, approve-here, migrate, crew-review, app-env, studio-changes, kept-fork-landing, pull-page-phases, schema-additive, schema-migrations, security-floor-routes and openapi-routes. After the message fix I re-ran guest-pull and approve-here, which pass.

Try it: on the preview, open a pull whose head is marked as from another forge (origin_head_repo set). The page shows "A guest", a writer sees Approve this guest, and a reader does not.

🤖 Generated with Claude Code

commented

This pull marks a pull from another forge as a guest. Its check and preview run without the repository's secrets or the forge token, and the crew doesn't review it until a person who can write the repository approves it once. The approval is a same-origin form on the pull page (src/origins/guest.ts, src/web/pages/pull-guest.ts). It is separate from the existing per-head "approve to run here".

Fix for the red check:

  • "a paused reviewer sends nothing": sendToReview checked whether a pull was a waiting guest before checking the reviewer seat. That made a paused or empty seat answer "held" instead of "none", and a test stub without originHeadRepo counted as a guest. The guest check now comes after the seat check. When there's no reviewer, nothing is sent, so there's nothing for the guest hold to stop.
  • Guest review test: test/guest-pull.test.ts had the same ordering assumption baked in. That test was wrong, not the code. It now seats a reviewer, so the guest hold is what stops the pull. With the guard removed, it fails.
  • "the repository, issues and pulls pages are lighter…": I couldn't reproduce this one. It passes here three times in a row, both before and after merging current main. On the test fixture the three pages are byte-for-byte the same size on this branch and on main (25,401 / 51,204 / 24,612), about 140–150 bytes under budget. Nothing this pull renders shows up on them. The forge's full check on this push will show whether it still fails.
  • Also: main is merged in, and a doc comment I'd moved by mistake in src/apps/runtime.ts is back where main has it.

scripts/gate.ts, bun x tsc --noEmit and the covering tests pass: guest-pull, seat-slots, crew-loop, holds and repo-head-quiet.

To try it: open a pull whose head is in a fork on the origin forge. As a writer, the pull page shows a "guest" card with an approve button; a reader sees the card without the button. Its preview starts with no app variables until it is approved.

🤖 Generated with Claude Code

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