Skip to content

A local-first multi-agent app development platform, built on PenguinHarness

fix(web): render thinking and compaction bodies as output, not as a quotation (#694)

Yaowei Zheng5d0ac14ca072
diff --git a/changelog/unreleased/2026-09-11-thinking-body-output-style.md b/changelog/unreleased/2026-09-11-thinking-body-output-style.md
new file mode 100644
index 00000000..b434a80e
--- /dev/null
+++ b/changelog/unreleased/2026-09-11-thinking-body-output-style.md
@@ -0,0 +1,23 @@
+# Thinking and compaction bodies read as output, not as a quotation
+
+- **Date:** 2026-09-11
+- **Type:** fix
+- **Scope:** `web`
+- **PR:** [#694](https://github.com/Prism-Shadow/penguin-harness/pull/694)
+
+[中文版](2026-09-11-thinking-body-output-style.zh.md)
+
+An expanded thinking block, and both sections of a compaction banner, sat in an inset rounded box
+on a tinted ground — the shape the transcript uses for a quotation. Both now wear the block an
+expanded `exec_command` output wears.
+
+## Details
+
+- The body runs full-bleed under its row, separated from it by the same divider, inset by the same
+ padding, in the same ink.
+- That padding is the whole gap at each end: the outermost paragraph, list or heading no longer
+ adds its own margin on top of it, and paragraph, list and heading spacing lands on one rhythm.
+- The type stays at prose size rather than the output block's, and both bodies still render
+ Markdown.
+- Neither body takes the output block's height cap: a long body grows the transcript instead of
+ scrolling inside itself.
diff --git a/changelog/unreleased/2026-09-11-thinking-body-output-style.zh.md b/changelog/unreleased/2026-09-11-thinking-body-output-style.zh.md
new file mode 100644
index 00000000..24b1a6aa
--- /dev/null
+++ b/changelog/unreleased/2026-09-11-thinking-body-output-style.zh.md
@@ -0,0 +1,19 @@
+# 思考与压缩正文按输出呈现,不再是引用样式
+
+- **Date:** 2026-09-11
+- **Type:** fix
+- **Scope:** `web`
+- **PR:** [#694](https://github.com/Prism-Shadow/penguin-harness/pull/694)
+
+[English](2026-09-11-thinking-body-output-style.md)
+
+展开的思考块与压缩横幅的两个小节此前缩在一只带底色的圆角框里——对话区用来表示引用的形状。两处现
+在都与展开的 `exec_command` 输出同款。
+
+## 细节
+
+- 正文整宽贴在所属行下,用同一条分隔线与行分开,内边距与字色也与输出块一致。
+- 正文上下的留白只剩这份内边距:最外层的段落、列表或标题不再在它之上再叠一层自己的外边距,段
+ 落、列表与标题的行距也落在同一套节奏上。
+- 字号仍按正文走,不取输出块的字号;两处正文也仍按 Markdown 渲染。
+- 两处正文都不套用输出块的高度上限:正文变长时撑开对话区,而不是在自己内部滚动。
diff --git a/packages/web/src/features/chat/compaction-banner.tsx b/packages/web/src/features/chat/compaction-banner.tsx
index ae07abd5..a9a0023d 100644
--- a/packages/web/src/features/chat/compaction-banner.tsx
+++ b/packages/web/src/features/chat/compaction-banner.tsx
@@ -49,7 +49,7 @@ import { humanizeDuration } from "../../lib/format";
import type { CompactionItem } from "../../lib/omni/stream-model";
import { compactionResultVisible, compactionSummaryText } from "../../lib/omni/compaction-summary";
import { StatusIcon } from "../../components/ui/status-icon";
-import { DisclosureRow } from "./disclosure-row";
+import { DISCLOSURE_BODY_MD_CLASS, DisclosureRow } from "./disclosure-row";
import { LiveDuration } from "./live-duration";
import { Md } from "./md";
import { StepBanner } from "./step-banner";
@@ -96,7 +96,7 @@ function CompactionSection({
</span>
}
>
- <div className="md-body anim-fade mx-3 mb-2 rounded-md bg-gray-50 px-3 py-2 text-sm leading-relaxed text-gray-600 dark:bg-gray-900/60 dark:text-gray-400">
+ <div className={`anim-fade ${DISCLOSURE_BODY_MD_CLASS}`}>
<Md text={text} streaming={streaming} />
</div>
</DisclosureRow>
diff --git a/packages/web/src/features/chat/disclosure-row.tsx b/packages/web/src/features/chat/disclosure-row.tsx
index bbff2b1c..0c43100a 100644
--- a/packages/web/src/features/chat/disclosure-row.tsx
+++ b/packages/web/src/features/chat/disclosure-row.tsx
@@ -51,6 +51,29 @@ export const DISCLOSURE_HEADER_TITLE_CLASS =
export const DISCLOSURE_OUTPUT_PRE_CLASS =
"max-h-72 overflow-auto whitespace-pre-wrap border-t border-gray-100 px-3 py-2 text-xs leading-5 text-gray-600 dark:border-gray-800 dark:text-gray-300";
+/**
+ * Expanded Markdown body — the thinking and compaction sections. The block
+ * DISCLOSURE_OUTPUT_PRE_CLASS wears, minus the parts that only fit command output:
+ * full-bleed under its row, separated by the same divider and inset by the same padding,
+ * so the body reads as another kind of output rather than as a quotation inset inside the
+ * card.
+ *
+ * It keeps prose type rather than the output block's, because the two are not the same
+ * size on screen: the output block is monospace, and the app's sans at that size reads
+ * visibly smaller beside it. `leading-relaxed` is within a hair of the 1.7 `.md-body p`
+ * applies, so paragraphs, list items and headings all land on one rhythm instead of two.
+ * `md-body-flush` drops the outermost block's margin at each end, so the body's own `py-2`
+ * is the whole gap — the same one the output block leaves. It is a rule in styles.css and
+ * not a `[&>*:first-child]:mt-0` utility here: the `.md-body` margins it has to beat are
+ * unlayered, and an unlayered declaration wins over `@layer utilities` at any specificity.
+ *
+ * Markdown keeps rendering (these bodies are prose, not command output), hence no
+ * `whitespace-pre-wrap`, and there is no height cap either: both bodies stream, and a
+ * nested scrollbox would strand the live tail the transcript's own follow scrolls to.
+ */
+export const DISCLOSURE_BODY_MD_CLASS =
+ "md-body md-body-flush border-t border-gray-100 px-3 py-2 text-sm leading-relaxed text-gray-600 dark:border-gray-800 dark:text-gray-300";
+
/**
* The card container a row (or group of rows) sits in — the work group's exact chrome.
* A standalone disclosure row wraps itself in one so its width and framing match the
diff --git a/packages/web/src/features/chat/thinking-block.tsx b/packages/web/src/features/chat/thinking-block.tsx
index 6606e199..91f06bb2 100644
--- a/packages/web/src/features/chat/thinking-block.tsx
+++ b/packages/web/src/features/chat/thinking-block.tsx
@@ -10,7 +10,7 @@ import { humanizeDuration } from "../../lib/format";
import type { ThinkingItem } from "../../lib/omni/stream-model";
import { StatusIcon } from "../../components/ui/status-icon";
import type { RunState } from "../../components/ui/status-icon";
-import { DisclosureRow } from "./disclosure-row";
+import { DISCLOSURE_BODY_MD_CLASS, DisclosureRow } from "./disclosure-row";
import { LiveDuration } from "./live-duration";
import { Md } from "./md";
@@ -41,7 +41,7 @@ export function ThinkingBlock({ item }: { item: ThinkingItem }) {
</>
}
>
- <div className="md-body anim-fade mx-3 mb-2 rounded-md bg-gray-50 px-3 py-2 text-sm leading-relaxed text-gray-600 dark:bg-gray-900/60 dark:text-gray-400">
+ <div className={`anim-fade ${DISCLOSURE_BODY_MD_CLASS}`}>
<Md text={item.thinking} streaming={item.streaming} />
</div>
</DisclosureRow>
diff --git a/packages/web/src/styles.css b/packages/web/src/styles.css
index 4c219aa0..e2536a3a 100644
--- a/packages/web/src/styles.css
+++ b/packages/web/src/styles.css
@@ -543,6 +543,19 @@
font-weight: 600;
margin: 0.75rem 0 0.5rem;
}
+/* A body that provides its own inset — the disclosure rows' expanded thinking and compaction
+ text (features/chat/disclosure-row.tsx) — drops the outermost block's margin, so the gap at
+ each end is that padding alone rather than the padding plus whatever margin the first and
+ last blocks carry. It has to be a rule here rather than a `[&>*:first-child]:mt-0` utility at
+ the call site: every rule in this file is unlayered, and an unlayered declaration beats
+ anything in `@layer utilities` whatever its specificity, so the utility would be inert
+ against the margins set above. */
+.md-body-flush > :first-child {
+ margin-top: 0;
+}
+.md-body-flush > :last-child {
+ margin-bottom: 0;
+}
.md-body h1 {
font-size: 1.25rem;
}
diff --git a/packages/web/test/disclosure-body.test.ts b/packages/web/test/disclosure-body.test.ts
new file mode 100644
index 00000000..eb0a0186
--- /dev/null
+++ b/packages/web/test/disclosure-body.test.ts
@@ -0,0 +1,112 @@
+/**
+ * The expanded Markdown body the thinking block and the compaction sections share
+ * (features/chat/disclosure-row.tsx). vitest is node-only here (`environment: "node"`, no
+ * jsdom), so this pins the contract against the source text and styles.css — the
+ * title-reveal.test.ts convention.
+ *
+ * The fragile part is not the class list, it is **where the end-margin reset lives**. The
+ * `.md-body` rules in styles.css sit outside any cascade layer while Tailwind's utilities are
+ * emitted inside `@layer utilities`, and an unlayered declaration beats a layered one at any
+ * specificity — so a `[&>*:first-child]:mt-0` utility on the body is silently inert against
+ * `.md-body`'s own `margin: 0.5rem 0`, and the body carries double the inset it claims.
+ * Nothing about the class list looks wrong when that happens, which is why it is asserted here.
+ *
+ * The rest keeps the body in step with the output block it is derived from: the same divider
+ * and the same inset, minus the parts that only fit command output, and none of the tinted
+ * rounded box the transcript uses for a quotation.
+ */
+import { describe, expect, it } from "vitest";
+import { readFileSync } from "node:fs";
+import { fileURLToPath } from "node:url";
+import {
+ DISCLOSURE_BODY_MD_CLASS,
+ DISCLOSURE_OUTPUT_PRE_CLASS,
+} from "../src/features/chat/disclosure-row";
+
+const read = (rel: string) =>
+ readFileSync(fileURLToPath(new URL(`../src/${rel}`, import.meta.url)), "utf8");
+
+const styles = read("styles.css");
+const thinking = read("features/chat/thinking-block.tsx");
+const compaction = read("features/chat/compaction-banner.tsx");
+
+/**
+ * styles.css with every `@layer …{ }` block removed, i.e. only its unlayered rules.
+ * Comments go first: one of them names `@layer utilities` in prose, and the scan below
+ * would take that for the start of a block and swallow the rules after it.
+ */
+const unlayered = (() => {
+ let css = styles.replace(/\/\*[\s\S]*?\*\//g, "");
+ for (;;) {
+ const at = css.search(/@layer[^;{]*\{/);
+ if (at === -1) return css;
+ const open = css.indexOf("{", at);
+ let depth = 0;
+ let end = open;
+ for (; end < css.length; end++) {
+ if (css[end] === "{") depth++;
+ else if (css[end] === "}" && --depth === 0) break;
+ }
+ css = css.slice(0, at) + css.slice(end + 1);
+ }
+})();
+
+/** Class list as a set, so an assertion does not depend on the order Prettier settles on. */
+const classes = (value: string) => new Set(value.split(" "));
+
+describe("the disclosure body's end margins", () => {
+ it("are reset by an unlayered rule in styles.css", () => {
+ expect(classes(DISCLOSURE_BODY_MD_CLASS)).toContain("md-body-flush");
+ // Written without whitespace so reformatting the stylesheet cannot break the match.
+ const rules = unlayered.replace(/\s+/g, "");
+ expect(rules).toContain(".md-body-flush>:first-child{margin-top:0");
+ expect(rules).toContain(".md-body-flush>:last-child{margin-bottom:0");
+ });
+
+ it("are never reset by a utility, which would lose to .md-body's own margins", () => {
+ expect(DISCLOSURE_BODY_MD_CLASS).not.toMatch(/\[&>\*:(first|last)-child\]/);
+ });
+});
+
+describe("the disclosure body's relation to the output block", () => {
+ it("wears the same divider, inset and ink", () => {
+ const body = classes(DISCLOSURE_BODY_MD_CLASS);
+ const output = classes(DISCLOSURE_OUTPUT_PRE_CLASS);
+ for (const shared of [
+ "border-t",
+ "border-gray-100",
+ "dark:border-gray-800",
+ "px-3",
+ "py-2",
+ "text-gray-600",
+ "dark:text-gray-300",
+ ]) {
+ expect(output).toContain(shared);
+ expect(body).toContain(shared);
+ }
+ });
+
+ it("takes neither the height cap nor the raw-text wrapping, which only fit command output", () => {
+ // Both bodies stream; a nested scrollbox would strand the tail the transcript follows.
+ for (const only of ["max-h-72", "overflow-auto", "whitespace-pre-wrap"]) {
+ expect(classes(DISCLOSURE_OUTPUT_PRE_CLASS)).toContain(only);
+ expect(classes(DISCLOSURE_BODY_MD_CLASS)).not.toContain(only);
+ }
+ });
+
+ it("carries no tinted rounded box, the shape the transcript uses for a quotation", () => {
+ for (const cls of classes(DISCLOSURE_BODY_MD_CLASS)) {
+ expect(cls).not.toMatch(/^(dark:)?(bg|rounded)-/);
+ expect(cls).not.toBe("rounded");
+ }
+ });
+});
+
+describe("both expanded bodies", () => {
+ it("come from the one shared class, spelled in neither call site", () => {
+ for (const source of [thinking, compaction]) {
+ expect(source).toContain("DISCLOSURE_BODY_MD_CLASS");
+ expect(source).not.toMatch(/className="[^"]*\bmd-body\b/);
+ }
+ });
+});