Skip to content

Commit ec1bade

Browse files
hqhq1025HAPI
andcommitted
fix: use structural checks for Agent metadata redaction
Replace loose substring matching (which could false-positive on legitimate agent output) with: 1. Structural check: result object has agentId/output_file keys 2. Strict text pattern: starts with the exact launch message prefix Also make the label state-aware: "Done" for completed, "Agent launched" for running. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run>
1 parent c744223 commit ec1bade

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

web/src/components/ToolCard/views/_results.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,15 @@ const AgentResultView: ToolViewComponent = (props: ToolViewProps) => {
529529
return <div className="text-sm text-[var(--app-hint)]">{state === 'completed' ? 'Done' : placeholderForState(state)}</div>
530530
}
531531

532-
// Strip internal system metadata (agentId, output_file, system instructions)
533-
// that should not be shown to users
534-
if (text.includes('agentId:') || text.includes('output_file:') || text.includes('internal ID')) {
535-
return <div className="text-sm text-[var(--app-hint)]">Agent launched</div>
532+
// Detect internal launch metadata. Check structurally first (result object
533+
// may carry agentId/output_file keys), then fall back to a strict text
534+
// pattern that is unlikely to appear in normal agent prose.
535+
const isInternalMeta = isObject(result) && ('agentId' in result || 'output_file' in result)
536+
|| (text.startsWith('Async agent launched successfully.') && text.includes('agentId:'))
537+
538+
if (isInternalMeta) {
539+
const label = state === 'completed' ? 'Done' : 'Agent launched'
540+
return <div className="text-sm text-[var(--app-hint)]">{label}</div>
536541
}
537542

538543
return (

0 commit comments

Comments
 (0)