Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
966b1d9
FIX-2154: wire the Teammates lab to the real packages
claude Oct 28, 2026
830c32d
FIX-2154: record the goal's verdicts and controls, file the gaps
claude Oct 28, 2026
944bbca
FIX-2154: say user, not person, in the lab's comments
claude Oct 28, 2026
2fd0c09
FIX-2154: name the Teammates lab's server config as a fallow entry
claude Oct 28, 2026
95fe4cf
FIX-2154: keep host.mts's own constants unexported
claude Oct 28, 2026
4d397d8
FIX-2154: answer review on the adapter and the goal
claude Oct 28, 2026
0660cd6
FIX-2154: read the feed's snapshot again when the history moves while…
claude Oct 28, 2026
ed88b9f
FIX-2154: hand the lab's Codex runs only the environment Codex needs
claude Oct 28, 2026
e8207d9
FIX-2154: follow a task's run by the session its card already names
claude Oct 28, 2026
e7ea812
FIX-2154: name the issue in the Codex pass-list changeset
claude Oct 28, 2026
ffb6fdd
FIX-2280: the Teammates lab reads a worker's project from its convers…
claude Oct 28, 2026
6e31e6b
FIX-2280: show a pick made here at once, before the next read confirm…
claude Oct 28, 2026
4e01de4
FIX-2289: render worker text as Markdown in the Teammates lab
claude Oct 28, 2026
9790706
Merge remote-tracking branch 'origin/claude/project-thread-e54cfm' in…
claude Oct 28, 2026
920da34
FIX-2289: keep MessageResponse internal to the lab's Markdown component
claude Oct 28, 2026
ecb5e55
FIX-2280: recount the lab inventory after the merge
claude Oct 28, 2026
6ee5d73
FIX-2280: a project set back elsewhere shows after a pick here
claude Oct 28, 2026
649e971
FIX-2289: read the lab's entries as shown in the goal check
claude Oct 28, 2026
7102c9e
FIX-2289: show a worker's answer as it is written
claude Oct 28, 2026
5258966
Merge remote-tracking branch 'origin/claude/project-thread-e54cfm' in…
claude Oct 28, 2026
49dd1b3
Merge main into FIX-2280 (keep both session-read tests; take main's p…
claude Oct 28, 2026
c295253
Merge main into FIX-2154 lab branch
claude Oct 28, 2026
2480d98
Merge remote-tracking branch 'origin/claude/project-thread-e54cfm' in…
claude Oct 28, 2026
0b3fc04
FIX-2280: recount the Teammates inventory after merging #4079
claude Oct 28, 2026
7bd40d0
Teammates lab: an unlinked task answer is not drawn as failed; lead n…
claude Oct 28, 2026
b82f66d
Teammates lab: researcher answers only through sendMessage; goal wait…
claude Oct 28, 2026
7f9874b
Merge remote-tracking branch 'origin/claude/project-thread-e54cfm' in…
claude Oct 28, 2026
a1dd201
FIX-2280: recount the Teammates inventory after merging #4079 at b82f…
claude Oct 28, 2026
78ce1ac
Merge main into FIX-2280 after #4079 landed
claude Oct 28, 2026
623e4db
Port fix: a task-board test still named the old human_input suspensio…
claude Oct 28, 2026
50789cc
FIX-2280: recount the Teammates inventory after the main merge settled
claude Oct 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
FIX-2289: render worker text as Markdown in the Teammates lab
A worker's answer, a message from another worker and a task's result are drawn
through the UI registry's MessageResponse (Streamdown), copied into the lab's
flow-state components. An unfinished code fence renders as a code block while
the answer streams. Streamdown parses raw HTML by default; the lab drops its
raw rehype plugin so HTML a model writes shows as text. Tests cover the open
fence, Markdown structure and the HTML, and fail on the plain-text entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiFEfpmT3smuFRj8ti2
  • Loading branch information
claude committed Oct 28, 2026
commit 4e01de447e8a422ecc584bd9598d238dd20a925b
6 changes: 3 additions & 3 deletions labs/teammates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ and on a flow over 200 lines; `--wired` also fails on any fixture.
<!-- inventory:start -->
| Kind | Files | Lines |
|---|---:|---:|
| Configuration | 16 | 518 |
| React UI | 18 | 1566 |
| Configuration | 16 | 523 |
| React UI | 19 | 1622 |
| Small flows | 1 | 148 |
| Checks (not app code) | 5 | 764 |
| Checks (not app code) | 6 | 816 |
<!-- inventory:end -->
5 changes: 5 additions & 0 deletions labs/teammates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
"@flow-state-dev/store-sqlite": "workspace:*",
"@flow-state-dev/workforce": "workspace:*",
"@flow-state-dev/workspace": "workspace:*",
"@streamdown/cjk": "^1.0.2",
"@streamdown/code": "^1.0.3",
"@streamdown/math": "^1.0.2",
"@streamdown/mermaid": "^1.0.2",
"streamdown": "^2.3.0",
"zod": "^3.24.1"
}
}
12 changes: 7 additions & 5 deletions labs/teammates/src/components/Entry.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { useState } from "react";
import type { ConversationEntry } from "../adapter";
import { cn } from "../lib/utils";
import { AgentMarkdown } from "./flow-state/message-response";

/**
* One entry of a conversation. Your lines sit on the right; the worker's
* answers on the left. A message the worker sent another worker is a one-line
* card that opens to its full text; a message it received, or a task it
* filed coming back, lands under the sender's name.
* filed coming back, lands under the sender's name. A worker's text is
* Markdown; your own lines are shown as typed.
*/
export function Entry({ entry, workerName, nameOf }: { entry: ConversationEntry; workerName: string; nameOf: (id: string) => string }) {
switch (entry.kind) {
Expand All @@ -21,8 +23,8 @@ export function Entry({ entry, workerName, nameOf }: { entry: ConversationEntry;
);
case "assistant":
return (
<div className="max-w-[85%] rounded-lg border border-border bg-card px-3 py-2 text-sm leading-relaxed whitespace-pre-wrap" data-entry="assistant">
{entry.text}
<div className="max-w-[85%] rounded-lg border border-border bg-card px-3 py-2 text-sm leading-relaxed" data-entry="assistant">
<AgentMarkdown text={entry.text} />
</div>
);
case "sent":
Expand All @@ -38,7 +40,7 @@ export function Entry({ entry, workerName, nameOf }: { entry: ConversationEntry;
← {nameOf(entry.from)}
{entry.inReplyTo ? " · reply" : ""}
</div>
<p className="mt-0.5 text-sm whitespace-pre-wrap">{entry.text}</p>
<AgentMarkdown className="mt-0.5 text-sm" text={entry.text} />
</section>
);
case "result":
Expand All @@ -47,7 +49,7 @@ export function Entry({ entry, workerName, nameOf }: { entry: ConversationEntry;
<div className="font-mono text-[10px] tracking-widest text-success uppercase">
← {nameOf(entry.from)} · {entry.failed ? "task failed" : "task done"}
</div>
<p className="mt-0.5 text-sm whitespace-pre-wrap">{entry.text}</p>
<AgentMarkdown className="mt-0.5 text-sm" text={entry.text} />
</section>
);
case "task":
Expand Down
53 changes: 53 additions & 0 deletions labs/teammates/src/components/flow-state/message-response.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* `MessageResponse` from the UI registry (`packages/ui/registry/components/message.tsx`),
* copied as the registry hands it out, without the rest of that file's message shell.
* It renders Markdown with Streamdown, which closes an unfinished code fence or
* emphasis while the text is still streaming.
*
* Streamdown parses raw HTML in Markdown by default (its `raw` rehype plugin,
* then sanitized). {@link AgentMarkdown} drops that plugin, so HTML a model
* writes shows as text and never becomes an element.
*/
import type { ComponentProps } from "react";
import { memo } from "react";
import { cjk } from "@streamdown/cjk";
import { code } from "@streamdown/code";
import { math } from "@streamdown/math";
import { mermaid } from "@streamdown/mermaid";
import { defaultRehypePlugins, Streamdown } from "streamdown";
import { cn } from "../../lib/utils";

export type MessageResponseProps = ComponentProps<typeof Streamdown>;

const streamdownPlugins = { cjk, code, math, mermaid };

export const MessageResponse = memo(
({ className, ...props }: MessageResponseProps) => (
<Streamdown
className={cn(
"size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
// Streamdown's inline code has a fixed corner; this one follows --radius-sm.
"[&_code]:rounded-sm",
className
)}
plugins={streamdownPlugins}
{...props}
/>
),
(prevProps, nextProps) => prevProps.children === nextProps.children
);

MessageResponse.displayName = "MessageResponse";

/** Streamdown's rehype plugins without `raw`: sanitize and harden stay, HTML stays text. */
const { raw: _raw, ...textOnlyHtml } = defaultRehypePlugins;
const AGENT_REHYPE = Object.values(textOnlyHtml);

/** A worker's text, as Markdown, with any HTML in it shown as text. */
export function AgentMarkdown({ text, className }: { text: string; className?: string }) {
return (
<MessageResponse className={className} rehypePlugins={AGENT_REHYPE}>
{text}
</MessageResponse>
);
}
1 change: 1 addition & 0 deletions labs/teammates/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
@import "@flow-state-dev/design-system/shift-manager.css";
@import "./components/flow-state/tokens.css";
@source "./";
@source "../node_modules/streamdown/dist/*.js";
@custom-variant dark (&:is(.dark *));

@theme inline {
Expand Down
52 changes: 52 additions & 0 deletions labs/teammates/test/markdown.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// @vitest-environment happy-dom
/**
* A worker's text renders as Markdown while it streams (FIX-2289): an
* unfinished code fence is already a code block, never a literal "```" line,
* and HTML the model writes stays text.
*/
import { cleanup, render, waitFor } from "@testing-library/react";
import { afterEach, describe, expect, it } from "vitest";
import { Entry } from "../src/components/Entry";

afterEach(cleanup);

const nameOf = (id: string) => id;
const assistant = (text: string) =>
render(<Entry entry={{ kind: "assistant", id: "e1", text }} workerName="lead" nameOf={nameOf} />).container;

describe("a worker's text", () => {
it("draws an unclosed code fence as a code block while it streams, and closes it in place when the fence arrives", async () => {
const partial = "Here is the fix:\n\n```ts\nconst launch = \"18 October\";\nconsole.log(lau";
const { container, rerender } = render(<Entry entry={{ kind: "assistant", id: "e1", text: partial }} workerName="lead" nameOf={nameOf} />);
await waitFor(() => expect(container.querySelector("pre code")).not.toBeNull());
expect(container.querySelector("pre code")!.textContent).toContain("console.log(lau");
expect(container.textContent).not.toContain("```");
expect(container.querySelector("p")!.textContent).toBe("Here is the fix:");

rerender(<Entry entry={{ kind: "assistant", id: "e1", text: `${partial}nch);\n\`\`\`\n\nDone.` }} workerName="lead" nameOf={nameOf} />);
await waitFor(() => expect(container.querySelector("pre code")!.textContent).toContain("console.log(launch);"));
expect(container.querySelectorAll("pre").length).toBe(1);
expect(container.textContent).toContain("Done.");
expect(container.textContent).not.toContain("```");
});

it("renders Markdown structure: emphasis, lists and inline code", async () => {
const container = assistant("**Launch** is on:\n\n- 18 October\n- in `relay`");
await waitFor(() => expect(container.querySelector('[data-streamdown="strong"]')?.textContent).toBe("Launch"));
expect(container.querySelectorAll("li").length).toBe(2);
expect(container.querySelector("code")?.textContent).toBe("relay");
});

it("shows HTML the model writes as text, not as elements", async () => {
const container = assistant('Look: <b>bold</b> <img src="x" onerror="alert(1)"> <script>alert(2)</script>');
await waitFor(() => expect(container.textContent).toContain("<b>bold</b>"));
expect(container.querySelector("b")).toBeNull();
expect(container.querySelector("img")).toBeNull();
expect(container.querySelector("script")).toBeNull();
});

it("renders a message from another worker as Markdown too", async () => {
const { container } = render(<Entry entry={{ kind: "received", id: "e2", messageId: "m1", from: "researcher", text: "Launch is **18 October**." }} workerName="lead" nameOf={nameOf} />);
await waitFor(() => expect(container.querySelector('[data-streamdown="strong"]')?.textContent).toBe("18 October"));
});
});
25 changes: 24 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions specs/issues/FIX-2289/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# FIX-2289: Markdown in the Teammates lab's worker conversations

A fix with no spec: the issue is the unit of intent. The lab draws a worker's
text through the UI registry's `MessageResponse` (Streamdown), with Streamdown's
`raw` rehype plugin dropped so HTML a model writes shows as text.

`assets/` holds two shots of lead's conversation, 1280×860, from `fsdev dev`
on `openai/gpt-5.4-mini`, asked for a heading, a list, a TypeScript code block
and the literal text `<b>not bold</b>`:

- `streaming-open-code-block.png`: mid-answer, the code fence not yet closed,
already drawn as a code block.
- `finished.png`: the same answer once it ended, highlighted, with no stray
fence marks and the HTML shown as text.
Binary file added specs/issues/FIX-2289/assets/finished.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading