Skip to content

Task/react port cutover react only workspace fixes - #1470

Merged
benjaminshafii merged 141 commits into
devfrom
task/react-port-cutover-react-only-workspace-fixes
Apr 22, 2026
Merged

benjaminshafii merged 141 commits into
devfrom
task/react-port-cutover-react-only-workspace-fixes

Conversation

@benjaminshafii

Copy link
Copy Markdown
Member

Summary

Why

Issue

  • Closes #

Scope

Out of scope

Testing

Ran

  • ...

Result

  • pass/fail:
  • if fail, exact files/errors:

CI status

  • pass:
  • code-related failures:
  • external/env/auth blockers:

Manual verification

Evidence

  • video/screenshot link, or N/A (docs-only)

Risk

Rollback

Introduces apps/app/src/index.react.tsx and apps/app/src/react-app/shell/app-root.tsx as the base for a component-by-component migration, while keeping the Solid runtime as the shipped default. Updates vite.config so files inside src/react-app/ and the new React entry are routed through the React plugin rather than Solid.

Made-with: Cursor
Adds react-app/kernel/platform.tsx with a React context equivalent of the Solid PlatformProvider and a createDefaultPlatform() helper that mirrors the Tauri-vs-web bootstrap logic from src/index.tsx. Wires it into the new React entry so downstream hooks can depend on usePlatform() during the migration.

Made-with: Cursor
Copies the shared TanStack Query client helper into react-app/infra/query-client.ts and wires QueryClientProvider into the new React entry so future domain modules can share one Query cache.

Made-with: Cursor
Introduces react-app/kernel/store.ts with a small OpenworkStore covering bootstrap, server, workspaces, selected session, and an error banner. This gives downstream domain modules a single place to read and mutate React-owned app state as the migration proceeds; it will grow as later phases port more behavior.

Made-with: Cursor
Adds react-app/kernel/selectors.ts with a handful of small selectors (active workspace, server status, server URL, error banner) so domain components can consume store state through named selectors instead of reaching into the store shape directly.

Made-with: Cursor
Adds react-app/kernel/server-provider.tsx with a React context equivalent of context/server.tsx: persisted server list, active URL, health polling, and add/remove/setActive helpers. Health checks reuse the Tauri or fetch transport based on runtime, and hosted web deployments skip any persisted localhost target.

Made-with: Cursor
Adds react-app/kernel/global-sdk-provider.tsx mirroring context/global-sdk.tsx: builds an OpenCode client keyed to the active server URL, subscribes to the SSE event stream when healthy, and fans events into a lightweight channel emitter. Replaces the Solid @solid-primitives/event-bus with a small React-friendly emitter so downstream React domains can listen without pulling in solid-js runtime.

Made-with: Cursor
Adds react-app/kernel/global-sync-provider.tsx with a React context equivalent of context/global-sync.tsx. Uses a single useState-backed GlobalState plus a workspaces map for per-directory slices, and re-implements the refresh/refreshDirectory helpers and the directory-scoped event subscriptions on top of the new GlobalEventEmitter from global-sdk-provider.

Made-with: Cursor
Adds react-app/kernel/local-provider.tsx as a React-side persisted UI state + preferences provider equivalent to context/local.tsx. Uses plain useState with localStorage serialisation and migrates the legacy standalone thinking preference into the unified preferences shape.

Made-with: Cursor
Adds react-app/shell/providers.tsx that wraps ServerProvider, GlobalSDKProvider, GlobalSyncProvider, and LocalProvider in the same order as the Solid entry, and mounts the default server URL resolution logic from the original src/index.tsx. Wires the new AppProviders into the React entry so the migration now runs behind the full kernel provider stack.

Made-with: Cursor
Adds react-app/shell/startup-deep-links.ts that mirrors the Tauri and web deep-link startup behaviour from src/index.tsx, and calls it from the React entry alongside the existing deployment dataset hook.

Made-with: Cursor
… web

Pulls react-router-dom into apps/app and selects HashRouter for Tauri builds (matching the Solid shell behaviour) and BrowserRouter elsewhere. Wraps AppRoot in the chosen router so downstream pages can use route primitives from day one of the React migration.

Made-with: Cursor
Adds react-app/kernel/system-state.ts with a useSystemState() hook that covers the reload-pending state (reasons, trigger, mark/clear helpers) and the reset modal state (open/close, confirm flow that clears localStorage and relaunches). Cache repair, Docker cleanup, and the Tauri updater surface stay in the original Solid factory for now and will be ported as the settings shell migrates.

Made-with: Cursor
…del hook

Adds react-app/kernel/model-config.ts with the framework-agnostic parse/serialize helpers for session-level and workspace-level model choices, plus a lightweight useDefaultModel() hook that reads and persists the default model ref to localStorage. The richer workspace-scoped overrides, auto-compact context, and model picker orchestration stay in the Solid factory for now and will be ported when the session + settings surfaces need them.

Made-with: Cursor
Adds react-app/domains/session/modals/model-picker-modal.tsx as a faithful 1:1 React port of src/app/components/model-picker-modal.tsx. Preserves the recommended / connected / more-providers sections, search, keyboard navigation (arrow keys, enter, escape), behaviour chip row on the active option, and the empty/"no results" state. Uses an inline ProviderIcon placeholder until the full Solid ProviderIcon is ported. Installs lucide-react so the React tree can consume the same icon set.

Made-with: Cursor
… domains/session/sync

Relocates the session sync store and the AI SDK chat transport adapter into react-app/domains/session/sync/, with re-export shims left at the old react/session/ paths for Solid consumers still importing from there. These two files compile as a pair so they are moved together; the shims will disappear once the session route is mounted from react-app.

Made-with: Cursor
…session/sync

Pure transition/render-model helper moves from src/react/session/ into react-app/domains/session/sync/. Leaves a re-export shim at the old path so session-surface.react.tsx and debug-panel.react.tsx can keep their imports until they migrate too.

Made-with: Cursor
React effect component that keeps the workspace session sync loop alive now lives under react-app/domains/session/sync/runtime-sync.tsx. Existing callers import through the shim at src/react/session/runtime-sync.react.tsx until Solid mounts move off it.

Made-with: Cursor
…/surface

Relocates the markdown/streamdown renderer to react-app/domains/session/surface/markdown.tsx with a re-export shim at the old react/session/ path.

Made-with: Cursor
…/surface

Ports the ToolCallView component file into react-app/domains/session/surface/tool-call.tsx and leaves a shim at src/react/session/tool-call.react.tsx for the Solid transcript to keep importing from.

Made-with: Cursor
…urface

Relocates the SessionTranscript renderer to react-app/domains/session/surface/message-list.tsx and retargets its local imports to the already-moved markdown and tool-call modules. Retains a shim at src/react/session/message-list.react.tsx for Solid session-surface.

Made-with: Cursor
…rface

Session debug overlay moves to react-app/domains/session/surface/debug-panel.tsx with imports retargeted to the already-moved transition-controller and the shared openwork-server types. Leaves a shim at src/react/session/debug-panel.react.tsx for session-surface.

Made-with: Cursor
…/surface

Core React session surface (transcript + composer + sync bridge) moves to react-app/domains/session/surface/session-surface.tsx. Imports update to point into the relocated surface, sync, and composer modules, plus the shared infra query client. Shim at src/react/session/session-surface.react.tsx keeps Solid pages/app.tsx compiling against the React island pattern.

Made-with: Cursor
Creates react-app/domains/workspace/modal-styles.ts as a re-export of the framework-agnostic class-name constants in src/app/workspace/modal-styles.ts, so React-side workspace modals consume a domain-scoped import path while the Solid tree keeps using the original file.

Made-with: Cursor
Creates react-app/domains/workspace/types.ts as a re-export so React-side modal flows pull workspace types through the domain path.

Made-with: Cursor
Adds react-app/domains/workspace/option-card.tsx as a 1:1 React port of app/workspace/option-card.tsx, using lucide-react's ChevronRight and the shared modal style tokens. Accepts an icon as a React ComponentType so callers can pass any lucide-react icon directly.

Made-with: Cursor
Ports the reusable remote-worker form (URL, token show/hide, optional directory, display name) into react-app/domains/workspace/remote-workspace-fields.tsx, keeping the Solid "Show" conditional as a plain conditional render and reusing the shared modal style tokens.

Made-with: Cursor
jcllobet and others added 23 commits April 18, 2026 15:37
Move DesktopRuntimeBoot inside ServerProvider so the boot hook can call
useServer().setActive with the real engine baseUrl from both the fast path
(engineInfo probe) and slow path (engineStart). Fixes chat on Windows where
the engine binds to a dynamic port (e.g. 64357) instead of the default 4096
that ServerProvider was stuck on.
…ghten chat column

Three unintentional regressions from the React port:

1. Thinking / reasoning variant picker was empty because session-route
   never threaded modelBehaviorOptions into SessionSurface. Now we
   prefetch opencode's provider catalog as soon as the workspace
   opencode client is available, and compute
   getModelBehaviorSummary(providerID, model, variant) for the current
   default model to produce both modelVariantLabel and
   modelBehaviorOptions. The composer's Default/Thinking/Minimal etc.
   pill works again.

2. Cmd+K command palette lost the top-bar shortcuts. Added entries for
   Open documentation, Send feedback, and direct jumps to every
   settings tab (Skills, Extensions, Messaging, Appearance, Recovery,
   Updates) alongside the existing New session / Sessions / Settings
   rows. onOpenSettings now accepts an optional route so the palette
   can drop the user straight into the matching tab.

3. Chat transcript column tightened from 800px to 720px so messages
   don't sit at the same width as the composer and feel too big. The
   composer stays at 800px for action-bar breathing room.
…'Provider default'

- Composer used way more vertical space than intended. The editor had
  min-h-[180px] on the wrapper + min-h-[140px] on the ContentEditable
  so the starting height was ~180px. The panel padding (p-5 md:p-6)
  added another ~40px. Reset to a tight single-line look
  (min-h-[24px]) and cap the ContentEditable at max-h-[220px] with
  overflow-y-auto so long pastes scroll inside the composer instead
  of pushing the transcript off screen.
- Drop the generic 'Provider default' row from the reasoning/thinking
  variant menu. The list now shows only concrete variants
  (Low / Balanced / Deep / …). When no override is saved we resolve
  the provider's actual default preset (OpenAI/Google reasoning →
  medium, Anthropic extended-thinking → none, etc.) and use its
  label for the pill, so the pill is honest about what will run.
  Variant menu highlights the row whose label matches the pill, so
  'Balanced' appears selected when the provider default is medium.
- Editor placeholder label sizing normalized to 15px/24px line height
  to match the new compact composer geometry.
The current freeze investigation pointed at frontend render cost more than
fresh exceptions: a giant session loaded with a huge pasted-email block,
and Chrome DevTools itself timed out when we tried to interact with it.
The transcript was only virtualized after 500 message blocks, which means
sessions with a few enormous messages still rendered a giant DOM eagerly.

This patch makes the transcript cheaper:
- lower virtualization threshold from 500 -> 40 blocks so react-virtual
  kicks in much earlier for realistic long sessions
- apply content-visibility:auto sooner (24 blocks) and reduce the
  intrinsic placeholder size so distant blocks stay out of layout/paint
- add contain: layout style paint to block wrappers to isolate large
  message subtree layout work
- avoid running the text-highlight walk when search is inactive; if no
  query is set, only clear highlights when marks actually exist instead
  of traversing every large message DOM tree on every render

After this change the previously-problematic giant session
(ses_262bc60dfffefubKIJNQ23S3h2) still loads and, importantly, accepts a
new prompt + assistant reply in Chrome without wedging.
When a pulled PR doesn't take effect on the running desktop app, the
cause is almost always a wedged Vite dev server still attached to the
previous module graph, plus the Tauri webview holding its own HMR
client cache, plus the dep pre-bundle cache in node_modules/.vite. The
fix is multi-step and easy to get wrong by hand, so codify it.

scripts/openwork-debug.sh now supports:
  start          nohup pnpm dev with the /dev/log sink on
  stop           layered teardown (pnpm dev -> tauri dev -> webview ->
                 Vite -> openwork-server/orchestrator/opencode/router ->
                 orphan sweep)
  reset          stop + wipe Vite caches (apps/app/node_modules/.vite,
                 root + apps/desktop too) + truncate sink + start +
                 wait-healthy
  restart        alias for reset
  wait-healthy   block until openwork-server /health returns 200
  status         alias for snapshot
  reset-webview  destructive: wipe the dev WKWebView WebsiteData when a
                 plain reset still leaves the UI stuck on a stale URL
                 override

Safety:
  - Tauri webview is matched by full 'target/debug/OpenWork-Dev' path so
    the installed /Applications/OpenWork.app is never killed by mistake.
  - pnpm dev teardown uses the PID file written at start time, falling
    back to a path-aware pkill so we don't nuke pnpm runs in other
    repos on the same host.
  - reset preserves ~/Library/Application Support/com.differentai.openwork.dev
    (tokens, workspaces registry, prefs) and only clears Vite ephemera
    plus the log sink file (truncated).

This replaces the previous ad-hoc 'kill pnpm; kill vite; rm -rf .vite'
dance users had to do when HMR went stale after pulling changes.
Two longstanding composer bugs:

1) Paste was fucked. The onPaste handler hijacked any plain-text paste
   whose lines looked 'path-ish' (anything starting with '/', file://,
   UNC, Windows drive letter) via parseClipboardLinks + preventDefault,
   and it also force-replaced any paste >10 lines with a
   'pasted text' chip. Together this meant normal email/code/legal
   pastes either vanished or collapsed into a pill.

   New policy:
     - clipboard files  -> attach (unchanged)
     - clipboard text/uri-list  -> treat as external URL drop, insert
       links via onUnsupportedFileLinks (drag-from-Finder path only)
     - everything else (plain text)  -> DO NOTHING, let Lexical handle
       the paste natively so newlines render and no content is lost
     - remote/sandbox workspace warning is now advisory only; the paste
       still goes through
   Removed the now-dead countLines helper and the WINDOWS_PATH_RE /
   UNC_PATH_RE constants. parseClipboardLinks becomes the
   uri-list-only parseClipboardUriList.

2) Emojis in the composer. Mention pills rendered '🤖 ' / '📄 ' and
   the pasted-text chip rendered '📋 N lines'. Removed all three. The
   pill background/foreground already communicates the kind. The paste
   chip now reads 'Pasted · N line(s)'.
The pasted-text chip was rendered twice: once inline inside the Lexical
editor via ComposerPastedTextNode, and again as a separate rail above
the composer. Deleted the rail so there's a single, inline
representation. The inline chip keeps its label + line-count pill and
users remove it with backspace like any other inline token.
…on at feedback

Two regressions from the React port:

1) Couldn't append a new prompt while the assistant was still producing
   a response. SessionSurface.handleSend short-circuited on
   chatStreaming, and the composer swapped the Send button out for a
   Stop button whenever busy. Together this made mid-stream follow-ups
   impossible.

   - handleSend now only short-circuits when the draft is empty. Sending
     while streaming is allowed; OpenCode accepts follow-up user turns
     mid-run, and any error surfaces via setError.
   - Composer action row now keeps Send reachable during streaming:
     when busy + draft has text, Stop and Send render side-by-side.
     When busy + draft empty, only Stop shows.

2) The bottom-right 'Send feedback' icon in the status bar used to
   openLink('https://openworklabs.com/docs'), so clicking feedback
   opened the docs. SessionRoute now uses buildFeedbackUrl({
   entrypoint: 'status-bar', appVersion: '0.11.207' }) from
   apps/app/src/app/lib/feedback.ts — the same helper the Solid app
   used — so the button opens the real feedback form with source +
   client OS context populated.
Dev-only overlay that shows which React zones re-render and how long
they take, so operators can immediately see which subtree is thrashing
when the UI feels stuck.

Mechanics:
- apps/app/src/react-app/shell/dev-profiler.tsx: exports DevProfiler
  (wraps a subtree with React's <Profiler>) and DevProfilerOverlay
  (small floating card, bottom-right).
- Aggregates every commit into a Map keyed by zone id: count, total
  actual ms, base ms, last commit ts, mount vs update counts. Emits
  to subscribers via rAF-throttled dispatch so a stream of commits
  can't flood setState.
- Overlay is opt-in. Toggle with Cmd/Ctrl+Shift+P; last state is
  persisted in localStorage.openwork.debug.profilerOverlay. Off by
  default.
- In prod builds the wrapper is a pure pass-through (no <Profiler>
  mounted, no overhead) and the overlay renders null. Gate via
  import.meta.env.DEV.
- Exposes the same snapshot at window.__openwork.slice('profiler') so
  Chrome MCP / external drivers can read render counts without the
  overlay being visible.

Instrumented zones so the table fills up with real work:
- AppRoot, SessionRoute, SettingsRoute (top-level routing)
- SessionSurface (chat pane)
- SessionTranscript (message list)
- SessionComposer (composer tree)

Using it:
1. pnpm dev
2. open the dev app
3. press Cmd+Shift+P
4. watch the table as you interact — hottest zones bubble to the top,
   rows flash when they commit so you can visually attribute bursts.
5. hit 'reset' in the overlay header to clear counters between tests.
The composer's variant labels were generic ('Light / Balanced / Deep /
Maximum'), which didn't match the terminology users already know from
the vendors' own products. Switched to vendor-aligned labels per
provider family so the composer pill shows names matching ChatGPT /
Claude / Gemini / Grok conventions.

Mapping (per provider family, by OpenCode variant key):

  OpenAI / ChatGPT / Azure / OpenCode
    none or minimal -> Instant
    low             -> Light thinking
    medium          -> Thinking
    high            -> Thinking longer
    xhigh / max     -> Maximum thinking
    section title   -> 'Reasoning effort'

  Anthropic / Claude
    none            -> No extended thinking
    low             -> Brief extended thinking
    medium          -> Extended thinking
    high            -> Deep extended thinking
    xhigh / max     -> Maximum extended thinking
    section title   -> 'Extended thinking'

  Google / Gemini
    none            -> Instant
    low             -> Brief thinking
    medium          -> Thinking
    high            -> Deep thinking
    xhigh / max     -> Maximum thinking
    section title   -> 'Thinking budget'

  xAI / Grok
    none            -> Fast
    low / medium    -> Think
    high            -> Think harder
    xhigh / max     -> Think hardest
    section title   -> 'Think mode'

Each row's description was also rewritten per family to match. The
previous generic labels remain as the fallback for providers outside
these four families.

Also added resolveProviderFamily(providerID) to centralize the family
bucketing so getVariantLabel / getVariantDescription / getBehaviorTitle
stay consistent.
The React Profiler overlay produced absurd numbers (1.1M+ commits per
zone, ~22min of render work) because it re-rendered itself inside the
AppRoot Profiler zone every time it recorded a commit — which itself
scheduled another commit, forever.

Why:
  commit somewhere -> recordCommit -> scheduleEmit (rAF)
  emit -> every subscriber's setSnapshot(...)
  -> overlay re-renders (inside AppRoot's <Profiler>)
  -> another commit -> recordCommit -> emit -> ...

Two changes:

1. DevProfilerOverlay now splits into two components.
   - DevProfilerOverlayToggle owns visibility + the Cmd+Shift+P bind
     and does NOT subscribe.
   - DevProfilerOverlayVisible is only mounted when the overlay is
     visible and is the sole subscriber to profiler snapshots.
   When the overlay is hidden (the default), nothing is subscribed.

2. recordCommit / scheduleEmit short-circuit when subscribers.size === 0.
   Profiler zones are therefore zero-cost when the overlay is off: no
   Map writes, no rAF scheduled, no emit, no re-render chain.

When the overlay is on you still get the intended behavior (rows
update per commit, flashing, reset button, totals), but the overlay's
own re-renders no longer propagate endlessly through the tree.

Prod builds: untouched (the wrapper is already a pass-through and the
overlay returns null when !import.meta.env.DEV).
…f AppRoot zone

The previous profile (1144 AppRoot commits, 55 SessionTranscript at
27ms each) made two things obvious:

1) AppRoot's commit count was inflated by the dev profiler overlay's
   own re-renders. The overlay subscribes to commits to refresh its
   table, and it was mounted inside <DevProfiler id='AppRoot'>, so
   every overlay self-render registered as an AppRoot commit (~1073 of
   the 1144). Now the overlay sits OUTSIDE the AppRoot Profiler zone
   so AppRoot's count reflects real app-level commits only and its
   children's relative numbers stay readable.

2) SessionTranscript was committing 55 times for 59 SessionSurface
   commits at ~26 ms per commit (right at the 16ms frame budget). The
   counts being almost identical means the transcript was re-rendering
   on every parent commit instead of only when its own props changed.
   Wrapping with React.memo at the transcript boundary lets it skip
   re-renders when SessionSurface ticks for unrelated state (sending,
   chatStreaming, attachment changes, etc.). The transcript component
   itself remains the same; the public export is a memoized wrapper
   over SessionTranscriptInner with displayName preserved.

Composer was already cheap (~0.5ms/commit), so left as-is. Next pass
should reduce SessionSurface state churn during streaming so the
parent commits 5-10x less often.
Symptom: open an old session, type 'tell me a long story', press
Enter. A few tokens stream in, then the webview wedges. Log contains:
  Uncaught DataCloneError: Failed to execute 'measure' on
  'Performance': Data cannot be cloned, out of memory.
  at logComponentRender (react-dom_client.js)

Root cause: the React <Profiler> zones I added (AppRoot, SessionRoute,
SessionSurface, SessionTranscript, SessionComposer) cause React-DOM's
internal instrumentation (logComponentRender) to emit
performance.measure entries on every commit. Sustained streaming
commits fill the browser's performance timeline faster than it can be
reclaimed; once the allocation cloner runs out of space the commit
throws mid-stream and the main thread stalls for everyone.

Fix: make the profiler fully opt-in. Default is OFF even in dev. Two
opt-ins:
  - VITE_OPENWORK_PROFILER=1 at pnpm dev
  - window.localStorage.setItem('openwork.debug.profiler', '1')

When off, <DevProfiler> is a pure pass-through (no <Profiler> mounted,
no overhead) and <DevProfilerOverlay> renders null. The Cmd+Shift+P
overlay toggle is unchanged for opted-in dev runs.
Audit of why large sessions still hung 'after 2 words' during streaming
turned up four real virtualizer bugs and one markdown hot spot:

1. shouldVirtualize required props.scrollElement() to already be
   non-null. On the first render of a large session the scroll
   container ref hadn't attached yet, so the whole transcript rendered
   eagerly (every message block) for one tick before switching to
   virtualization. That burst alone froze the UI on huge transcripts.
   Now shouldVirtualize only depends on block count.

2. A useEffect called virtualizer.measure() on every messageBlocks
   change. During streaming messageBlocks gets a new identity on every
   token, so we forced a synchronous re-measure (every row's
   getBoundingClientRect) on every token. react-virtual already
   invalidates rows whose refs or content change. Deleted the effect.

3. The render had a second eager fallback: virtualRows.length > 0
   ? <virtualized> : <every message eagerly>. That re-introduced the
   same freeze on the very first virtualized render before rows were
   computed. Removed; if shouldVirtualize is true we always render the
   virtualized container, even when getVirtualItems() is empty, so the
   tree stays bounded.

4. estimateSize was a flat 220 for every block. Giant messages and
   tiny user-user bubbles share the same bad guess, so react-virtual
   constantly fought the real sizes. Replaced with a shape-aware
   estimate (steps-cluster: 80, user: 96, assistant: 320).

5. VIRTUALIZATION_THRESHOLD lowered from 40 -> 20. Medium sessions are
   cheaper to render via the virtualizer than as a flat list of 20+
   markdown-heavy blocks.

6. MarkdownBlock was not memoized. Every streamed token re-parsed
   markdown for every visible message. Wrapped it in React.memo so
   blocks other than the currently-streaming one skip re-render when
   their own text prop didn't change.

Also fixed an unrelated TS error in session-sync (missing
deltaFlushBuffer / deltaFlushScheduled fields on the SyncEntry factory
literal) that was blocking typecheck.
Port the useStableRows idea from T3Tools' MessagesTimeline. On every
streaming token, props.messages is a fresh array but only the
currently-streaming message has a new UIMessage reference — every
other message in the transcript is still pointer-equal to last tick
(session-sync.ts uses messages.slice() + targeted mutation).

Our messageBlocks useMemo previously reconstructed every block object
from scratch on every token, so downstream React.memo'd components
(MarkdownBlock especially) always saw fresh prop references and
couldn't bail out. Structural sharing fixes that:

- blockIdentityKey(block): derives a stable key per block ('msg:<id>'
  for message blocks, 'cluster:<id>' for step clusters).
- blocksAreEquivalent(prev, next): returns true when the two blocks
  point at content-equal data. For message blocks the critical check
  is prev.message === next.message (UIMessage reference). For step
  clusters we compare messageIds + stepGroups identity.
- SessionTranscriptInner keeps a previousBlocksRef<Map<key, block>>.
  After the raw messageBlocks array is computed it maps each entry
  through useStableBlocks-equivalent logic: if the previous block at
  the same key is content-equivalent we reuse the previous reference.

Net effect: during a streaming burst, only the active assistant
message's block gets a new identity per token. All other rows hand
pointer-equal props to their memoized children, which bail out of
rendering entirely. This is the highest-leverage fix available for
the 'big sessions freeze after a few streamed words' symptom.
…pdated

When message.part.updated or message.part.delta arrives for a
messageID we haven't seen a message.updated for yet, we stub the
message so the part has somewhere to live. The stub's role was
hard-coded to 'assistant', which lost the race during a promptAsync
flow: if the server emitted a part event for a user turn before the
user message.updated, the new user message flashed as an assistant-
styled block (left-aligned, markdown, no bubble) until the real role
arrived a tick later. User saw 'sometimes my message renders outside
the user bubble, as if it were assistant'.

Fix: infer the stub role from the conversation. Chat turns alternate
so a new unknown message is almost always the opposite role of the
most recent known message. If the transcript is empty the first
message is always the user's.

- New inferStubRole(messages): returns 'user' when the last message
  was 'assistant' (and vice versa), defaulting to 'user' when there
  is no prior message.
- message.part.updated / delta-flush stubs now call inferStubRole if
  the message isn't already in state. If it is, they preserve the
  existing role to avoid flapping.

upsertMessage already re-applies the authoritative role as soon as
the real message.updated event arrives, so this is purely a correct-
on-first-paint improvement and doesn't affect long-term state.
The React debug-logger posts console/error/fetch/hang events to the
openwork-server /dev/log sink. When pnpm dev is started without
OPENWORK_DEV_LOG_FILE set, the server returned 404 from both GET and
POST /dev/log. The browser logs every failed POST as
'Failed to load resource: 404' regardless of whether the logger
silently handles the error, so an operator who doesn't know about the
env var sees console noise on every page.

Two changes:

1) Server probe now returns 200 + {ok:false, reason:'dev_log_disabled'}
   instead of 404. Clients that want to know whether the sink is active
   should read the body flag, not the status. This eliminates the
   console warning from the probe itself.

2) Client now probes /dev/log once per base URL with GET. If the
   response body says the sink is disabled, it caches that decision
   and skips all further POSTs for the remainder of the session. In-
   memory events remain available via window.__openwork.events().

Net effect: sink-disabled dev sessions produce zero /dev/log traffic
and zero console 404s. Sink-enabled sessions behave as before.
Share workspace (React port):
- session-route wires the full ShareWorkspaceModal + useShareWorkspaceState,
  with remote-access toggle (local workspaces), workspace-profile publish,
  skills-set publish, team/public template flows, and workspace export.
- Route now tracks OpenworkServerInfo, EngineInfo, and settings version so
  the share state has enough context to resolve the mounted local workspace
  URL and host tokens.

Alpha release channel:
- New ReleaseChannel type ("stable" | "alpha").
- apps/app/src/app/lib/release-channels.ts exposes STABLE/ALPHA updater
  endpoints, resolveUpdaterEndpoint, isAlphaChannelSupported, and a
  coerceReleaseChannel helper.
- LocalPreferences carries releaseChannel (default "stable").
- Updates settings shows a macOS-only Stable/Alpha toggle.
- .github/workflows/alpha-macos-aarch64.yml now publishes signed+notarized
  macOS arm64 builds to a rolling alpha-macos-latest GitHub release with
  a Tauri updater latest.json on every merge to dev.
- ARCHITECTURE.md documents the channel contract.
…ixes

Dev's React-port cutover deleted the Solid tree; this merge keeps those
deletions and drops the new Solid-only files dev added on top (they
imported from contexts we removed, so they can't typecheck against the
React shell):

- apps/app/src/app/cloud/{den-auth-provider,den-signin-surface,desktop-config-provider,forced-signin-page}.tsx

Dev's new functionality that has NOT yet been ported to React (tracked
in the follow-up report): forced-signin gate, Den bootstrap config,
desktop_app_restrictions, update supported-version gate, Better-Auth
active-org, DenSignInSurface embed in settings.

Shared libs (den.ts, tauri.ts, types.ts, model-behavior.ts, utils/providers.ts)
and i18n (en.ts, fr.ts) take dev's version — these are consumed by the
React port.

DenOrgSummary.role widened to 'owner' | 'admin' | 'member' in the React
Den-settings panel to match the Better-Auth upgrade (ac41d58).

pnpm-lock regenerated after pinning @opencode-ai/sdk to 1.4.9 (7bb7e52).
… gate

Ports the cloud-domain pieces dev added on Solid so the React shell has
feature parity for:

- DenAuthProvider / useDenAuth — drives auth status + user, calls
  ensureDenActiveOrganization() on every refresh so Better-Auth's
  active org stays in sync (Solid: apps/app/src/app/cloud/den-auth-provider.tsx)

- DesktopConfigProvider / useDesktopConfig / useOrgRestrictions — fetches
  the org-scoped DesktopAppRestrictions (blockZenModel, disallowNonCloudModels,
  etc.) introduced in packages/types, caches it per base-url+org in
  localStorage so the gate resolves synchronously on next boot, and
  re-fetches on denSessionUpdatedEvent / denSettingsChangedEvent and a
  1h interval (Solid: apps/app/src/app/cloud/desktop-config-provider.tsx)

- DenSignInSurface — shared presentation surface for both the forced
  sign-in page and any embedded 'panel' usage; matches Solid props 1:1
  so flows are interchangeable
  (Solid: apps/app/src/app/cloud/den-signin-surface.tsx)

- ForcedSigninPage — full-screen sign-in gate that owns local drafts
  (base URL, manual auth input) and pipes them into DenSignInSurface.
  Handles manual auth input parsing (openwork:// deep links and raw
  grant codes) and base-URL overrides via setDenBootstrapConfig
  (Solid: apps/app/src/app/cloud/forced-signin-page.tsx)

Shell wiring:

- providers.tsx mounts DenAuthProvider > DesktopConfigProvider inside
  GlobalSyncProvider so all routes have access to auth + org restrictions
- app-root.tsx adds a /signin route and a DenSigninGate component that
  enforces readDenBootstrapConfig().requireSignin: redirects unsigned
  users to /signin and signed-in users away from /signin. Renders null
  while the first Den session check is still in flight so no
  session/settings chrome flashes behind the gate.

Better-Auth active-org:

- den-settings-panel.tsx now calls ensureDenActiveOrganization({
  forceServerSync: true }) both in refreshOrgs and in the org <select>
  change handler so subsequent /v1/org/* requests resolve against the
  freshly selected org (Solid ac41d58).

Shared lib:

- den.ts re-exports the DenDesktopConfig type alias so React consumers
  can import it from the same module as its helpers. Solid referenced it
  only internally.
Fast-forward merge of dev since the last merge commit; same pattern:
keep the React-cutover deletions, drop newly-added Solid-only files,
take dev's versions of shared libs.

Conflict resolutions:
- apps/app/src/app/lib/den.ts -- combined: took dev's rename to the
  shared DesktopConfig schema ( allowedDesktopVersions), kept our local
  DenDesktopConfig alias + re-export so React consumers keep working.
- apps/app/src/app/lib/model-behavior.ts -- took dev (i18n-based vendor
  nomenclature via model_behavior.* keys). Our earlier hardcoded vendor
  strings regressed in favor of localized ones with the same intent.
- apps/app/src/react-app/design-system/provider-icon.tsx -- kept our
  React file; added providerName prop + family detection from dev
  #1510 so cloud-id-keyed providers still resolve the right icon.
- apps/app/src/react-app/design-system/restriction-notice-modal.tsx --
  dev's new modal (Solid) was auto-moved here; rewrote as a proper
  React component (no Show/solid-js imports). Matches the Solid contract
  so the cloud domain can use it directly.
- apps/app/src/react-app/domains/connections/provider-auth/store.ts --
  kept React version, added sourceProviderId on imported-provider write
  to satisfy the new type from #1510 (track local/remote provider id
  drift).

Solid-only files deleted-by-us kept deleted:
- app.tsx, cloud/den-auth-provider.tsx (old Solid copy),
  cloud/desktop-config-provider.tsx (old Solid copy),
  components/den-settings-panel.tsx, components/model-picker-modal.tsx,
  context/model-config.ts, context/providers/provider-auth-modal.tsx,
  pages/session.tsx, pages/settings.tsx, shell/settings-shell.tsx,
  system-state.ts.

New feature surface ported in follow-up commits (see PR notes).
Completes the cloud-domain feature parity audit: everything dev shipped
on Solid that hadn't yet been reachable from the React shell now has a
React-native equivalent.

Desktop restriction enforcement (#1505):
- desktop-config-provider exposes a stable checkRestriction closure
  matching DesktopAppRestrictionChecker from cloud/desktop-app-restrictions
- New hooks: useCheckDesktopRestriction() and useDesktopRestriction(key)
- RestrictionNoticeProvider owns a single app-wide RestrictionNoticeModal
  and exposes { show, dismiss } via useRestrictionNotice()
- session-route now gates "Create workspace" on blockMultipleWorkspaces
  and surfaces the admin notice when blocked
- session-route filters the model picker against blockZenModel and
  disallowNonCloudModels before the search filter runs, so blocked
  providers/models are never offered
- settings-route filters the provider-auth modal's provider list through
  the same desktop-provider gate so users can't connect a forbidden one

Cloud provider auto-sync (#1509):
- Ported cloud/sync/constants.ts already came in via the merge
- New useCloudProviderAutoSync(refresh) hook runs refreshCloudOrgProviders
  on mount and every CLOUD_SYNC_INTERVAL_MS while Den auth is signed-in;
  skips while signed-out and avoids overlapping ticks via an in-flight ref
- Mounted from settings-route (which already owns the provider-auth store)

Cloud-id drift protection (#1510):
- import-state.ts + provider-auth/store.ts track sourceProviderId so we
  can detect when the provider's server-side id drifts from what we
  imported (enables rename-aware de-dup later)
- ProviderIcon gained the providerName prop so cloud-id-keyed providers
  still resolve the right icon via the provider-family detector

Desktop update gating (#1476 + #1512):
- New lib/version-gate.ts exposes compareVersions, parseComparableVersion,
  isUpdateAllowedByDesktopConfig (allowedDesktopVersions), and
  isUpdateSupportedByDen (Den /v1/app-version round-trip)
- Combined isUpdateAllowed() helper is the single entry point the React
  updater flow should call once it's wired (pre-existing TODO)

Not yet wired (explicit follow-ups, none of them user-facing gaps today):
- React checkForUpdates itself is still stubbed; version-gate helpers are
  ready to plug in when that land
- Full workspace-config-side restriction reconciliation
  (runDesktopAppRestrictionSyncEffects) — our React provider store
  doesn't yet expose ensureProjectProviderDisabledState; when it does,
  wire the sync-effects call from app-root.

This branch was successfully deployed

5 active deployments
Preview – openwork-den-worker-proxy — c5ca3b65 Deployed Apr 21, 2026 by vercel[bot]
Preview – openwork-den — c5ca3b65 Deployed Apr 21, 2026 by vercel[bot]
Preview – openwork-landing — c5ca3b65 Deployed Apr 21, 2026 by vercel[bot]
Preview – openwork-app — c5ca3b65 Deployed Apr 21, 2026 by vercel[bot]
Preview – openwork-share — c5ca3b65 Deployed Apr 21, 2026 by vercel[bot]
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.

2 participants