Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
perf([strip-stage-runhistory-from-list-payloads]): strip runHistory from list-shaped pipeline payloads
[._.]/ Adam Eivy58b63ab42575
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 07307853f9..52f07d51f0 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -9,6 +9,7 @@- **[cover-prose-input-idea-input-in-canonusage-corpus] Universe canon cross-reference test suite now pins every stage the per-issue search reads** — a regression that silently drops a stage from the search now fails the test suite immediately.- **[extract-shared-requiretoolkit-helper] Internal: consolidated three duplicated AI toolkit accessors into one shared module.** No behavior change; cuts ~30 lines and makes future toolkit-state changes one-touch.- **[codex5-bundle-lazy-routes] Dashboard widgets load on demand.** A dashboard layout now only downloads the widgets it actually uses — the first paint of a slimmed-down layout no longer drags in every widget in the registry, and slow widgets render their own placeholder while loading instead of blocking sibling cells. Also adds an `npm run build:analyze` script for inspecting bundle composition during development.+- **[strip-stage-runhistory-from-list-payloads] Pipeline list views stay lean as version history grows.** The sidebar's recent-issues list and the per-series issue list no longer ship each stage's full draft history on every read — the History button on an issue's detail page still shows the full set, but list responses can no longer balloon to many megabytes once a series has many issues with deep histories.## Fixeddiff --git a/PLAN.md b/PLAN.mdindex c25e04833d..cef178daf3 100644--- a/PLAN.md+++ b/PLAN.md@@ -16,7 +16,6 @@ _Nothing currently parked — pick the next item from the Backlog._### Pipeline — deferred-- [ ] [strip-stage-runhistory-from-list-payloads] **[LOW][PERF]** Strip `stages.*.runHistory` from list-shaped pipeline payloads. `sanitizeIssue` now returns the full per-stage history (up to 5 × ~600KB per text stage ≈ 12MB per maxed-out issue) on every read, including the sidebar (`listRecentIssues`) and per-series list (`listIssues`). Those views never render history, so the payload + sanitize cost is pure waste. Fix: add a `withHistory: false` flag (or a parallel `sanitizeIssueSummary`) that nulls out `runHistory` for list endpoints; detail reads (`GET /api/pipeline/issues/:id`) stay on the full sanitizer. Surfaced 2026-05-20 by /simplify during the runHistory diff-modal PR; deferred because the cap-at-5 keeps memory bounded for single-user and no list view paginates that many issues today.- [ ] [backport-pre-023-migrations-to-_lib] **Back-port pre-023 prompt-replace migrations onto `scripts/migrations/_lib.js`.** 003 / 004 / 005 / 006 / 010 / 013 / 019 all clone the inline `applyMigration` + per-file scan + customized-skip warning pattern that `_lib.js` now centralizes. Wrap any `OLD_SHIPPED_MD5: string` entries (003 / 004 / 006) into single-element arrays to match the `accepted[filename]: string[]` shape. Drop ~70 LOC per migration; nothing changes behaviorally so the only risk is mis-typed hashes — review each diff alongside a re-run of its test against the `_testHelpers.js` `runPromptMigrationTests`. Settled-history migrations have a higher rewrite-bar than active code, so a separate PR with focused review is appropriate. Surfaced by /simplify during `[pipeline-idea-stage-character-detail-plumbing]`.- [ ] [per-panel-scene-image-progress-in-the-pipeline-ui] **Per-panel/scene image progress in the Pipeline UI.** ComicPages and Storyboards record `jobId` but don't subscribe to the media-job SSE for live preview.diff --git a/server/services/pipeline/issues.js b/server/services/pipeline/issues.jsindex 076d1e4401..68190df9a9 100644--- a/server/services/pipeline/issues.js+++ b/server/services/pipeline/issues.js@@ -218,6 +218,22 @@ export function snapshotRunHistory(prevStage, patch, stageId) {return [snapshot, ...dedupedPrior].slice(0, STAGE_RUN_HISTORY_MAX);}+// Strip per-stage `runHistory` from a sanitized issue so list endpoints don't+// ship the full version history on every read. Text stages can hold up to+// STAGE_RUN_HISTORY_MAX (5) entries × ~600KB each, so a maxed-out issue is+// ~12MB of payload the sidebar + per-series list never render. Detail reads+// (`getIssue`, `GET /api/pipeline/issues/:id`) stay on the full shape; no+// current caller of `listIssues` / `listRecentIssues` reads `stage.runHistory`+// off a list result. Future callers that need history must use `getIssue`.+const stripRunHistoryFromIssue = (issue) => {+ if (!issue || typeof issue !== 'object' || !issue.stages) return issue;+ const strippedStages = {};+ for (const [stageId, stage] of Object.entries(issue.stages)) {+ strippedStages[stageId] = stage?.runHistory?.length ? { ...stage, runHistory: [] } : stage;+ }+ return { ...issue, stages: strippedStages };+};+// Episode-video render settings the user chose at kickoff time. Persisted// on the stage so a page reload doesn't reset them to the defaults — the// restart flow can render the same pickers populated with the user's@@ -417,9 +433,14 @@ export async function listIssues({ seriesId = null, offset = 0, limit = ISSUES_Pconst safeLimit = Math.min(Math.max(1, limit), ISSUES_PER_RESPONSE_MAX);const safeOffset = Math.max(0, offset);if (paginated) {- return { items: sorted.slice(safeOffset, safeOffset + safeLimit), total: sorted.length, offset: safeOffset, limit: safeLimit };+ return {+ items: sorted.slice(safeOffset, safeOffset + safeLimit).map(stripRunHistoryFromIssue),+ total: sorted.length,+ offset: safeOffset,+ limit: safeLimit,+ };}- return sorted.slice(0, ISSUES_PER_RESPONSE_MAX);+ return sorted.slice(0, ISSUES_PER_RESPONSE_MAX).map(stripRunHistoryFromIssue);}/**@@ -440,7 +461,8 @@ export async function listRecentIssues({ limit = 10 } = {}) {const clamped = Math.max(1, Math.min(50, fallback));return [...issues].sort((a, b) => (b.updatedAt || '').localeCompare(a.updatedAt || ''))- .slice(0, clamped);+ .slice(0, clamped)+ .map(stripRunHistoryFromIssue);}export async function getIssue(id) {diff --git a/server/services/pipeline/issues.test.js b/server/services/pipeline/issues.test.jsindex 9957ff3b86..d8ef8da7a7 100644--- a/server/services/pipeline/issues.test.js+++ b/server/services/pipeline/issues.test.js@@ -441,6 +441,50 @@ describe('pipeline issues service', () => {});});+ describe('list endpoints strip runHistory', () => {+ // List payloads (sidebar, per-series list) never render runHistory,+ // and each text stage can hold up to 5 × ~600KB entries. Strip them+ // so a maxed-out issue doesn't ship ~12MB per read. Detail reads+ // (`getIssue`) must keep the full shape so the diff modal still works.+ const seedWithHistory = async () => {+ const i = await svc.createIssue({ seriesId: 'ser-1', title: 'With history' });+ await svc.updateStage(i.id, 'idea', { status: 'ready', input: 'seed', output: 'v1', lastRunId: 'r1' });+ await svc.updateStage(i.id, 'idea', { status: 'ready', input: 'seed', output: 'v2', lastRunId: 'r2' });+ return i;+ };++ it('listIssues returns empty runHistory even when history is persisted', async () => {+ await seedWithHistory();+ const list = await svc.listIssues({ seriesId: 'ser-1' });+ expect(list).toHaveLength(1);+ expect(list[0].stages.idea.runHistory).toEqual([]);+ // Active stage fields still survive the strip.+ expect(list[0].stages.idea.output).toBe('v2');+ expect(list[0].stages.idea.lastRunId).toBe('r2');+ });++ it('listIssues paginated:true strips runHistory from items', async () => {+ await seedWithHistory();+ const result = await svc.listIssues({ seriesId: 'ser-1', offset: 0, limit: 10, paginated: true });+ expect(result.items).toHaveLength(1);+ expect(result.items[0].stages.idea.runHistory).toEqual([]);+ });++ it('listRecentIssues strips runHistory', async () => {+ await seedWithHistory();+ const recent = await svc.listRecentIssues({ limit: 10 });+ expect(recent).toHaveLength(1);+ expect(recent[0].stages.idea.runHistory).toEqual([]);+ });++ it('getIssue (detail read) keeps the full runHistory', async () => {+ const i = await seedWithHistory();+ const fresh = await svc.getIssue(i.id);+ expect(fresh.stages.idea.runHistory).toHaveLength(1);+ expect(fresh.stages.idea.runHistory[0].runId).toBe('r1');+ });+ });+it('updateIssue partial patch preserves other fields', async () => {const i = await svc.createIssue({ seriesId: 'ser-1', title: 'First' });await svc.updateStage(i.id, 'idea', { status: 'ready', output: 'Beats here' });