Skip to content

fix(ui): restore connectGeneration/serverVersion/chatStreamSegments on RemoteClawApp (#2493)#2498

Merged
alexey-pelykh merged 1 commit intomainfrom
fix/ui-restore-lifecycle-host-fields
Apr 23, 2026
Merged

fix(ui): restore connectGeneration/serverVersion/chatStreamSegments on RemoteClawApp (#2493)#2498
alexey-pelykh merged 1 commit intomainfrom
fix/ui-restore-lifecycle-host-fields

Conversation

@alexey-pelykh
Copy link
Copy Markdown

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 companion app-lifecycle.ts / app-gateway.ts / app-tool-stream.ts changes arrived (adding connectGeneration, serverVersion, chatStreamSegments to their host-shape types) but the class-level initializers silently conflicted with the OpenClawApp → RemoteClawApp rebrand and were dropped during merge resolution. The as unknown as Parameters<typeof X>[0] cast pattern in app.ts (21 occurrences) erased the structural type-check that would otherwise have flagged the missing fields.

Symptoms (from #2493)

  • Fatal: connectGeneration undefined → ++undefined → NaNNaN !== NaN is always true at app-lifecycle.ts:55connectGateway never called → Health Offline / Version n/a / "Disconnected from gateway." banner on first load.
  • Latent crash: chatStreamSegments undefined → TypeError: not iterable when a tool call interrupts streaming text (app-tool-stream.ts:441 spreads it).
  • Cosmetic: serverVersion undefined → 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 near hello/lastError).
  • @state() chatStreamSegments: Array<{ text: string; ts: number }> = [] — reactive, feeds chat streaming view (grouped with chatStream/chatStreamStartedAt).
  • private connectGeneration = 0 — non-reactive lifecycle counter (grouped with chatHasAutoScrolled in the private bookkeeping section).

No test changes. Synthetic-host fixtures in app-lifecycle.node.test.ts / app-lifecycle-connect.node.test.ts already hand-set these fields — the problem was only in the production class.

Test plan

  • pnpm tsgo clean (0 errors)
  • pnpm lint clean (0 warnings, 0 errors)
  • pnpm format:check clean
  • pnpm exec vitest run --config vitest.unit.config.ts ui/src/ui/app-tool-stream.node.test.ts — 4/4 pass
  • Full pnpm test — via CI
  • Manual: chat dashboard connects on first load (Health=Online, Version populated) — deferred to post-merge smoke

Follow-ups (already filed per issue comment)

…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>
@alexey-pelykh alexey-pelykh merged commit bb0e29a into main Apr 23, 2026
15 checks passed
@alexey-pelykh alexey-pelykh deleted the fix/ui-restore-lifecycle-host-fields branch April 23, 2026 13:14
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.

fix(ui): restore connectGeneration/serverVersion/chatStreamSegments on RemoteClawApp — gateway connect silently broken

1 participant