Skip to content

Persist bounded output/result manifests for audited execute_code calls #12

Description

Summary

The v2.0.0 execute_code audit contract requires engagement metadata, saves the Python source, and records a digest/status/duration in history. It does not preserve the tool result or output in a structured receipt comparable to violin_exec.

Affected paths on dev at dc53bbb:

  • plugins/violin_guard/code_execution_audit.py
  • plugins/violin_guard/__init__.py
  • plugins/violin_guard/execution.py
  • tests/guard/test_terminal_policy.py

Current behavior

record_completion(source, result, duration_ms) writes only:

  • evidence/<phase>/execute-code-<timestamp>-<digest>.py
  • one history row containing digest, target, duration, and status

_result_summary() parses enough of result to decide success/error, then discards the result body.

Impact

Complex scripts used for structured HTTP requests or payload construction are source-auditable but outcome-poor. Reviewers cannot reconstruct what the script printed or returned from the same receipt model used by guarded command execution.

Suggested fix

Write a bounded JSON sidecar manifest containing:

  • schema version and receipt ID;
  • source digest and relative source path;
  • engagement, phase, target, and session metadata;
  • start/completion or duration fields;
  • normalized status/error information;
  • a size-capped result/output field;
  • truncation and redaction indicators.

Reference the JSON manifest from history. Preserve the source file separately. Avoid storing unbounded results or secrets.

Acceptance criteria

  • Successful, failed, non-JSON, and oversized results produce valid manifests.
  • Output truncation is explicit and deterministic.
  • Sensitive-field redaction follows repository privacy conventions.
  • History references the JSON manifest used for review.
  • Existing source-digest validation remains unchanged.
  • Regression tests prove the result body can be audited without reading tool chat output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions