fix(demo): wire Chat sidebar — add chat-template workspace + align templates to real names#238
Merged
Merged
Conversation
…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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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>
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.
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
Screenshots in the PR thread.
Boundary touch
None — demo fixtures + handlers only, no production code modified.
🤖 Generated with Claude Code