* fix: disable bundled OpenClaw gateway auth
* refactor(openclaw): delete token plumbing now that auth is locked off
Builds on the cherry-picked spike (#933). With gateway.auth.mode=none
locked in as the only path the bundled gateway runs, the BrowserOS-side
token machinery becomes dead weight. This commit deletes:
- OpenClawService: token field, tokenLoaded, gatewayAuthMode state
machine, getGatewayToken(), getGatewayHttpToken(),
ensureTokenLoaded(), refreshGatewayAuthToken(),
loadTokenFromConfig() and all six lifecycle call sites.
- OpenclawGatewayAccessor.getGatewayToken interface field.
- OpenClawHttpClient / OpenClawGatewayChatClient: optional getToken
constructor arg and authHeaders() helpers.
- OpenClawObserver: gatewayToken field/parameter and the auth.token
branch in the connect frame.
- GatewayContainerSpec.gatewayToken and the
OPENCLAW_GATEWAY_TOKEN env wiring; the
OPENCLAW_GATEWAY_PRIVATE_INGRESS_NO_AUTH=1 env is now always set
rather than conditional.
Test suites: dropped bearer-token assertions and the two persisted-token
tests in openclaw-service that asserted deleted behavior.
Net: -310 LOC across src + tests, with 118 openclaw + acpx tests still
green. Typecheck and biome clean.
Reference: TKT-788 (move OpenClaw integration to ACPX runtime), WS-A.
* refactor(openclaw): delete gateway image bypass, route image turns via ACP (TKT-788 WS-C) (#935)
* refactor(openclaw): delete gateway image bypass, route image turns through ACP
The browseros-ai/openclaw ACP bridge accepts image content blocks
natively (extractAttachmentsFromPrompt at openclaw/src/acp/event-mapper.ts:92,
forwarded via chat.send attachments at translator.ts:295), so the
BrowserOS-side carve-out that diverted image-bearing turns to the
gateway HTTP /v1/chat/completions endpoint is no longer needed.
Deletes:
- apps/server/src/api/services/openclaw/openclaw-gateway-chat-client.ts
- The corresponding test file
- AcpxRuntime.sendOpenclawViaGateway, persistGatewayTurn,
recordToOpenAIMessages helpers
- The image-attachment carve-out branch in AcpxRuntime.send
- openclawGatewayChat option from AcpxRuntime + AgentHarnessService
+ agent routes ctor wiring
- The randomUUID import (only the deleted helper used it)
- The acpx-runtime test for the deleted carve-out
Net: 614 LOC removed, 0 added, all 142 openclaw + acpx + agent tests
still green.
Reference: TKT-788, WS-C. Stacked on WS-A (#934).
* refactor(openclaw): delete WS observer, feed ClawSession from harness events (#936)
The openclaw-observer.ts WebSocket observer was a second tap on the
same gateway events the AcpxRuntime already sees as ACP session/update
notifications. Replace it with a pull from the AgentHarnessService's
turn lifecycle stream — keeping ClawSession and the /openclaw/dashboard
SSE endpoint shape unchanged for the BrowserOS UI.
Changes:
- AgentHarnessService: emit `turn_started` / `turn_event` / `turn_ended`
to subscribers via a new `onTurnLifecycle(listener)` API. Wired around
the existing `notifyTurnStarted/Ended` calls and inside the
per-event read loop.
- agents route: forward an optional `onTurnLifecycle` dep into the
service it constructs.
- server.ts: subscribe and route OpenClaw-adapter events to
`OpenClawService.recordAgentTurnEvent(agentId, sessionKey, event)`.
- OpenClawService: new `recordAgentTurnEvent` method that maps stream
events to ClawSession transitions (working/idle/error + currentTool
from `tool_call` events). Keeps the existing
`onAgentStatusChange` / `getAgentState` / `getDashboard` API.
- Delete `openclaw-observer.ts` (276 LOC) and all observer wiring
(`new OpenClawObserver`, `ensureObserverConnected`, three
`observer.disconnect()` call sites, the import).
Net: 276 LOC removed from the observer; ~130 LOC added across harness
event plumbing + recorder method. -146 LOC overall, all 141 tests still
green, typecheck clean, biome clean.
Reference: TKT-788, WS-B (Path 1: keep ClawSession + dashboard SSE shape).
Independent of WS-A (#934) and WS-C (#935); will rebase on top of
whichever lands first.
---------
Co-authored-by: Nikhil Sonti <nikhilsv92@gmail.com>