Commit e24a783
fix(google-adk): cap before_tool args + review test coverage (page 6)
Follow-up to the #362 review pass — the earlier commit covered AgentTool walk,
_stringify cap, cached-agent rebind, trace_id drop, and the cap warning; these
are the rest of page 6:
- callbacks.py:249 (Major) — before_tool no longer passes tool args uncapped.
New _cap_args bounds the payload: within budget the dict passes through
unchanged (per-key rules still work); once its serialized size exceeds the
cap it is replaced with a single capped {"_truncated": ...}. Contrast with
after_tool, which already capped its result.
- test_callbacks.py (Minor) — the tree test now also asserts the container
agent is NOT decorated; added a huge-args cap test. (Double-attach with a
pre-existing user callback is already covered by
test_install_governance_preserves_existing_callback_and_runs_first.)
Acknowledged, unchanged (flagged as follow-ups):
- callbacks sync-only (Major): making governance async is a protocol-wide
change (the evaluator is sync) — deferred, not one-off here.
- _session_state accumulation across cached-agent reuse (Minor): fixed by the
rebind added in the earlier commit (rebind resets the counters). Per-task
safety for ParallelAgent's concurrent callbacks is a known limitation.
- LIFO cap ordering (Minor): the cap now logs; which nodes are dropped past
the cap is non-deterministic but all found nodes are governed.
Tests: 66 pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent ef4518b commit e24a783
2 files changed
Lines changed: 33 additions & 1 deletion
File tree
- packages/uipath-google-adk
- src/uipath_google_adk/governance
- tests/governance
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
| 334 | + | |
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
461 | 479 | | |
462 | 480 | | |
463 | 481 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
| 141 | + | |
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
| |||
350 | 352 | | |
351 | 353 | | |
352 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
353 | 367 | | |
354 | 368 | | |
355 | 369 | | |
| |||
0 commit comments