Skip to content

RFC 0035: pr_runtime per-candidate environments - #280

Open
rycerzes wants to merge 2 commits into
huggingface:mainfrom
rycerzes:rfc/0035-per-candidate-environments
Open

rycerzes wants to merge 2 commits into
huggingface:mainfrom
rycerzes:rfc/0035-per-candidate-environments

Conversation

@rycerzes

@rycerzes rycerzes commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • RFC 0035 (draft) for the remaining environment work on pr_runtime: one environment built at HEAD and one shared validation container limit yield on older PRs #253: build each candidate's environment at its base commit on a clean toolchain image, validate in the image the task ships (validate: optional fresh container per stage #279's fresh containers, --network none), and accept a candidate only when its own oracle, no-op and regression controls pass there.
  • Revised after review: a "Today" section separating current behaviour from the proposal, build caches as cache mounts outside the shipped image, what stays for offline builds and how dependencies are pinned, the verifier rebuilding native edits offline, network_unenforced as an inconclusive result, and a run-wide LLM spend cap.
  • Evidence (my measurements, with revisions, inputs and commands in the RFC's Measurements table): hugo gives 2 tasks with one environment at the tip, 19 with re-anchored windows and 54 with go mod download at each base. uv sync --frozen does not rebuild pydantic-core when only its Rust sources change (31 of 112 consecutive base pairs).

Test plan

  • npm run build in website/, tools/check-links.mjs (11,546 internal links OK) and tools/check-tutorials.mjs.

Out of scope

Implementation (opt-in environment=candidate, after review). Regenerating published bundles stays on #253. RFC-only PR, per docs/rfcs/index.md (status draft).

@adithya-s-k adithya-s-k left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rycerzes. The hugo/pydantic measurements make the case for candidate-specific dependencies, and requiring the candidate's own gold/base/regression controls is the right gate. I approved CI. I want to tighten a few contracts before accepting this RFC:

  1. Start the toolchain image clean and define the cache boundary. “Bootstrap image without the source” still leaves HEAD-installed packages, editable metadata and native build output. Checking the top-level import path does not cover a compiled dependency such as pydantic-core. Please describe a clean toolchain recipe and keep shared build caches outside the shipped image. Key reusable artifacts on toolchain/image digest, platform, recipe, dependency resolution and relevant source trees—not just lockfiles. uv explicitly documents that its default local-directory cache heuristic can miss source changes.
  2. Make offline dependencies and temporal provenance precise. “Download caches are removed” needs to distinguish unnecessary caches from the registry/source artifacts needed to rebuild offline. Cargo uses its home as both a download and source cache. Also, uv's date cutoff covers registry distributions, not Git dependencies, and does not downgrade an installed package through the pip interface without reinstall. State how Git/URL/path dependencies are pinned and how a PR that introduces a new dependency gets an offline-buildable gold control without exposing its implementation.
  3. Separate proposal from existing behavior and evidence. environment=candidate is not implemented. #279 only isolates stage containers; it does not enforce the shipped verifier's network policy. Make unsupported network enforcement an explicit failure/inconclusive result in the proposed path. Label the timings/yield as contributor measurements and link the exact revisions, inputs and commands before using them to change the default. The existing BOOTSTRAP.md claim about automatic per-PR reinstalls should be corrected too.

Finally, please define a run-wide LLM spend cap in addition to a retry count, so retries cannot multiply the intended budget. These can all be resolved in the design document; I'm not asking for the implementation in this PR. Keeping #253 open for that follow-up and the published-bundle work.

@rycerzes
rycerzes force-pushed the rfc/0035-per-candidate-environments branch from 473dafe to a06965b Compare December 2, 2026 18:32
@rycerzes

rycerzes commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @adithya-s-k, revised. Each point, with the numbers in the new Measurements table:

  1. Toolchain image and caches. The toolchain image has no source, dependencies or build output. Build caches are cache mounts outside the shipped image, and local packages are always rebuilt with --reinstall-package. On pydantic, uv sync --frozen kept a stale pydantic-core after a Rust-only change, as you expected (31 of 112 base pairs).
  2. Offline contents and pinning. Step 5 lists what's kept and removed. Lockfiles already pin Git dependencies to a commit, so step 4 only rejects path dependencies outside the repository, and Git dependencies without a commit when there's no lockfile. A gold patch that needs a dependency the base doesn't have is dropped (step 7): 2 of my 54 hugo tasks.
  3. Today vs proposed. New "Today" section. Unenforceable validation networking gives inconclusive. Harbor rejects an unenforceable verifier policy only after the agent phase (checked on hf-sandbox), which the RFC states. I also found pr_runtime never runs rebuild_cmds, so step 6 adds an offline rebuild in the verifier. Corrections: those runs pinned db619e1, not 0.9.6, and two fingerprint counts were recomputed.
  4. Spend cap. max_run_llm_spend_usd on the campaign BudgetLedger. Unpriced models currently report $0, so a run with a cap refuses them unless a price is set.

@rycerzes
rycerzes requested a review from adithya-s-k December 2, 2026 18:43

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants