You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sanitize_for_json() in hackagent/router/tracking/utils.py:85-86 then replaces
matching values with ***REDACTED***. This redacts operational metrics stored in the hackagent-db
via Tracker/StepTracker such as prompt_tokens, completion_tokens, total_tokens, input_tokens, output_tokens, cached_tokens, and token_count (e.g. response.usage in hackagent/router/router.py:895-897, hackagent/server/api/models.py:435-443, hackagent/cli/tui/views/results/formatters/http.py:290-309).
Counts are not secrets and must remain visible in traces/results.
Sensitive keys like api_key, api_token, access_token, secret, password
must still be redacted.
Minimal Fix
In hackagent/router/tracking/utils.py add an exact-match allowlist checked
before the sensitive-substring test and keep the substring check for everything
else:
_TOKEN_COUNT_ALLOWLIST=frozenset({
"prompt_tokens", "completion_tokens", "total_tokens",
"input_tokens", "output_tokens", "cached_tokens",
"token_count", "prompt_tokens_details", "completion_tokens_details",
})
# in sanitize_for_json, if k.lower() in allowlist → recurse, don't redact
Files To Change
hackagent/router/tracking/utils.py -> add allowlist and guard in sanitize_for_json.
Partly fixed by the restructure: sanitize_for_json (now hackagent/tracking/serialize.py) keeps the usage counts prompt_tokens, completion_tokens, total_tokens, input_tokens, output_tokens, cached_tokens, reasoning_tokens and the other *_tokens counters.
Activity
franconicola commentedon Sep 25, 2026
Hold on this until the restructure lands first (#640 / refactor/main). Reopen or retarget a fix after that lands so we don’t fight path/layout churn.
franconicola commentedon Oct 19, 2026
Partly fixed by the restructure:
sanitize_for_json(nowhackagent/tracking/serialize.py) keeps the usage countsprompt_tokens,completion_tokens,total_tokens,input_tokens,output_tokens,cached_tokens,reasoning_tokensand the other*_tokenscounters.Still redacted on current
main:So
token_countand the*_tokens_detailsdicts still need to be exempted. The*_tokens_detailsdicts should be recursed into rather than kept whole.