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: keep the transcript-clip notice visible when the tail window has no lines (#3498)
[._.]/ Adam Eivy3773b8fcfec4
diff --git a/client/src/components/cos/tabs/AgentCard.jsx b/client/src/components/cos/tabs/AgentCard.jsxindex 752068fa61..b0ce7ad838 100644--- a/client/src/components/cos/tabs/AgentCard.jsx+++ b/client/src/components/cos/tabs/AgentCard.jsx@@ -97,12 +97,15 @@ function toTranscript(data) {function TranscriptTruncationNotice({ transcript }) {if (!transcript?.truncated) return null;+ const count = transcript.lines.length;+ const size = transcript.totalBytes > 0 ? ` (${formatBytes(transcript.totalBytes)})` : '';return (<div className="flex items-center gap-1.5 text-xs text-yellow-500 mb-2"><AlertTriangle size={12} aria-hidden="true" className="shrink-0" /><span>- Showing the last {transcript.lines.length.toLocaleString()} {transcript.lines.length === 1 ? 'line' : 'lines'} — the full transcript- {transcript.totalBytes > 0 ? ` (${formatBytes(transcript.totalBytes)})` : ''} is on disk in the agent's output.txt.+ {count > 0+ ? `Showing the last ${count.toLocaleString()} ${count === 1 ? 'line' : 'lines'} — the full transcript${size} is on disk in the agent's output.txt.`+ : `The tail of this transcript held no readable lines — the full transcript${size} is on disk in the agent's output.txt.`}</span></div>);@@ -972,11 +975,14 @@ export default function AgentCard({ agent, onPause, onKill, onDelete, onResume,</div>);}- if (stageOut?.lines.length > 0) {+ // A truncated transcript whose tail window yielded no renderable+ // lines still has to say so — falling through to "No output+ // captured" would call a multi-MB log empty.+ if (stageOut?.lines.length > 0 || stageOut?.truncated) {return (<><TranscriptTruncationNotice transcript={stageOut} />- <OutputBlocks key={activeStage.agentId} output={stageOut.lines} />+ {stageOut.lines.length > 0 && <OutputBlocks key={activeStage.agentId} output={stageOut.lines} />}</>);}@@ -995,11 +1001,12 @@ export default function AgentCard({ agent, onPause, onKill, onDelete, onResume,</div>);}- if (output.length > 0) {+ const truncated = inactive && fullOutput?.truncated;+ if (output.length > 0 || truncated) {return (<>- {inactive && <TranscriptTruncationNotice transcript={fullOutput} />}- <OutputBlocks output={output} />+ {truncated && <TranscriptTruncationNotice transcript={fullOutput} />}+ {output.length > 0 && <OutputBlocks output={output} />}</>);}diff --git a/client/src/components/cos/tabs/AgentCard.test.jsx b/client/src/components/cos/tabs/AgentCard.test.jsxindex 69df3e8470..cdd28e9e9f 100644--- a/client/src/components/cos/tabs/AgentCard.test.jsx+++ b/client/src/components/cos/tabs/AgentCard.test.jsx@@ -170,6 +170,28 @@ describe('AgentCard transcript truncation (#3498)', () => {expect(screen.getByText(/12 MB/)).toBeInTheDocument();});+ it('still reports the clip when the tail window yielded no renderable lines', async () => {+ const user = userEvent.setup();+ api.getCosAgent.mockResolvedValue({+ ...agent,+ output: [],+ outputTruncated: true,+ outputTotalBytes: 8 * 1024 * 1024,+ });++ render(+ <MemoryRouter>+ <AgentCard agent={agent} completed />+ </MemoryRouter>+ );++ await user.click(screen.getByRole('button', { name: 'Show' }));++ // "No output captured" would call a multi-MB log empty.+ expect(await screen.findByText(/no readable lines/)).toBeInTheDocument();+ expect(screen.queryByText('No output captured')).not.toBeInTheDocument();+ });+it('stays quiet when the whole transcript fit under the cap', async () => {const user = userEvent.setup();api.getCosAgent.mockResolvedValue({diff --git a/server/services/cosAgentLifecycle.js b/server/services/cosAgentLifecycle.jsindex 4fbb27639a..810142e909 100644--- a/server/services/cosAgentLifecycle.js+++ b/server/services/cosAgentLifecycle.js@@ -434,9 +434,15 @@ async function readAgentTranscriptTail(outputFile, { limit, maxBytes }) {if (text === null) return null;const clippedByBytes = info.size > maxBytes;// The byte window can start mid-line (and mid-multibyte-character), so drop- // the leading fragment rather than surfacing a garbled partial line.+ // the leading fragment rather than surfacing a garbled partial line — UNLESS+ // it is the only thing in the window. A repainted TUI transcript is one+ // enormous newline-free line, and dropping it would hand the UI an empty+ // transcript for a file that is plainly not empty; a partial last screen+ // beats nothing.const split = text.split('\n');- const lines = (clippedByBytes ? split.slice(1) : split).filter(line => line.trim());+ const kept = split.filter(line => line.trim());+ const withoutFragment = clippedByBytes ? split.slice(1).filter(line => line.trim()) : kept;+ const lines = withoutFragment.length > 0 ? withoutFragment : kept;const clippedByLines = lines.length > limit;return {lines: clippedByLines ? lines.slice(-limit) : lines,diff --git a/server/services/cosAgentLifecycle.test.js b/server/services/cosAgentLifecycle.test.jsindex 06868a6e68..70060391d1 100644--- a/server/services/cosAgentLifecycle.test.js+++ b/server/services/cosAgentLifecycle.test.js@@ -119,8 +119,11 @@ describe('cosAgentLifecycle', () => {const agent = await getAgent('agent-oneline', { maxBytes: 1024 });- // The leading partial line is dropped, so a single over-cap line yields none.- expect(agent.output).toEqual([]);+ // The leading partial line is normally dropped, but here it is the ONLY+ // content in the window — a partial last screen beats an empty transcript+ // for a file that is plainly not empty.+ expect(agent.output).toHaveLength(1);+ expect(agent.output[0].line).toBe('x'.repeat(1024));expect(agent.outputTruncated).toBe(true);expect(agent.outputTotalBytes).toBe(200_000);});