fix(context): use SDK token pressure and expose compaction lifecycle #498

Merged
karsten merged 1 commit from fix/sdk-context-pressure into main 2026-11-15 12:52:59 +00:00
Owner

Operator symptoms

Unnecessary/still compaction and missing progress, including reports immediately after /new. Live projections measured around 49KB raw JSON while provider input was only 11–12K tokens. The host compared those BYTES with token budgets and forced a zero-token native threshold. That can repeatedly summarize useful working context.

Correction

  • Remove the host byte-triggered native override. Existing SDK/provider usage-aware token pressure, trailing-message estimation, output headroom, explicit role/native limits and overflow recovery remain authoritative. No tokenizer round trip or new input gate.
  • Runtime working-budget telemetry prefers SDK context accounting; unknown post-compaction usage uses an explicitly labelled approximate bytes/3 fallback, not byte-as-token percentages.
  • Expose SDK compaction started/completed/failed/cancelled through bounded content-free activity, configured gateway progress, TUI and API events. Compaction is not a productive tool/effect receipt; summaries/error text are not leaked.

Verification

  • Real SDK tests: 49KB fixtures with 12K or zero reported tokens do NOT add a summary request; genuinely high token usage still compacts; unknown post-compaction usage remains labelled.
  • Actual inner tool-loop tests use genuine token pressure and explicit small retained tail, preserving native call/result pairs and one execution per effect. Removed obsolete byte-admission assertion.
  • Lifecycle tests check visibility and non-disclosure of private summary/errors. Existing tiny-history /new-style guard remains covered.
  • 53 focused tests, typecheck/build and independent review PASS. Exact-head full suite: 2631 passed, 1 existing optional skip, 0 failures (2632 total); exact-head CI PASS.

Minerva Main/validator change to explicitly authorized Homelab DeepSeek v4 Flash is separate shared #144. Latest inspected fresh Matrix native session had NO actual compaction and host skipped maintenance as irreducible-base-small-history; no claim that every reported UI wait was an actual compaction. Structured summary/schema/accumulation and fleet base-overhead work remain separate unfinished items.

## Operator symptoms Unnecessary/still compaction and missing progress, including reports immediately after /new. Live projections measured around 49KB raw JSON while provider input was only 11–12K tokens. The host compared those BYTES with token budgets and forced a zero-token native threshold. That can repeatedly summarize useful working context. ## Correction - Remove the host byte-triggered native override. Existing SDK/provider usage-aware token pressure, trailing-message estimation, output headroom, explicit role/native limits and overflow recovery remain authoritative. No tokenizer round trip or new input gate. - Runtime working-budget telemetry prefers SDK context accounting; unknown post-compaction usage uses an explicitly labelled approximate bytes/3 fallback, not byte-as-token percentages. - Expose SDK compaction started/completed/failed/cancelled through bounded content-free activity, configured gateway progress, TUI and API events. Compaction is not a productive tool/effect receipt; summaries/error text are not leaked. ## Verification - Real SDK tests: 49KB fixtures with 12K or zero reported tokens do NOT add a summary request; genuinely high token usage still compacts; unknown post-compaction usage remains labelled. - Actual inner tool-loop tests use genuine token pressure and explicit small retained tail, preserving native call/result pairs and one execution per effect. Removed obsolete byte-admission assertion. - Lifecycle tests check visibility and non-disclosure of private summary/errors. Existing tiny-history /new-style guard remains covered. - 53 focused tests, typecheck/build and independent review PASS. Exact-head full suite: 2631 passed, 1 existing optional skip, 0 failures (2632 total); exact-head CI PASS. Minerva Main/validator change to explicitly authorized Homelab DeepSeek v4 Flash is separate shared #144. Latest inspected fresh Matrix native session had NO actual compaction and host skipped maintenance as irreducible-base-small-history; no claim that every reported UI wait was an actual compaction. Structured summary/schema/accumulation and fleet base-overhead work remain separate unfinished items.
fix(context): use SDK token pressure and expose compaction lifecycle
All checks were successful
decision-interface-ci / full-validation (pull_request) Successful in 3m29s
a90d1dbf04
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
harness/core!498
No description provided.