Skip to content

fix(truthbench): retry a generated-code run once after a native crash - #385

Merged
kevincostner17 merged 1 commit into
mainfrom
fix/truthbench-sandbox-crash-retry
Sep 15, 2026
Merged

kevincostner17 merged 1 commit into
mainfrom
fix/truthbench-sandbox-crash-retry

Conversation

@kevincostner17

Copy link
Copy Markdown
Contributor

Summary

If the TruthBench generated-code sandbox is killed by a native crash (negative exit code), the run is retried once. Every crash is still recorded and printed to the CI log, so the generated_code_sandbox gate no longer fails on an intermittent pandas segfault while a real crash still shows up.

Why

generated_code_sandbox has failed with generated code exited -11 on three different copilot cases, each on a PR that didn't touch the code involved:

In every case, rerunning the failed job on the same commit passed. 60 local reruns with pandas 2.3.3 / numpy 2.5.3 did not reproduce it. The pattern is an intermittent native crash in pandas, not a bug in the generated code. Failing a release gate on it trains everyone to rerun blindly, and blind reruns are how a real regression slips through.

Change

  • verify_generated_code:
  • GeneratedCodeResult.native_crashes: a new field with one redacted excerpt per signal exit, including crashes a retry recovered from.
  • runner.py: prints each recorded crash to stderr (truthbench: <domain>/<surface>: generated code exited -11: ...), so a recovered crash is visible in the CI log.

Tests

  • test_native_crash_is_retried_once_and_recorded: a crash followed by a clean run passes and records the crash with its stack frame.
  • test_repeated_native_crash_still_fails: two crashes fail the gate, and both are recorded.
  • test_ordinary_failure_is_not_retried: exit code 1 runs once and records no crash.
  • The existing crash tests pass unchanged: signal exit, dump, stack-not-module-list and traceback tail.
  • tests/truthbench: 250 passed on Python 3.9 / pandas 1.5.3 and on Python 3.12 / pandas 2.3.3 / numpy 2.5.3. ruff check . is clean.

The generated_code_sandbox gate failed three times in a few hours with
"generated code exited -11" on different copilot cases (finance, and
healthcare, plus the copilot test on py3.13). Each time it was a
segfault inside pandas native code, and each rerun of the same commit
passed. The crash is not in the generated code, and failing the release
gate on it hides real regressions behind flake reruns.

When the sandbox child is killed by a signal (negative exit code), run
it once more with the input file restored. Timeouts and ordinary
non-zero exits are not retried, and a crash on the retry still fails
the gate with the faulthandler excerpt. Every crash, including one a
retry recovered from, is kept in GeneratedCodeResult.native_crashes,
and the runner prints each one to stderr so a flaky pass stays visible
in the CI log.
@coderabbitai

coderabbitai Bot commented Sep 15, 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: 7a7b6b3f-e085-41a6-a8d5-24c281fccedb


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.

@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 merged commit 2d098cb into main Sep 15, 2026
19 checks passed
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