fix(web): collapsed reasoning previews no longer process the whole block #23001
main fromfix/issue-22985merged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
juliusmarminge added labelsvia-triage
juliusmarminge added labelsvia-triage:needs-julius
juliusmarminge removed labelsvia-triage
juliusmarminge removed labelsvia-triage:needs-julius
juliusmarminge added labelsbugfix
juliusmarminge added labelspr:needs-julius
juliusmarminge removed labelspr:needs-julius
juliusmarminge added labelspr:needs-verification
juliusmarminge removed labelspr:needs-verification
juliusmarminge added labelspr:gate-failed
juliusmarminge added labelspr:in-progress
juliusmarminge removed labelspr:gate-failed
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- @@ -0,0 +81,21 @@81+const iso = (offsetSeconds) => new Date(now.getTime() - offsetSeconds * 1000).toISOString();82+const setText = (payload, text) => ("text" in payload ? { ...payload, text } : payload);83+84+db.exec("BEGIN");85+try {86+ db.prepare(87+ "DELETE FROM orchestration_v2_projection_threads WHERE thread_id LIKE '%pr23001fx%'",88+ ).run();89+ for (const { name } of tables)90+ db.prepare(`DELETE FROM "${name}" WHERE thread_id LIKE '%pr23001fx%'`).run();91+ db.prepare(92+ "UPDATE orchestration_v2_projection_threads SET archived_at = coalesce(archived_at, ?), payload_json = json_set(payload_json, '$.archivedAt', coalesce(archived_at, ?))",93+ ).run(iso(3600), iso(3600));94+95+ Object.entries(FIXTURES).forEach(([name, text], index) => {96+ const tag = `pr23001fx${name.toLowerCase().replace(/[^a-z0-9]/g, "")}`;97+ const newToken = `${tag}${"0".repeat(64 - tag.length)}`;98+ const swap = (value) =>99+ typeof value === "string"100+ ? value101+ .replaceAll(token, newToken)
- @@ -0,0 +1,19 @@1+#!/usr/bin/env node2+// Evidence fixtures for the collapsed reasoning preview (#22985): one synthetic3+// thread per reasoning shape, cloned from a completed thread in an isolated dev4+// database. Run it with that worktree's dev server stopped:5+//6+// vp run migrate-dev-db7+// node apps/web/scripts/seed-reasoning-preview-fixtures.mjs .t3/userdata/statev2.sqlite8+//9+// These are projection-only visual fixtures (orchestration_events is untouched).10+// Every other thread is archived so screenshots only show fixture content.11+import * as NodeSqlite from "node:sqlite";12+import * as NodeOS from "node:os";13+import * as NodePath from "node:path";14+15+const dbPath = NodePath.resolve(process.argv[2] ?? "");16+if (NodePath.basename(dbPath) !== "statev2.sqlite")17+ throw new Error("pass <base>/userdata/statev2.sqlite");18+if (dbPath.startsWith(NodePath.join(NodeOS.homedir(), ".t3") + NodePath.sep)) {19+ throw new Error("refusing to write the live ~/.t3 database");@@ -0,0 +154,21 @@154+ "UPDATE orchestration_v2_projection_messages SET payload_json = ? WHERE message_id = ?",155+ ).run(156+ JSON.stringify(setText(JSON.parse(message.payload_json), userText)),157+ message.message_id,158+ );159+ } else if (finalMessageId && message.message_id !== finalMessageId) {160+ db.prepare("DELETE FROM orchestration_v2_projection_messages WHERE message_id = ?").run(161+ message.message_id,162+ );163+ } else {164+ db.prepare(165+ "UPDATE orchestration_v2_projection_messages SET payload_json = ? WHERE message_id = ?",166+ ).run(167+ JSON.stringify(setText(JSON.parse(message.payload_json), assistantText)),168+ message.message_id,169+ );170+ }171+ }172+173+ const id = `turn-item:fixture:pr23001:${name}`;174+ const ordinal = assistant.ordinal - 1;
- @@ -0,0 +155,21 @@155+ "UPDATE orchestration_v2_projection_messages SET payload_json = ? WHERE message_id = ?",156+ ).run(157+ JSON.stringify(setText(JSON.parse(message.payload_json), userText)),158+ message.message_id,159+ );160+ } else if (finalMessageId && message.message_id !== finalMessageId) {161+ db.prepare("DELETE FROM orchestration_v2_projection_messages WHERE message_id = ?").run(162+ message.message_id,163+ );164+ } else {165+ db.prepare(166+ "UPDATE orchestration_v2_projection_messages SET payload_json = ? WHERE message_id = ?",167+ ).run(168+ JSON.stringify(setText(JSON.parse(message.payload_json), assistantText)),169+ message.message_id,170+ );171+ }172+ }173+174+ const id = `turn-item:fixture:pr23001:${name}`;175+ const ordinal = assistant.ordinal - 1;
juliusmarminge removed labelspr:in-progress
juliusmarminge added labelspr:needs-julius
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
tanstack-source added labelsbug
juliusmarminge linked this to fix #22985
juliusmarminge merged thise0379fb
juliusmarminge closed this
Sign in to join this conversation.


macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed