Commit 786e5fd
authored
fix: return TaskNotFoundError when SendMessage references non-existent taskId (#788)
Per A2A spec section 3.4.2, when a client includes a taskId in a
Message, it MUST reference an existing task. The SDK was creating a new
task with that id instead.
Added a guard in DefaultRequestHandler.initMessageSend() that throws
TaskNotFoundError when the provided taskId does not reference an
existing task.
This fixes the issue on all three transports (JSON-RPC, gRPC, HTTP+JSON)
since they all use the same DefaultRequestHandler code path.
Also fixes a related contextId bug: when a follow-up message had a
taskId but no contextId, RequestContext.Builder.build() was generating a
fresh UUID, so the agent executor saw the wrong contextId. The rebuild
now seeds contextId from the stored task.
Existing tests that relied on the old taskId behavior have been updated.
Fixes #7661 parent 98d2bdb commit 786e5fd
10 files changed
Lines changed: 438 additions & 258 deletions
File tree
- extras
- push-notification-config-store-database-jpa/src/test/java/org/a2aproject/sdk/extras/pushnotificationconfigstore/database/jpa
- queue-manager-replicated
- tests-multi-instance/tests/src/test/java/org/a2aproject/sdk/extras/queuemanager/replicated/tests/multiinstance
- tests-single-instance/src/test/java/org/a2aproject/sdk/extras/queuemanager/replicated/tests
- task-store-database-jpa/src/test/java/org/a2aproject/sdk/extras/taskstore/database/jpa
- server-common/src
- main/java/org/a2aproject/sdk/server/requesthandlers
- test/java/org/a2aproject/sdk/server/requesthandlers
- tests/server-common/src/test/java/org/a2aproject/sdk/server/apps/common
- transport
- grpc/src/test/java/org/a2aproject/sdk/transport/grpc/handler
- jsonrpc/src/test/java/org/a2aproject/sdk/transport/jsonrpc/handler
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
98 | 101 | | |
99 | 102 | | |
100 | 103 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
109 | 108 | | |
110 | | - | |
111 | 109 | | |
112 | 110 | | |
113 | | - | |
| 111 | + | |
114 | 112 | | |
115 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
116 | 125 | | |
117 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
118 | 131 | | |
119 | 132 | | |
120 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| |||
254 | 257 | | |
255 | 258 | | |
256 | 259 | | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
261 | 264 | | |
262 | | - | |
| 265 | + | |
263 | 266 | | |
264 | | - | |
265 | | - | |
266 | 267 | | |
267 | 268 | | |
268 | 269 | | |
| |||
272 | 273 | | |
273 | 274 | | |
274 | 275 | | |
275 | | - | |
276 | 276 | | |
277 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
278 | 286 | | |
279 | | - | |
280 | | - | |
| 287 | + | |
281 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
282 | 292 | | |
283 | 293 | | |
284 | 294 | | |
| |||
297 | 307 | | |
298 | 308 | | |
299 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
300 | 313 | | |
301 | 314 | | |
302 | 315 | | |
| |||
Lines changed: 13 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | 133 | | |
137 | 134 | | |
138 | 135 | | |
139 | | - | |
| 136 | + | |
140 | 137 | | |
141 | 138 | | |
142 | 139 | | |
143 | | - | |
144 | 140 | | |
145 | | - | |
146 | 141 | | |
147 | 142 | | |
148 | 143 | | |
| |||
166 | 161 | | |
167 | 162 | | |
168 | 163 | | |
169 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
170 | 167 | | |
171 | 168 | | |
172 | 169 | | |
| |||
193 | 190 | | |
194 | 191 | | |
195 | 192 | | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | 193 | | |
200 | 194 | | |
201 | 195 | | |
202 | | - | |
| 196 | + | |
203 | 197 | | |
204 | 198 | | |
205 | 199 | | |
206 | | - | |
207 | 200 | | |
208 | | - | |
209 | 201 | | |
210 | 202 | | |
211 | 203 | | |
| |||
223 | 215 | | |
224 | 216 | | |
225 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
226 | 221 | | |
227 | 222 | | |
228 | 223 | | |
| |||
312 | 307 | | |
313 | 308 | | |
314 | 309 | | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | 310 | | |
319 | 311 | | |
320 | 312 | | |
321 | | - | |
| 313 | + | |
322 | 314 | | |
323 | 315 | | |
324 | 316 | | |
325 | 317 | | |
326 | | - | |
327 | 318 | | |
328 | | - | |
329 | 319 | | |
330 | 320 | | |
331 | 321 | | |
| |||
348 | 338 | | |
349 | 339 | | |
350 | 340 | | |
351 | | - | |
| 341 | + | |
352 | 342 | | |
353 | 343 | | |
354 | 344 | | |
| |||
408 | 398 | | |
409 | 399 | | |
410 | 400 | | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | 401 | | |
415 | 402 | | |
416 | 403 | | |
417 | | - | |
| 404 | + | |
418 | 405 | | |
419 | 406 | | |
420 | 407 | | |
421 | | - | |
422 | 408 | | |
423 | | - | |
424 | 409 | | |
425 | 410 | | |
426 | 411 | | |
| |||
439 | 424 | | |
440 | 425 | | |
441 | 426 | | |
| 427 | + | |
| 428 | + | |
442 | 429 | | |
443 | 430 | | |
444 | 431 | | |
| |||
Lines changed: 4 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 71 | + | |
77 | 72 | | |
78 | 73 | | |
79 | 74 | | |
80 | | - | |
81 | 75 | | |
82 | | - | |
83 | 76 | | |
84 | 77 | | |
85 | 78 | | |
| |||
102 | 95 | | |
103 | 96 | | |
104 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
105 | 101 | | |
106 | 102 | | |
107 | 103 | | |
| |||
0 commit comments