Commit 98e8317
committed
Keep agent snapshots resumable when runtime-only inputs cannot be serialized
The fallback added for agent snapshot serialization errors preserved the
original runtime failure, but it could also replace the entire
chat_generator or tool_invoker payload with an empty dict. That made the
saved snapshot impossible to resume even when only a runtime-only field
such as a streaming callback was non-serializable.
This change narrows the fallback behavior: Haystack now retries those
component inputs field-by-field and omits only the fields that cannot be
serialized, preserving resumable fields like messages, state, and tools.
A regression test covers resuming from a tool-invoker snapshot created
with a non-serializable runtime callback.
Constraint: Must preserve the original deepset-ai#11108 goal of not masking the real runtime error
Rejected: Keep saving `{}` and document snapshots as non-resumable | breaks the existing resume contract more than necessary
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: If agent snapshot fallback behavior changes again, verify both error preservation and snapshot resumability
Tested: hatch -e test run pytest test/components/agents/test_agent_breakpoints.py -k 'resume_from_tool_invoker' -q
Tested: hatch -e test run pytest test/core/pipeline/test_breakpoint.py -k 'create_agent_snapshot' -q
Tested: hatch run fmt-check haystack/core/pipeline/breakpoint.py test/components/agents/test_agent_breakpoints.py
Not-tested: Full unit suite and integration suite
Related: deepset-ai#111261 parent 07e8c9b commit 98e8317
3 files changed
Lines changed: 96 additions & 23 deletions
File tree
- haystack/core/pipeline
- releasenotes/notes
- test/components/agents
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
401 | 384 | | |
402 | 385 | | |
403 | 386 | | |
| |||
407 | 390 | | |
408 | 391 | | |
409 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
410 | 443 | | |
411 | 444 | | |
412 | 445 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
475 | 509 | | |
476 | 510 | | |
477 | 511 | | |
| |||
0 commit comments