fix(agent): preserve tracebacks in prompt_builder and trajectory warnings

Two `except Exception as e:` warnings lose the traceback:

- agent/prompt_builder.py: skill-file frontmatter parse failure
- agent/trajectory.py:      trajectory log append failure

Add `exc_info=True` so the stack is preserved when a skill manifest is
malformed or trajectory writes hit filesystem errors in production.
This commit is contained in:
Alexazhu 2026-04-18 15:37:29 +08:00
parent 73bccc94c7
commit 8c4eeffb4c
2 changed files with 2 additions and 2 deletions

View file

@ -545,7 +545,7 @@ def _parse_skill_file(skill_file: Path) -> tuple[bool, dict, str]:
return True, frontmatter, extract_skill_description(frontmatter)
except Exception as e:
logger.warning("Failed to parse skill file %s: %s", skill_file, e)
logger.warning("Failed to parse skill file %s: %s", skill_file, e, exc_info=True)
return True, {}, ""

View file

@ -53,4 +53,4 @@ def save_trajectory(trajectory: List[Dict[str, Any]], model: str,
f.write(json.dumps(entry, ensure_ascii=False) + "\n")
logger.info("Trajectory saved to %s", filename)
except Exception as e:
logger.warning("Failed to save trajectory: %s", e)
logger.warning("Failed to save trajectory: %s", e, exc_info=True)