Files
hermes-agent/cron/scheduler_diagnostics.py
T
Teknium e1a161538a fix(cron): make failed runs diagnosable without verbose delivery errors
Persist a redacted chained traceback in the private run output and expose
redacted last_error in tool and slash listings, including historical errors.
Keep the run_job concise error return unchanged for delivery classification.

Slim redo of liuhao1024's earliest #104545; adds forced redaction and keeps
formatting in a topical sibling. Local SDK/socket A/B verifies diagnosis
visibility plus healthy-script, clearing, and private-file controls.
Canonical tests queued under the campaign lock at commit time.

Co-authored-by: liuhao1024 <sunsky.lau@gmail.com>
2026-09-07 08:18:56 -07:00

14 lines
490 B
Python

"""Private run-document diagnostics, kept separate from delivery summaries."""
from traceback import format_exception
from agent.redact import redact_sensitive_text
def format_run_error(exc: BaseException) -> str:
"""Retain chained causes without capturing locals or exposing URL credentials."""
traceback_text = redact_sensitive_text(
"".join(format_exception(exc)), force=True, redact_url_credentials=True,
)
return f"## Error\n\n```\n{traceback_text}\n```\n"