Commit 8709e0b
committed
test(usage)+harden: model_name handoff coverage, serialize round-trip, defensive _get_model_name
Three small follow-ups from the CodeRabbit review of PR #4:
* test_multi_agent_run_attributes_usage_to_correct_agents now sets a
distinct model attribute on each FakeModel and asserts model_name on
both the triage and specialist RequestUsage entries, so a regression
that drops or cross-wires model_name during handoff aggregation will
surface here too.
* Adds test_serialize_deserialize_roundtrip_preserves_agent_and_model_names
that builds a Usage with both a named and an unnamed RequestUsage entry,
runs serialize_usage then deserialize_usage, and asserts both fields
survive on the named entry while staying None on the unnamed one. This
exercises both branches of the conditional emit in serialize_usage.
* Hardens _get_model_name against custom Model implementations whose
descriptors or properties raise on attribute access: the helper now
swallows exceptions, falls back to model_name when model is missing,
and rejects empty strings. This keeps usage accounting from ever
crashing the run on a third-party Model.1 parent 09c9bbb commit 8709e0b
2 files changed
Lines changed: 75 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
268 | | - | |
269 | | - | |
270 | | - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
271 | 277 | | |
272 | | - | |
273 | | - | |
274 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
275 | 285 | | |
276 | 286 | | |
277 | 287 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 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 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
400 | 450 | | |
401 | 451 | | |
402 | 452 | | |
| |||
584 | 634 | | |
585 | 635 | | |
586 | 636 | | |
| 637 | + | |
587 | 638 | | |
588 | 639 | | |
589 | 640 | | |
590 | 641 | | |
| 642 | + | |
591 | 643 | | |
592 | 644 | | |
593 | 645 | | |
| |||
607 | 659 | | |
608 | 660 | | |
609 | 661 | | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
610 | 665 | | |
611 | 666 | | |
612 | 667 | | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
613 | 672 | | |
614 | 673 | | |
615 | 674 | | |
| |||
0 commit comments