Skip to content

Keep the scheduler CPU grant out of local readiness receipts - #1698

Merged
mergify[bot] merged 1 commit into
mainfrom
lean178/1596-scheduler-grant-fingerprint
Nov 26, 2026
Merged

mergify[bot] merged 1 commit into
mainfrom
lean178/1596-scheduler-grant-fingerprint

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Keep the scheduler CPU grant out of local readiness receipts

Context and goal

  • Context: IntelFlo #14604 allowlists HEAVY_SLOT_GRANTED_CORES to size workers to the slot reservation.
  • Problem: The inherited grant is transient. A passing slotted check cannot supply an ordinary unslotted ready receipt when the value is included in the digest.
  • Goal: Exclude only the inherited local scheduler grant from the readiness fingerprint while still forwarding it into the sandbox.

Closes #1596

Acceptance

  • A passing local check made with grant 2 is accepted at the same head with a different or absent inherited grant.
  • An allowlisted non-grant input and an explicit check-environment grant still invalidate the receipt when changed.
  • Preserve stage reuse keys and the delegated runner identity and environment checks.
  • IntelFlo main, #14605 head and the base recorded by its check jobs do not allowlist the grant. #14604 does. This fix is independent of host-config Prepare Mergify repository adoption #198.

Security notes

The trusted base still owns what enters the sandbox. The exception applies only to the inherited worker-count input of local checks, never to PATH, locale, explicit check settings, delegated runners, or the stage cache. No check is skipped and no environment value is recorded in the receipt.

Validation

Recorded for 0142601d03b7

  • uv run --group dev ruff check src tests: exit 0
  • uv run --group dev tach check: exit 0
  • uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0
  • scripts/size_budget.sh: exit 0
  • uv run --group dev pytest -q: exit 0

The unfixed check passed with the grant forwarded but rejected the saved receipt when the value changed. The fixed readiness predicate accepts changed and absent inherited grants, rejects a changed ordinary allowlisted input, and still runs keyed stages fresh after the grant changes. Focused sandbox tests: 20 passed. The architecture guide now records the exception.

Security review

The trusted allowlist and commands still define what runs. The exemption does not change sandbox forwarding, configured environment values, stage keys, runner identity, head matching, or receipt publication. IntelFlo's production consumer validates the grant for worker sizing. No blocking security findings.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Review

  • primary, claude, 0142601, approve

Co-Authored-By: Codex <noreply@openai.com>

@loopzero-feder-positronics loopzero-feder-positronics Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

loopzero primary review by claude on 0142601d03b72cfdd4341d0f773b62f045d62f32, 35.3s: approve (0 critical, 0 important, 2 suggestion)

Settings per native call (launch configuration and CLI claims, not backend attestation):

  • Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)

Native Claude output is retained in the restricted local review receipt.

Comment thread src/loopzero/sandbox.py
settings = _execution_settings(config, base)
if config.check_runner and settings["runner_executable"] is None:
return None
if not config.check_runner and "HEAVY_SLOT_GRANTED_CORES" not in config.env:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: The explicit-grant guard never applies because config.env holds (name, value) pairs

Config.env is declared as tuple[tuple[str, str], ...] in types.py:44. Because of that, "HEAVY_SLOT_GRANTED_CORES" not in config.env compares the string against pairs, so it is always True. The grant is therefore removed from settings["environment"] even when it was set explicitly in checks.env.

The acceptance criterion still holds today, but only by accident: _execution_settings also copies the raw env field from asdict(config) into the digest, so a changed explicit value still changes the fingerprint. The guard looks like it does something it doesn't. If the redundant env key is ever dropped from the settings, the bug will surface silently.

Smallest fix: test against dict(config.env), or {name for name, _ in config.env}. Also add a test case that sets the grant through checks.env, changes its value, and asserts that _current_check_report returns None. That would cover the second acceptance bullet, which has no test right now.

Comment thread src/loopzero/sandbox.py
settings = _execution_settings(config, base)
if config.check_runner and settings["runner_executable"] is None:
return None
if not config.check_runner and "HEAVY_SLOT_GRANTED_CORES" not in config.env:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: A variable name from one downstream project is hardcoded into a generic fingerprint

The exemption names HEAVY_SLOT_GRANTED_CORES directly inside settings_fingerprint. It applies to any project that allowlists that name, whatever the project uses the value for. Readiness then ignores a value that the trusted base forwards into the sandbox, and nothing here confirms the value only controls worker count.

This is acceptable as a narrow fix. Moving the name to a module-level constant next to SANDBOX_ENV, with a comment explaining why it is excluded, would make the exception easier to find. It would also make it easier to replace later with a configurable list of transient inputs.

@eowca
eowca marked this pull request as ready for review November 26, 2026 08:36
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Merged into main as 4e1c0a4 at 08:42 UTC

4 min in the queue, 3 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 08:37 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1719
  • ✅ Merged 08:42 · 4e1c0a4 · squash
3 merge conditions met
  • github-review-approved · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = checks
    • check-neutral = checks
    • check-skipped = checks
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = Loop-zero Eligibility
    • check-neutral = Loop-zero Eligibility
    • check-skipped = Loop-zero Eligibility

Times in UTC · dashboard · how the merge queue works

@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

No description provided.

@mergify
mergify Bot merged commit 4e1c0a4 into main Nov 26, 2026
18 checks passed
@mergify mergify Bot removed the queued label Nov 26, 2026
@eowca
eowca deleted the lean178/1596-scheduler-grant-fingerprint branch November 26, 2026 08:42
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.

Scheduler CPU grant in sandbox allowlist breaks readiness receipt fingerprint

1 participant