mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-08 13:12:08 +00:00
fix: drop timestamp in handle_max_iterations' hand-built api_messages
Gateway user replay entries now carry a timestamp (read by the stale-confirmation expiry check). The transports already sanitize it (#47868), but handle_max_iterations hand-builds api_messages and calls chat.completions.create() directly, bypassing the transport — a strict provider would 400 on the foreign key. Mirror the transport's pop here, alongside the existing tool_name/codex_* sanitization.
This commit is contained in:
parent
e7a6d676c8
commit
6d3d9d0baf
1 changed files with 3 additions and 1 deletions
|
|
@ -1525,8 +1525,10 @@ def handle_max_iterations(agent, messages: list, api_call_count: int) -> str:
|
|||
# hand-builds messages and calls chat.completions.create() directly,
|
||||
# bypassing the transport — so mirror that sanitization here:
|
||||
# tool_name (SQLite FTS bookkeeping), the codex_* reasoning carriers,
|
||||
# timestamp (preserved on gateway user replay entries for the
|
||||
# stale-confirmation expiry check — #47868 rejection class),
|
||||
# and every Hermes-internal underscore-prefixed scaffolding key.
|
||||
for schema_foreign in ("tool_name", "codex_reasoning_items", "codex_message_items"):
|
||||
for schema_foreign in ("tool_name", "codex_reasoning_items", "codex_message_items", "timestamp"):
|
||||
api_msg.pop(schema_foreign, None)
|
||||
for internal_key in [k for k in api_msg if isinstance(k, str) and k.startswith("_")]:
|
||||
api_msg.pop(internal_key, None)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue