Files
hermes-agent/agent
kshitijk4poor 307428377b refactor: drop dead api_kwargs strip from the ASCII-codec recovery branch
The ASCII branch of _recover_unicode_encode_error popped/stripped/restored
`tools` on the failed attempt's api_kwargs and tracked `_tools_sanitized`,
but that dict is discarded: build_api_request rebuilds api_kwargs from
agent.tools on every retry iteration and sanitize_outbound_kwargs already
strips the whole payload once `_force_ascii_payload` is set. Only
api_messages (reused across retries) and the local active_system_prompt
still need stripping here.

Also removes the `_force_ascii_payload = False` assignment in the UTF-8
branch (the flag is initialised False in agent_init and only ever set True
in this function), the now-unused `_sanitize_tools_non_ascii` import and
the dead `import copy`. The test drops its assertion on the recovery
dict's tools identity; the chokepoint assertion (agent.tools byte-stable
after sanitize_outbound_kwargs) is kept.
2026-09-21 21:33:44 +05:30
..
…
…