Repository navigation
fix: hook_error evidence + auto-capture status line (#138) - #288
Conversation
guarded() swallowed hook failures into the host log only, and the chat surface could not tell capture off from misconfigured from armed-and-inert. setup() now mirrors every swallowed failure into the evidence file as hook_error (hook name + error class, never the message), the heartbeat names the captureOnCompact-alone mismatch as switch_mismatch, and memory_status prints an auto-capture line read from the evidence window. Closes #138
WhollyMindless
left a comment
There was a problem hiding this comment.
Reviewed bot head 114b56f4595b0ce94358d8b01283031c6bec5b97 against #138 and the owner's narrowed scope (hook errors + memory_status). Request changes: one confirmed status-reporting defect.
F1 — A successful capture that finds nothing is reported as "ARMED BUT NEVER FIRED" (src/status/metrics.ts, captureHealth; src/status/report.ts, captureLines). A valid [] model response writes capture_lag outcome=empty in src/capture/runtime.ts:319, with no auto_capture_* candidate rows. The new metric ignores that completion receipt and returns lastFired=null; the renderer interprets zero promoted/refused candidates as no execution. This confuses a healthy, token-spending pipeline with the inert pipeline #138 is intended to distinguish.
Independently reproduced on Windows/Bun 1.4.4 through the real plugin registrations and fake host: enabled capture, supplied a 300-character transcript, returned [], dispatched session.execution.succeeded, and waited for this session's durable completion receipt. Observed:
generate.text calls: 1
capture_lag: session=review-empty outcome=empty model=fake/model
captureHealth: {state:"on", rows:0, blocked:0, lastFired:null}
memory_status: auto-capture: ARMED BUT NEVER FIRED
Suggested direction: derive execution/last-fired independently of candidate outcome counts (the existing capture_lag completion receipt covers this case), and base the inert verdict on absence of execution evidence. Keep rows/refusals at zero for an empty successful result. Add a regression through the status surface for this case; the truly inert case should still render distinctly. Equivalent scoped approaches are fine.
Other verification: status + capture suites and the independent probe pass together: 84 tests, 259 assertions. The new hook-error tests verify TypeError/string classification and omission of the error message from evidence; the switch-mismatch heartbeat test passes. All four hosted checks are green. I did not run the full suite or a live host. No implementation changes made.
|
Rework at head F1 — empty successful capture no longer reported as ARMED BUT NEVER FIRED.
Differential (measured): the 3 new/updated tests fail at Proof (measured at |
WhollyMindless
left a comment
There was a problem hiding this comment.
Re-verified bot head 06db5182ae4817d6fe8aeb3a30217b9410de127f: APPROVE with one nonblocking timestamp nit, superseding my earlier changes request. F1 is closed.
I reran the original scenario through real plugin registrations / fake host on Windows, Bun 1.4.4: before execution, memory_status says ARMED BUT NEVER FIRED; after the model returns [] and this session's capture_lag outcome=empty is durable, it says on with 0 rows, 0 refused. lastExecuted matches the receipt. Restoring the prior head's metrics/report files makes that independent regression fail; tracked files were then restored. Status/capture suites plus two independent probes: 87 pass, 278 assertions. All four hosted checks pass. No full-suite or live-host claim.
N1 — display the newer of the candidate and completion timestamps (src/status/report.ts, const fired = c.lastFired ?? c.lastExecuted). Null-coalescing always prefers a candidate timestamp, even if an empty successful capture executed later. Independently measured with a promoted event 3h ago and an empty completion 1h ago: the metric retains both correctly, but the status renders last fired 3h ago. This is a low-severity display follow-up; it no longer misclassifies the pipeline as inert. Consider taking the newest available timestamp, with a mixed-history regression. Fine to defer this nit at the maintainer's discretion.
|
🎉 This PR is included in version 0.15.29 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #138
What
The remaining two items of #138, scoped by the repository owner's triage comment (2026-10-30): "Still unbuilt: Item 2 —
hook_errorevidence … Item 4 — thememory_statusline." Item 1 (theplugin_loadheartbeat) shipped earlier; this PR leaves it intact and completes the surface.hook_errorevidence (item 2).setup()installs a guarded-failure reporter (src/core/hooks.ts+src/index.ts). Every errorguarded()swallows now also writesev=hook_error hook=<name> error=<class>to the evidence file — hook name and error class only, never the message, because a hook payload can carry conversation content. The reporter is awaited inside the swallow and its own failure is swallowed: fail-soft stays fail-soft.switch_mismatchheartbeat state. The acceptance criteria require the evidence file alone to distinguishswitch-mismatch(captureOnCompact: truewithautoCaptureabsent) from plainoff; the shipped heartbeat collapsed both tocapture=off capture_on_compact=true. The heartbeat now recordscapture=switch_mismatchfor that config.memory_statusauto-capture line (item 4). NewcaptureHealth()metric (src/status/metrics.ts) reads the trailing 30d evidence window andrenderMemoryReportprintsAUTO-CAPTURE — is it off, misconfigured, armed, or alive?:off (default)/invalid_model/no_capabilities/switch_mismatch/ARMED BUT NEVER FIRED/on, last fired 3h ago, 4 rows, 1 refused.memory_statuswires it from the samecaptureLagLines()read it already performed.Acceptance evidence
Frozen spec anchor verified before work:
osi-spec-hash: 898e760635e7f8a6matches the recomputed body hash.Red-first at merge-base
cb68647c6301a85dc766d12f91ac90a0c5c9042e— the new tests fail there for the stated reasons (4 fail):plugin_load heartbeat (#138) > switch mismatch: captureOnCompact alone is NOT plain off— merge-base recordscapture=off.hook_error evidence (#138) > a guarded failure lands in the evidence file as hook_error, class only— no such line exists at merge-base.hook_error evidence (#138) > a non-Error throw still records, with typeof as the class— same.test/status.test.tsfails to load at merge-base:Export named 'captureHealth' not found.On this branch: the evidence file alone distinguishes off / invalid-model / missing-capability / switch-mismatch / armed-and-inert (heartbeat tests +
captureHealthunit tests), and the chat surface prints the matching line.Commands run (measured)
bun run typecheck— exit 0bun run lint— exit 0bun run test— 953 pass, 19 skip, 0 fail (972 tests, 92 files)bun run test:e2e— 30 pass, 0 fail (src/ changed)Deliberately not changed
capturevaluesoff|invalid_model|no_capabilities|on,capture_on_compact,subscribed,inject_budget,store_rows) keep their semantics; only the newswitch_mismatchvalue is added.switch_mismatchvalue closes the one warning the heartbeat did not encode./memorypanel is untouched; the ticket names thememory_statusline.fix:*touched.