Repository navigation
Conversation
The default tail breakpoint (#795) adds a cache_control mark to the last message after the pipeline ran. A string content also becomes one text block. The message gets longer on the wire, and no operation reported the extra bytes. The sum check failed on every request with a trailing system message (section=messages ops=0 bodies=-63 bytes), so every request fell back with check_sum and booked no saving. apply now appends one rewrite operation for the last message, in wire bytes, when markTail places a mark. Its ChangeID comes from the message before the mark, so it is the same on every request. The operator tailbreakpoint is an envelope operator in dash, so it gets its own row. No accountant check or plausibility rule is weakened. The check now has the operation it was missing. Harness (FAKE_TOKDIV=8, tailx, 7 requests): net_saved_usd 0 -> 0.0817. Truth (control cost - tail on cost): 0.0736. Fallbacks 7 -> 0. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
…y bound (#907) PriceMode compared the tokens the library saved with e.TokensBefore. TokensBefore counts message text only. Removed tool declarations are not in it. A 121-token conversation that drops 2,188 tokens of declarations looked like a request that removed more than it had, so the event fell back with implausible_size and lost every other component's saving too. countedSavedTokens now skips operations of the operators that act on the tools section (toolfilter, toolschema, expand, adjudicate). The bound is unchanged for every operation on messages. The accountant checks are not touched. The bound cannot be made against the full request size here, because the event has no count of tool and system tokens. Harness (FAKE_TOKDIV=7, MSGMULT=30, tf2, 8 requests): fallbacks 8 implausible_size -> 0. net_saved_usd 0 -> 0.0554. Truth (control cost - treatment cost): 0.0564. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
…908) Tool deferral runs after the pipeline reported its operations. It marks declarations defer_loading, adds the search tool, and puts a names list at messages[1]: appended to the system message there, or as a new system message. The tools half is found by the envelope reporter. The names list was reported by nobody, so the sum check failed on the messages section (ops=0 bodies=-308 bytes) and conservation failed with it, on every request of a deferred thread. proxy now diffs the body before and after applyToolDefer and reports the change as a tooldefer operation: a one-message splice for a new message, a rewrite in place for an appended list. tooldefer is an envelope operator in dash, so it gets its own row. No accountant check is weakened. Harness (FAKE_TOKDIV=4, MSGMULT=1500, td, 8 requests): check_sum fallbacks 8 -> 0, failed checks 8+7 -> 0. The Overview still does not credit the deferred declarations: the library sees bytes, and a declaration marked defer_loading keeps its bytes. net_saved_usd is -0.0006 (the names list and search tool as cost), truth is +0.0185. /api/tool-defer still reads 0.0412. Making the two agree needs a product decision, so it is not part of this change. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID BOAZ <[email protected]>
This was referenced Nov 5, 2026
Collaborator
Author
|
Closed in favour of #930, the combined PR for the accountant integration. The commits of this PR are in #930. Nothing is lost: the branch stays. Assisted-By: Claude (Anthropic AI) [email protected] |
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.
Summary
Three accountant fallbacks lost the whole saving of a request. Each now has the operation or bound it was missing.
This PR is a draft stacked on #923. Figures change on purpose.
What changed
check_sum.ops=0 bodies=-63 bytes).applyappends atailbreakpointrewrite on the last message when the mark is placed.dashgives it an envelope row.net_saved_usd0 to 0.0817. Truth 0.0736.implausible_sizeand dropped the whole result.TokensBefore, which counts messages only.countedSavedTokensskips tool-section operators (toolfilter, toolschema, expand, adjudicate). The bound stays for messages.net_saved_usd0 to 0.0554. Truth 0.0564.check_sumandconservationon every request.messages[1]after the pipeline reported its operations. Nobody reported it.proxydiffs the body aroundapplyToolDeferand reports atooldeferoperation (splice or rewrite).net_saved_usdnow -0.0006.No accountant check or plausibility rule is weakened. Reasons are in each commit message.
Not fixed
/api/tool-deferstill says 0.0412. Making the two agree is a product decision.How it was tested
TestTailBreakpointReportsItsBytes,TestTailOpCoversTheMarkBytes,TestRemovedToolDeclarationsDoNotTripThePlausibilityBound,TestPriceMode_ToolSectionTokensAreNotBoundedByMessageTokens,TestToolDeferReportsItsNamesList,TestMessageOpsExplainTheDeferralList.go test -count=1 ./dash/... ./proxy/... ./apply/... ./keepalive/... ./components/... ./tooldefer/...passes.gofmt -l,go vet ./...,go build ./...andgo mod tidy -diffare clean.Assisted-By: Claude (Anthropic AI) [email protected]