Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(approval): handle missing session id and null fields in approval history

Steven Enamakel68bdccddf0ad
diff --git a/app/src/components/settings/panels/ApprovalHistoryPanel.tsx b/app/src/components/settings/panels/ApprovalHistoryPanel.tsx
index aa96340140..8e2c7eb3a1 100644
--- a/app/src/components/settings/panels/ApprovalHistoryPanel.tsx
+++ b/app/src/components/settings/panels/ApprovalHistoryPanel.tsx
@@ -42,7 +42,8 @@ const DECISION_DOT_CLASS: Record<ApprovalDecision, string> = {
};
/** Last 8 characters of a long id — enough to tell sessions apart. */
-const shortId = (id: string): string => (id.length > 10 ? `…${id.slice(-8)}` : id);
+const shortId = (id: string | null | undefined): string =>
+ !id ? '—' : id.length > 10 ? `…${id.slice(-8)}` : id;
const DECISION_LABEL_KEY: Record<ApprovalDecision, string> = {
approve_once: 'settings.approvalHistory.decision.approveOnce',
@@ -115,8 +116,8 @@ const ApprovalHistoryPanel = () => {
if (selectedDecisions.size > 0 && !selectedDecisions.has(entry.decision)) return false;
if (!needle) return true;
return (
- entry.tool_name.toLowerCase().includes(needle) ||
- entry.action_summary.toLowerCase().includes(needle)
+ (entry.tool_name ?? '').toLowerCase().includes(needle) ||
+ (entry.action_summary ?? '').toLowerCase().includes(needle)
);
});
}, [entries, query, selectedDecisions]);
@@ -151,7 +152,9 @@ const ApprovalHistoryPanel = () => {
header: t('settings.approvalHistory.column.session'),
className: 'w-px whitespace-nowrap',
cell: entry => (
- <span className="font-mono text-[11px] text-content-muted" title={entry.session_id}>
+ <span
+ className="font-mono text-[11px] text-content-muted"
+ title={entry.session_id ?? undefined}>
{shortId(entry.session_id)}
</span>
),
diff --git a/app/src/services/api/approvalApi.ts b/app/src/services/api/approvalApi.ts
index 9fb5b95d1a..2b99ffa474 100644
--- a/app/src/services/api/approvalApi.ts
+++ b/app/src/services/api/approvalApi.ts
@@ -48,7 +48,9 @@ export interface PendingApproval {
action_summary: string;
/** Redacted JSON arguments — counts/shape only, no raw message bodies. */
args_redacted: unknown;
- session_id: string;
+ /** Not sent by `approval_list_recent_decisions` today; optional so the UI
+ * cannot crash on its absence. */
+ session_id?: string | null;
/** RFC3339 timestamp. */
created_at: string;
/** RFC3339 timestamp, or null when the request does not expire. */