feat(agent-platform): approval detail panel with embedded session#63908
feat(agent-platform): approval detail panel with embedded session#63908benjackwhite wants to merge 1 commit into
Conversation
Replace the agent-console approval drawer with a URL-addressable master-detail panel. The detail view shows the approval context (model reasoning, proposed args, decision controls) in an Approval tab and renders the agent session that proposed the gated call in a Session tab, reusing the existing SessionDetail component. Selection is driven by a ?request=<id> URL param (bookmarkable, mirrors the sessions tab) on both the fleet and per-agent surfaces. Adds approval fixtures, MSW handlers, and Storybook stories so every approval state is reviewable without a backend. Generated-By: PostHog Code Task-Id: 9a4a4069-25cb-4816-b1d0-a018556f7fee
|
Hey @benjackwhite! 👋 It looks like your git author email on this PR isn't your
You can fix it for this repo with: git config user.email "you@posthog.com"Or set it globally with |
|
|
Size Change: 0 B Total Size: 62.8 MB ℹ️ View Unchanged
|
|
👋 Visual changes detected for this PR. Review and approve in PostHog Visual Review If these changes are unexpected, they may be caused by a flaky test or a broken snapshot on master. Don't approve — rerun the job or wait for a fix. |
Problem
The agent-console approvals UI surfaced each approval-gated tool call in a slide-out drawer. The drawer overlaid the list, had no URL-addressable state, and showed the approval in isolation — an approver couldn't see the conversation that led the agent to propose the gated call, which is exactly the context needed to make a good decision.
Changes
Replaces the drawer with a proper master-detail panel, mirroring how the sessions tab already works:
ApprovalDetailis now an embeddable panel (no drawer chrome) with two tabs:SessionDetail(conversation + logs), hydrated from the approval'ssession_id.?request=<id>URL param (bookmarkable) on both the fleet (/approvals) and per-agent (/agents/<slug>/approvals) surfaces. Nothing selected → centered list; selecting a row → list + detail grid.ApprovalsList,ApprovalDetail,Approvals) covering every state — queued/editable, queued/read-only, dispatched, rejected, dispatch-failed — each linked to a real session fixture so the Session tab renders a conversation. This is the intended review surface.No backend changes — purely the Next.js agent-console app plus shared fixtures.
How did you test this code?
I'm an agent (Claude Code). I ran only automated checks — no manual browser testing:
tsc --noEmitclean for@posthog/agent-consoleand@posthog/agent-chat(including a.storybook-inclusive pass for the mocks)oxlintclean (only pre-existing warnings in an unrelated file)oxfmtapplied to all changed filesbuild-storybookcompletes successfully — all stories, mocks, and imports bundleTo eyeball:
pnpm --filter @posthog/agent-console storybook→ "Agent console components / Pages / Approval Detail" and ".../Approvals".Automatic notifications
Docs update
No docs update needed.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Authored by Claude Code (Opus 4.8) at Ben White's direction. The ask was to extend the approvals flow by removing the "rough" popup in favour of a detail view that can render the relevant session for context.
Two approval systems share the name in the repo; confirmed with the requester this targets the agent-console system (where approvals carry a
session_id) and the chosen layout is a master-detail panel (not a separate route), to match the existing sessions tab.Key decisions:
SessionDetailwholesale for the Session tab rather than duplicating its composition. This nests its Conversation/Logs tabs under the outer Approval/Session tabs — flagged for reviewer judgement vs. flattening to a singleApproval | Conversation | Logsbar.getApprovalas the authoritative per-detail fetch (polling) rather than threading the list row through, and chained the session/logs fetch off the loaded approval'ssession_id.