fix(execute_code): forward session_id to nested tool calls via RPC - #52000
Conversation
|
I compared this with #52001 against current This PR forwards a session id inside So I think the safer merge shape is either #52001's approach, or this PR plus the same handler/signature threading and a registry-level regression test. That would cover both local/remote RPC internals and the public dispatch path that originally receives the |
5c0dda8 to
88b042f
Compare
|
Addressed the registry-dispatch gap called out above in commit 88b042f75. What changed:
Validation is in the updated PR body: |
7728b35 to
df74d3c
Compare
|
Thanks for tracing this through both RPC transports. Current Current Automated hermes-sweeper review. |
df74d3c to
94d89eb
Compare
|
Rebased and verified in All 4 final regressions fail on exact |
b400a1d to
6ed59cd
Compare
df74d3c to
1749a2b
Compare
Maintenance updateRebased onto current |
CI retriggerPrevious Pushed an empty commit ( |
_rpc_server_loop and _rpc_poll_loop dispatched nested tool calls (e.g. read_file invoked by execute_code) via handle_function_call without passing session_id. Plugin hooks on_pre_tool_call / on_post_tool_call therefore saw an empty session_id and could not correlate nested calls with the originating turn (NousResearch#51931). The fix reads HERMES_SESSION_ID from the session context on the parent thread (before spawning the RPC thread) and passes it explicitly through to handle_function_call in both the local (UDS) and remote (file-based) RPC paths. Fixes NousResearch#51931
Previous Python e2e job failed during setup-uv fetch (network), not during test execution. Empty commit to re-run required checks.
6ff17d6 to
73be067
Compare
|
Rebased onto current Targeted: |
What does this PR do?
_rpc_server_loopand_rpc_poll_loopdispatched nested tool calls (e.g.read_fileinvoked byexecute_code) viahandle_function_callwithout passingsession_id. Plugin hookson_pre_tool_call/on_post_tool_calltherefore saw an emptysession_idand could not correlate nested calls with the originating turn.registry.dispatch("execute_code", ..., session_id="...")forwards that value through theexecute_coderegistry handler instead of dropping it.execute_code()now accepts an explicitsession_id, forwards it into both local (UDS/TCP) and remote (file-based) sandbox RPC paths, and only falls back to the legacy session context when no explicit session id is supplied.rpc_tokenauthorization remains intact in both loop signatures, thread arguments, request payloads, and constant-time validation.Related Issue
Fixes #51931
Type of Change
Changes Made
tools/code_execution_tool.py: threads explicitsession_idthrough the registry handler and both nested RPC transports while preserving currentrpc_tokenauthorization.tests/tools/test_code_execution.py: covers registry and local RPC forwarding.tests/tools/test_code_execution_modes.py: covers remote file-RPC forwarding and the compatibility default.tests/tools/test_approved_command_clean_slate.py: keeps the existing remote-dispatch regression stub aligned with the extended_execute_remotesignature.How to Test
origin/main07be37d99; local ancestry and diff checks are cleanscripts/check.sh --project hermes-agent --worktree worktrees/hermes-agent/51931- all blocking gates passedscripts/run_tests.sh: 123/123 passed across all three changed test filesTestRpcSessionIdForwarding- 4/4 passedorigin/mainand pass on this branchuv lock --check- cleanty checkremains advisory: focused ty output only shows existing diagnostics in the touched file/tool area; full-project ty still panics on pre-existingtools/checkpoint_manager.py, outside this changeChecklist