Skip to content

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

fix: show current delivery and cleanup on agent cards

[._.]/ Adam Eivy3022356a599b
diff --git a/client/src/components/cos/AgentResultLine.jsx b/client/src/components/cos/AgentResultLine.jsx
index 5a6ff296b2..1bd7a8b6dd 100644
--- a/client/src/components/cos/AgentResultLine.jsx
+++ b/client/src/components/cos/AgentResultLine.jsx
@@ -23,7 +23,9 @@ export default function AgentResultLine({ agent, className = '' }) {
const scanIncomplete = scanner && scanner.status !== 'completed';
const cleanup = agent.metadata?.cleanupOutcome;
const cleanupRecovery = agent.metadata?.recoveryOrigin?.subsystem === 'repository-cleanup';
- const cleanupPending = (cleanupRecovery || cleanup) && cleanup?.status !== 'verified';
+ const cleanupTracked = cleanupRecovery || cleanup || agent.result.cleanupPending === true;
+ const cleanupPending = cleanupTracked && cleanup?.status !== 'verified';
+ const merged = cleanup?.committedIntegrationVerified === true;
const incomplete = cleanupPending || interruption || scanIncomplete || assessmentUnverified || validationFailed || publicationIncomplete;
const tone = handoff ? 'text-port-accent' : !executionSuccess ? 'text-port-error' : incomplete || deliveryHeld ? 'text-port-warning'
: deliveryComplete ? 'text-port-success' : executionSuccess ? 'text-port-text-muted' : 'text-port-error';
@@ -41,9 +43,10 @@ export default function AgentResultLine({ agent, className = '' }) {
<><AlertCircle size={14} aria-hidden="true" /> {agent.result.error || 'Failed'}</>
)}
</span>
- {!handoff && outcome?.reason && <div>{outcome.reason}</div>}
+ {!handoff && cleanupTracked && <div>{merged ? 'Code merged.' : deliveryComplete ? 'Delivery verified.' : 'Code delivery still needs verification.'}</div>}
+ {!handoff && outcome?.reason && !cleanupTracked && <div>{outcome.reason}</div>}
{interruption && <div>Execution interrupted: {interruption.category === 'content-refusal' ? 'provider safety refusal; automatic retry stopped' : interruption.category}</div>}
- {cleanupPending && <div>Cleanup {cleanup?.status === 'already-absent' ? 'already absent; preservation unverified' : cleanup?.status === 'blocked' ? 'blocked' : 'unverified/pending'}{cleanup?.reason ? `: ${cleanup.reason}` : ''}<CleanupHolders owners={cleanup?.owners} /></div>}
+ {!handoff && cleanupTracked && <CleanupStatus cleanup={cleanup} outcome={outcome} />}
<SecurityScanEvidence scanner={scanner} control={agent.metadata?.securityScanControl} />
{!handoff && assessment && <div>{assessment.status === 'recorded' ? 'Assessment saved' : assessment.status === 'persistence-failed' ? 'Assessment could not be saved' : assessment.status === 'not-attempted' ? 'Assessment not attempted' : 'Assessment not verified as saved'}</div>}
{!handoff && validationFailed && <div>Delivery validation failed</div>}
@@ -52,6 +55,29 @@ export default function AgentResultLine({ agent, className = '' }) {
);
}
+function CleanupStatus({ cleanup, outcome }) {
+ const verified = cleanup?.status === 'verified';
+ const absent = cleanup?.status === 'already-absent';
+ const blocked = cleanup?.status === 'blocked';
+ const owners = Array.isArray(cleanup?.owners) && cleanup.owners.length > 0;
+ return (
+ <div>
+ <div>{verified ? 'Local cleanup confirmed; preservation verified.'
+ : absent ? 'The local worktree is already gone, but PortOS has not verified its backup yet.'
+ : blocked ? 'Local cleanup is blocked. PortOS has not confirmed safe removal.'
+ : 'Local cleanup is pending; preservation and removal are not yet confirmed.'}</div>
+ {!verified && <div>{owners ? <>Next: wait for the current owner to finish.<CleanupHolders owners={cleanup.owners} /></>
+ : cleanup?.taskId ? <>Next: the <Link className="underline" to={`/cos/tasks?task=${encodeURIComponent(cleanup.taskId)}&source=internal`}>cleanup recovery task</Link> must verify preservation and finish cleanup.</>
+ : absent ? 'Next: PortOS must verify the preservation evidence.'
+ : 'Next: PortOS must resolve the cleanup hold and verify preservation before removal.'}</div>}
+ <details className="mt-1 text-port-text-muted">
+ <summary className="cursor-pointer">Cleanup diagnostics</summary>
+ <pre className="whitespace-pre-wrap break-words text-xs">{JSON.stringify({ cleanup: cleanup || null, reportedOutcome: outcome }, null, 2)}</pre>
+ </details>
+ </div>
+ );
+}
+
// The live run(s) a claim-owner hold waits on. Without them the card said only
// "claim-owner-ambiguous" and the operator had to hunt for the run (#12769).
function CleanupHolders({ owners }) {
diff --git a/client/src/components/cos/AgentResultLine.test.jsx b/client/src/components/cos/AgentResultLine.test.jsx
index 419aeb5a2c..f69ddae9f9 100644
--- a/client/src/components/cos/AgentResultLine.test.jsx
+++ b/client/src/components/cos/AgentResultLine.test.jsx
@@ -106,10 +106,10 @@ it('does not promote historical cleanup process success to verified cleanup', ()
const agent = { result: { success: true }, metadata: { recoveryOrigin: { subsystem: 'repository-cleanup' } } };
const view = render(<AgentResultLine agent={agent} />);
expect(screen.getByText('Execution completed')).toBeInTheDocument();
- expect(screen.getByText('Cleanup unverified/pending')).toBeInTheDocument();
+ expect(screen.getByText('Local cleanup is pending; preservation and removal are not yet confirmed.')).toBeInTheDocument();
expect(screen.queryByText('Completed successfully')).not.toBeInTheDocument();
view.rerender(<AgentResultLine agent={{ ...agent, metadata: { ...agent.metadata, cleanupOutcome: { status: 'already-absent', reason: 'already-absent-preservation-unverified' } } }} />);
- expect(screen.getByText(/Cleanup already absent; preservation unverified/)).toBeInTheDocument();
+ expect(screen.getByText('The local worktree is already gone, but PortOS has not verified its backup yet.')).toBeInTheDocument();
expect(screen.queryByText('Completed successfully')).not.toBeInTheDocument();
view.rerender(<AgentResultLine agent={{ ...agent, metadata: { ...agent.metadata, cleanupOutcome: { status: 'verified' } } }} />);
expect(screen.getByText('Execution completed')).toBeInTheDocument();
@@ -120,7 +120,7 @@ it('names the live runs a claim-owner cleanup hold is waiting on', async () => {
const cleanupOutcome = { status: 'blocked', reason: 'claim-owner-ambiguous', owners: ['agent-aaa', 'agent-bbb'] };
render(<MemoryRouter><AgentResultLine agent={{ result: { success: true }, metadata: { cleanupOutcome } }} /></MemoryRouter>);
const first = screen.getByRole('link', { name: 'agent-aaa' });
- expect(first.closest('div')).toHaveTextContent('Cleanup blocked: claim-owner-ambiguous — waiting on live runs agent-aaa, agent-bbb');
+ expect(first.closest('div')).toHaveTextContent('Next: wait for the current owner to finish. — waiting on live runs agent-aaa, agent-bbb');
expect(first).toHaveAttribute('href', '/cos/agents/agent-aaa');
expect(screen.getByRole('link', { name: 'agent-bbb' })).toHaveAttribute('href', '/cos/agents/agent-bbb');
});
@@ -137,3 +137,37 @@ it('renders delivery separately from normal execution, including historical pros
expect(screen.getByText('Invented evidence.')).toBeInTheDocument();
}
});
+
+
+it('separates merged delivery from pending, verified, absent and blocked cleanup without exposing codes in the primary summary', async () => {
+ const { MemoryRouter } = await import('react-router');
+ const record = { result: { success: true, cleanupPending: true, taskOutcome: { status: 'completed', reason: 'Historical cleanup queued.' } },
+ metadata: { cleanupOutcome: { status: 'pending', reason: 'cognitive-review-pending', committedIntegrationVerified: true, taskId: 'cleanup-example' } } };
+ const view = render(<MemoryRouter><AgentResultLine agent={record} /></MemoryRouter>);
+ expect(screen.getByText('Code merged.')).toBeInTheDocument();
+ expect(screen.getByText('Execution completed')).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'cleanup recovery task' })).toHaveAttribute('href', '/cos/tasks?task=cleanup-example&source=internal');
+ expect(screen.queryByText('Historical cleanup queued.')).not.toBeInTheDocument();
+ for (const [status, reason, message] of [
+ ['verified', 'retirement-receipt-verified', 'Local cleanup confirmed; preservation verified.'],
+ ['already-absent', 'already-absent-preservation-unverified', 'The local worktree is already gone, but PortOS has not verified its backup yet.'],
+ ['blocked', 'retirement-review-unavailable', 'Local cleanup is blocked. PortOS has not confirmed safe removal.'],
+ ]) {
+ view.rerender(<MemoryRouter><AgentResultLine agent={{ ...record, metadata: { cleanupOutcome: { status, reason, committedIntegrationVerified: true } } }} /></MemoryRouter>);
+ expect(screen.getByText('Code merged.')).toBeInTheDocument();
+ expect(screen.getByText(message)).toBeInTheDocument();
+ const diagnostic = screen.getByText(new RegExp(reason));
+ expect(diagnostic.closest('details')).not.toHaveAttribute('open');
+ expect(screen.queryByText('Historical cleanup queued.')).not.toBeInTheDocument();
+ if (status === 'verified') expect(screen.getByText('Completed successfully')).toBeInTheDocument();
+ else expect(screen.queryByText('Completed successfully')).not.toBeInTheDocument();
+ if (status !== 'verified') expect(screen.getByText('Execution completed')).toBeInTheDocument();
+ }
+});
+
+it('does not infer merged delivery or backup existence from successful execution or absent cleanup', () => {
+ render(<AgentResultLine agent={{ result: { success: true }, metadata: { cleanupOutcome: { status: 'already-absent', reason: 'already-absent-preservation-unverified' } } }} />);
+ expect(screen.getByText('Code delivery still needs verification.')).toBeInTheDocument();
+ expect(screen.queryByText('Code merged.')).not.toBeInTheDocument();
+ expect(screen.queryByText('Local cleanup confirmed; preservation verified.')).not.toBeInTheDocument();
+});
diff --git a/client/src/components/cos/tabs/AgentCard.jsx b/client/src/components/cos/tabs/AgentCard.jsx
index c0cc94023a..002395e4f5 100644
--- a/client/src/components/cos/tabs/AgentCard.jsx
+++ b/client/src/components/cos/tabs/AgentCard.jsx
@@ -630,6 +630,7 @@ export default function AgentCard({ agent, onPause, onKill, onDelete, onResume,
useStickToBottom(outputPanelRef, { enabled: expanded && !inactive, revision: output });
const taskSummary = completed && (fullMetadata && Object.hasOwn(fullMetadata, 'taskSummary')
? fullMetadata.taskSummary : agent.metadata?.taskSummary);
+ const cleanupTracked = agent.metadata?.cleanupOutcome || agent.result?.cleanupPending;
const lastOutput = output.length > 0 ? output[output.length - 1]?.line : null;
// Why this run has NO "Open Shell" link. Scoped to the one case where the user
@@ -1142,11 +1143,14 @@ export default function AgentCard({ agent, onPause, onKill, onDelete, onResume,
{agent.result.warnings?.length > 0 && (
<div className="text-sm text-port-warning flex items-start gap-2">
<AlertTriangle size={14} className="shrink-0 mt-0.5" aria-hidden="true" />
- <div>
+ {cleanupTracked ? <details>
+ <summary className="cursor-pointer">Earlier cleanup warnings</summary>
+ {agent.result.warnings.map((w, i) => <p key={i}>{w}</p>)}
+ </details> : <div>
{agent.result.warnings.map((w, i) => (
<p key={i}>{w}</p>
))}
- </div>
+ </div>}
</div>
)}
{/* Memory extraction status */}
@@ -1303,7 +1307,7 @@ export default function AgentCard({ agent, onPause, onKill, onDelete, onResume,
<div className="mt-2 bg-port-bg/50 border border-port-border/50 rounded p-2.5">
<div className="text-[11px] text-gray-500 mb-1 flex items-center gap-1">
<Sparkles size={10} aria-hidden="true" className="text-emerald-400" />
- Task Summary
+ {cleanupTracked ? 'Earlier agent report — current delivery and cleanup status shown above' : 'Task Summary'}
</div>
{taskSummary && <MarkdownOutput content={taskSummary} linkifyText={linkifyIssues} />}
{agent.metadata?.taskSummaryTruncated && !fullMetadata?.taskSummary && (
diff --git a/client/src/components/cos/tabs/AgentCard.test.jsx b/client/src/components/cos/tabs/AgentCard.test.jsx
index ae80088336..59cbc3399c 100644
--- a/client/src/components/cos/tabs/AgentCard.test.jsx
+++ b/client/src/components/cos/tabs/AgentCard.test.jsx
@@ -1397,3 +1397,18 @@ it('keeps the runner transcript separate when no completion summary was saved',
await userEvent.click(screen.getByRole('button', { name: 'Show full transcript' }));
expect(screen.getByText('exec: example tool output')).toBeInTheDocument();
});
+
+it('keeps the current cleanup verdict primary and labels stale report and warnings as historical', async () => {
+ const current = { ...agent, result: { success: true, cleanupPending: true, warnings: ['Cleanup queued: old-internal-code'] },
+ metadata: { ...agent.metadata, taskSummary: 'Cleanup is queued with the checkout preserved.',
+ cleanupOutcome: { status: 'already-absent', reason: 'already-absent-preservation-unverified', committedIntegrationVerified: true } } };
+ api.getCosAgent.mockResolvedValue({ ...current, output: [] });
+ render(<MemoryRouter><AgentCard agent={current} completed /></MemoryRouter>);
+ expect(screen.getByText('Code merged.')).toBeInTheDocument();
+ expect(screen.getByText('The local worktree is already gone, but PortOS has not verified its backup yet.')).toBeInTheDocument();
+ expect(screen.getByText('Cleanup queued: old-internal-code').closest('details')).not.toHaveAttribute('open');
+ expect(screen.queryByText('Cleanup is queued with the checkout preserved.')).not.toBeInTheDocument();
+ await userEvent.click(screen.getByRole('button', { name: 'Show', exact: true }));
+ expect(await screen.findByText('Earlier agent report — current delivery and cleanup status shown above')).toBeInTheDocument();
+ expect(screen.getByText('Cleanup is queued with the checkout preserved.')).toBeInTheDocument();
+});