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: strip lifecycle lines whose trailing value is empty, and the tail fragment before them
Adam Eivyf9b5a06f31f6
diff --git a/server/lib/agentOutputMarkers.js b/server/lib/agentOutputMarkers.jsindex c514b07170..3021ebe6d5 100644--- a/server/lib/agentOutputMarkers.js+++ b/server/lib/agentOutputMarkers.js@@ -19,8 +19,8 @@* list this replaced was written against nine messages and silently missed every* one added after it (merge-gate, stall, OOM and permission nudges, host restart,* provider-signal holds), so those leaked into PR bodies again.- * `agentOutputMarkers.test.js` fails on a literal `appendLine('…')` in an- * emitter, so a new line can only be added here.+ * `agentOutputMarkers.test.js` fails on a literal `appendLine('…')` in the TUI+ * spawner, so a line written there has to be declared here first.*/import { escapeRegExp } from './textUtils.js';@@ -55,7 +55,10 @@ function lifecycleLine(strings, ...keys) {throw new Error(`Lifecycle line "${fixedText}" has too little fixed text to anchor on — declare it with emitOnlyLine`);}const format = formatter(strings, keys);- format.pattern = new RegExp(`^\\s*${strings.map(escapeRegExp).join('.*?')}`, 'u');+ // Whitespace stays flexible because the spooler trims each line: an empty+ // trailing value would otherwise take the space before it with it.+ const fixed = strings.map(text => escapeRegExp(text).replace(/\s+/g, '\\s*'));+ format.pattern = new RegExp(`^\\s*${fixed.join('.*?')}`, 'u');return Object.freeze(format);}diff --git a/server/lib/gitOutputParsers.js b/server/lib/gitOutputParsers.jsindex 18ecbffb73..e2e27509e2 100644--- a/server/lib/gitOutputParsers.js+++ b/server/lib/gitOutputParsers.js@@ -86,8 +86,8 @@ export function parseSubmoduleStatusLine(line) {* Two shapes reach this:* - A TUI agent's `output.txt`, which is lifecycle telemetry plus the* `.agent-done` sentinel summary ingested behind- * `SENTINEL_COMPLETION_MARKER`. When that marker is present, everything- * after it IS the agent's summary — nothing before it was ever the agent+ * `SENTINEL_COMPLETION_MARKER`. When that marker is present, the agent's+ * summary is what follows it — nothing before it was ever the agent* talking, so the tool-line walk must not be allowed to reach back into it.* - A CLI agent's streamed output, which ends with a summary after the last* tool-call artifact. That's the fallback walk.@@ -111,6 +111,8 @@ export function extractAgentSummary(output) {? output.slice(markerIdx + SENTINEL_COMPLETION_MARKER.length): output.slice(-4000);const lines = region.split('\n');+ // A tail cut mid-line leaves a fragment no lifecycle shape can recognize.+ if (markerIdx < 0 && output.length > 4000 && lines.length > 1) lines.shift();let summaryLines;if (markerIdx >= 0) {diff --git a/server/lib/gitOutputParsers.test.js b/server/lib/gitOutputParsers.test.jsindex c20caa0d2e..7dcffd5ba0 100644--- a/server/lib/gitOutputParsers.test.js+++ b/server/lib/gitOutputParsers.test.js@@ -232,12 +232,15 @@ describe('extractAgentSummary', () => {// An idle-complete TUI run's output.txt is nothing but PortOS telemetry, so the// PR body must fall back to commit messages rather than open with a nudge log.// Built from the catalog the emitters write through, so a shape whose derived- // pattern misses its own output fails here.+ // pattern misses its own output fails here — including with every value empty,+ // trimmed the way the output spooler stores it.it('strips every line the TUI emitters can write, leaving no summary', () => {- const lines = Object.entries(LIFECYCLE_LINES)- .filter(([, line]) => line.pattern)- .map(([id, line]) => line(new Proxy({}, { get: (_, key) => `${id}-${String(key)} (1/3)` })));- expect(lines.length).toBeGreaterThan(20);+ const anchored = Object.entries(LIFECYCLE_LINES).filter(([, line]) => line.pattern);+ const lines = anchored.flatMap(([id, line]) => [+ line(new Proxy({}, { get: (_, key) => `${id}-${String(key)} (1/3)` })),+ line({}).trim(),+ ]);+ expect(anchored.length).toBeGreaterThan(20);expect(extractAgentSummary(lines.join('\n'))).toBeNull();});