Skip to content

fix(sdk): preserve wireApi through provider resolution; stage archive decompression - #94

Open
waldemort-auto[bot] wants to merge 1 commit into
mainfrom
waldemort/responses-wireapi-and-archive-staging
Open

waldemort-auto[bot] wants to merge 1 commit into
mainfrom
waldemort/responses-wireapi-and-archive-staging

Conversation

@waldemort-auto

@waldemort-auto waldemort-auto Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Two product defects, plus tests that were passing when they should not have been

1. An Azure OpenAI Responses provider was silently downgraded to chat completions

Provider resolution rebuilt the SDK provider without the configured wireApi and appended Azure legacy deployments/.../chat/completions?api-version=... routing. A provider explicitly declaring wireApi: "responses" therefore reached the completions endpoint carrying temperature: 0.

Deployments that reject an explicit temperature fail the request outright:

400 Unsupported value: 'temperature' does not support 0 with this model.
Only the default (1) value is supported.

In a deployed environment every durable session turn failed, exhausted its retries, and left the session in error. Captured from the deployed image, before and after the change:

Endpoint temperature
Before /openai/deployments/<name>/chat/completions?api-version=2024-10-21 0
After /openai/v1/responses absent

The fix forwards wireApi through model-providers, provider-catalog, session-manager and types. Temperature handling is unchanged — temperature was the symptom, the routing was the defect.

2. Session archive extraction raced its own decompression

tar could exit before the decompression pipeline drained, surfacing ERR_STREAM_PREMATURE_CLOSE on a valid archive. Reproduced in a controlled probe by delaying compressed-input EOF until the real tar close event; the archive decompressed fully and extracted bytes matched, yet the exported helper still rejected it.

session-store.ts now fully validates compression into a private mkdtemp 0600 directory, then extracts with unchanged tar EOF semantics, then cleans up the directory it owns. Truncated, corrupt and hash-reject paths keep their existing behaviour, and no pipeline error is ignored.

Tradeoff worth stating: temporary storage roughly the size of the uncompressed tar. On a tmpfs TMPDIR that counts as RAM rather than disk.

3. Tests

  • Four model-switch paths logged SKIP and returned green when a required model was absent. They now throw an explicit coverage error, so missing coverage reports as missing rather than as success.
  • The admin-scope fixture supplies its own provider catalog instead of depending on ambient configuration.
  • The multi-worker seed constructs a SessionManager the way production does. It previously diverged, so it exercised a shape that never runs. Assertions are unchanged.
  • New tests: fixture-models, model-providers-responses, model-providers-responses-wire, session-archive-stream.

Validation

Result
SDK suite 2,097 passed / 7 failed / 16 skipped of 2,120, 0 unaccounted
Node suites 2,286 / 2,286
Archive targeted run 57 / 57
Deployed acceptance real assistant response persisted through openai-responses

The baseline before this work was 1,709 passed / 130 failed / 239 skipped, with 4 outcomes unaccounted for. All 1,709 original passes are retained; no test was weakened to obtain the improvement, and the accounting now reconciles exactly.

The 7 remaining failures require two genuinely distinct model providers, which the validating environment did not have. They are classified as unexercised prerequisites, not forced to pass.

Not included

A UX banner used only to verify that the deployed image was the one built here is deliberately excluded from this branch.

Validated against 2b638c37. Reviewed independently before deployment. No public-edge, DNS, TLS or browser coverage is claimed.

… decompression

Provider resolution rebuilt the SDK provider without the configured wireApi and appended Azure legacy deployment/apiVersion routing. An explicit Azure OpenAI Responses provider was silently downgraded to chat completions and sent temperature=0, so deployments that reject an explicit temperature failed every turn. Forward wireApi through model-providers, provider-catalog, session-manager and types so an explicit Responses provider reaches /openai/v1/responses with no temperature field.

Session archive extraction raced: tar could exit before the decompression pipeline drained, surfacing ERR_STREAM_PREMATURE_CLOSE. Fully validate compression into a private 0600 temp dir, then extract with unchanged tar EOF semantics.

Tests: replace false-green SKIP paths in model selection with explicit coverage errors; give the admin-scope fixture its own provider catalog; wire the multi-worker seed the way production constructs a SessionManager.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant