fix(tools): MemoryReviewer --dry-run builds the prompts and stops - #2109
Open
pai-scaffolde wants to merge 1 commit into
Open
fix(tools): MemoryReviewer --dry-run builds the prompts and stops#2109pai-scaffolde wants to merge 1 commit into
pai-scaffolde wants to merge 1 commit into
Conversation
The header documents `review --dry-run` as "extract + prompt, no inference", but the flag only reached dispatchItems(): review() still called the model (twice on a parse retry), created a MEMORY/OBSERVABILITY/reviewer-runs/<runId>/ directory and appended a row to reviewer-runs.jsonl. CortexHealth reads both artifacts as evidence of a real run — a run directory newer than the latest ledger row grades as "timed-out" — so the command meant to be safe could move memory health and inflate every reviewer denominator. Return right after the prompts are built: no inference, no run directory, no ledger row. The result carries dry_run:true and the prompt sizes so the operator sees what would have been sent. dispatchItems keeps its own dryRun option (used by the smoke test); review() no longer passes it since that path is never reached on a dry run. The smoke test now asserts a dry run leaves run-dir and ledger counts unchanged. Public issue danielmiessler#2073. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Reproduced on a fresh LifeOS 7.40.4 install (macOS, Claude Code in the Claude desktop app); the fix was applied to that install and run there before filing. Fixes #2073 (the shape suggested there is the one taken).
Observed
bun LIFEOS/TOOLS/MemoryReviewer.ts review --dry-runcalled the model, createdMEMORY/OBSERVABILITY/reviewer-runs/<runId>/and appended a row toreviewer-runs.jsonl, while the file's own header (line 28) promises "extract + prompt, no inference".Root cause
review()threadsdryRuninto exactly one place,dispatchItems(). Everything upstream of that —writeRunDebug(),inference()(twice on a parse retry),logRunSummary()— runs unconditionally. Those two artifacts are whatCortexHealth.reviewerEvidence()grades: a run directory newer than the latest ledger row is treated as an orphaned run and, past the grace window, reportedtimed-out; every dry run also inflates the reviewer denominatorsMemoryFixesCheck/MemoryInsights/MemoryStatusread.Fix (behavior, so the header becomes true)
review()returns right after the prompts are built whendryRunis set: no inference, no run directory, no ledger row. The result carriesdry_run: trueandprompt_chars(system/user sizes) alongsidetranscriptandexchanges, so the operator sees what would have been sent.dispatchItems()keeps its owndryRunoption (the smoke test uses it);review()no longer passes it since a dry run never reaches dispatch. The header line is unchanged because it now describes the code.How tested
bun MemoryReviewer.ts test(the tool's existing self-test), run under a temp HOME with the USER/MEMORY symlink layout, gains five checks: dry run returnsokwithdry_run,inference_duration_ms === 0and nodispatch_summary, run-dir count unchanged, ledger row count unchanged, prompt sizes reported.The remaining self-test checks are unchanged before and after. Transpiles. On the live install:
review --dry-runleaves the run-dir and ledger counts unchanged, and Cortex health reports ok.🤖 Generated with Claude Code