Uh oh!
There was an error while loading. Please reload this page.
feat(headless): validate active-prune 2048 - #340
Merged
Conversation
Astro-Hanforce-pushed
the
codex/issue293-active-prune-2048
branch
from
June 28, 2026 05:41
6d815eb to
8e2dbadCompare
This was referenced Jun 28, 2026
Astro-Han added a commit
that referenced
this pull request
Jul 4, 2026
Document the desktop+headless default-on behavior, the 2048-token threshold, the metadata-only placeholder behavior for oversized tool results, the opt-out env, and the #340 non-inferiority evidence basis. Per review feedback on the headless default behavior change.
Astro-Han added a commit
that referenced
this pull request
Jul 4, 2026
…#498) * feat(desktop): enable activeToolResultPrune by default Add buildActiveToolResultPrunePolicy to the desktop context-budget builder, aligned with the headless env names (MAKA_CONTEXT_ACTIVE_TOOL_RESULT_PRUNE and aliases). Defaults to enabled with the 2048-token threshold; explicit off/false opts out. Wires the current-turn prune step that runs before the already default-on semanticCompact, using the existing desktop archiveToolResult/readToolResultArchive wiring. * feat(headless): default activeToolResultPrune on Flip activePruneEnabled from `?? false` to `?? true` so harbor cells no longer need to set MAKA_CONTEXT_ACTIVE_TOOL_RESULT_PRUNE to get current-turn large tool-result pruning. Explicit off/false still opts out. Adjusts the existing explicit-false-like-boolean test (stale/archive off no longer implies an empty context budget) and adds default-on and explicit-off coverage. * refactor(desktop): drop activeToolResultPrune threshold env alias Keep only the canonical MAKA_CONTEXT_ACTIVE_TOOL_RESULT_MAX_ESTIMATED_TOKENS env. The MAKA_CONTEXT_ACTIVE_TOOL_RESULT_PRUNE_MAX_ESTIMATED_TOKENS alias was a half-alignment with headless (only the threshold alias, not the enable/disable aliases); drop it per review feedback to avoid carrying headless historical compatibility baggage on desktop. * docs: changelog activeToolResultPrune default-on Document the desktop+headless default-on behavior, the 2048-token threshold, the metadata-only placeholder behavior for oversized tool results, the opt-out env, and the #340 non-inferiority evidence basis. Per review feedback on the headless default behavior change.
This was referenced Jul 6, 2026
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 freeto 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
Why
Closes#293
The active-prune policy needs both a validated 2048-token threshold and benchmark evidence that it saves cost without a large regression detected under the 10pp phase-1 framing. Issue #293 frames this as a first-phase non-inferiority experiment with a 10 percentage-point margin, not as a proof of mathematical losslessness or a 5pp claim.
Evidence
Bottom line: archive-backed active tool-result prune at the 2048-token threshold did not show a regression larger than the declared 10pp non-inferiority margin, while saving 31.6% cost and 41.7% tokens across the combined evidence set. The margin clearance is narrow: the stratified 95% lower bound is -9.78pp against a -10pp margin, clearing by 0.22pp. This supports “no large regression detected” under the phase-1 framing, not proof of equivalence or absolute losslessness.
Design: non-inferiority test where A is prune off and B is active prune on with archive retrieval enabled. The evidence is reported as two strata because the older full runs predate continuation rescue and A/B pair concurrency, while the new rescue run uses the fixed harness.
Combined cost was $2.1600 baseline vs $1.4781 candidate, saving $0.6819 / 31.6%. Combined tokens were 192.0M vs 111.9M, saving 80.1M / 41.7%.
The new 32-task continuation rescue run is inconclusive by itself. Its value is that it exercises the replay fix, benchmark-safe continuation, and A/B pair concurrency on the tasks that previously hit the tool-step cap. The rescue run logs had no
APICallError,insufficient tool messages,invalid_request_error, orruntime_error.Per-run breakdown and local artifacts
issue293-active-prune-default-le30-005issue293-active-prune-default-30to45-001issue293-active-prune-default-45to60-001issue293-active-prune-default-gt60missing-001issue293-continuation-canary-002issue293-continuation-rescue-001Local artifacts used for the evidence above:
maka-eval/runs/issue293-prune-ab/issue293-active-prune-default-le30-005/runtime-policy-ab-result.jsonmaka-eval/runs/issue293-prune-ab/issue293-active-prune-default-30to45-001/runtime-policy-ab-result.jsonmaka-eval/runs/issue293-prune-ab/issue293-active-prune-default-45to60-001/runtime-policy-ab-result.jsonmaka-eval/runs/issue293-prune-ab/issue293-active-prune-default-gt60missing-001/runtime-policy-ab-result.jsonmaka-eval/runs/issue293-prune-ab/issue293-continuation-canary-002/runtime-policy-ab-result.jsonmaka-eval/runs/issue293-prune-ab/issue293-continuation-rescue-001/runtime-policy-ab-result.jsonruntime-policy-ab-report.md.Scope
Changed:
tool_call/tool_resultevents.sendMessagefailure is reported as a failed invocation instead of being hidden behind an earlier step-cap result.runtimeStepsdiagnostics instead of countingRuntimeEventrows.Not included:
maka-eval/tracked files; local run outputs stay git-excluded.packages/headless/src/__tests__/prompt-ab-run.test.ts; that file should be split in a follow-up pure test-organization PR.Verification
Local gates:
npm --workspace @maka/runtime run buildnpm --workspace @maka/headless run buildnode --test packages/runtime/dist/__tests__/ai-sdk-backend.test.js packages/runtime/dist/__tests__/active-tool-result-prune.test.js packages/runtime/dist/__tests__/runtime-runner.test.js packages/headless/dist/__tests__/harbor-cell.test.js packages/headless/dist/__tests__/prompt-ab-run.test.js packages/headless/dist/__tests__/runtime-policy-ab-run.test.js packages/headless/dist/__tests__/fixed-prompt-controller.test.js packages/headless/dist/__tests__/cell-output.test.js packages/headless/dist/__tests__/harbor-adapter.test.jsgit diff --checkResult: 221 related tests passed.
User-facing impact
None for the desktop UI. This affects benchmark/headless Harbor execution and runtime replay robustness. No changelog, docs, breaking changes, or migrations are included.
Reviewer notes
This is intentionally one PR because the 2048 policy evidence depends on the runtime replay fix, Harbor continuation, and A/B pair-concurrency fix being exercised together. The commits are split by concern for review.
The active-prune default of 2048 is intentional. Issue #293 was updated so this is no longer scoped as a non-goal: 8192 was the archive retrieval budget, while active current-turn prune should match the measured 2048 threshold and the existing stale tool-result prune default.
packages/headless/src/__tests__/prompt-ab-run.test.tsis now over 1.4k lines and mixes manifest, generic A/B execution, fingerprinting, summary/rendering, and prompt-specific run tests. That boundary cleanup is worthwhile, but it should be a separate pure test-organization PR so this PR does not mix behavior changes with file-move noise.