fix(truthbench): keep the faulthandler stack in sandbox crash failures - #366
Merged
Merged
Conversation
The generated-code sandbox reported a failed child with the last 800 characters of its stderr. faulthandler writes the crashing thread's stack first and a long "Extension modules: ..." line last, so a native crash was reported with only the module list and without the frame that located it. The finance/copilot case on PR #360 failed this way. Keep a faulthandler dump from its header, drop the module list line and cap it at 1500 characters. Other failures still keep the traceback tail.
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 was referenced Sep 15, 2026
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
When generated code crashes natively in the TruthBench sandbox, the failure message now includes the crashing thread's Python stack. Before this change it contained only the extension-module list.
Why
verify_generated_codereported a failed child asstderr[-800:]. A faulthandler dump puts the stack first and a longExtension modules: ... (total: 53)line last, so the tail cut dropped the stack. On PR #360, thegenerated_code_sandboxgate failed withfinance/copilot: generated code exited -11: libs.tzconversion, pandas._libs.tslibs.timestamps, ...and no frame. That left nothing to locate the crash.That crash is intermittent. It shows up on one CI run of #360 (truthbench, py3.12) and one run of #353 (test-matrix 3.13). The #353 run kept its stack because pytest printed it directly:
pandas.to_numericviasteps/dtypes.py:182insidetest_recommended_code_escapes_untrusted_literals. Main and the other open PRs pass both jobs, and 60 local reruns with pandas 2.3.3 / numpy 2.5.3 did not reproduce it. The next time it happens in the sandbox, this change makes the report actionable.Change
_stderr_excerpt()handles faulthandler dumps: it keeps the dump fromFatal Python error:, drops theExtension modules:line and caps the result at 1500 characters.Tests
test_native_crash_failure_keeps_stack_not_module_list: a realistic dump over 800 characters keeps its frame and loses the module list.test_ordinary_failure_keeps_traceback_tail: a normal traceback still ends with its exception line.tests/truthbenchpasses on Python 3.9 / pandas 1.5.3 and Python 3.12 / pandas 2.3.3 / numpy 2.5.3 (247 passed each), andruff check .is clean.