refactor: wire normalized intent into activity UI

- ChatPane header now prefers session.currentIntent over the activity-
  derived label from summarizeSessionActivity for the busy status display
- TurnActivityPanel receives currentIntent via props and prefers it over
  extractLatestIntent (report_intent tool-call scanning) when the panel
  is active; falls back to tool-call scan for completed/inactive runs
- This replaces the report_intent-as-status inference pattern with the
  normalized assistant-intent event data from the backend

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-04-13 16:20:04 +02:00
co-authored by Copilot
parent 08886f9078
commit 8d08a1df1a
2 changed files with 10 additions and 3 deletions
+2 -1
View File
@@ -530,7 +530,7 @@ export function ChatPane({
</div>
)}
{isSessionBusy && !pendingApproval && !pendingUserInput && (() => {
const label = summarizeSessionActivity(sessionActivity);
const label = session.currentIntent ?? summarizeSessionActivity(sessionActivity);
return (
<div className="flex items-center gap-1.5 text-[12px] text-[var(--color-accent-sky)]">
<span className="size-2 animate-pulse rounded-full bg-[var(--color-accent-sky)]" />
@@ -593,6 +593,7 @@ export function ChatPane({
isActive={isTurnActive(item, itemIndex)}
turnStartedAt={item.turnStartedAt}
sessionId={session.id}
currentIntent={session.currentIntent}
agentNames={item.agentNames}
isLastRunPanel={item.isLastRunPanel}
onDiscard={onDiscardRunChanges}
@@ -41,6 +41,7 @@ export interface TurnActivityPanelProps {
isActive: boolean;
turnStartedAt?: string;
sessionId: string;
currentIntent?: string;
agentNames?: ReadonlySet<string>;
isLastRunPanel?: boolean;
onDiscard?: (sessionId: string, runId: string, files?: ProjectGitFileReference[]) => Promise<unknown>;
@@ -418,6 +419,7 @@ export function TurnActivityPanel({
isActive,
turnStartedAt,
sessionId,
currentIntent,
agentNames,
isLastRunPanel,
onDiscard,
@@ -471,8 +473,12 @@ export function TurnActivityPanel({
return groupActivityStream(stream);
}, [thinkingMessages, scopedEvents]);
// Extract intent text for the header
const intentText = useMemo(() => extractLatestIntent(scopedEvents), [scopedEvents]);
// Prefer the session-level normalized intent when active; fall back to
// scanning run timeline for report_intent tool calls (backward compat).
const intentText = useMemo(
() => (isActive ? currentIntent : undefined) ?? extractLatestIntent(scopedEvents),
[isActive, currentIntent, scopedEvents],
);
const fallbackSummary = useMemo(
() => !intentText ? generateActivitySummary(scopedEvents) : undefined,
[intentText, scopedEvents],