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
fix: redact the error line and stop calling a blocked duplicate task "queued" (#5981)
[._.]/ Adam Eivycc67b0a8ae5a
diff --git a/client/src/components/install/QueueInstallInvestigationButton.jsx b/client/src/components/install/QueueInstallInvestigationButton.jsxindex 082e81237a..013760bb8d 100644--- a/client/src/components/install/QueueInstallInvestigationButton.jsx+++ b/client/src/components/install/QueueInstallInvestigationButton.jsx@@ -35,7 +35,11 @@ export default function QueueInstallInvestigationButton({surface,className = '',}) {- const [queued, setQueued] = useState(false);+ // null = not queued yet · 'queued' = this click created the task ·+ // 'duplicate' = the store already held one. They read differently to the user:+ // the store's 409 also fires for a task it has BLOCKED, which will not run+ // without intervention, so this must not claim an agent is on it.+ const [queueResult, setQueueResult] = useState(null);// `useAsyncAction` owns the failure toast, so the request itself is silent —// otherwise the user gets two toasts for one failed queue.const [queueTask, queueing] = useAsyncAction(async () => {@@ -43,14 +47,16 @@ export default function QueueInstallInvestigationButton({// The description is deterministic per installer + stage, so retrying the// same failing install and clicking again hits the store's duplicate guard// (409 DUPLICATE_TASK). That is the queued state, not a failure.- const alreadyQueued = await addCosTask({ ...task, ...INSTALL_INVESTIGATION_DELIVERY }, { silent: true })- .then(() => false)+ const duplicateMessage = await addCosTask({ ...task, ...INSTALL_INVESTIGATION_DELIVERY }, { silent: true })+ .then(() => null).catch((err) => {- if (err?.code === 'DUPLICATE_TASK') return true;+ // The server names the existing task's status ("already pending" /+ // "already blocked"); pass it through rather than guessing.+ if (err?.code === 'DUPLICATE_TASK') return err.message || 'A task for this failure already exists';throw err;});- setQueued(true);- if (alreadyQueued) toast('An agent task for this failure is already queued', { icon: '🤖' });+ setQueueResult(duplicateMessage ? 'duplicate' : 'queued');+ if (duplicateMessage) toast(duplicateMessage, { icon: '🤖' });else toast.success('Queued an agent to investigate this failure');}, { errorMessage: 'Failed to queue the investigation task' });@@ -58,14 +64,18 @@ export default function QueueInstallInvestigationButton({<buttontype="button"onClick={queueTask}- disabled={queueing || queued}- title={queued- ? 'An agent task for this failure is already queued'+ disabled={queueing || queueResult !== null}+ title={queueResult+ ? 'A CoS task for this failure already exists — see Agent Ops': 'Queue a PortOS agent task to investigate this install failure'}className={`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium transition-colors bg-port-accent text-white hover:bg-port-accent/80 disabled:opacity-50 disabled:hover:bg-port-accent ${className}`}>- {queued ? <Check size={14} /> : <Bot size={14} />}- {queued ? 'Agent queued' : queueing ? 'Queueing…' : 'Queue agent to investigate'}+ {queueResult ? <Check size={14} /> : <Bot size={14} />}+ {queueResult === 'queued'+ ? 'Agent queued'+ : queueResult === 'duplicate'+ ? 'Task already exists'+ : queueing ? 'Queueing…' : 'Queue agent to investigate'}</button>);}diff --git a/client/src/components/install/RuntimeInstallModal.test.jsx b/client/src/components/install/RuntimeInstallModal.test.jsxindex 2a3761667e..bafab6bd5c 100644--- a/client/src/components/install/RuntimeInstallModal.test.jsx+++ b/client/src/components/install/RuntimeInstallModal.test.jsx@@ -89,8 +89,10 @@ describe('RuntimeInstallModal failure footer', () => {expect(toast.success).not.toHaveBeenCalled();});- it('reads a duplicate-task 409 as already queued, not as a failure', async () => {- const duplicate = Object.assign(new Error('A task with this description is already pending'), {+ it('reads a duplicate-task 409 as an existing task, not as a failure or a fresh queue', async () => {+ // The store returns 409 for an existing PENDING **or BLOCKED** task, so the+ // button must not claim an agent is on it — it surfaces the server's wording.+ const duplicate = Object.assign(new Error('A task with this description is already blocked'), {code: 'DUPLICATE_TASK',status: 409,});@@ -99,8 +101,10 @@ describe('RuntimeInstallModal failure footer', () => {fireEvent.click(screen.getByRole('button', { name: /queue agent to investigate/i }));- const queued = await screen.findByRole('button', { name: /agent queued/i });- expect(queued.disabled).toBe(true);+ const existing = await screen.findByRole('button', { name: /task already exists/i });+ expect(existing.disabled).toBe(true);+ expect(screen.queryByRole('button', { name: /agent queued/i })).toBeNull();+ expect(toast).toHaveBeenCalledWith('A task with this description is already blocked', { icon: '🤖' });expect(toast.error).not.toHaveBeenCalled();});diff --git a/client/src/lib/installFailureTask.js b/client/src/lib/installFailureTask.jsindex 2995c99681..e4b387bcd5 100644--- a/client/src/lib/installFailureTask.js+++ b/client/src/lib/installFailureTask.js@@ -40,6 +40,9 @@ const stripLeadingLoneSurrogate = (text) => {return first >= 0xdc00 && first <= 0xdfff ? text.slice(1) : text;};+// Also applied to the error string: `useInstallStream` copies the same text into+// `logs`, so redacting only inside the fence would reprint the raw home path one+// line above it.const redactLogLine = (line) => {const withoutHome = HOME_PATH_PATTERNS.reduce((text, [pattern, replacement]) => text.replace(pattern, replacement),@@ -92,7 +95,7 @@ const cleanLabel = (value) => (typeof value === 'string' ? value.trim() : '');export function buildInstallFailureTask({ label, stage, error, logs, surface } = {}) {const name = cleanLabel(label) || 'PortOS';const failedStage = cleanLabel(stage);- const message = cleanLabel(error) || 'Installer failed with no error message.';+ const message = redactLogLine(cleanLabel(error)) || 'Installer failed with no error message.';const description = failedStage? `Fix ${name} installer failure at the ${failedStage} stage`: `Fix ${name} installer failure`;diff --git a/client/src/lib/installFailureTask.test.js b/client/src/lib/installFailureTask.test.jsindex 9709afed64..753f78da3b 100644--- a/client/src/lib/installFailureTask.test.js+++ b/client/src/lib/installFailureTask.test.js@@ -53,11 +53,15 @@ describe('installLogTail', () => {});it('never emits a lone surrogate when one huge line is cut mid-pair', () => {- // Every code point here is a surrogate pair, so a raw slice always lands inside one.- const logs = [{ text: '\u{1F40D}'.repeat(INSTALL_FAILURE_LOG_TAIL_CHARS) }];+ // Pairs plus ONE trailing BMP char, so the fixed-width cut from the end lands+ // at an ODD offset inside the pair region — an actual mid-pair slice. (An+ // even-length all-pairs line always cuts cleanly and proves nothing.)+ const logs = [{ text: `${'\u{1F40D}'.repeat(INSTALL_FAILURE_LOG_TAIL_CHARS)}x` }];const tail = installLogTail(logs);expect(tail).not.toMatch(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])/);expect(tail).not.toMatch(/(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/);+ // Sanity: the tail really is the end of that line, so the guard had to fire.+ expect(tail.endsWith('x')).toBe(true);});it('redacts home-directory paths and neutralizes fences in the log tail', () => {@@ -103,6 +107,17 @@ describe('buildInstallFailureTask', () => {expect(prompt).toMatch(/untrusted third-party process output/i);});+ it('redacts the error line too — useInstallStream copies it into the logs as well', () => {+ const raw = 'ERROR: no write access to /Users/someone/.cache/pip';+ const { prompt } = buildInstallFailureTask({+ label: 'FLUX.2 Runtime',+ error: raw,+ logs: [{ kind: 'error', text: raw }],+ });+ expect(prompt).not.toContain('someone');+ expect(prompt).toContain('Error: ERROR: no write access to /Users/<user>/.cache/pip');+ });+it('still produces a usable task when the stream failed with no message or logs', () => {const { description, prompt } = buildInstallFailureTask({});expect(description).toBe('Fix PortOS installer failure');