ledger-signals: derive zeroMergeStreak from Prior-night fates tokens - #15
Draft
ruvnet wants to merge 2 commits into
Draft
ledger-signals: derive zeroMergeStreak from Prior-night fates tokens#15ruvnet wants to merge 2 commits into
ruvnet wants to merge 2 commits into
Conversation
The CLI's `ledger signals` command has always called learningSignals(rows) with no mergedPrNumbers option, so zeroMergeStreak was unconditionally true whenever any PR existed in the window, regardless of real merge status — demonstrated live tonight: PR #7 merged three days ago but the signal still reported a zero-merge streak. Prior-night fates already exists to record per-PR MERGED/CLOSED/OPEN/STALE fates from each night's STEP-1 check; wire it in via a small #N:FATE token parser (parsePriorFates), additive to the existing option so nothing regresses when fate data is absent. Dream Cycle 2026-08-16, DEEP=ledger-signals, SCAN=witness,verify.
Owner
Author
Independent critic passSpawned a separate agent (not the candidate's author) to adversarially review this diff. Verdict: CLEAR of reward-hacking, with two disclosed limitations worth tracking as follow-ups rather than blockers:
Neither limitation changes the verdict: the fix is additive, conservative-by-default, and demonstrated live against real GitHub state (PR #7's actual merge) in the issue/PR description above. Generated by Claude Code |
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.
Nightly Dream Cycle, 2026-08-16. DEEP=ledger-signals, SCAN=witness,verify. Full report:
docs/dream-cycle/2026-08-16-ledger-signals-report.md. Issue: #14.Hypothesis
Given the ledger's
Prior-night fatescolumn carries per-PR fate text recorded by each night's STEP-1 fate check, whenlearningSignals()additionally parses that column for an explicit#<PR>:MERGEDtoken (never inventing a fate from free prose), thenzeroMergeStreakshould correctly clear once a row records a PR as MERGED — whereas today it is assertedtruefor any window containing a PR regardless of real merge status. Frozen before implementation.Candidate
+150/-4 across 3 files (1 new report, 2 edits:
packages/ledger/src/index.ts+ its test file). One conceptual change: an additiveparsePriorFates()token parser wired intolearningSignals()'s existingmergedPrNumbersunion — no removal, no behavior change when fate tokens are absent.Evaluation Receipt
Real evaluator:
npm test(vitest, this repo's ownbenchentrypoint).Live receipt against the real repo ledger tonight vs. a synthetic follow-up ledger:
Baseline
Parent commit
8ce385786faa5e63cc0e7105cc6e96f663a51f07, 96/96 tests passing, clean build (npm ci && npm run build, no wasm/NAPI packages in this workspace).Darwin Lineage
Not run —
DARWIN=not-applicable. Single, minimal, pure-parsing conceptual change; no evolvable population.Evidence
Confirmed live via GitHub MCP tonight: PR #7 (last night's candidate) is
merged: true,merged_at: 2026-08-13T22:05:44Z, issue #6closed/completed. The pre-fixledger signalsCLI output nonetheless claimedzeroMergeStreak: trueon the real ledger — a real, demonstrated contradiction, not a hypothetical one. Root cause:packages/cli/src/index.ts'sledger signalssub-command has always calledlearningSignals(rows)with nomergedPrNumbersoption, and the pre-fix logic (!merged || ...) forces the streaktruewhenevermergedisundefined— which it always was on the CLI path. Existing unit tests never caught this because every pre-fix test exercisingzeroMergeStreakexplicitly suppliedmergedPrNumbers— the CLI's actual (unsupplied) path was untested.Reward-Hack Check
Self-critique (no second agent available in this environment tonight): CLEAR. Only the ledger package's source + test file changed, all additive. The new
#N:FATEtoken format is a hard, explicit syntax (#(\d+)\s*:\s*(MERGED|CLOSED|OPEN|STALE)) — verified by a dedicated test that free prose like "PR 105 was merged into main yesterday" is correctly ignored, so the fix cannot manufacture a false positive from loose language. Today's real 1-row ledger (no fate tokens present) is verified unchanged: still reportszeroMergeStreak: true, its existing conservative default — the fix adds recall, it never removes a real signal.Security Review
Pure string/regex parsing over
docs/dream-cycle/LEDGER.md, a file this repo already owns and writes to itself. No new I/O, no new credentials, no LLM calls, no change toevaluatorEntrypointsorio.exec.Regression Analysis
0 pre-existing tests modified or removed. All 96 baseline tests still pass unchanged; 4 new tests added covering: token-present clears streak, non-MERGED tokens don't clear it, free-prose is ignored, and latest-token-wins when a PR is mentioned more than once.
ADR
None — this is a signal-computation bug fix using an existing, already-designed-for-but-unused ledger column, not a new architectural decision. (Extends, doesn't supersede, ADR-0001.)
Gist
No
gh gist createtool /ghCLI available in this environment (same as the #6/#7 night). Report committed atdocs/dream-cycle/2026-08-16-ledger-signals-report.mdinstead.GIST=LOCAL.Issue
#14
Witness
Verify:
sha256sum docs/dream-cycle/2026-08-16-ledger-signals-report.md, thenprintf '%s%s' "<hash>" "8ce385786faa5e63cc0e7105cc6e96f663a51f07" | sha256summust equal the witness above. Confirmed tonight viadream-machine witness verify(✓ VALID).Merge Policy
Draft — human review required. This PR does not carry the
automerge-safelabel: while the diff is small and additive, it changes the semantics of a decision-support signal (zeroMergeStreak) that future nights read to decide candidate scope, which per this repo's own guarded-auto-merge policy warrants a human look before it starts influencing subsequent nights' behavior. The session never applies that label itself and never merges.Generated by Claude Code