# Release 0.4.10 — Bounded incomplete-stream retry and safe compaction failure metadata

**Coordinated packages:** `ds4-context-core`, `ds4-context-reference-adapter`, and `ds4-context-engine` 0.4.10.

## Changes

- Recognizes Pi's exact `Stream ended without finish_reason` error in both rejected requests and error responses as `transport / stream-incomplete`. Uses the existing attempt cap, exponential backoff, fresh routing sessions, cooperative cancellation, usage accounting and pre-dispatch operation-input budget; defaults and limits are unchanged.
- Adds adapter-local typed provider-failure diagnostics: stage, allowlisted category/reason, attempt count/limit and optional validated HTTP status. No raw body, headers, arbitrary provider code, finish-reason string or exception cause is exposed. HTTP client/server errors, content filters, unknown finish reasons and unclassified failures are not indiscriminately retried; HTTP error bodies cannot turn into transport retries merely by containing transport keywords.
- `/context compaction` distinguishes planned from successfully completed segments. The existing `segmentCount` field remains the planned count; the additive `completedSegmentCount` can show partial completion before fallback, without claiming graph persistence. Each new custom attempt resets counters and failure metadata.
- Pi fallback preserves the original custom-attempt trigger, including proactive requests, along with safe provider-failure metadata. Metadata-only fallback warnings and command output expose the bounded diagnostic.
- Adds synthetic unit/integration coverage for failure classification, replay bounds, cancellation, usage, fresh routing sessions, operation-budget enforcement, metadata privacy, partial counters/reset, trigger preservation and TUI output after native fallback. The missing-terminator regressions fail on the prior implementation and pass with the patch.

**Implementation commit:** `7cc8a23`. Decision: [ADR 070](../ADR/070-compaction-provider-failure-metadata.md).

## Scope and limitations

The reported host's 0.4.9 preparation took 2.48 seconds and generation took 141.15 seconds, with an unclassified provider error before aggregation. That report does not establish a missing terminator as its cause. This release corrects a reproducible classification/retry gap and makes remaining failures attributable; it does not promise successful compaction or a specific real-provider latency. No live provider calls, real compactions, session/database inspection or Windows configuration changes were made for this patch. Full real-context BPE/auto-tuning verification remains a separate objective.

Compaction validation, exact-value downgrading, graph atomicity, concurrency limits, input/output budgets, JSONL authority, persistence schemas and opt-in BPE/auto-tuning defaults remain unchanged. Core and the reference adapter receive only the coordinated version bump.

## Validation

On the final 0.4.10 source, version and dependency state, using Node 26.5.1 / npm 11.17.0:

- `npm ci` completed successfully.
- The approved `jev_verify all` gate passed `npm run typecheck`, `npm test` and `git diff --check`: workspace builds, strict TypeScript and the full Vitest suite, including compatibility/privacy/integration tests. These are the build/typecheck/test scopes of `npm run check`, executed through the acquired verification policy rather than claiming a separate execution of that command.
- `npm run quality:compare`: candidate quality 0.9875 versus baseline 0.808156 on the packaged synthetic corpus.
- `npm run schema:context-persistence`: `passed: true`, 1,266 bytes / 317 estimated tokens, within the 320-token relative gate.
- `npm run pack:check`: verified core 251 files, reference adapter 7 files and engine 118 files in a clean consumer, including packaged exports, reference conformance and isolated offline Pi RPC.
- `npm audit --omit=dev --json`: no production findings. `npm ci` reports five development-inclusive audit findings (three moderate, two high); the lockfile diff changes only coordinated versions/exact internal dependencies, not third-party package versions. These warnings are not hidden or fixed by this patch.

No live-provider or Windows-host confirmation is claimed.

## Publication and registry verification

- Published manually to npm in dependency order: `ds4-context-core@0.4.10` → `ds4-context-reference-adapter@0.4.10` → `ds4-context-engine@0.4.10`, all public with `latest`. All three `dist-tags.latest` values were verified as 0.4.10.
- The first exact-version consumer check returned `ETARGET` for core; subsequent engine metadata lookups returned `E404` until the registry exposed 0.4.10. After propagation, `npm run registry:check -- 0.4.10` passed with a fresh temporary npm cache: “Verified all DS4 registry packages at exact version 0.4.10.” This includes exact internal dependencies, core/public exports, reference conformance, the packaged quality corpus, the storage CLI shim and isolated offline Pi RPC.
- npm 11.17.0 emitted a misleading bin-normalization warning during engine publication. Exact registry metadata retains `ds4-context-storage` at `scripts/ds4-context-storage.mjs`, and the installed CLI usage probe passed; no CLI was removed from the release.
- Annotated tag `v0.4.10` points to release-preparation commit `1397362f767728c829165e27a62a8acc1985984b` and was pushed after successful registry verification.
- GitHub Release: <https://github.com/Alucard24/ds4-context-engine/releases/tag/v0.4.10>.
- CI remains validation-only; no publishing credentials, provider calls or session data were added.
