fix(ui): restore connectGeneration/serverVersion/chatStreamSegments on RemoteClawApp (#2493)#2498
Merged
alexey-pelykh merged 1 commit intomainfrom Apr 23, 2026
Merged
Conversation
…n RemoteClawApp — sync regression silently broke gateway connect (#2493) Partial-sync of upstream v2026.3.7 (9ef1894) brought in app-lifecycle.ts changes requiring connectGeneration/serverVersion on LifecycleHost and chatStreamSegments on ToolStreamHost, but the companion RemoteClawApp class initializers were dropped during rebrand conflict resolution. The `as unknown as Parameters<typeof X>[0]` cast pattern erased structural type-checking that would have caught the gap. Symptoms: - connectGeneration undefined → ++undefined → NaN → NaN !== NaN is always true at app-lifecycle.ts:55 → connectGateway never called → Health Offline, Version n/a, "Disconnected from gateway." chat banner on first load. - chatStreamSegments undefined → TypeError: not iterable when tool call interrupts streaming text (app-tool-stream.ts:441 spreads it). - serverVersion undefined → incorrect client version in gateway handshake. Fields match upstream type signatures and existing declaration style: - `@state() serverVersion: string | null = null` (reactive, feeds Version pill) - `@state() chatStreamSegments: Array<{ text: string; ts: number }> = []` (reactive, feeds chat streaming view) - `private connectGeneration = 0` (non-reactive lifecycle counter) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2493.
Summary
Adds three missing field initializers on
RemoteClawApp(ui/src/ui/app.ts) that were dropped during partial-sync of upstream v2026.3.7 (9ef18943dc). The companionapp-lifecycle.ts/app-gateway.ts/app-tool-stream.tschanges arrived (addingconnectGeneration,serverVersion,chatStreamSegmentsto their host-shape types) but the class-level initializers silently conflicted with theOpenClawApp → RemoteClawApprebrand and were dropped during merge resolution. Theas unknown as Parameters<typeof X>[0]cast pattern inapp.ts(21 occurrences) erased the structural type-check that would otherwise have flagged the missing fields.Symptoms (from #2493)
connectGenerationundefined →++undefined → NaN→NaN !== NaNis alwaystrueatapp-lifecycle.ts:55→connectGatewaynever called → Health Offline / Version n/a / "Disconnected from gateway." banner on first load.chatStreamSegmentsundefined →TypeError: not iterablewhen a tool call interrupts streaming text (app-tool-stream.ts:441spreads it).serverVersionundefined → incorrect client version in gateway handshake (optional-chained, no crash).Fix
Three field initializers in
RemoteClawApp, matching upstream type signatures and existing declaration styles:@state() serverVersion: string | null = null— reactive, feeds Version pill (grouped with other nullable gateway state nearhello/lastError).@state() chatStreamSegments: Array<{ text: string; ts: number }> = []— reactive, feeds chat streaming view (grouped withchatStream/chatStreamStartedAt).private connectGeneration = 0— non-reactive lifecycle counter (grouped withchatHasAutoScrolledin the private bookkeeping section).No test changes. Synthetic-host fixtures in
app-lifecycle.node.test.ts/app-lifecycle-connect.node.test.tsalready hand-set these fields — the problem was only in the production class.Test plan
pnpm tsgoclean (0 errors)pnpm lintclean (0 warnings, 0 errors)pnpm format:checkcleanpnpm exec vitest run --config vitest.unit.config.ts ui/src/ui/app-tool-stream.node.test.ts— 4/4 passpnpm test— via CIFollow-ups (already filed per issue comment)
as unknown as Parameters<typeof X>[0]casts — restore structural type-checking #2494 — audit and removeas unknown as Parameters<typeof X>[0]casts so TypeScript catches future regressions of this classRemoteClawAppasserting required host-interface fields