Repository navigation
refactor(core): step ledger and classified settlement - #35235
Closed
kitlangton wants to merge 3 commits into
Closed
kitlangton wants to merge 3 commits into
kitlangton wants to merge 3 commits into
Conversation
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.
Implements the parked settlement refactor for the V2 runner (plan: branch
settlement-ledger, PLAN.md). Follow-up to #35218 (step vocabulary) and #35227 (runner renames). Behavior-preserving: all 144 runner-adjacent tests pass with zero test-logic changes (one import path updated for the file rename).1.
refactor(core): rename LLM event publisher to step ledgerPure rename:
publish-llm-event.ts→step-ledger.ts,createLLMEventPublisher→createStepLedger, bindingpublisher→ledger. The object already owned the step's durable facts (assistant started, provider error, tool records, step settlement data); the name now says so.2.
refactor(core): derive continuation and held overflow from step ledgerKills the attempt-scoped mutable evidence in
attemptStep:let needsContinuation(flipped inside the stream closure, read ~130 lines later) → derivedledger.hasLocalToolCalls(). Semantics preserved exactly: the ledger admits a local call at the same point the old flag was set — after the provider-executed and tools-disabled early returns.let overflowFailure→ledger.holdOverflow(event)/ledger.heldOverflow(). The hold-back policy check (context overflow before any assistant output) stays at the call site; only the stash moved to the transcript owner.The stream handler is now near-stateless: admit to ledger, spawn tool fibers.
3.
refactor(core): classify step settlement onceThe settlement block previously re-derived combinations of ~8 evidence booleans as it went. Now it classifies once —
— then runs flat, verdict-keyed effects. Effect ordering is load-bearing and unchanged: clear fibers before awaiting on interrupt, publish held overflow before classifying, failUnsettledTools before failAssistant,
Step.Endedonly on Clean, identical failure/interrupt propagation. LLM stream-failure handling stays before classification (it is evidence recording, not a settlement arm).Reviewable decisions
failUnsettledTools/failAssistant/publishStepEndstay inattemptStepwhere their ordering is visible. Deliberate boundary; could move later if the ledger grows.Tool execution failed: <reason>before the orphan sweep, matching the old unconditional defect-settle order (the naive classify-once shape would have lost the defect message).Verification
packages/core)bun typecheck, prettier, oxlint clean