Skip to content

Scope pull request uploads to the pull request #16

Open

Description

@wan9chi

Motivation

A pull request can't reuse cache entries from its own earlier runs. Only push jobs on the namespace's default branch can upload (src/auth.ts), so pull_request runs get 403 write_policy and can only restore what the default branch published. After each new push to a PR, tasks whose inputs differ from the default branch rebuild, even if the PR's previous run already built them.

Uploading PR results into the namespace itself would let unreviewed PR code publish entries that default-branch builds restore, so PR entries need their own scope.

Proposal

  • A pull_request run uploads to a scope for its PR, derived from the token's ref claim (refs/pull/<n>/merge).
  • PR runs read their PR scope first, falling back to the default branch. Default-branch builds never read PR scopes.
  • Default-branch publishing is unchanged.

This covers same-repository PRs only; fork PR runs in public repositories don't get id-token: write.

Open questions

  • Endpoint: how a client addresses a PR scope (e.g. /projects/<namespace>/pulls/<n>), with the write policy checking that the token's ref matches it.
  • Fallback: the server could serve default-branch entries on a PR-scope miss, or vp run (vite-task) could read both endpoints.
  • Retention: PR scopes should expire soon after the PR closes or goes idle, within the namespace's limits.

Activity

  1. jasonkuhrt commented on Nov 28, 2026

    @jasonkuhrt

    Written by an AI agent (Gemini 4 Neon) on behalf of @jasonkuhrt.

    Return candidates from both scopes in one PR /fetch response. With RFC 0003, a PR can upload an entry for a task, then revert the input change. The lookup key stays the same, but the PR entry fails input validation. A default-branch entry can still match if the response includes it.

    sequenceDiagram
        participant PR as PR 42 (vp run)
        participant S as Server (/projects/docs/pulls/42)
        participant P as PR 42 scope
        participant M as Default-branch scope
        Note over PR,M: Default branch stored E_main (a.ts=v1) under key K.<br/>PR 42 edited a.ts=v2 and stored E_pr under key K.<br/>PR 42 now reverts a.ts=v1.
        PR->>S: POST /fetch (key K)
        alt Fallback on PR-scope miss only
            S->>P: selectEntries(pr:42, K)
            P-->>S: [E_pr]
            S-->>PR: exact [E_pr]
            Note over PR: E_pr fails input check -> MISS (E_main never seen)
        else Merged read across [pr:42, default]
            S->>P: selectEntries(pr:42, K)
            S->>M: selectEntries(default, K)
            S-->>PR: exact [E_pr, E_main]
            Note over PR: E_pr fails input check, E_main validates -> HIT
        end
    
    Loading

    Keep candidates from each scope represented within the response budget. Resolve a returned blob through the same scopes the fetch could read. The default-branch endpoint should continue to read only its own scope.

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

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions