Skip to content

fix(truthbench): keep the faulthandler stack in sandbox crash failures - #366

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

kevincostner17 merged 1 commit into
mainfrom
fix/truthbench-crash-excerpt

Conversation

@kevincostner17

Copy link
Copy Markdown
Contributor

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_code reported a failed child as stderr[-800:]. A faulthandler dump puts the stack first and a long Extension modules: ... (total: 53) line last, so the tail cut dropped the stack. On PR #360, the generated_code_sandbox gate failed with finance/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_numeric via steps/dtypes.py:182 inside test_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 from Fatal Python error:, drops the Extension modules: line and caps the result at 1500 characters.
  • Any other stderr keeps the existing 800-character tail.
  • Redaction still happens before the excerpt is taken.

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/truthbench passes on Python 3.9 / pandas 1.5.3 and Python 3.12 / pandas 2.3.3 / numpy 2.5.3 (247 passed each), and ruff check . is clean.

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.
@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: 9b056b3d-237f-47ac-830e-2108d5cfe539


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 f08eb62 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