Commit a12c8d5
committed
fix(agent,channels): forward receipts through delegate sub-loops + strict disabled coverage
Address #6214 review feedback against #6182's full acceptance criteria.
- Add `TOOL_LOOP_RECEIPT_CONTEXT` task-local in `agent::tool_receipts`,
matching the existing `TOOL_LOOP_COST_TRACKING_CONTEXT` pattern. The
orchestrator scopes the per-turn `Arc<Mutex<Vec<String>>>` collector
plus the process-lifetime `ReceiptGenerator` clone before entering the
tool-call loop.
- `DelegateTool::execute_sync` reads the scope and forwards generator +
collector into the sub-agent's `run_tool_call_loop`, replacing the
prior `None, None` placeholders at delegate.rs:1184. Multi-agent
resilience: `execute_parallel` captures the parent scope and re-enters
it inside each spawned sub-agent so parallel sub-tool receipts land in
the same per-turn collector via `Arc` sharing. Background spawns stay
unsigned by design (per-turn collector is already rendered before they
finish; documented as a known limitation).
- Strict #6182 disabled coverage:
`process_channel_message_disabled_receipt_generator_emits_no_receipts_anywhere`
asserts no `zc-receipt-` token in any sent message and no `[receipt:`
trailer in conversation history when `receipt_generator: None`.
Distinct from the existing `show_in_response = false` test (which
keeps the generator on but suppresses the user-visible block).
- Delegate forwarding coverage: positive test exercises `execute_agentic`
inside a scoped `TOOL_LOOP_RECEIPT_CONTEXT` and verifies a real
`echo_tool` sub-call lands in the parent collector with a valid
`zc-receipt-` HMAC token; negative test confirms unsigned sub-loop
output when no scope is set.
- Clarify "session" semantics in `docs/book/src/security/tool-receipts.md`:
the HMAC key is per daemon process (not per conversation or channel),
generated at `start_channels` and rotated on restart. Add explicit
"what receipts don't isolate" entries for cross-channel and
background-delegate spawns.1 parent 1776b6d commit a12c8d5
4 files changed
Lines changed: 281 additions & 11 deletions
File tree
- crates
- zeroclaw-channels/src/orchestrator
- zeroclaw-runtime/src
- agent
- tools
- docs/book/src/security
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3143 | 3143 | | |
3144 | 3144 | | |
3145 | 3145 | | |
3146 | | - | |
3147 | | - | |
| 3146 | + | |
| 3147 | + | |
| 3148 | + | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
| 3156 | + | |
3148 | 3157 | | |
3149 | 3158 | | |
3150 | 3159 | | |
| |||
3157 | 3166 | | |
3158 | 3167 | | |
3159 | 3168 | | |
| 3169 | + | |
| 3170 | + | |
3160 | 3171 | | |
3161 | 3172 | | |
3162 | 3173 | | |
| |||
3195 | 3206 | | |
3196 | 3207 | | |
3197 | 3208 | | |
3198 | | - | |
| 3209 | + | |
| 3210 | + | |
3199 | 3211 | | |
3200 | 3212 | | |
3201 | 3213 | | |
| |||
3479 | 3491 | | |
3480 | 3492 | | |
3481 | 3493 | | |
| 3494 | + | |
| 3495 | + | |
| 3496 | + | |
3482 | 3497 | | |
3483 | 3498 | | |
3484 | 3499 | | |
| |||
7604 | 7619 | | |
7605 | 7620 | | |
7606 | 7621 | | |
| 7622 | + | |
| 7623 | + | |
| 7624 | + | |
| 7625 | + | |
| 7626 | + | |
| 7627 | + | |
| 7628 | + | |
| 7629 | + | |
| 7630 | + | |
| 7631 | + | |
| 7632 | + | |
| 7633 | + | |
| 7634 | + | |
| 7635 | + | |
| 7636 | + | |
| 7637 | + | |
| 7638 | + | |
| 7639 | + | |
| 7640 | + | |
| 7641 | + | |
| 7642 | + | |
| 7643 | + | |
| 7644 | + | |
| 7645 | + | |
| 7646 | + | |
| 7647 | + | |
| 7648 | + | |
| 7649 | + | |
| 7650 | + | |
| 7651 | + | |
| 7652 | + | |
| 7653 | + | |
| 7654 | + | |
| 7655 | + | |
| 7656 | + | |
| 7657 | + | |
| 7658 | + | |
| 7659 | + | |
| 7660 | + | |
| 7661 | + | |
| 7662 | + | |
| 7663 | + | |
| 7664 | + | |
| 7665 | + | |
| 7666 | + | |
| 7667 | + | |
| 7668 | + | |
| 7669 | + | |
| 7670 | + | |
| 7671 | + | |
| 7672 | + | |
| 7673 | + | |
| 7674 | + | |
| 7675 | + | |
| 7676 | + | |
| 7677 | + | |
| 7678 | + | |
| 7679 | + | |
| 7680 | + | |
| 7681 | + | |
| 7682 | + | |
| 7683 | + | |
| 7684 | + | |
| 7685 | + | |
| 7686 | + | |
| 7687 | + | |
| 7688 | + | |
| 7689 | + | |
| 7690 | + | |
| 7691 | + | |
| 7692 | + | |
| 7693 | + | |
| 7694 | + | |
| 7695 | + | |
| 7696 | + | |
| 7697 | + | |
| 7698 | + | |
| 7699 | + | |
| 7700 | + | |
| 7701 | + | |
| 7702 | + | |
| 7703 | + | |
| 7704 | + | |
| 7705 | + | |
| 7706 | + | |
| 7707 | + | |
| 7708 | + | |
| 7709 | + | |
| 7710 | + | |
| 7711 | + | |
| 7712 | + | |
| 7713 | + | |
| 7714 | + | |
| 7715 | + | |
| 7716 | + | |
| 7717 | + | |
| 7718 | + | |
| 7719 | + | |
| 7720 | + | |
| 7721 | + | |
| 7722 | + | |
| 7723 | + | |
| 7724 | + | |
| 7725 | + | |
| 7726 | + | |
| 7727 | + | |
| 7728 | + | |
| 7729 | + | |
| 7730 | + | |
| 7731 | + | |
| 7732 | + | |
| 7733 | + | |
| 7734 | + | |
| 7735 | + | |
| 7736 | + | |
| 7737 | + | |
| 7738 | + | |
| 7739 | + | |
| 7740 | + | |
| 7741 | + | |
| 7742 | + | |
| 7743 | + | |
| 7744 | + | |
| 7745 | + | |
| 7746 | + | |
| 7747 | + | |
| 7748 | + | |
| 7749 | + | |
| 7750 | + | |
| 7751 | + | |
7607 | 7752 | | |
7608 | 7753 | | |
7609 | 7754 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
123 | 140 | | |
124 | 141 | | |
125 | 142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
788 | 788 | | |
789 | 789 | | |
790 | 790 | | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
791 | 803 | | |
792 | 804 | | |
793 | 805 | | |
| |||
804 | 816 | | |
805 | 817 | | |
806 | 818 | | |
| 819 | + | |
807 | 820 | | |
808 | 821 | | |
809 | 822 | | |
| |||
819 | 832 | | |
820 | 833 | | |
821 | 834 | | |
822 | | - | |
823 | | - | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
824 | 842 | | |
825 | 843 | | |
826 | 844 | | |
| |||
1153 | 1171 | | |
1154 | 1172 | | |
1155 | 1173 | | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
1156 | 1185 | | |
1157 | 1186 | | |
1158 | 1187 | | |
| |||
1181 | 1210 | | |
1182 | 1211 | | |
1183 | 1212 | | |
1184 | | - | |
1185 | | - | |
| 1213 | + | |
| 1214 | + | |
1186 | 1215 | | |
1187 | 1216 | | |
1188 | 1217 | | |
| |||
1899 | 1928 | | |
1900 | 1929 | | |
1901 | 1930 | | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
1902 | 2006 | | |
1903 | 2007 | | |
1904 | 2008 | | |
| |||
0 commit comments