feat(logging): record the provider reason for a failed agent turn

A failed provider turn collapsed to AGENT_EXECUTION_FAILED/unknown with the
underlying reason discarded, so a model-side rejection or safeguard was
indistinguishable from a transport fault in the error log.

- add safeProviderTurnDetails: write bounded, non-sensitive fields (provider,
  model, responseId, stop reason, tool-in-flight, category, retryable) to error.log
- gate a sanitized errorMessage snippet behind SHANNON_DEBUG_PROVIDER_ERRORS, off by default
- forward SHANNON_DEBUG_PROVIDER_ERRORS from the CLI into the worker container
This commit is contained in:
ajmallesh
2026-08-28 12:18:51 -07:00
parent 8df9eb3db4
commit 0fe0c67ca5
3 changed files with 138 additions and 3 deletions
+4
View File
@@ -31,6 +31,10 @@ const COMMON_FORWARD_VARS = [
'SHANNON_AI_MODEL',
'SHANNON_AI_BASE_URL',
'SHANNON_AI_OPENAI_FORMAT',
// Opt-in debug flag: when set, the worker persists a bounded, sanitized snippet of a failed
// provider turn's raw error message to error.log. Off by default; provider prose stays out of
// durable state unless an operator deliberately enables it for a diagnosis.
'SHANNON_DEBUG_PROVIDER_ERRORS',
GENERIC_API_KEY_ENV,
] as const;