mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-11 04:00:38 +00:00
The review's arithmetic checks: the closing-frame walk used cap logBudget - openCost, so a compliant merged entry (58-byte wire cost under a 64-byte budget) could see a negative cap and truncate; the first-fragment cap used logBudget instead of the ledger's logBudget - 1, so an open frame costing 63 was admitted with a bill of 64, pushing the ledger negative and letting a subsequent empty frame ride in one byte past the configured cap; and the child billed a closing frame as a fresh entry (quotes+separator again) instead of the merged tail, truncating an exact-fit 30+30 entry. Fixes: first-fragment cap logBudget - 1 (matching admit), continuation and closing-frame cap logBudget + 2 (billed without quotes), jsonStringCostUpTo returns undefined below 2 bytes, and the child's split billing keys off _open_started alone (a closing frame pays content only) with the cheaper bound len(text) while a merge is open. Regression cases cover all three arithmetic paths.