Skip to content

fix(engine): sanitize error messages in checkpoint reconciliation #615

@Aureliolo

Description

@Aureliolo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    prio:lowNice to have, can deferscope:smallLess than 1 day of workspec:agent-systemDESIGN_SPEC Section 3 - Agent Systemtype:fixBug fixes and corrections

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions