fix(agent): import SimpleNamespace for hook payload sanitization

_hook_jsonable() referenced SimpleNamespace without importing it, so
sanitizing any hook payload that contained one raised
NameError: name 'SimpleNamespace' is not defined.

Bedrock, Codex-responses, and the auxiliary client build their
response / message / tool_call objects as SimpleNamespace and hand the
raw objects to the post_api_request hook. The hook call sites swallow
exceptions (except Exception: pass), so the crash silently dropped the
observability hook for those providers.

Add the missing `from types import SimpleNamespace` and a regression
test covering the SimpleNamespace sanitization path.
This commit is contained in:
Frowtek
2026-06-06 19:32:36 -07:00
committed by Teknium
parent bb53edc773
commit 40cea4d58d
2 changed files with 47 additions and 0 deletions
+1
View File
@@ -60,6 +60,7 @@ from typing import List, Dict, Any, Optional
# ModuleNotFoundError on broken/partial installs where `fire` isn't present.
from datetime import datetime
from pathlib import Path
from types import SimpleNamespace
from hermes_constants import get_hermes_home