Skip to main content

Module runtime

Module runtime 

Source
Expand description

Runtime wiring: learn gotchas from real shell outcomes.

detect_error / try_resolve_pending were fully implemented and unit-tested but never called on a live path — the engine that learns “error X was fixed by Y” sat dormant. This module hooks them into the shell layer at the exact point the #499 diagnostics store uses (shell::exec), so a failing build/test pushes a pending error and the next green run of the same command base correlates the fix into a persisted Gotcha — automatic, no agent action required.

§State model

Pending errors are in-memory by design (GotchaStore.pending_errors is #[serde(skip)]). A process-global active store keeps them alive across calls, so in the long-lived daemon a fail→fix spanning two ctx_shell calls correlates. Durable gotchas / error logs / stats are persisted to gotchas.json, so the injection block and CLI see them across processes.

Functions§

record_shell_outcome
Shell-layer hook: learn from a finished command’s outcome.