fix(cpg): carry the engine's own account when a session request fails (M2)

The session-enabled NodeGoat run reported session_query_failed:census:
session_request_failed and fell back, which is correct behaviour but says nothing
about why. A bare transport failure cannot distinguish a timeout from a crash from
an out-of-memory kill, and the only account of which it was is in the server's own
log.

A transport failure now carries the exception and the tail of that log, and the
backend logs it with the process exit code alongside its own label. A control
asserts an OutOfMemoryError in the log reaches the caller.

This is diagnosis, not a repair: the run's timings were unchanged because the
session died early and everything fell back to the disposable path.

1,397 tests passed, nine skipped.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01EmM1j46qgKMh3zqD1QMwEo
This commit is contained in:
Marius Ciepluch
2026-09-16 21:00:24 +02:00
co-authored by Claude Opus 5
parent fc69055a32
commit d2362cd18d
3 changed files with 32 additions and 2 deletions
+4
View File
@@ -1163,7 +1163,11 @@ class JoernBackend:
arguments = ", ".join(f"{name} = {json.dumps(_render(value))}" for name, value in sorted(params.items()))
answer = session.evaluate(f"{symbol}({arguments})", timeout=self.query_timeout)
if answer is None:
# Carry the engine's own account, not just our label: a bare `session_request_failed`
# cannot distinguish a timeout from a crash from an out-of-memory kill.
detail = (session.last_body or session.log_tail())[-500:].replace("\n", " ")
self._note("session_query_failed:" + query + ":" + (session.failure or "unknown"))
logger.warning("session query %s failed (exit=%s): %s", query, session.exit_code(), detail)
return None
return answer.stdout