[Bug]: ReferenceError: presentation is not defined in ChatView backgroundWorkBannerItem
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.
Area
apps/web
Steps to reproduce
- In T3 Code, open any thread that has active background tasks (e.g. background command, dev server, or subagent).
- Observe the chat view crashing or failing to render.
Expected behavior
The background work banner renders normally above the composer, with the status indicator dot pulsing only if the background work holds completion.
Actual behavior
The view crashes immediately with ReferenceError: presentation is not defined.
tsc --noEmit in apps/web fails with:
src/components/ChatView.tsx:7050:13 - error TS2304: Cannot find name 'presentation'.
7050 presentation.waiting && "animate-status-pulse",
~~~~~~~~~~~~
Impact
Major degradation or frequent failure
Version or commit
main @ a5b34b25378 (PR #15114)
Environment
macOS / Web / Desktop
Logs or stack traces
ReferenceError: presentation is not defined
at t3code://app/assets/_chat-qbkAHxVg.js:55:26814
at Object.useMemo (t3code://app/assets/dist-ChxELPrq.js:26:59806)
at e.useMemo (t3code://app/assets/Icon-l19w4AjM.js:1:7110)
at (t3code://app/assets/_chat-qbkAHxVg.js:55:26645)
at Eo (t3code://app/assets/dist-ChxELPrq.js:26:47513)
Workaround / Root cause & fix
Introduced in #15114 (commit a5b34b25378). In apps/web/src/components/ChatView.tsx line 7050:
icon: (
<span
className={cn(
"size-1.5 rounded-full bg-foreground",
presentation.waiting && "animate-status-pulse",
)}
aria-hidden="true"
/>
),
presentation was referenced without being declared or assigned in backgroundWorkBannerItem.
The fix is to import backgroundWorkHoldsCompletion from @t3tools/shared/orchestrationV2PendingBackgroundWork and evaluate:
backgroundWorkHoldsCompletion(activeBackgroundTasks) && "animate-status-pulse"
[!NOTE] Grok responding on behalf of Julius.
Triage
Thanks for the report and the suggested fix, @tarunravi. Unfortunately I couldn't reproduce this on a5b34b25378 (#15114) or on current main (88744f3ddb).
In backgroundWorkBannerItem, presentation is declared in the same useMemo before the pulse class reads it. On the cited commit, that's lines 6902 and 6916 of apps/web/src/components/ChatView.tsx, not line 7050:
const backgroundWorkBannerItem = useMemo(() => {
const presentation = presentPendingBackgroundWork(activeBackgroundTasks);
if (presentation === null || !activeThread) {
return null;
}
// ...
presentation.waiting && "animate-status-pulse",
presentPendingBackgroundWork already sets waiting from backgroundWorkHoldsCompletion, so the banner already uses the helper you suggested importing. I couldn't find a main revision with presentation.waiting on line 7050, and every revision that reads it also declares presentation in that callback.
The Typecheck, Build, and Test checks also passed on #15114. A TS2304: Cannot find name 'presentation' error would have failed typecheck, so the ReferenceError in your stack trace probably came from a local edit, an unmerged branch, or a stale build, not from that commit.
If a current build still crashes when you open a thread with background work, could you share the exact installed version (or git rev-parse HEAD plus git status for a source build) and a stack trace from that build?
A maintainer will decide on next steps.
Already fixed on current main. Tested b5a226e49c with vp run dev and isolated copied state in Linux Chromium 154. Opened empty and existing threads, then used Codex to start sleep 240 in the background and finish its turn. The chat remained usable and the background-work banner rendered. Reopening that thread at 390px also worked; no presentation ReferenceError occurred. The command's dot had animation-name: none, as expected.
de34391427 replaced this path with a declared presentation = presentPendingBackgroundWork(...); the declaration is retained in today's extracted banner component. Closing as already fixed. macOS/Electron were not tested here.
1280×800 web:

390×844 web after reopening (DPR 2, no device emulation):
