fix(truthbench): retry a generated-code run once after a native crash - #385
Merged
Merged
Conversation
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.
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 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. Comment |
FreshData benchmark report —
|
| fixture | n_rows | n_cols | p50 s | p95 s | peak MB | repair % | false-repair % | preserve % | trust | monotonic | export % |
|---|
Authored-code reduction (Metric 6)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_sandboxgate no longer fails on an intermittent pandas segfault while a real crash still shows up.Why
generated_code_sandboxhas failed withgenerated code exited -11on three different copilot cases, each on a PR that didn't touch the code involved:finance/copilot, truthbench job, py3.12, numpy 2.5.1.healthcare/copilot, truthbench job.test_recommended_code_escapes_untrusted_literals, test-matrix 3.13. The stack showed it insidepandas.to_numeric(steps/dtypes.py:182).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.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.