Skip to content

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

fix: share reader-panel and rejection-reason labels between server and client (#9112)

[._.]/ Adam Eivy2648104c7db0
diff --git a/client/src/components/pipeline/ReaderPanelView.jsx b/client/src/components/pipeline/ReaderPanelView.jsx
index 428e32bea2..980c733312 100644
--- a/client/src/components/pipeline/ReaderPanelView.jsx
+++ b/client/src/components/pipeline/ReaderPanelView.jsx
@@ -10,31 +10,10 @@
import { Link } from 'react-router';
import { Loader2, Sparkles, Users, AlertTriangle, Scale, Split, ArrowRight } from 'lucide-react';
+import { PANEL_PERSONA_IDS, PANEL_QUESTIONS, personaLabel } from '../../../../server/lib/editorial/panelDisagreement.js';
import { useReaderPanel } from '../../hooks/useReaderPanel';
-// Mirror server/lib/editorial/panelDisagreement.js persona + question labels
-// (keep in sync — the two are small, stable vocabularies).
-const PERSONA_LABELS = {
- editor: 'The Editor',
- 'genre-reader': 'The Genre Reader',
- writer: 'The Writer',
- 'first-reader': 'The First Reader',
-};
-const PERSONA_ORDER = ['editor', 'genre-reader', 'writer', 'first-reader'];
-const QUESTION_LABELS = [
- ['momentum_loss', 'Momentum lost'],
- ['earned_ending', 'Earned ending'],
- ['cut_candidate', 'Cut candidate'],
- ['missing_scene', 'Missing scene'],
- ['thinnest_character', 'Thinnest character'],
- ['best_scene', 'Best scene'],
- ['worst_scene', 'Worst scene'],
- ['would_recommend', 'Would recommend'],
- ['haunts_you', 'Haunts you'],
- ['next_book', 'Next book'],
-];
-
-const personaLabel = (id) => PERSONA_LABELS[id] || id;
+const PERSONA_ORDER = PANEL_PERSONA_IDS;
const IssueTags = ({ issues }) => (
issues?.length ? (
<span className="ml-1 inline-flex flex-wrap gap-1 align-middle">
@@ -57,7 +36,7 @@ function PersonaColumn({ response }) {
{response.verdict ? <p className="mt-1 text-[11px] text-gray-400 italic">“{response.verdict}”</p> : null}
</div>
<dl className="p-2.5 space-y-2 overflow-y-auto">
- {QUESTION_LABELS.map(([qid, label]) => {
+ {PANEL_QUESTIONS.map(({ id: qid, label }) => {
const a = answers[qid];
if (!a || !a.text) return null;
return (
diff --git a/client/src/components/pipeline/ReaderPanelView.test.jsx b/client/src/components/pipeline/ReaderPanelView.test.jsx
new file mode 100644
index 0000000000..240f99d324
--- /dev/null
+++ b/client/src/components/pipeline/ReaderPanelView.test.jsx
@@ -0,0 +1,30 @@
+import { describe, it, expect, vi } from 'vitest';
+import { render, screen } from '@testing-library/react';
+import { MemoryRouter } from 'react-router';
+import { PANEL_PERSONAS, PANEL_QUESTIONS } from '../../../../server/lib/editorial/panelDisagreement.js';
+
+vi.mock('../../hooks/useReaderPanel', () => ({ useReaderPanel: vi.fn() }));
+
+import { useReaderPanel } from '../../hooks/useReaderPanel';
+import ReaderPanelView from './ReaderPanelView';
+
+describe('ReaderPanelView', () => {
+ it('renders one answer per server panel question and every persona name', () => {
+ const answers = Object.fromEntries(PANEL_QUESTIONS.map((q) => [q.id, { text: `answer-${q.id}`, issues: [1] }]));
+ useReaderPanel.mockReturnValue({
+ panel: {
+ status: 'complete',
+ personas: PANEL_PERSONAS.map((p) => ({ persona: p.id, verdict: 'v', answers })),
+ disagreements: {},
+ },
+ loading: false, running: false, starting: false,
+ convene: vi.fn(), cancel: vi.fn(), progressText: '',
+ });
+ render(<MemoryRouter><ReaderPanelView seriesId="s1" hasContent /></MemoryRouter>);
+ for (const q of PANEL_QUESTIONS) {
+ expect(screen.getAllByText(`answer-${q.id}`)).toHaveLength(PANEL_PERSONAS.length);
+ expect(screen.getAllByText(q.label, { exact: false }).length).toBeGreaterThan(0);
+ }
+ for (const p of PANEL_PERSONAS) expect(screen.getAllByText(p.label).length).toBeGreaterThan(0);
+ });
+});
diff --git a/client/src/utils/layeredIntelligenceReasons.js b/client/src/utils/layeredIntelligenceReasons.js
index df2ab2691d..b85a785a41 100644
--- a/client/src/utils/layeredIntelligenceReasons.js
+++ b/client/src/utils/layeredIntelligenceReasons.js
@@ -1,3 +1,5 @@
+import { REJECTION_REASON_LABELS } from '../../../server/lib/layeredIntelligenceRejectionLabels.js';
+
// Canonical gloss for the Layered Intelligence loop's run-outcome reason tokens.
//
// The reason vocabulary is authored server-side (server/services/autonomousJobs/
@@ -63,26 +65,13 @@ export function liReasonTone(reason = null) {
// The proposal-REJECTION taxonomy (#2689) — WHY a filed proposal ended up not
// merged. Distinct vocabulary from the run-reason tokens above: those explain why a
// LOOP RUN produced no proposal, these explain why a FILED proposal was rejected.
-// Mirrors the server gloss (REJECTION_REASON_LABELS in
-// server/services/layeredIntelligenceRejections.js) so the outcomes dashboard reads
-// the same as the reasoner prompt. Keep in lockstep; an unknown token degrades to
-// itself. `unknown-reason` is the honest "we classified it and found no signal"
-// sentinel — a real answer, not a gap.
-const LI_REJECTION_REASON_LABELS = {
- 'duplicate': 'already tracked elsewhere (duplicate)',
- 'user-rejected': 'the user declined it (closed as not planned)',
- 'scope-mismatch': "outside the app's scope",
- 'missing-context': 'missing context the proposal should have supplied',
- 'quality-issue': 'the proposal itself was low quality or malformed',
- 'environment-blocker': 'blocked on the environment or a dependency',
- 'merge-conflict': 'the implementing change could not be merged',
- 'validation-failed': 'the implementing change failed lint/validation',
- 'unknown-reason': 'closed with no recorded reason'
-};
+// Shares the server gloss table (server/lib/layeredIntelligenceRejectionLabels.js)
+// so the outcomes dashboard reads the same as the reasoner prompt; an unknown
+// token degrades to itself.
// Gloss one rejection-reason token as prose. A nullish input renders as '' (not
// classified — nothing to say); an unglossed token passes through.
export function formatLiRejectionReason(reason = null) {
if (!reason) return '';
- return LI_REJECTION_REASON_LABELS[reason] || reason;
+ return REJECTION_REASON_LABELS[reason] || reason;
}
diff --git a/server/lib/README.md b/server/lib/README.md
index 8bce6cfdae..d7a39ca817 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -168,6 +168,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
| `seasonStructure.js` | Season/episode structure recommendation. |
| `seriesAutopilotDefaults.js` | `SERIES_AUTOPILOT_DEFAULTS`, the immutable `pipelineEditorialChecks` defaults shared by Series Autopilot's runtime resolvers, foundation judge, and options panel. |
| `seriesCharacterArc.js` | Per-character story-arc shapes (`series.characterArcs[]`): want/need, start → end state, transition beats. `CHARACTER_ARC_LIMITS` / `TRANSITION_KINDS` + `TRANSITION_KIND_LABELS` / `CHARACTER_ARC_STATUSES` (a pure leaf — the arc editor in `PipelineSeries.jsx` imports the caps, kinds and labels, so no Node built-in here; ids come from `uuid.js`). Sanitizers + `renderCharacterArcsForPrompt` for the `arc.transitions` editorial check, `characterArcEvidenceRefs` (the transition-id set a lens anchor resolves against), and `renderCharacterEvolutionsForPrompt` — the cast-level render of `characterEvolution.js`'s five-stage lens the character-arc checks and the arc planner share. |
+| `layeredIntelligenceRejectionLabels.js` | `REJECTION_REASON_LABELS` — the one token→prose gloss table for the Layered Intelligence proposal-rejection taxonomy, shared by `services/layeredIntelligenceRejections.js` (prompt blocks) and the client outcomes dashboard (`utils/layeredIntelligenceReasons.js`). Pure leaf. |
| `llmRoutePin.js` | The per-record LLM route pin `{ providerId, model, effort }` — `LLM_ROUTE_PIN_LIMITS` + `llmRoutePinSchema` (door check, `effort` as the shared `EFFORT_LEVELS` enum), `sanitizeLlmRoutePin(raw)` (trim/cap, `null` for an all-empty pin), and `resolveLlmRoutePin(pin, perCall)` → `{ providerId, model, effort, providerMatchesPin }`. Owns the never-cross-providers rule once, in its two shapes: `resolveLlmRoutePin` merges a record pin with an independent per-call pick per FIELD (guarded by a provider-id comparison), while `pickLlmRoutePinLayer(...layers)` + `llmRoutePinNamesProvider(layer)` take the most specific layer WHOLE for pins whose provider and model were chosen together in one control (falling through to the base layer). Consumed by `seriesLlmOverride.js`, FableLoom's play pin, and the Creative Director stage pins. |
| `seriesLlmOverride.js` | Pure `resolveSeriesLlmOverride(series, { overrideProvider, overrideModel })` → `{ provider, model, providerMatchesSeries }` — shared fallback so Pipeline LLM actions honor the series' configured provider/model, only inheriting the series model when the effective provider still matches. |
| `catalogBulkParsers.js` | Dependency-free markdown/CSV/JSON parsers for `POST /api/catalog/bulk-import` and YAML/markdown serializers for `GET /api/catalog/export`. |
diff --git a/server/lib/index.js b/server/lib/index.js
index 1d6cfe1c52..7312c0b9cf 100644
--- a/server/lib/index.js
+++ b/server/lib/index.js
@@ -770,3 +770,4 @@ export * as artistLimits from './artistLimits.js';
export * as authorLimits from './authorLimits.js';
export * as trackLimits from './trackLimits.js';
export * from './shellLimits.js';
+export * from './layeredIntelligenceRejectionLabels.js';
diff --git a/server/lib/layeredIntelligenceRejectionLabels.js b/server/lib/layeredIntelligenceRejectionLabels.js
new file mode 100644
index 0000000000..b4a43ed74a
--- /dev/null
+++ b/server/lib/layeredIntelligenceRejectionLabels.js
@@ -0,0 +1,15 @@
+// Human-readable gloss for the Layered Intelligence proposal-rejection taxonomy
+// (#2689). A pure leaf so the server (prompt blocks) and the client (outcomes
+// dashboard) read ONE table. Keys are the REJECTION_REASONS tokens plus the
+// `unknown-reason` sentinel from services/layeredIntelligenceRejections.js.
+export const REJECTION_REASON_LABELS = Object.freeze({
+ 'duplicate': 'already tracked elsewhere (duplicate)',
+ 'user-rejected': 'the user declined it (closed as not planned)',
+ 'scope-mismatch': "outside the app's scope",
+ 'missing-context': 'missing context the proposal should have supplied',
+ 'quality-issue': 'the proposal itself was low quality or malformed',
+ 'environment-blocker': 'blocked on the environment or a dependency',
+ 'merge-conflict': 'the implementing change could not be merged',
+ 'validation-failed': 'the implementing change failed lint/validation',
+ 'unknown-reason': 'closed with no recorded reason'
+});
diff --git a/server/lib/layeredIntelligenceRejectionLabels.test.js b/server/lib/layeredIntelligenceRejectionLabels.test.js
new file mode 100644
index 0000000000..ad18b953b4
--- /dev/null
+++ b/server/lib/layeredIntelligenceRejectionLabels.test.js
@@ -0,0 +1,9 @@
+import { describe, it, expect } from 'vitest';
+import { REJECTION_REASON_LABELS } from './layeredIntelligenceRejectionLabels.js';
+import { REJECTION_REASON_VALUES } from '../services/layeredIntelligenceRejections.js';
+
+describe('REJECTION_REASON_LABELS', () => {
+ it('glosses every rejection reason the store may hold, and nothing else', () => {
+ expect(Object.keys(REJECTION_REASON_LABELS).sort()).toEqual([...REJECTION_REASON_VALUES].sort());
+ });
+});
diff --git a/server/services/layeredIntelligenceRejections.js b/server/services/layeredIntelligenceRejections.js
index ecc0bdea4a..abbe8430be 100644
--- a/server/services/layeredIntelligenceRejections.js
+++ b/server/services/layeredIntelligenceRejections.js
@@ -48,6 +48,7 @@
* maps, and classifiers.
*/
+import { REJECTION_REASON_LABELS } from '../lib/layeredIntelligenceRejectionLabels.js';
import {
normalizeToken,
formatTaxonomyToken,
@@ -100,19 +101,8 @@ export const UNKNOWN_REJECTION_REASON = 'unknown-reason';
// non-merged proposal.
export const REJECTION_REASON_VALUES = [...REJECTION_REASONS, UNKNOWN_REJECTION_REASON];
-// Human-readable gloss, used to render the prompt blocks. A token with no gloss
-// degrades to the raw token rather than being dropped.
-const REJECTION_REASON_LABELS = {
- 'duplicate': 'already tracked elsewhere (duplicate)',
- 'user-rejected': 'the user declined it (closed as not planned)',
- 'scope-mismatch': "outside the app's scope",
- 'missing-context': 'missing context the proposal should have supplied',
- 'quality-issue': 'the proposal itself was low quality or malformed',
- 'environment-blocker': 'blocked on the environment or a dependency',
- 'merge-conflict': 'the implementing change could not be merged',
- 'validation-failed': 'the implementing change failed lint/validation',
- [UNKNOWN_REJECTION_REASON]: 'closed with no recorded reason'
-};
+// Human-readable gloss (REJECTION_REASON_LABELS, shared with the client) renders
+// the prompt blocks. A token with no gloss degrades to the raw token.
/**
* Render one token as prose for the reasoner. An unglossed token passes through;