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
stop filing never-started TUI runs as lint errors
[._.]/ Adam Eivyebda9534aa28
diff --git a/.changelog/next/fixed-agent-12743ad5.md b/.changelog/next/fixed-agent-12743ad5.mdnew file mode 100644index 0000000000..341802979c--- /dev/null+++ b/.changelog/next/fixed-agent-12743ad5.md@@ -0,0 +1 @@+- CoS TUI agents no longer die on startup when Claude Code offers to make auto mode the default permission mode, and a swallowed paste is reported as a startup failure instead of being misfiled as a lint errordiff --git a/server/services/agentErrorAnalysis.js b/server/services/agentErrorAnalysis.jsindex 419e0495c8..c14ae3d9a1 100644--- a/server/services/agentErrorAnalysis.js+++ b/server/services/agentErrorAnalysis.js@@ -569,6 +569,19 @@ export const ERROR_PATTERNS = [export const FAILURE_WINDOW_MAX_LINES = 200;export const FAILURE_WINDOW_MAX_CHARS = 16000;+// Claude Code's EMPTY-composer placeholder — `❯ Try "fix lint errors"`. It is+// the TUI advertising what you could ask for, not anything that happened, and it+// is on screen precisely when the agent did nothing. The suggestion rotates+// ("fix lint errors", "fix typecheck errors", …), so it can trip several+// ERROR_PATTERNS by pure coincidence; `lint-error` is the one that actually+// shipped a bogus diagnosis (agent-f71b794e). Dropped from the analysis window+// so no pattern — present or future — can classify a run off a hint the user+// never followed.+//+// Anchored on the `❯ Try "` chrome rather than the suggestion text: real agent+// prose can say "fix lint errors", and only the composer prefixes it this way.+const TUI_PLACEHOLDER_HINT_PATTERN = /^\s*[❯>]\s*Try\s+["'].*$/gm;+/*** Reduce raw agent output to the tail worth classifying.*@@ -586,6 +599,7 @@ export const FAILURE_WINDOW_MAX_CHARS = 16000;function getFailureAnalysisWindow(output) {const windowed = stripAnsi(output).replace(/\r\n?/g, '\n')+ .replace(TUI_PLACEHOLDER_HINT_PATTERN, '').split('\n').filter(l => l.trim()).slice(-FAILURE_WINDOW_MAX_LINES)@@ -649,6 +663,30 @@ export const COMPLETION_REASON_ANALYSES = {message: 'Agent idled out before any work started',suggestedFix: 'The prompt likely never submitted — no working indicator ever appeared. Check the TUI paste/submit path and provider availability.'},+ // The two startup verdicts the TUI spawner resolves itself (agentTuiSpawning.js:+ // `retryOrFailPaste` and the TUI_INPUT_READY_DEADLINE_MS branch). Both were+ // missing here, and the cost was not merely a vaguer message: with no+ // structural def, `analyzeAgentFailure` falls through to the regex sweep over a+ // repaint-mangled TUI screen. Claude Code's idle composer renders a rotating+ // placeholder hint — `❯ Try "fix lint errors"` — so a run that never submitted+ // anything at all got filed as `lint-error` / "Linting failed", pointing every+ // reader (and the auto-fixer tier) at a lint problem that did not exist+ // (agent-f71b794e, 2026-08-14; the actual blocker was claude's new auto-mode+ // modal). Registering the reasons restores the documented precedence — the+ // spawner's own verdict beats a keyword sweep — and the `startup-failure`+ // category is reused rather than minted so downstream taxonomies are unchanged.+ 'paste-not-rendered': {+ category: 'startup-failure',+ actionable: false,+ message: 'Prompt never rendered in the TUI input box',+ suggestedFix: 'The provider CLI accepted the bracketed paste but the prompt never appeared, so nothing was ever submitted. Usually the TUI was still initializing, or a startup dialog (folder trust, an opt-in offer, an account banner) was up and swallowed the paste. Check the tail of the raw transcript for a modal — if it is one PortOS does not know about yet, it needs a dismissal branch in agentTuiSpawning.js.'+ },+ 'tui-not-ready': {+ category: 'startup-failure',+ actionable: false,+ message: 'TUI never presented an input prompt',+ suggestedFix: 'The provider CLI never signalled that its input box was live, so no prompt was sent. Check the raw transcript for a stalled sign-in, an unresolved startup dialog, or a CLI that exited back to the shell during boot.'+ },'review-loop-idle-timeout': {category: 'timeout',actionable: false,@@ -780,14 +818,35 @@ export function endsAwaitingUserInput(analysisOutput) {const AWAITING_INPUT_REFINABLE_REASONS = new Set(['idle-no-changes', 'idle-no-activity', 'idle-no-deliverable']);/**- * Re-word an idle-out whose transcript ends on an unanswered prompt. The+ * The startup counterparts: the prompt never landed, and the transcript ends on a+ * dialog. Same evidence, different story — no reaper was involved and the run+ * never started, so the idle prose above ("re-running as-is will stall the same+ * way", "invoke the non-interactive form") is wrong on every clause. Here the+ * dialog is a STARTUP gate the spawner does not know how to dismiss, and the fix+ * is a dismissal branch, not a reworded task.+ */+const STARTUP_GATE_REFINABLE_REASONS = new Set(['paste-not-rendered', 'tui-not-ready']);++/**+ * Re-word a run whose transcript ends on an unanswered prompt — an idle-out that+ * stalled ON one, or a startup verdict where a dialog was up BEFORE the prompt+ * could land (the two groups get different prose; see the reason sets). The* original `category` is preserved — downstream taxonomies (auto-fix tiers,* layered-intelligence failure buckets) keep classifying it exactly as they did,* and both idle reasons already escalate rather than blind-retry. Only the prose* a human reads changes. Pure.*/function refineIdleReasonAnalysis(def, completionReason, analysisOutput) {- if (!def || !AWAITING_INPUT_REFINABLE_REASONS.has(completionReason)) return def;+ if (!def) return def;+ if (STARTUP_GATE_REFINABLE_REASONS.has(completionReason)) {+ if (!endsAwaitingUserInput(analysisOutput)) return def;+ return {+ ...def,+ message: 'Agent never started — a startup dialog swallowed the prompt',+ suggestedFix: 'The transcript ends on an unanswered dialog (a choice selector or opt-in offer) that was up before the prompt could land, so nothing was ever submitted and the run is a no-op rather than a failed attempt. PortOS auto-answers the dialogs it knows (folder trust, claude\'s auto-mode offer); a new one from a CLI update needs its own pattern and dismissal branch in tuiHandshake.js / agentTuiSpawning.js. Read the tail of the raw transcript to see which dialog it was.'+ };+ }+ if (!AWAITING_INPUT_REFINABLE_REASONS.has(completionReason)) return def;if (!endsAwaitingUserInput(analysisOutput)) return def;return {...def,diff --git a/server/services/agentErrorAnalysis.test.js b/server/services/agentErrorAnalysis.test.jsindex 0ff9270b5c..59b31488e9 100644--- a/server/services/agentErrorAnalysis.test.js+++ b/server/services/agentErrorAnalysis.test.js@@ -1073,6 +1073,67 @@ describe('analyzeAgentFailure — runner completion reason (COMPLETION_REASON_AN});});+// agent-f71b794e (2026-08-14): claude v2.1.233 put its auto-mode offer up before+// the paste landed, so the run submitted nothing. With no COMPLETION_REASON entry+// for `paste-not-rendered` the analyzer fell through to the regex sweep and matched+// the idle composer's placeholder hint — filing a never-started run as `lint-error`+// / "Linting failed", which is what the follow-up investigation task was named for.+describe('analyzeAgentFailure — TUI startup gates are not lint errors', () => {+ // Verbatim shape of the failing screen: banner, the composer's rotating+ // placeholder, then the modal that swallowed the paste.+ const stuckOnAutoModeOffer = withLead(+ [+ 'Claude Code v2.1.233',+ 'Opus 5 with high effort · Claude Max',+ '❯ Try "fix lint errors"',+ '⏵⏵ bypass permissions on (shift+tab to cycle) · ← for agents',+ 'Make auto mode your default permission mode?',+ ' ❯ 1. Yes, set auto mode as my default permission mode',+ " 2. No, keep don't ask",+ ].join('\n')+ );++ it('classifies a swallowed paste as a startup failure, not a lint error', () => {+ const analysis = analyzeAgentFailure(stuckOnAutoModeOffer, { id: 't' }, 'x', {+ completionReason: 'paste-not-rendered',+ completionError: 'claude was still initializing and the paste was silently swallowed.',+ });+ expect(analysis.category).toBe('startup-failure');+ expect(analysis.category).not.toBe('lint-error');+ expect(analysis.origin).toBe('runner');+ });++ it('names the unanswered dialog as the cause instead of blaming the idle reaper', () => {+ const analysis = analyzeAgentFailure(stuckOnAutoModeOffer, { id: 't' }, 'x', {+ completionReason: 'paste-not-rendered',+ });+ expect(analysis.message).toMatch(/startup dialog/i);+ // The idle-out prose would be wrong here — no reaper was involved.+ expect(analysis.suggestedFix).not.toMatch(/idle reaper/i);+ });++ it('registers both spawner-resolved startup verdicts', () => {+ expect(COMPLETION_REASON_ANALYSES['paste-not-rendered'].category).toBe('startup-failure');+ expect(COMPLETION_REASON_ANALYSES['tui-not-ready'].category).toBe('startup-failure');+ });++ // Defense in depth for the case with no completion reason to lean on: the+ // placeholder is the TUI advertising what you COULD ask, and its suggestion+ // rotates — so leaving it in the window lets it trip patterns by coincidence.+ it('ignores the empty-composer placeholder hint when there is no runner verdict', () => {+ const analysis = analyzeAgentFailure(stuckOnAutoModeOffer, { id: 't' }, 'x');+ expect(analysis.category).not.toBe('lint-error');+ });++ it('still classifies a genuine lint failure the agent actually hit', () => {+ const analysis = analyzeAgentFailure(+ withLead('npm run lint\n/src/app.js\n 12:1 error Unexpected var\n\nlint failed with 1 error'),+ { id: 't' }, 'x'+ );+ expect(analysis.category).toBe('lint-error');+ });+});+describe('createInvestigationTask body', () => {beforeEach(() => {addTask.mockReset();