Skip to content

fix(demo): wire Chat sidebar — add chat-template workspace + align templates to real names#238

Merged
luokerenx4 merged 1 commit into
masterfrom
fix/demo-chat-workspace-empty
Jun 1, 2026
Merged

fix(demo): wire Chat sidebar — add chat-template workspace + align templates to real names#238
luokerenx4 merged 1 commit into
masterfrom
fix/demo-chat-workspace-empty

Conversation

@luokerenx4
Copy link
Copy Markdown
Contributor

Summary

The Chat activity sidebar was rendering empty in demo mode. Root cause: the Stage 1 / 2 fixtures invented a placeholder template name `'demo-template'` and used it for the only workspace. The Chat sidebar's `ChatWorkspaceSection` filters workspaces by `template === 'chat'` and templates by `name === 'chat'`, then hard-returns null when no chat template is found (`ui/src/components/workspace/ChatWorkspaceSection.tsx:113`). Both filters missed → whole sidebar section vanished.

Also: per memory `feedback_ground_truth_before_reference_docs`, demo fixtures should mirror real product names — I'd violated that by inventing `'demo-template'`.

What changed

1. Flagship workspace now uses a real template

The AAPL Q1 research workspace gets template `'finance-research'` instead of `'demo-template'`. The real template at `src/workspaces/templates/finance-research/template.json` is described as "yfinance market data, valuation, earnings, social readers, sentiment" — which is literally what the AAPL Q1 transcript demonstrates (read SEC filings → compute services-rev YoY → write report). Semantically correct, no fiction.

Workspace tag also renamed `'demo'` → `'aapl-q1'` for the same coherence reason. The workspace ID (`DEMO_WORKSPACE_ID = 'demo-ws'`) stays the same so transcripts/inbox cross-references don't break.

2. New chat workspace + chat template fixtures

`chatWorkspace` (tag `chat-may26`, template `'chat'`, session `demo-chat-session`) + `chatTemplate` (name `'chat'`, displayName `'Chat'`, mirroring `src/workspaces/templates/chat/template.json`).

The chat workspace has no transcript registered, so its terminal pane falls back to `DemoTerminalStub` — which is the right "in real OpenAlice this is a live PTY" placeholder for demo mode.

3. Two hard-coded "demo" string fixes

The AAPL report's `Workspace: demo` markdown line and the transcript banner's `workspace demo` label both said "demo", but the tag is now `aapl-q1`. Updated both to `aapl-q1` for self-consistency — visitors won't see "Workspace: demo" in a report that came from workspace "aapl-q1".

4. Handlers return arrays

`/api/workspaces` → `demoWorkspaces` (was `[demoWorkspace]`). `/api/workspaces/templates` → `demoTemplates` (was `[demoTemplate]`). Back-compat singletons stay exported for any future consumer.

Verification

Check Result
`pnpm -F open-alice-ui exec tsc -b` clean
`pnpm test` 1701/1701
`pnpm -F open-alice-ui build` (prod) main chunk has zero `demoChatWorkspace` / `chat-may26` / `financeResearchTemplate` / `aapl-q1` / transcript-string leaks
`pnpm dev:demo` + Playwright walk Chat sidebar shows `chat-may26` workspace + `c1` session ✓; Workspaces sidebar shows both workspaces side-by-side ✓; opening AAPL session still plays the AAPL transcript end-to-end ✓; Inbox report markdown now says `Workspace: aapl-q1` ✓

Screenshots in the PR thread.

Boundary touch

None — demo fixtures + handlers only, no production code modified.

🤖 Generated with Claude Code

…mplates to real names

The Chat activity sidebar (`ChatWorkspaceSection`) filters workspaces
by `template === 'chat'` and the templates list by `name === 'chat'`,
then HARD-RETURNS NULL if no chat template is found. Stage 1/2's
fixtures used a fictional `'demo-template'` for the only workspace,
so both filters missed and the entire Chat surface rendered empty.

Three changes:

1. Renamed the flagship workspace's template from `'demo-template'`
   to `'finance-research'` — the real template name from
   `src/workspaces/templates/finance-research/template.json`. This
   matches what the AAPL Q1 transcript actually IS (read SEC filings,
   compute services-rev YoY, write report), and it makes the
   Workspaces sidebar group the workspace under the correct template.
   Renamed its tag from `'demo'` to `'aapl-q1'` for the same coherence
   reason.

2. Added a new `chatWorkspace` (tag `chat-may26`, template `'chat'`,
   session `demo-chat-session`) and `chatTemplate` (name `'chat'`,
   displayName `'Chat'`, mirroring real chat/template.json). The Chat
   sidebar now finds both, renders the single chat workspace row, and
   clicking it shows the (transcript-less) terminal stub — the right
   "in real OpenAlice this is a live PTY" placeholder for demo.

3. Renamed two hard-coded "demo" strings inside fixtures that no
   longer match the new tag — the AAPL report's "Workspace: demo"
   markdown line, and the transcript banner's "workspace demo" label.
   Both now say "aapl-q1" for self-consistency.

Handler change: `/api/workspaces` and `/api/workspaces/templates`
return arrays (`demoWorkspaces`, `demoTemplates`) instead of singleton
arrays.

Side observation worth flagging: the `fixtures/index.ts` barrel
re-exports `* from './workspaces'`, but no other code uses anything
beyond the existing IDs and the array exports. The back-compat
singleton `demoTemplate` stays exported (points at the flagship) so
any future consumer of the old name keeps compiling.

Verified:
- pnpm -F open-alice-ui exec tsc -b: clean
- pnpm test: 1701/1701
- pnpm -F open-alice-ui build (prod): main chunk has zero
  `demoChatWorkspace` / `chat-may26` / `financeResearchTemplate` /
  `aapl-q1` / transcript-string leaks
- pnpm dev:demo + Playwright walk: Chat sidebar shows `chat-may26`
  workspace with `c1` session; Workspaces sidebar shows both
  workspaces side-by-side; opening AAPL session still plays the
  AAPL transcript end-to-end; Inbox report markdown now says
  `Workspace: aapl-q1`

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openalice-demo Ready Ready Preview, Comment Jun 1, 2026 3:43am

Request Review

@luokerenx4 luokerenx4 merged commit 9d55973 into master Jun 1, 2026
3 checks passed
pull Bot pushed a commit to bhardwajRahul/OpenAlice that referenced this pull request Jun 1, 2026
…nging /api/* surfaces

Three recent demo crashes (TraderAlice#235 / TraderAlice#238 / TraderAlice#240) all came from the same
pattern: a refactor changed what production code returns or expects,
but the parallel demo handler in `ui/src/demo/handlers/` kept the old
(or invented an ad-hoc) shape. `pnpm test` doesn't catch it because
esbuild doesn't enforce types.

Adds demo mode to the existing "Subsystem guides" section alongside
the event/listener/producer guide. The text names the two cheap habits
that prevent the failure mode:

1. Import the canonical type from `ui/src/api/types.ts` (or wherever
   the contract lives) when writing a demo handler, instead of inlining
   an ad-hoc shape.
2. Run `pnpm -F open-alice-ui dev:demo` and walk the affected surface
   before declaring the refactor done. The catchAll's
   `[demo] unmocked …` warn surfaces missing endpoints; visible crashes
   surface shape mismatches.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant