Skip to content

bug(tools): ClaimSource and ErrorDomain never propagated to AuditEntry — audit trail always null for both fields #2308

@bug-ops

Description

@bug-ops

Summary

PR #2293 added claim_source: Option<ClaimSource> and error_domain: Option<ErrorDomain> to both ToolOutput and AuditEntry. Executors correctly set claim_source on ToolOutput (e.g. ClaimSource::Shell in shell/mod.rs:253), but every AuditEntry construction hardcodes both fields as None.

Evidence

In crates/zeph-tools/src/shell/mod.rs:529–541:

let entry = AuditEntry {
    // ...
    error_domain: None,   // hardcoded — never Shell
    claim_source: None,   // hardcoded — never ClaimSource::Shell
};

The ToolOutput returned by the same executor sets:

claim_source: Some(ClaimSource::Shell),  // shell/mod.rs:253

Same pattern confirmed in scrape.rs, audit.rs test helpers — all 7 AuditEntry construction sites hardcode None for both fields.

Impact

Fix

In each executor's log_audit() method, set claim_source to the appropriate variant. For shell: claim_source: Some(ClaimSource::Shell). For scrape: claim_source: Some(ClaimSource::WebScrape). When a ToolError is available, derive error_domain from error_category via ErrorDomain::from_category().

Alternatively, pass the constructed ToolOutput into the audit function and read claim_source from it, avoiding duplication.

Steps to reproduce

  1. Run agent with tool_audit = true in config
  2. Execute any bash/file/scrape tool
  3. Check .local/testing/data/audit-test.jsonlclaim_source and error_domain are always null

Metadata

Metadata

Assignees

Labels

P2High value, medium complexitybugSomething isn't workingtoolsTool execution and MCP integration

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions