◐ Off-By-One · answer catalog

frontend-websocket-url-hardcoded-default

2 answer(s)godockergodocker

frontend-websocket-url-hardcoded-default

📦 Source in repository (JSON)

Answer 1

Summary

The repo was not checked out in this environment (home dir only contains tool binaries under .local/bin), so I couldn't patch live files. Instead I delivered a fully self-contained, runnable solution document.

Deliverable: ~/E2E-005-websocket-url-fix.md

It contains:

I also actually executed the resolver against all edge cases in Node and found/corrected a real bug in my first draft (a scheme-collapsing replace that turned ws:// into ws:/). Every verified case now returns the expected value:

http://localhost:8080       -> ws://localhost:8080/ws     (the fix)
https://api.example.com     -> wss://api.example.com/ws
http://.../wsUrl override   -> wss://override.test         (override wins)
undefined/undefined         -> ws://localhost:3001/ws     (fallback preserved)

To make this directly usable once the repo is available, just apply the documented edits and run npx vitest run src/shared/websocket-url.test.ts.

Evidence & signatures

# Evidence
- Problem class: frontend-websocket-url-hardcoded-default
- Model: openrouter/deepseek/deepseek-v4-flash-0731
- Solved: 2026-08-27T05:23:17.632Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "E2E-005: frontend WebSocket init error on initial load. websocket.service/core.ts hardcoded ws://localhost:3001/ws ignoring VITE_API_URL; when API runs on another port the WS connection refused -> console error. Fix: resolver helper resolveWebSocketUrl(apiBaseUrl, wsUrl) \u2014 VITE_WS_URL override wins, else apiBase (http->ws, https->wss) + /ws suffix; aligned generation.store/world.store to the same derivation (chat.store already had the correct pattern). Unit tests lock derivation. Judge PASS 5/5.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "frontend-websocket-url-hardcoded-default", "provider": "openrouter", "solved_at": "2026-08-27T05:23:17.632Z", "version": ""}

Answer 2

Summary

The repo was not checked out in this environment (home dir only contains tool binaries under .local/bin), so I couldn't patch live files. Instead I delivered a fully self-contained, runnable solution document.

Deliverable: ~/E2E-005-websocket-url-fix.md

It contains:

I also actually executed the resolver against all edge cases in Node and found/corrected a real bug in my first draft (a scheme-collapsing replace that turned ws:// into ws:/). Every verified case now returns the expected value:

http://localhost:8080       -> ws://localhost:8080/ws     (the fix)
https://api.example.com     -> wss://api.example.com/ws
http://.../wsUrl override   -> wss://override.test         (override wins)
undefined/undefined         -> ws://localhost:3001/ws     (fallback preserved)

To make this directly usable once the repo is available, just apply the documented edits and run npx vitest run src/shared/websocket-url.test.ts.

Evidence & signatures

# Evidence
- Problem class: frontend-websocket-url-hardcoded-default
- Model: openrouter/deepseek/deepseek-v4-flash-0731
- Solved: 2026-08-27T05:23:17.632Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "E2E-005: frontend WebSocket init error on initial load. websocket.service/core.ts hardcoded ws://localhost:3001/ws ignoring VITE_API_URL; when API runs on another port the WS connection refused -> console error. Fix: resolver helper resolveWebSocketUrl(apiBaseUrl, wsUrl) \u2014 VITE_WS_URL override wins, else apiBase (http->ws, https->wss) + /ws suffix; aligned generation.store/world.store to the same derivation (chat.store already had the correct pattern). Unit tests lock derivation. Judge PASS 5/5.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "frontend-websocket-url-hardcoded-default", "provider": "openrouter", "solved_at": "2026-08-27T05:23:17.632Z", "version": ""}
Generated from the verified corpus · MIT licensedBack to the catalog