Skip to content

fix: add error handling to critical tools - #269

Open
TerminalGravity wants to merge 3 commits into
mainfrom
fix/error-handling-critical-tools
Open

fix: add error handling to critical tools#269
TerminalGravity wants to merge 3 commits into
mainfrom
fix/error-handling-critical-tools

Conversation

@TerminalGravity

Copy link
Copy Markdown
Collaborator

Adds try/catch with helpful error messages to 4 tools that previously had none:

  • checkpoint — most critical; a crash here means lost context during compaction
  • session-health — called frequently, should never crash mid-session
  • what-changed — fails on shallow clones or repos with <5 commits
  • audit-workspace — fails if not in a git repo

Each error response includes actionable recovery steps instead of a raw stack trace.

Build ✅ | Tests ✅ (43/43)

Adds a new export_timeline tool that generates markdown reports from
timeline data. Reports include:
- Summary stats (event counts, correction rate, sessions)
- Daily breakdown with commits, corrections, and errors
- Tool usage frequency table
- Configurable period (daily/weekly/monthly)
- Optional save to ~/.preflight/reports/

Closes #5
Show users what preflight_check actually returns for ambiguous,
clear, and cross-service prompts. Helps new users understand
the value before installing.
…, what-changed, audit-workspace)

Previously these tools had no try/catch — if git commands failed or the
workspace was in an unexpected state, they'd crash with an unhandled
exception. Now they return helpful error messages with recovery steps.

Tools fixed:
- checkpoint: most critical — crash during checkpoint means lost context
- session-health: called frequently during long sessions
- what-changed: fails on shallow clones or repos with few commits
- audit-workspace: fails if not in a git repo

@TerminalGravity TerminalGravity left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error handling additions to checkpoint, session-health, what-changed, and audit-workspace look solid — actionable error messages instead of raw stack traces is exactly right, especially for checkpoint where a crash means lost context.

One thing: this PR also includes export-timeline.ts (342 lines) and its registration in index.ts, which looks like it belongs in PR #268 (the export_timeline feature PR). Might want to split that out to keep the diff focused on what the title says. As-is, merging this before #268 would create a conflict or duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant