Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(desktop): keep the AskTool question body in one text column

vastsaff3065440cc2
diff --git a/apps/desktop/src/components/AskToolCard.tsx b/apps/desktop/src/components/AskToolCard.tsx
index c8636bcd6..2fa4eaeb7 100644
--- a/apps/desktop/src/components/AskToolCard.tsx
+++ b/apps/desktop/src/components/AskToolCard.tsx
@@ -173,7 +173,9 @@ export function AskToolCard({ request, queued = 0 }: { request: PendingAsk; queu
<span className="asktool-question-number">
{t("askTool.questionNumber", { number: index + 1 })}
</span>
- <AskToolRichText source={current.question} />
+ <span className="asktool-question-body">
+ <AskToolRichText source={current.question} />
+ </span>
</h3>
<div className="asktool-options" role={current.multiSelect ? "group" : "radiogroup"}>
{current.options.map((option, optionIndex) => {
diff --git a/apps/desktop/src/styles/messages.css b/apps/desktop/src/styles/messages.css
index ba18005e8..2847fddbd 100644
--- a/apps/desktop/src/styles/messages.css
+++ b/apps/desktop/src/styles/messages.css
@@ -157,7 +157,6 @@
}
.asktool-question-number {
- flex: none;
color: var(--ds-text-muted);
font-size: var(--text-xs);
font-weight: var(--font-weight-medium);
@@ -206,9 +205,10 @@
}
.asktool-question {
- display: flex;
+ display: grid;
+ grid-template-columns: max-content minmax(0, 1fr);
align-items: baseline;
- gap: 8px;
+ column-gap: 8px;
margin: 8px 0 0;
color: var(--ds-text-primary);
font-size: var(--text-sm);
@@ -216,6 +216,11 @@
line-height: var(--leading-snug);
}
+.asktool-question-body {
+ display: block;
+ min-width: 0;
+}
+
.asktool-options {
display: grid;
gap: 6px;
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 2c0e5d939..ff6dc5209 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -345,12 +345,15 @@
- **Steps:** Mount the production `AskToolCard`, assert the header Tab order
(decline, skip, next) with no legacy bottom action row, then walk select →
next → submit, skip → submit, decline-all, and a custom answer, remounting
- with a fresh request id between flows.
+ with a fresh request id between flows. Finally mount a question whose body
+ holds two markdown blocks and measure their boxes.
- **Expected:** Every flow resolves through the store's `resolveAsk` with the
exact answers (skips recorded as `null`), and no render errors are reported.
+ The two question blocks stack vertically on a shared left edge that spans
+ the card's text column, so a sentence never wraps inside a flex column.
- **Status:** Automated in `pnpm test:e2e:asktool-card`, which mounts the
- production `AskToolCard` in a real Chromium page and clicks through the
- header actions.
+ production `AskToolCard` in a real Chromium page, clicks through the header
+ actions, and measures the multi-block question layout.
### E2E-POWER-keep-awake-setting
diff --git a/scripts/e2e/asktool-card.tsx b/scripts/e2e/asktool-card.tsx
index 03f5ef507..175c225b9 100644
--- a/scripts/e2e/asktool-card.tsx
+++ b/scripts/e2e/asktool-card.tsx
@@ -8,7 +8,9 @@
* the user-visible paths: the new header action order, select → next →
* submit, skip → submit, decline-all, and a custom answer.
*
- * Scenario: E2E-ASKTOOL-compact-card-interaction.
+ * Scenario: E2E-ASKTOOL-compact-card-interaction. It also pins the compact
+ * question block: a multi-paragraph question body stays one stacked text
+ * column rather than lining its blocks up in a row.
*/
import { createRoot } from "react-dom/client";
import { flushSync } from "react-dom";
@@ -67,6 +69,15 @@ const QUESTIONS: FixtureQuestion[] = [
},
];
+// A question body with several markdown blocks must render as stacked
+// paragraphs. The compact header row once made every block a flex item, so
+// the blocks lined up side by side and every sentence wrapped inside a column.
+const MULTI_BLOCK_QUESTION: FixtureQuestion = {
+ question:
+ "The old host 124.71.12.42 is unreachable and the new database is empty, so nothing has been restored yet.\n\nThe S3 bucket still holds every page file, so a rebuild can recover the HTML body plus its title.",
+ options: [{ label: "delta", description: "Fourth choice" }],
+};
+
export async function asktoolCardProbe() {
await i18n.init({ lng: "en", resources: { en: { translation: en } } });
const initial = useAppStore.getState();
@@ -110,8 +121,8 @@ export async function asktoolCardProbe() {
// question independent of the active locale.
const questionText = () =>
element(".asktool-question").textContent ?? "";
- const mount = (requestId: string) => {
- const request = askRequest(requestId, QUESTIONS);
+ const mount = (requestId: string, questions: FixtureQuestion[] = QUESTIONS) => {
+ const request = askRequest(requestId, questions);
useAppStore.setState({
pendingAsks: { [SESSION_ID]: [request] },
});
@@ -250,6 +261,46 @@ export async function asktoolCardProbe() {
`custom text survives, saw ${JSON.stringify(resolutions[3]!.answers)}`,
);
+ // Flow E: a multi-block question body keeps its blocks stacked in the
+ // card's text column instead of lining them up as flex items.
+ mount("ask-layout", [MULTI_BLOCK_QUESTION]);
+ await until(() => options().length > 0, "layout flow mounts");
+ const paragraphs = [
+ ...host.querySelectorAll<HTMLElement>(
+ ".asktool-question .asktool-rich-paragraph",
+ ),
+ ];
+ assert(
+ paragraphs.length === 2,
+ `the multi-block question renders one paragraph per block, saw ${paragraphs.length}`,
+ );
+ const cardWidth = element(".asktool-card").getBoundingClientRect().width;
+ const boxes = paragraphs.map((node) => node.getBoundingClientRect());
+ assert(
+ boxes[1]!.top >= boxes[0]!.bottom - 1,
+ `question blocks stack vertically (tops ${boxes[0]!.top}, ${boxes[1]!.top})`,
+ );
+ assert(
+ Math.abs(boxes[1]!.left - boxes[0]!.left) < 1,
+ `question blocks share a left edge (${boxes[0]!.left}, ${boxes[1]!.left})`,
+ );
+ assert(
+ boxes[0]!.width > cardWidth / 2,
+ `a question block spans the text column (${boxes[0]!.width} of ${cardWidth})`,
+ );
+ const numberBox = element(
+ ".asktool-question-number",
+ ).getBoundingClientRect();
+ assert(
+ numberBox.right <= boxes[0]!.left + 1,
+ `the question number sits left of the text column (${numberBox.right}, ${boxes[0]!.left})`,
+ );
+ assert(
+ numberBox.top >= boxes[0]!.top - 1 &&
+ numberBox.bottom <= boxes[0]!.top + 26,
+ `the question number shares the first line with the question text (${numberBox.top}, ${boxes[0]!.top})`,
+ );
+
assert(errors.length === 0, `render errors: ${errors.map(String)}`);
return { ok: true, resolutions: resolutions.length };
} catch (error) {