Skip to content
This repository was archived by the owner on Aug 3, 2026. It is now read-only.

validator: subprocess-isolate op4 canonical eval (corrected #61) - #75

Merged
bitzic merged 3 commits into
mainfrom
fix/op4-subprocess-isolation
Jun 28, 2026
Merged

validator: subprocess-isolate op4 canonical eval (corrected #61)#75
bitzic merged 3 commits into
mainfrom
fix/op4-subprocess-isolation

Conversation

@bitzic

@bitzic bitzic commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Supersedes PR#61 with its critical env-leak fixed + reconciled onto main.

  • extract shared _run_eval_subprocess: BOTH the canonical and patched op4 paths now run eval_in_workdir.py in a child process, so a fatal CUDA fault (illegal access / device-side assert) kills only the child and the validator rejects the bundle instead of aborting (a C++ CUDA abort can't be caught in-process). The default RALPH_SANDBOX=0 path gains crash-resilience the container only provides when enabled.
  • KEEPS env sanitization: the child gets env=_sanitized_env(...) (no seal privkey / wallet / tokens) + _redacted stderr. PR#61's first cut DROPPED this, silently reverting PR#70 and leaking RALPH_VALIDATOR_PRIVKEY to miner code. New test asserts no secret reaches the subprocess (the gap CI missed).
  • integrated with the now-merged op4 result cache + RALPH_SANDBOX dispatch (PR#61 was on a stale pre-sandbox/pre-cache base)
  • drop now-unused run_hidden_eval import

bitzic and others added 3 commits June 28, 2026 16:07
Supersedes PR#61 with its critical env-leak fixed + reconciled onto main.

- extract shared _run_eval_subprocess: BOTH the canonical and patched op4
  paths now run eval_in_workdir.py in a child process, so a fatal CUDA fault
  (illegal access / device-side assert) kills only the child and the validator
  rejects the bundle instead of aborting (a C++ CUDA abort can't be caught
  in-process). The default RALPH_SANDBOX=0 path gains crash-resilience the
  container only provides when enabled.
- KEEPS env sanitization: the child gets env=_sanitized_env(...) (no seal
  privkey / wallet / tokens) + _redacted stderr. PR#61's first cut DROPPED this,
  silently reverting PR#70 and leaking RALPH_VALIDATOR_PRIVKEY to miner code.
  New test asserts no secret reaches the subprocess (the gap CI missed).
- integrated with the now-merged op4 result cache + RALPH_SANDBOX dispatch
  (PR#61 was on a stale pre-sandbox/pre-cache base)
- drop now-unused run_hidden_eval import

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… CI)

The op4 canonical path now runs in a subprocess with an allowlist-only env,
which (correctly) strips secrets — but it also stripped the validator's own
RALPH_ALLOW_SYNTHETIC_EVAL, so the eval harness in the child fail-closed where
the in-process path used synthetic (CI / testnet, no held-out shard). This broke
test_op4_canonical_path_end_to_end in CI.

Forward only that toggle (read by run_hidden_eval in the child; never set on
mainnet => still fail-closed there; not miner-settable). Secrets + the real
enforcement toggles (SKIP_HANDSHAKE, ALLOW_MOCK_ATTESTATION, TEST_MODE) stay
blocked. Test asserts it's forwarded when set and absent when not.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Follow-up to forwarding the validator's own synthetic-eval toggle: the
patched-subprocess env-sanitization test asserted it was blocked. It's still in
_TRAINING_ENV_BLOCKLIST (so _sanitized_env scrubs it — the blocklist + direct
scrub tests are unchanged), but _run_eval_subprocess re-adds it because the
canonical eval harness in the child needs it. Update the integration test to
assert it IS forwarded while secrets + the real enforcement toggles
(SKIP_HANDSHAKE, ALLOW_MOCK_ATTESTATION, TEST_MODE) stay blocked.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bitzic
bitzic merged commit 70e2840 into main Jun 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant