mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-11 10:01:27 -10:00
* feat(agent): align context compaction with harness semantics Problem: Reasonix bounded tool results before provider admission and summarized through a separate prompt shape, reducing model-visible fidelity and prompt-cache reuse. Legacy retention and fallback behavior could also fabricate lossy summaries after failures. Root cause: Tool pruning, summary construction, timeout ownership, and persistence were split across independent paths with cache-breaking prompts and legacy keep rules. Fix: - make pressure maintenance single-flight and durably prune large tool results - replay cache-aligned summary prefixes with fixed 16% retention and an 8192-token cap - remove fabricated fallback summaries and unify provider idle guards at 300 seconds - update compatibility defaults, desktop surfaces, documentation, and regression coverage Verification: - go test ./internal/agent ./internal/provider/... ./internal/config - go test -race ./internal/agent ./internal/extension/providerext - go test ./... - cd desktop && go test ./... - cd desktop/frontend && pnpm typecheck && pnpm test - git diff --check * test(agent): isolate compaction extension coverage Problem: The compaction changes added assertions to an already oversized extension test file, which exceeded its repolint carry-forward budget and failed the PR lint job. Root cause: The new summary-input mode coverage was placed beside legacy extension cases instead of in a focused test file. Fix: Move the two compaction summary-input extension tests into a dedicated file without changing their behavior or widening the lint baseline. Verification: - go test ./internal/agent -run TestCompactionPrepareReplace - go run ./tools/repolint - git diff --check * fix(agent): harden context compaction recovery Problem: Overflow recovery could build an inadmissible summary request, extension guidance-only replacements lost provider replay fields, and covered-prefix identity ignored model-visible tool RawContent. Context-limit handling could also retry one original request twice, while default retention settings emitted a false deprecation warning and lint remained blocked. Root cause: Summary planning did not share the final request builder or account for the provider window, extension DTO round-trips were treated as message rewrites, projection hashes used bounded compatibility content, and output-budget and compaction retries had independent counters. Fix: Select the largest balanced admissible prefix for overflow summaries, preserve unchanged extension messages, migrate legacy bounded hashes to RawContent-aware hashes, enforce one recovery retry, recognize the boot default retention policy, and remove dead lint violations. Add regression coverage for each behavior. Verification: make lint go test ./internal/agent ./internal/provider/... ./internal/config go test -race ./internal/agent ./internal/extension/providerext go test ./... cd desktop && go test ./... cd desktop/frontend && pnpm typecheck * fix(agent): bound compaction maintenance retries Problem: - Pressure pruning copied every tool-result code point into a full rune slice, amplifying peak memory for large outputs. - The runtime stuck latch suppressed maintenance after the provider-visible input changed. Root cause: - Unicode boundaries were computed by materializing the complete string. - Retry backoff stored only a session-wide boolean instead of the blocked input identity. Fix: - Locate retained UTF-8 head and tail boundaries with constant-space scans. - Scope the runtime stuck latch to the provider-visible input hash and clear it on lineage resets. - Add allocation and changed-input regression coverage. Verification: - go test ./internal/agent - go test -race ./internal/agent ./internal/extension/providerext - go test ./... - cd desktop && go test ./... - make lint - go vet ./... * fix(desktop): account for compaction locale copy Problem: - The latest main-v2 left only 30 bytes below the simplified-Chinese locale budget. - This PR adds 40 bytes gzip of intentional compaction policy guidance, putting the exact merge result 10 bytes over the gate. Root cause: - The locale ratchet still described the pre-compaction settings payload. Fix: - Raise only the simplified-Chinese locale allowance from 55.0 KiB to 55.1 KiB. - Document the measured feature-owned delta beside the budget. Verification: - Latest main-v2: 56,290 bytes gzip - Exact PR merge before fix: 56,330 bytes gzip - Exact PR merge after fix: 56,330 / 56,422 bytes - cd desktop/frontend && pnpm build