Skip to content

fix: diagnose TruthBench generated-code sandbox crashes - #189

Merged
kevincostner17 merged 1 commit into
mainfrom
fix/truthbench-sandbox-diagnostics
Sep 14, 2026
Merged

kevincostner17 merged 1 commit into
mainfrom
fix/truthbench-sandbox-diagnostics

Conversation

@kevincostner17

Copy link
Copy Markdown
Contributor

Summary

The scheduled CI truthbench job fails intermittently (09-01, 09-04, 09-06) with:

REGRESSION: regression: gate generated_code_sandbox passed in baseline, fails now

The downloaded truthbench-results artifact gives the only evidence:

{"name": "generated_code_sandbox", "failures": ["generated code exited -11: "]}

That is a segfault (SIGSEGV) in the sandbox subprocess with empty stderr. It is not a timeout or a canary leak, and neither the run nor the report shows which generated script crashed.

This PR is the diagnose-first step: it doesn't change what passes or fails, but the next crash will be explained.

Changes

  • benchmarks/truthbench/generated_code.py:
    • Run the sandbox with -X faulthandler, so a native crash writes its Python traceback to stderr. The dump holds only file, line and function names, and stderr is already scanned for canaries and redacted before it is reported.
    • Pin native thread pools and the locale in the otherwise empty sandbox environment (OMP_NUM_THREADS, OPENBLAS_NUM_THREADS, MKL_NUM_THREADS, POLARS_MAX_THREADS, RAYON_NUM_THREADS = 1; LANG=C.UTF-8). Without them, BLAS/OpenMP/Rayon size their pools from the host core count, which is the leading suspect for a crash that happens only on some runners.
  • benchmarks/truthbench/runner.py: sandbox gate failures are prefixed with domain/surface, so the report names the crashing script.

If crashes continue after this, the faulthandler output should point at the module to fix. A narrowly scoped retry for signal exits (PR/scheduled ratchet only, never the release gate) stays a fallback, not part of this change.

Tests

tests/truthbench/test_generated_code.py uses the existing python= hook with a fake interpreter to test two things:

  • The sandbox passes -I -X faulthandler and the pinned thread variables.
  • A SIGSEGV crash yields a failure string containing exited -11 and the Segmentation fault faulthandler dump.

Results:

  • pytest tests/truthbench: all pass
  • ruff check benchmarks/truthbench tests/truthbench: clean
  • make truthbench-pr: generated_code_sandbox: pass, overall: PASS

Scheduled CI intermittently reports a generated_code_sandbox regression
whose only evidence is "generated code exited -11: " - a segfault in the
sandbox subprocess with empty stderr and no indication of which script.

- Run the sandbox with -X faulthandler so native crashes dump a traceback
  to stderr (already canary-scanned and redacted before reporting).
- Pin OMP/OpenBLAS/MKL/Polars/Rayon thread pools to 1 and LANG=C.UTF-8 in
  the otherwise empty sandbox environment.
- Prefix sandbox gate failures with domain/surface.
@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: a6ca6935-716b-4ddf-ba31-bf6396c8fd62


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kevincostner17
kevincostner17 merged commit c0d2838 into main Sep 14, 2026
15 of 16 checks passed
@github-actions

Copy link
Copy Markdown

FreshData benchmark report — performance

  • freshdata: ?
  • python: ?
  • platform: ?
fixture n_rows n_cols p50 s p95 s peak MB repair % false-repair % preserve % trust monotonic export %

Authored-code reduction (Metric 6)

@kevincostner17
kevincostner17 deleted the fix/truthbench-sandbox-diagnostics branch September 14, 2026 18:58
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.

1 participant