Skip to content

Persist clabby's own crashes & errors locally (observability) #113

Description

@Zlyzart

Problem

Clabby does not persist anything about its own failures. When the process panics or an internal error propagates, the output goes to stderr only and is lost as soon as the terminal closes or a headless/cron run ends. There is no on-disk record of clabby's crashes or errors.

Concretely today:

  • crates/cli/src/main.rs initializes tracing_subscriber::fmt() writing to stderr, default filter warn — no file sink, no rotation.
  • There is no panic hook; a panic prints the default message to stderr and unwinds, leaving no trace.
  • main returns Result, so propagated errors print via anyhow to stderr and then vanish.

Note: an agent's own stdout/stderr is already persisted (runner streaming → db.insert_log). The gap is specifically clabby's own panics and internal errors.

Why it matters

This bit us directly: issue #89 set out to add a regression test for a real crash in run_managed, but the crash could not be reconstructed because nothing captured it — no panic message, location, backtrace, or surrounding log. Without persisted diagnostics, post-mortem debugging and accurate regression tests are impossible, and the cron/headless paths are effectively blind.

Goal

Provide durable, local persistence of clabby's own errors and crashes so a failure can be diagnosed (and turned into a regression test) after the fact — without violating Constitution §7 (core stays UI-free; a process-global hook is a driver concern, not core's).

Status

Intentionally not designed yet — this is a research/design issue. Open questions to resolve during refinement:

  • Capture scope: panics only, or panics + propagated error!/warn! traces?
  • Sink: a rotating log file (robust even mid-DB-failure) vs. the DB vs. both; where the file lives (next to the DB / under the config root / an OS state dir).
  • Where installation belongs across drivers (CLI main, cron, future Tauri) so behavior can't diverge by entry point.
  • Retention/rotation and any redaction of sensitive command lines/env.

Out of scope (for this issue)

  • Implementation — design first.
  • Agent session-output logging (already handled via db.insert_log).
  • Remote/network telemetry or third-party crash reporting (core must stay network-free per §7/§11).

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:engineRust core/CLI: crates/core, crates/cli.area:researchPOCs, library evaluation, open-ended discovery.priority:mediumMeaningful improvement; normal queue.status:needs-decisionBlocked on a human: design sign-off, a clarifying answer, or repeated agent failure.type:tech-debtKnown shortcut to repay; reduces future friction.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions