Skip to content

The open-source agent harness - the runtime layer that turns an LLM into a working agent.

Fix: Hide tool approval actions in session details (#883)

harshil-2096ad6648010150
diff --git a/.changeset/session-detail-hitl-readonly.md b/.changeset/session-detail-hitl-readonly.md
new file mode 100644
index 000000000..19c0485ff
--- /dev/null
+++ b/.changeset/session-detail-hitl-readonly.md
@@ -0,0 +1,5 @@
+---
+'@truefoundry/trueforge-ui': patch
+---
+
+Hide tool approval Allow/Deny actions and the "Awaiting Response" spinner for paused approvals on session detail (read-only replay).
diff --git a/packages/trueforge-ui/src/containers/AgentSessionTimelineContainer.tsx b/packages/trueforge-ui/src/containers/AgentSessionTimelineContainer.tsx
index 800826663..021a75e8e 100644
--- a/packages/trueforge-ui/src/containers/AgentSessionTimelineContainer.tsx
+++ b/packages/trueforge-ui/src/containers/AgentSessionTimelineContainer.tsx
@@ -6,6 +6,8 @@ import { Suspense, useCallback, useEffect, useMemo, useRef, useState, type Compo
import { Markdown, type MarkdownProps } from '../atoms/Markdown.js';
import { MessageActionBar } from '../atoms/MessageActionBar.js';
+import { ToolApprovalBar, type ToolApprovalBarProps } from '../atoms/ToolApprovalBar.js';
+import { ToolCallCard, type ToolCallCardProps } from '../atoms/ToolCallCard.js';
import type { UserMessageActionBarProps } from '../atoms/UserMessageActionBar.js';
import { useServer } from '../server/ServerContext.js';
import type { AgentChatServer, SessionEventItem } from '../server/types.js';
@@ -36,9 +38,21 @@ function ReadOnlyUserMessageActionBar({ isCopied, onCopy, createdAt, className }
return <MessageActionBar isCopied={isCopied} onCopy={onCopy} createdAt={createdAt} className={className} />;
}
+/** HITL Allow/Deny is only for live chat — session detail is a historical replay. */
+function ReadOnlyToolApprovalBar(props: ToolApprovalBarProps) {
+ return <ToolApprovalBar {...props} readOnly />;
+}
+
+/** Nothing will answer a paused approval in a replay, so drop the "Awaiting Response" spinner. */
+function ReadOnlyToolCallCard(props: ToolCallCardProps) {
+ return <ToolCallCard {...props} awaiting={props.approvalSlot ? false : props.awaiting} />;
+}
+
const READ_ONLY_SLOT_OVERRIDES: SlotOverrides = {
UserMessageActionBar: ReadOnlyUserMessageActionBar,
Markdown: ReadOnlyMarkdown,
+ ToolApprovalBar: ReadOnlyToolApprovalBar,
+ ToolCallCard: ReadOnlyToolCallCard,
};
type TurnCreatedEvent = Extract<SessionEventItem['event'], { type: 'turn.created' }>;
diff --git a/packages/trueforge-ui/test/containers/AgentSessionTimelineContainer.test.tsx b/packages/trueforge-ui/test/containers/AgentSessionTimelineContainer.test.tsx
index 48332ef80..b9825f451 100644
--- a/packages/trueforge-ui/test/containers/AgentSessionTimelineContainer.test.tsx
+++ b/packages/trueforge-ui/test/containers/AgentSessionTimelineContainer.test.tsx
@@ -277,4 +277,92 @@ describe('AgentSessionTimelineContainer', () => {
fireEvent.mouseEnter(screen.getByText('report.txt').parentElement ?? screen.getByText('report.txt'));
expect(screen.getByRole('tooltip')).toHaveTextContent('Download File is not available in read-only mode');
});
+
+ it('hides tool approval Allow/Deny actions in session turns', async () => {
+ const approvalEvents: SessionEventItem[] = [
+ {
+ turnId: 'turn-1',
+ event: {
+ type: 'turn.created',
+ id: 'c1',
+ turnId: 'turn-1',
+ previousTurnId: null,
+ input: [{ type: 'user.message', content: 'run tool' }],
+ state: { status: 'running' },
+ createdAt: '2026-01-01T00:00:00.000Z',
+ threadId: null,
+ },
+ },
+ {
+ turnId: 'turn-1',
+ event: {
+ type: 'model.message',
+ id: 'm1',
+ threadId: 'main',
+ content: 'calling tool',
+ createdAt: '2026-01-01T00:00:01.000Z',
+ toolCalls: [
+ {
+ id: 'approval-1',
+ type: 'function',
+ function: { name: 'bash', arguments: '{}' },
+ toolInfo: {
+ type: 'mcp',
+ name: 'bash',
+ serverId: 'bash-server',
+ serverName: 'bash',
+ },
+ },
+ ],
+ },
+ },
+ {
+ turnId: 'turn-1',
+ event: {
+ type: 'tool.approval_required',
+ id: 'approval-event',
+ threadId: 'main',
+ createdAt: '2026-01-01T00:00:01.500Z',
+ toolCalls: [{ id: 'approval-1', sourceEventId: 'm1' }],
+ },
+ },
+ {
+ turnId: 'turn-1',
+ event: {
+ type: 'turn.done',
+ id: 'd1',
+ state: {
+ status: 'done',
+ completedAt: '2026-01-01T00:00:02.000Z',
+ output: null,
+ requiredActions: [
+ {
+ type: 'tool.approval_required',
+ id: 'approval-event',
+ threadId: 'main',
+ createdAt: '2026-01-01T00:00:01.500Z',
+ toolCalls: [{ id: 'approval-1', sourceEventId: 'm1' }],
+ },
+ ],
+ },
+ createdAt: '2026-01-01T00:00:02.000Z',
+ threadId: null,
+ },
+ },
+ ];
+
+ render(
+ <SlotsProvider overrides={{ AgentSessionEventTimeline: () => null }}>
+ <ServerProvider server={createMockAgentUIServer()}>
+ <AgentSessionTimelineContainer sessionId="sess-1" events={approvalEvents} />
+ </ServerProvider>
+ </SlotsProvider>,
+ );
+
+ expect(await screen.findByText('Tool Approval Required for')).toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: 'Allow' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: 'Deny' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: 'Approve' })).not.toBeInTheDocument();
+ expect(screen.queryByText(/Awaiting Response/)).not.toBeInTheDocument();
+ });
});