feat(context)!: deterministic minimum-first layer allocator - #87
feat(context)!: deterministic minimum-first layer allocator#87LukasParke wants to merge 16 commits into
Conversation
Signed-off-by: Luke Parke <5702154+LukasParke@users.noreply.github.com>
Signed-off-by: Luke Parke <5702154+LukasParke@users.noreply.github.com>
Signed-off-by: Luke Parke <5702154+LukasParke@users.noreply.github.com>
Signed-off-by: Luke Parke <5702154+LukasParke@users.noreply.github.com>
Signed-off-by: Luke Parke <5702154+LukasParke@users.noreply.github.com>
Signed-off-by: Luke Parke <5702154+LukasParke@users.noreply.github.com>
Signed-off-by: Luke Parke <5702154+LukasParke@users.noreply.github.com>
Signed-off-by: Luke Parke <5702154+LukasParke@users.noreply.github.com>
Signed-off-by: Luke Parke <5702154+LukasParke@users.noreply.github.com>
|
@LukasParke is attempting to deploy a commit to the Matt Apperson's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Agent: Code CI/structural/DCO are green where configured; remaining external red checks are |
Replaces the 60/40 layer/history split and its infinite-headroom
special cases: minimums are guaranteed first (proportionally scaled
when overcommitted), the remainder distributes proportional to
declared caps, and 'auto'/omitted budgets get a fixed 2000-token cap
instead of an unbounded share of the window.
Deterministic block sizes are the precondition for byte-stable
rendered layer blocks — which is what makes the prompt-cache anchoring
in this repo actually hold across turns when layer budgets are in
play. Same layers + same policy now always yields the same allocation
regardless of window size.
BREAKING CHANGE: layers with 'auto' or omitted budgets previously
received up to 60% of the post-reserve window (~74k tokens on the
128k default); they now receive a fixed 2000-token cap. Declare an
explicit budget (number or {min,max}) for layers that need more. The
allocator's historyBudget return field is removed (it had no readers).
Part of the ce6d44e9 port from OpenRouter's fork.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Luke Parke <5702154+LukasParke@users.noreply.github.com>
The ported allocator (faithfully to its fork source) scaled declared
minimums against the 25% layer pool rather than the full available
budget, so {min: 10000} at a 32k window received 7000. Minimums are
now satisfied first out of the full post-reserve window (proportional
scale-down only when they overcommit it), and the LAYER_POOL_SHARE
ration applies to the discretionary remainder only. The documented
"minimums first" guarantee now holds numerically.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Luke Parke <5702154+LukasParke@users.noreply.github.com>
…behavior Signed-off-by: Luke Parke <5702154+LukasParke@users.noreply.github.com>
Signed-off-by: Luke Parke <5702154+LukasParke@users.noreply.github.com>
1ebd469 to
6fa44da
Compare
Expose the pure retry-delay calculation for deterministic assertions instead of proxying global setTimeout, which captured sibling test timers under CI concurrency. Signed-off-by: Luke Parke <5702154+LukasParke@users.noreply.github.com>
|
Agent: Rewrote the two unsigned commits with identical tree content and valid SSH/DCO signatures, then replaced global timer interception with deterministic retry-delay unit assertions. DCO and Structural gate pass on the new history; CI rerun is in progress. |
What
autolayer budgets at 2,000 tokenshistoryBudgetresult fieldWhy
The prior 60/40 split could violate declared minimums and treated
autoas infinite headroom, producing unstable allocations. Deterministic block sizes also keep prompt-cache bands byte-stable.This ports item 17 from
fork/port/openrouter-fixescommitsd8fb4f34and59497c48, plus a review fix that conserves fractional residual budgets.Test plan
Breaking changes
autobudgets now cap at 2,000 tokensallocateBudgets()no longer returnshistoryBudgetDependency
Semantically follows compaction items #80 and runtime folding #85. The branch currently includes those prerequisites and must be rebased through main after they merge.