This commit is contained in:
Robby Sarvis 2026-05-26 09:40:49 -05:00 committed by GitHub
commit 55385277d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View File

@ -201,7 +201,7 @@ def parse_lookup_requests(text: str, max_requests: int = DEFAULT_MAX_LOOKUP_REQU
current = {}
for raw_line in lines:
stripped = raw_line.strip()
stripped = raw_line.strip().strip("`")
if stripped in {"lookup_requests:", "repo_lookup:", "repo_lookups:"}:
in_section = True
continue

View File

@ -120,10 +120,20 @@ def tail_lines(path: Path, limit: int = 100) -> list[str]:
def _redact_fields(fields: dict[str, object]) -> dict[str, object]:
redacted: dict[str, object] = {}
safe_metrics = {"prompt_tokens", "output_tokens", "total_tokens",
"actual_prompt_tokens", "actual_output_tokens"}
for key, value in fields.items():
lowered = key.lower()
if any(marker in lowered for marker in ("secret", "token", "password", "key")):
if key in safe_metrics:
redacted[key] = value
elif _looks_like_secret(key):
redacted[key] = "<redacted>"
else:
redacted[key] = value
return redacted
def _looks_like_secret(key: str) -> bool:
lowered = key.lower()
sensitive = {"secret", "password", "api_key", "auth_token", "access_token",
"secret_key", "private_key", "db_password"}
return lowered in sensitive