-
Notifications
You must be signed in to change notification settings - Fork 0
fix(engine): sanitize error messages in checkpoint reconciliation #615
Description
Problem
deserialize_and_reconcile in src/synthorg/engine/checkpoint/resume.py (line ~79-83) injects f"Previous error: {error_message}." into the LLM context. The error_message comes from RecoveryResult.error_message, which is populated from ExecutionResult.error_message -- a value that may contain raw internal detail (stack trace prefix, internal paths, provider error bodies) depending on the code path.
Impact
Sensitive error content can be echoed back to the LLM as context, potentially leaking internal implementation details via the model's verbatim repetition in output.
Suggested Fix
Apply the same sanitization pattern from _handle_fatal_error (the re.sub chain at agent_engine.py lines ~1242-1253) to error_message before constructing the reconciliation message.
Context
Discovered during PR #601 review (security-reviewer agent, confidence 75). Pre-existing issue, not introduced by PR #601.