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
address review (codex): guard row effort against non-string persisted values
[._.]/ Adam Eivy51e95dd6eb81
diff --git a/client/src/components/media/MediaJobsQueue.jsx b/client/src/components/media/MediaJobsQueue.jsxindex 2ffae04a5d..3c6ea2297a 100644--- a/client/src/components/media/MediaJobsQueue.jsx+++ b/client/src/components/media/MediaJobsQueue.jsx@@ -21,6 +21,13 @@ const STATUS_BADGE = {const KIND_ICON = { video: Film, image: ImageIcon, training: Cpu };+// Safe-read a Codex job's stored reasoning effort. Mirrors codex.js's server-side+// guard (`typeof effort === 'string' && effort.trim()`): a non-string value from+// hand-edited media-jobs.json returns '' instead of throwing on `.trim()`, and a+// blank/absent value returns '' so callers can apply their own fallback (the row+// resolves to the shipped default level; the retry editor to its 'default' option).+const codexEffortOf = (raw) => (typeof raw === 'string' ? raw.trim() : '');+// Compact "engine / model" badge so a failed row tells the user *what* failed,// not just that it failed. Codex jobs carry `params.model`; local image/video// jobs carry `params.modelId`; training jobs carry a runtime + character.@@ -34,10 +41,11 @@ function modelLabel(params) {}if (params.mode === IMAGE_GEN_MODE.CODEX) {const m = (params.model || '').trim();- // Resolve an absent effort to the shipped default — a job that ran on the- // default stores no `effort`, but codex.js still rendered it at `low`, so- // the row must show the effective level, not a blank.- const eff = (params.effort || '').trim() || CODEX_IMAGEGEN_DEFAULT_EFFORT;+ // Resolve the effective effort. `codexEffortOf` mirrors codex.js's own guard+ // (`typeof === 'string' && trim`) so a non-string effort from hand-edited+ // media-jobs.json can't throw on `.trim()`; an absent/blank value resolves to+ // the shipped default the server actually rendered at.+ const eff = codexEffortOf(params.effort) || CODEX_IMAGEGEN_DEFAULT_EFFORT;const base = m ? `codex / ${m}` : 'codex';return `${base} · ${eff}`;}@@ -470,7 +478,7 @@ function EditRetryForm({ job, onSubmit, onCancel }) {// The job's stored effort (a CODEX_EFFORT_LEVELS value) or the "default" option// when it carried none. On submit we only send `effort` when this differs from// the original — the sentinel resets to default, a level pins that level.- const originalEffort = (p.effort || '').trim() || EFFORT_DEFAULT_OPTION;+ const originalEffort = codexEffortOf(p.effort) || EFFORT_DEFAULT_OPTION;const [effort, setEffort] = useState(originalEffort);const submit = (e) => {diff --git a/client/src/components/media/MediaJobsQueue.test.jsx b/client/src/components/media/MediaJobsQueue.test.jsxindex 5db4541890..d3e3525e3b 100644--- a/client/src/components/media/MediaJobsQueue.test.jsx+++ b/client/src/components/media/MediaJobsQueue.test.jsx@@ -99,6 +99,19 @@ describe('MediaJobsQueue — Codex reasoning-effort retry control', () => {await waitFor(() => expect(screen.getByText(/codex \/ gpt-5.6-luna · low/)).toBeInTheDocument());});+ it('does not crash on a non-string effort from hand-edited data', async () => {+ const user = userEvent.setup();+ // A hand-edited media-jobs.json could carry a numeric effort; the row label+ // must coerce safely (mirror of codex.js) instead of throwing on .trim().+ listMediaJobs.mockResolvedValue([{+ ...failedCodexDefaultEffortJob, id: 'codexbadeff00dead', params: { ...failedCodexDefaultEffortJob.params, effort: 5 },+ }]);+ render(<MediaJobsQueue kind="image" />);+ await expandReel(user);+ // Non-string → treated as absent → resolves to the shipped default.+ await waitFor(() => expect(screen.getByText(/codex \/ gpt-5.6-luna · low/)).toBeInTheDocument());+ });+it('pre-fills the retry editor to Default for a job that stored no effort', async () => {const user = userEvent.setup();listMediaJobs.mockResolvedValue([failedCodexDefaultEffortJob]);