Add a timed kill -9 recovery benchmark (exact-once spend) - #137
Merged
Conversation
Add a recovery-time benchmark alongside the cost benchmark. It interrupts a
governed, checkpointing run with a hard kill -9 of the daemon mid-run, restarts
on the same durable data dir, and times how long until the daemon is healthy with
the run reloaded. It then proves the cost meter continues from where it was — no
reset, no double-count — and still halts at the original budget, i.e. exact-once
spend across the crash.
Key-free and deterministic like the cost benchmark: the same mock provider, a
dummy key, spend read from RiskKernel's own ledger (GET /v1/runs/{id}). Numbers
are merged into results.json under a recovery key without touching the existing
cost object; the benchmark README gains a Recovery time section.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The cost benchmark measures one dimension — dollars saved when a runaway
loop is capped. This adds the other: crash recovery, with a number.
benchmark/recovery.pyruns a governed, checkpointing run through RiskKernel,hard
kill -9s the daemon mid-run (no graceful shutdown), restarts it on thesame durable data dir, and:
reloaded with its prior spend (the
resumed runs from storestartup line is thedaemon confirming it restored from the store);
before the crash (no reset, no double-count), and the run still halts at the
original budget. A reset would have re-paid the pre-crash calls; the harness
prints that counterfactual.
It mirrors the cost benchmark exactly: key-free and deterministic (the same mock
provider, a dummy key, spend read straight from RiskKernel’s own ledger via
GET /v1/runs/{id}), waits for/healthzbefore driving calls, and cleans upits processes and temp data dir on exit. Reproducible on a clean machine with no
API key.
results.jsongains arecoverykey without disturbing the existing cost object,and the benchmark README gets a "Recovery time" section with the methodology.
Sample run on a laptop:
Closes #98