fix(session): enforce daily spending limits with current ledger totals - #1595
Closed
santoshkumarradha wants to merge 4 commits into
Closed
santoshkumarradha wants to merge 4 commits into
santoshkumarradha wants to merge 4 commits into
Conversation
Member
Author
Pass 1 Review: Defects & Contracts
drafted with CodeAF |
Member
Author
Pass 2 Review: Architecture & Software Craft
drafted with CodeAF |
santoshkumarradha
marked this pull request as ready for review
September 27, 2026 04:08
Member
Author
|
@AbirAbbas this is review ready |
Member
Author
Pass 3 Review: Production Readiness & Verification
drafted with CodeAF |
santoshkumarradha
marked this pull request as draft
September 27, 2026 14:42
santoshkumarradha
marked this pull request as ready for review
September 27, 2026 15:03
santoshkumarradha
added a commit
that referenced
this pull request
Sep 27, 2026
Member
Author
|
Superseded by draft #1627. Exact reviewed head |
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.
Real product workflow — recorded on Spark
Goal: Build a pantry stock CLI, use it, and correct unsafe partial-output behavior while managing the actual daily spending rail.
Observed outcome: The app built a working CLI. With /budget day .001, the requested correction was refused and model receipt count stayed 19 → 19. Raising the rail with /budget day 5 allowed the correction in the same conversation. The final artifact passed 17 tests and printed the expected rice/beans stock output.
Watch the workflow (MP4) · Animated GIF · Original terminal recording (.cast)
Evidence: tested revision
3a31539e683eaf1011b4d7657c9c9ca8dbdc59c8; Spark sessioncritical-extended-1595-v2. Execution/binary identity, model receipts, checksums and playback details. All 36 recorded calls used OpenRouterdeepseek/deepseek-v4.1-flash, including auxiliary calls. Independent generated-project test output.Playback and limits: Original
.castis preserved; GIF/MP4 play at 3× speed with idle intervals capped at 3 seconds. Run used --one-model and explicitly disabled Model Pool for issue #1608; Model Pool behavior is verified separately in #1610. Earlier failed-policy recordings remain preserved locally and are not counted as successful evidence. This workflow verifies a blocked chat turn and recovery after changing the rail; it does not prove an atomic cross-process reservation or test midnight rollover live (covered by regression tests).Interactive turns and task-crew/helper guards enforce the profile's daily spending limit. Guards observe completed usage from other conversations throughout their lifetime and reset completed spending at the local date boundary. Locally settled calls remain counted while their asynchronous receipts catch up, without adding the same completed receipt twice.
Resolves #1546. Existing per-conversation and per-task limits remain separate. Calls already in flight may finish; reservations are process-local, not an atomic cross-process spending guarantee.
Validation:
LIVE_BUDGET_READY_1595. Lowering the fixture's daily budget below recorded spend refused the next turn withdaily limit reached; the ledger stayed at three receipts. Raising the limit allowedBUDGET_RESUMED_1595in the same conversation.deepseek/deepseek-v4.1-flash, including auxiliary roles.