Repository navigation
Commit 31e2f5c
Michael Feth
fix(workflow): attribute workflow messages via
Addresses the two review findings left open on the previous commit.
## Finding 1 — the owner was woken as a second agent
ACP's mention test is pure `p`-tag equality (`event_mentions` /
`event_mentions_agent`), with no attribution/wake distinction. Both workflow
actions p-tagged the workflow owner for attribution, so whenever an agent owned
the workflow that agent was woken alongside the real target — defeating exactly
the single-assignee contract `assign_agent` exists to provide.
Owner attribution moves to the `actor` tag, which is already the relay-trusted
attribution channel: `effective_message_author` (ingest.rs) prefers `actor` and
only falls back to the first `p` tag. `p` now means "wake" and nothing else.
Applied to **both** actions, not just `assign_agent`. `send_message` has the
same defect, and fixing one action while leaving the other would have left two
workflow message shapes that disagree about what a `p` tag means.
`assign_agent` consequently emits exactly one `p` tag. The owner==assignee
dedup is gone with it: a self-assignment is a real assignment and must still
wake, and there is no longer a second owner tag to collide with.
Companion change, without which this would be a regression: desktop's
`resolveEventAuthorPubkey` only consults `actor` when the caller passes
`preferActorTag`. All eight timeline/typing call sites already do;
`shared/api/forum.ts` did not, so it would have fallen through to the first `p`
tag — now the assignee — and attributed forum posts to the wrong person. Both
call sites there now opt in. Mobile needs no change: it renders the author the
relay computed at ingest.
## Finding 2 — templated routing fields could not be saved
The executor resolves `{{...}}` templates in `channel` and `task_id`, but
`validate_action` required a literal UUID for both, and `parse_yaml` always
validates — so a workflow using the templates the executor was written to
resolve could never be saved. The executor test hid this by constructing a
`Step` directly and asserting a non-UUID resolved `task_id`.
Definition validation now accepts either a literal UUID or a single `{{...}}`
placeholder for both fields — the same contract `agent_pubkey` already had —
and the resolved value is re-checked before dispatch: `resolve_action_channel`
re-parses the channel, and the executor now re-parses `task_id` as a UUID and
fails the run with `invalid_definition` rather than putting a malformed
correlation id on the wire.
The masking test now resolves a real UUID, and two tests were added: one
proving the templated form actually validates (the save path the mismatch
blocked), one proving a literal non-UUID is still rejected, so widening the
shape check did not turn it into a rubber stamp.
## Verification
x86_64-pc-windows-msvc, with Postgres and Redis up — the gated tests are no
longer skipped:
- `cargo test -p buzz-relay --lib workflow_sink -- --ignored`: **3 passed**.
This is the end-to-end proof for both findings: the assign_agent test now
asserts exactly one `p` tag (the assignee) plus `actor` == owner, and the
send_message test asserts the author is attributed via `actor` and is NOT
p-tagged.
- `cargo test -p buzz-relay --lib workflow_sink`: 20 passed.
- `cargo test -p buzz-workflow --lib`: 171 passed (169 before + 2 new).
- `cargo test -p buzz-workflow --lib -- --ignored`: 2 passed.
- `cargo clippy -p buzz-workflow -p buzz-relay --all-targets -- -D warnings`:
clean. `cargo fmt --check`: clean.
- Desktop `pnpm exec tsc --noEmit`: clean. `pnpm check`: exit 0. `pnpm test`:
5023/5024 — the one failure, `focused polling pauses on blur`, passes in
isolation and is untouched by this branch.
Signed-off-by: Michael Feth <[email protected]>actor so p means wake only1 parent a24d84b commit 31e2f5c
4 files changed
Lines changed: 188 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
159 | 165 | | |
160 | 166 | | |
161 | 167 | | |
| |||
167 | 173 | | |
168 | 174 | | |
169 | 175 | | |
170 | | - | |
| 176 | + | |
171 | 177 | | |
172 | 178 | | |
173 | 179 | | |
| |||
176 | 182 | | |
177 | 183 | | |
178 | 184 | | |
179 | | - | |
180 | | - | |
| 185 | + | |
| 186 | + | |
181 | 187 | | |
182 | 188 | | |
183 | 189 | | |
184 | 190 | | |
185 | 191 | | |
186 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
187 | 200 | | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | 201 | | |
197 | 202 | | |
198 | 203 | | |
| |||
312 | 317 | | |
313 | 318 | | |
314 | 319 | | |
315 | | - | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
316 | 327 | | |
317 | 328 | | |
318 | 329 | | |
| |||
321 | 332 | | |
322 | 333 | | |
323 | 334 | | |
324 | | - | |
325 | | - | |
| 335 | + | |
| 336 | + | |
326 | 337 | | |
327 | 338 | | |
328 | 339 | | |
| |||
353 | 364 | | |
354 | 365 | | |
355 | 366 | | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
356 | 370 | | |
357 | 371 | | |
358 | 372 | | |
| |||
817 | 831 | | |
818 | 832 | | |
819 | 833 | | |
820 | | - | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
821 | 847 | | |
822 | 848 | | |
823 | | - | |
824 | | - | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
825 | 853 | | |
826 | | - | |
| 854 | + | |
827 | 855 | | |
828 | 856 | | |
829 | 857 | | |
830 | 858 | | |
831 | 859 | | |
832 | 860 | | |
833 | | - | |
| 861 | + | |
834 | 862 | | |
| 863 | + | |
835 | 864 | | |
836 | 865 | | |
837 | 866 | | |
| |||
1001 | 1030 | | |
1002 | 1031 | | |
1003 | 1032 | | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
1004 | 1048 | | |
1005 | | - | |
1006 | | - | |
| 1049 | + | |
| 1050 | + | |
1007 | 1051 | | |
1008 | 1052 | | |
1009 | 1053 | | |
| |||
1137 | 1181 | | |
1138 | 1182 | | |
1139 | 1183 | | |
1140 | | - | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
1141 | 1188 | | |
1142 | 1189 | | |
1143 | | - | |
1144 | | - | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
1145 | 1204 | | |
1146 | 1205 | | |
1147 | 1206 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
629 | 629 | | |
630 | 630 | | |
631 | 631 | | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
632 | 647 | | |
633 | 648 | | |
634 | 649 | | |
| |||
2003 | 2018 | | |
2004 | 2019 | | |
2005 | 2020 | | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
2006 | 2027 | | |
2007 | 2028 | | |
2008 | 2029 | | |
| |||
2014 | 2035 | | |
2015 | 2036 | | |
2016 | 2037 | | |
2017 | | - | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
2018 | 2042 | | |
2019 | 2043 | | |
2020 | 2044 | | |
2021 | 2045 | | |
2022 | 2046 | | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
2023 | 2090 | | |
2024 | 2091 | | |
2025 | 2092 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
156 | 158 | | |
157 | 159 | | |
158 | 160 | | |
| |||
166 | 168 | | |
167 | 169 | | |
168 | 170 | | |
169 | | - | |
170 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
171 | 174 | | |
172 | 175 | | |
173 | 176 | | |
174 | | - | |
| 177 | + | |
| 178 | + | |
175 | 179 | | |
176 | 180 | | |
177 | 181 | | |
| |||
278 | 282 | | |
279 | 283 | | |
280 | 284 | | |
281 | | - | |
| 285 | + | |
282 | 286 | | |
283 | 287 | | |
284 | 288 | | |
| |||
297 | 301 | | |
298 | 302 | | |
299 | 303 | | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
300 | 312 | | |
301 | 313 | | |
302 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
303 | 318 | | |
304 | | - | |
| 319 | + | |
| 320 | + | |
305 | 321 | | |
306 | 322 | | |
307 | 323 | | |
308 | 324 | | |
309 | 325 | | |
310 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
311 | 329 | | |
312 | | - | |
| 330 | + | |
| 331 | + | |
313 | 332 | | |
314 | 333 | | |
315 | 334 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
77 | 80 | | |
78 | 81 | | |
79 | 82 | | |
| |||
108 | 111 | | |
109 | 112 | | |
110 | 113 | | |
| 114 | + | |
| 115 | + | |
111 | 116 | | |
112 | 117 | | |
113 | 118 | | |
| |||
0 commit comments