Repository navigation
fix(accounting): credit monitor only after durable token commit - #4811
Open
ScriptedAlchemy wants to merge 9 commits into
Open
ScriptedAlchemy wants to merge 9 commits into
ScriptedAlchemy wants to merge 9 commits into
Conversation
Keep the live monitor's raw tool activity after a local accounting write fails, but publish zero saved tokens instead of crediting the uncommitted delta. Only the canonical project-store commit controls what the monitor reports; optional global projection remains best-effort. Add a real registered-store and mmap-backed regression covering successful savings, an overflow refusal, both durable counters and monitor output. No schema, release or policy changes. Refs #4447
|
Apply the exact source changes requested by the first failing hosted Bazel Rustfmt gate at the preceding PR head. No behavior or assertions change; all existing regression tests are preserved. Refs #4447 Verification: source contexts checked against hosted Rustfmt diffs. New-head Rust/Bazel tests require hosted CI.
Repair three hosted automation_runner_test failures by supplying the configured executable identity required by the production prefilter. Use the same identity for the prefilter and retained runner, preserving manual-schedule, exact-ledger, live-lock and lock-race assertions. Add a production-prefilter regression for unconfigured refusal, deduplication and same-occurrence recovery after binding, with zero backend calls and no effectful terminal. Do not relax backend admission, change timeouts, or alter the graph publication changes. Refs #4532
A synchronous OnceLock wait inside the asynchronous historical-ingest fixture blocked the worker that must poll live projection concurrently. Use a durable async watch latch to preserve release ordering while exercising the real interleaving and supersession journey. Refs #4481
This branch has not been deployed
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.
Scope — Refs #4447 (correctness slice, not full acceptance)
The canonical project-store writer already atomically commits lifetime and resettable savings counters. However the MCP accounting task wrote a positive saved-token delta to the live monitor ring even when the project-store commit refused, so terminal-monitor totals could claim savings that were never durable. The logged persistence error did not stop that credit.
This one-file change makes
commit_token_savingsreport whether the project-store transaction committed. The monitor always retains the raw tool-activity size; it publishes a positive saved-token delta only for a successful canonical commit. Optional global projection failure remains warned and does not erase a locally committed saving. The response remains nonblocking and observed ledger-write shutdown settlement is unchanged. No schema, lock, API, dashboard, policy or release changes.Falsifiable production regression
The new
live_monitor_reports_only_committed_token_savingsRust test uses a registered project store plus the real memory-mapped monitor ring, not mock counters: a successful 7-token response must appear as delta 7 with raw input 20, then a committed maximum counter forces the next 1-token write to fail checked addition. Its monitor activity must still appear with raw input 30 but delta 0, and both durable project counters must remain unchanged at the boundary. The old implementation fails the delta-0 assertion. Existing concurrent/restart/rollback tests remain intact.Review / validation
Commit
109f4608e616is a single-parent change based onmaster91c72aba7750, touching onlycrates/tracedecay/src/mcp/server/ledger.rs(88 added / 5 removed). Diff reviewed; pushed withforce=falseand exact expected-old-head fast-forward. No existing #4447 branch was rewritten.Not yet verified by Bazel: this connector-backed runtime has no local checked-out repository or Bazel installation. Hosted CI for the exact head must execute a nonzero Rust
//crates/tracedecay:unit_test(including this module's test) and//crates/tracedecay:automation_runner_test, plus format/Clippy and relevant native macOS verification. No CI pass is claimed before job logs establish execution.Remaining #4447: durable per-response idempotency/replay identity across retries, explicit failed-stage diagnostics and reinsertion/restart/disconnect coverage, proving no double credit under all races, and reducing duplicate authority. Those are not satisfied by this monitor fix; keep #4447 open, Refs only. PR-maintenance handles CI review and eligible merges; no automatic merge on green metadata. Mixed Kev/draft #4776 and release #4763 untouched.
Latest CI source fix — hosted Rustfmt (2026-11-08)
Commit
48d27c89applies all three exact formatting corrections inledger.rsreported by Repository gates run 42453927974: one awaited-commit conditional and two multi-line counter assertions. Diff independently reviewed: one file, twelve insertions/three deletions, no behavior or assertion changes. Published withforce=falseand expected previous head. New-head Bazel/MCP integration remains unverified; no test pass or #4447 completion is claimed. Remaining durable response idempotency and reset/replay integration must still be addressed.