#5925 [GUI] Fix Responses API 404 over LAN sharing

closed · @djmarker287-code · 0 comentários · No GitHub

Setup & installServer & APIAMD / HIPModels & quantsSecurityWindows

Descrição

## Problem and result

With a native model loaded and LAN sharing enabled in Strata Desktop 0.2.13, `POST /v1/responses` returned HTTP 404 on the shared port. The same valid request on the loopback port returned HTTP 200. With the patch, requests on the shared port return HTTP 200 for both JSON and streaming responses.

### Reproduce on Strata Desktop 0.2.13

1. Load a native model that supports Responses, such as Qwen3.8-Flash-Next IQ3_S.
2. In **Serving → Local sharing**, start sharing and copy the base URL shown there. Use the shared port, typically `47832`. The desktop loopback port is typically `47831`.
3. On the Strata PC, run these probes. Replace `STRATA_HOST` with the app's LAN IP. If you configured an API key, include `-H "Authorization: Bearer $STRATA_API_KEY"` in each request.

```sh
LAN=http://STRATA_HOST:47832/v1
LOCAL=http://127.0.0.1:47831/v1
curl -si "$LAN/models"
curl -si -H 'Content-Type: application/json' -d '{}' "$LAN/responses"
curl -si -H 'Content-Type: application/json' -d '{}' "$LOCAL/responses"
```

On stock 0.2.13, the model list returned HTTP 200, the LAN POST returned HTTP 404 with `Not found`, and the loopback POST returned HTTP 400 naming the missing `input`. A valid JSON request on loopback returned HTTP 200.

## Related discussion

Fixes #5677. Related to #451, which added the Responses API to the native engine.

## Approach

The LAN listener's route list rejected the request before it reached the host's Responses handler. The LAN listener now forwards `POST /v1/responses` to that handler, which applies the existing API-key check and native model capability check.

## Validation

**Passed**

On Windows 11 with a Radeon AI PRO R9700 (32 GB), Strata Desktop 0.2.13 and HIP engine 0.1.59, I applied the same routing changes as this PR to the installed host, restarted it, and loaded `iq3_s`. Requests went from the Strata PC to its LAN address. The live share had no API key configured. These curl commands reproduce the requests sent by the Node fetch test.

```sh
curl -si -H 'Content-Type: application/json' \
  -d '{"model":"iq3_s","input":"Reply with exactly OK.","reasoning":{"effort":"none"},"max_output_tokens":24,"store":false,"stream":false}' \
  "$LAN/responses"

curl -siN -H 'Content-Type: application/json' \
  -d '{"model":"iq3_s","input":"Reply with exactly OK.","reasoning":{"effort":"none"},"max_output_tokens":24,"store":false,"stream":true}' \
  "$LAN/responses"
```

| Request | Observed result |
| --- | --- |
| LAN, `stream: false` | HTTP 200, `object: "response"`, `status: "completed"`, output `OK` |
| LAN, `stream: true` | HTTP 200, `text/event-stream`, `response.created`, `response.output_text.delta` carrying `OK`, and `response.completed` |
| Loopback, `stream: false` | HTTP 200, completed, output `OK` |
| LAN models, Chat Completions, and Anthropic Messages | HTTP 200 for each |

On the PR branch, the following checks ran from `apps/host` on Windows 11 with Node 24.12.0, at commit `fe35ac6` based on `13eedf5`.

- `node --test tests/local-share-responses.test.mjs tests/native-gateway.test.mjs tests/cors-share.test.mjs tests/connect-urls.test.mjs tests/serving-key-compare.test.mjs` passed all 17 tests. The new test starts the real host without a model. With the configured key, the LAN POST reaches the host and returns its expected 503. A missing key gets 401. GET, subpaths, and host controls get 404. Before the routing change, the same regression assertion got 404 in place of 503.
- `npm run typecheck` and `npm run build` passed.

**Failed**

- The stock `npm test` runner hit Windows' command-line length limit in this checkout. Running `node --test --test-timeout=120000 --test-concurrency=6 --test-reporter=spec 'tests/*.test.mjs'` reported 1,571 passed, 116 skipped, and two failures.
- `chat-shell.test.mjs` and `model-directory.test.mjs` both received Windows `EPERM` when creating fixture symlinks. Both failures also reproduced on base revision `13eedf5`.

**Not run**

- Live requests from a second LAN device, live Cloudflare requests, and live model tests on other backends.

## Limits

The new route is enabled on the LAN listener. It uses Strata's existing stateless Responses API and requires a supported native model for inference.

No site

Links install, modelos, releases.