fix(delegation): normalize child runtime tuple - #25386
Conversation
wesleysimplicio
left a comment
There was a problem hiding this comment.
Read-only review pass: one remaining edge case seems to preserve the stale key this PR is trying to eliminate.
_normalize_child_runtime_tuple only repairs the inherited tuple when URL/mode/provider shape mismatches. If base_url and api_mode already match the resolved runtime but the inherited api_key is stale, the helper returns the old key. I reproduced this in a local read-only checkout by patching the resolver to return fresh-key; the helper still returned stale-key because no URL/mode mismatch was present.
I would include api_key mismatch in the repair condition whenever the resolver provides a key, plus a targeted regression for inherited stale key with matching base URL and API mode.
|
thanks, good catch. i added a follow-up commit that includes the api_key mismatch in the normalization condition and a regression test for the matching URL/mode case.\n\nwhile testing this on my live Hermes setup, i also found a related credential pool edge case: after a parent route switch, parent.provider can be openai-codex while the inherited pool is still from the previous provider. i added a small guard so child agents only share the parent pool when the pool provider matches too.\n\nlocal checks after the follow-up commit:\n- scripts/run_tests.sh tests/tools/test_delegate.py -> 132 passed\n- .venv/bin/ruff check tools/delegate_tool.py tests/tools/test_delegate.py -> passed |
|
Thanks for the focused delegation investigation and the follow-up coverage for stale keys and pools. This is an automated hermes-sweeper review; current
Those current-main fixes cover the stale delegated runtime tuple and stale credential-pool behavior addressed here. |
Summary
Normalizes the delegated child agent runtime tuple before constructing
AIAgent:base_url/api_key/api_modethrough Hermes' runtime provider resolverdelegation.base_urland ACP transport overridesRoot cause
v0.18.0 can construct a child with the intended provider/model but a stale parent endpoint or key after a parent route switch. That produces a subtly wrong runtime tuple: provider/model say one thing, but
base_url/ credential pool still point somewhere else.Related merged precedent
tools/delegate_tool.pyplus focused regression tests.tests/tools/test_delegate.py.Scope / risk
Verification
python -m pytest tests/tools/test_delegate.pypython -m py_compile tools/delegate_tool.pygit diff --checkeb0ad009e89a