You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(agent,channels): receipts integration test + drop duplicate footer surface
Addresses @WareWolf-MoonWall's review on zeroclaw-labs#6214 (29a779b).
🔴 Add `process_channel_message_renders_trailing_tool_receipts_block_when_enabled`
in `crates/zeroclaw-channels/src/orchestrator/mod.rs::tests` that runs the
full activated path (Some<ReceiptGenerator> + show_receipts_in_response=true)
and asserts the mock channel receives a second send carrying the documented
`---\nTool receipts:` separator and a valid `zc-receipt-*` token tied to the
tool name. Plus a paired `_omits_receipts_block_when_disabled` test
asserting the toggle actually gates the second send.
These tests required `AutonomyLevel::Full` + an explicit
`auto_approve.push("mock_price")` so mock_price actually reaches
`execute_one_tool` — the existing `process_channel_message_*` tests in
this file pass under default Supervised because `ToolCallingProvider`
returns the BTC reply regardless of whether the tool ran (the LLM only
needs to see a `[Tool results]` user message — even a denied/cancelled
payload triggers the canned response). Receipts only generate on the
actual execute path, so the gate has to be open here.
Drop `append_receipt_footer` from `crates/zeroclaw-runtime/src/agent/loop_.rs`
and its two call sites (the `_omits_receipts_block_when_disabled` test
exposed the bug that surfaced it). Pre-fix, the footer mechanism
appended a `---\nTool receipts:\n...` block to the agent's response text
*regardless* of `show_receipts_in_response`, while the orchestrator
*also* sent the same content as a separate channel message *gated* on
the toggle — so:
show_receipts_in_response = true → footer + separate block (duplicate)
show_receipts_in_response = false → footer only (toggle ignored)
Both modes were wrong. The orchestrator's separate-message render is
the design Wolf's review expects (and matches the original PR body), so
keep that path and remove the footer entirely. The
`[receipt: ...]` markers on individual tool results in history are
*kept* — those are how the LLM echoes receipts when the system-prompt
addendum is active. Their corresponding tests live in
`agent::tool_receipts::tests` and are unaffected.
🔵 Replace `let _ = channel.send(...)` for the receipts block with a
`tracing::warn!` on `Err(e)`. The block is the operator-facing audit
surface for the feature; a dropped send must leave a log signal rather
than silently disappear.
🔵 Make the `collected_receipts` arg to `run_tool_call_loop` conditional
on `ctx.receipt_generator.is_some()` instead of unconditional `Some(&...)`.
Inside the loop the collector is only written to when the generator is
also Some, so behaviour is unchanged — the explicit `.map(|_| ...)`
just makes the "collector is meaningful only when generator is active"
relationship visible at the call site.
0 commit comments