[BUG] sandbox mode with --resume crashes UI
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When I exit calude code (tui fullscreen) and restart to bring in new env vars, if sandbox mode was on, the command:
claude --resume
Crashes the system.
Calling /resume from inside calude works:
^Cwilson@wilson-NUC01:~/repos/monument$ claude --resume --verbose
ERROR UKH is not a function. (In 'UKH(K)', 'UKH' is undefined)
/$bunfs/root/src/entrypoints/cli.js:9247:5663
9244: ${K.join()}
9245:
9246 }var $v5,sv4=1000,qv5=300,Kv5=5000;var[ScheduledTasks] teammate ${M.agentId} gone, removing
: FC6=T(()=>{L$();V$();Tp();zb();av4();$$();oN();$v5=(NmH(),S6(kmH))});var
KV4={};X$(KV4,{useScheduledTasks:()=>Av5});function
Av5({isLoading:H,assistantMode:$,setMessages:q}){let
K=QD8.useRef(H);K.current=H;let
_=B9(),A=F6(),z=Ww();QD8.useEffect(()=>{if(!TZ()||R6())return;let
f=(M)=>Ez({value:_v5.resolveLoopDefaultFire(M),mode:"prompt",priority:"l
ater",isMeta:!0,workload:SSH}),Y=void
0,O=BC6({onFire:f,onFireTask:(M)=>{if(M.agentId){let
w=dr(M.agentId,_.getState().tasks);if(w&&!sI(w.status)){fmH(w.id,M.promp
t,z);return}E(
orphaned cron ${M.id}),l$H([M.id]);return}letClaude resuming /loop wakeup (${qV4(new
D=WB7(M.kind==="loop"?
Date)}):Running scheduled task (${qV4(new
Date)}));q((w)=>[...w,D]),f(M.prompt)},isLoading:()=>K.current,assistanopen in ${D}
tMode:$,getJitterConfig:t5H,isKilled:()=>!TZ(),getExtraTasks:$V4&&Y?()=>
$V4.getRoutineCronTasks(Z_(),Y):void 0});return
O.start(),()=>{O.stop()}},[$,q,_.getState,z])}function qV4(H){return
H.toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",min
ute:"2-digit"}).replace(/,? at |, /," ").replace(/
([AP]M)/,($,q)=>q.toLowerCase())}var QD8,_v5,$V4=null;var
_V4=T(()=>{ES();L$();h6();uT();eI();Yb();C4$();FC6();zb();$$();Q3();D6()
;K_H();QD8=u(JH(),1),_v5=(NmH(),S6(kmH))});var
OV4={};X$(OV4,{REPL:()=>QC6});function AV4(H){let
$=dD8.c(14),{showAllInTranscript:q,virtualScroll:K,searchBadge:_,suppres
sShowAll:A,status:z}=H,f=A===void 0?!1:A,Y=J1("app:toggleTranscript","Gl
obal","ctrl+o"),O=J1("transcript:toggleShowAll","Transcript","ctrl+e"),M
;if($[0]===Symbol.for("react.memo_cache_sentinel"))M=kc7(),$[0]=M;else
M=$[0];let D=M,w=D?:"open in${_$.arrowUp}${_$.arrowDown} scroll \xB7 [ to print output
editor",j;if($[1]===Symbol.for("react.memo_cache_sentinel"))j=A8.createE
lement(A8.Fragment,null,"Showing detailed transcript"),$[1]=j;else
j=$[1];let X;if($[2]!==Y)X=A8.createElement(A8.Fragment,null,Y," to
toggle"),$[2]=Y,$[3]=X;else X=$[3];let J=_?"n/N to
navigate":K?
\xB7 v to ${w}:f?v to ${w}:${O} to ${q?"collapse":"show
all"},L;if($[4]!==X||$[5]!==J)L=A8.createElement(V,{dimColor:!0},A8.cre${D} ${K}
ateElement(t$,null,j,X,J)),$[4]=X,$[5]=J,$[6]=L;else L=$[6];let
P;if($[7]===Symbol.for("react.memo_cache_sentinel"))P=A8.createElement(p
,{flexGrow:1}),$[7]=P;else P=$[7];let G;if($[8]!==_||$[9]!==z)G=A8.creat
eElement(Lv5,{status:z,searchBadge:_}),$[8]=_,$[9]=z,$[10]=G;else
G=$[10];let W;if($[11]!==L||$[12]!==G)W=A8.createElement(p,{noSelect:!0,
alignItems:"center",alignSelf:"center",borderTopDimColor:!0,borderBottom
:!1,borderLeft:!1,borderRight:!1,borderStyle:"single",marginTop:1,paddin
gLeft:2,width:"100%"},L,P,G),$[11]=L,$[12]=G,$[13]=W;else W=$[13];return
W}function Lv5(H){let $=dD8.c(6),{status:q,searchBadge:K}=H;if(q){let
A;if($[0]!==q)A=A8.createElement(V,null,q," "),$[0]=q,$[1]=A;else
A=$[1];return A}if(K){let A;if($[2]!==K.count||$[3]!==K.current)A=A8.cre
ateElement(V,{dimColor:!0},K.current,"/",K.count,"
"),$[2]=K.count,$[3]=K.current,$[4]=A;else A=$[4];return A}let
_;if($[5]===Symbol.for("react.memo_cache_sentinel"))_=A8.createElement(V
,{dimColor:!0},"verbose "),$[5]=_;else _=$[5];return _}function
Pv5({jumpRef:H,count:$,current:q,onClose:K,onCancel:_,setHighlight:A,ini
tialQuery:z}){let{query:f,cursorOffset:Y,handleKeyDown:O,handlePaste:M}=
z0({isActive:!0,initialQuery:z,onExit:()=>K(f),onCancel:_}),[D,w]=s$.use
State("building");s$.useEffect(()=>{let
L=!0,P=H.current?.warmSearchIndex;if(!P){w(null);return}return
w("building"),P().then((G)=>{if(!L)return;if(G<20)w(null);else
w({ms:G}),setTimeout(()=>L&&w(null),2000)}),()=>{L=!1}},[]);let
j=D!=="building";s$.useEffect(()=>{if(!j)return;H.current?.setSearchQuer
y(f),A(f)},[f,j]);let X=Y,J=X<f.length?f[X]:" ";return
A8.createElement(p,{borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,b
orderRight:!1,borderStyle:"single",marginTop:1,paddingLeft:2,tabIndex:0,
autoFocus:!0,onKeyDown:O,onPaste:M,width:"100%",noSelect:!0},A8.createEl
ement(V,null,"/"),A8.createElement(V,null,f.slice(0,X)),A8.createElement
(V,{inverse:!0},J),X<f.length&&A8.createElement(V,null,f.slice(X+1)),A8.
createElement(p,{flexGrow:1}),D==="building"?A8.createElement(V,{dimColo
r:!0},"indexing\u2026 "):D?A8.createElement(V,{dimColor:!0},"indexed in
",D.ms,"ms "):$===0&&f?A8.createElement(V,{color:"error"},"no matches
"):$>0?A8.createElement(V,{dimColor:!0},q,"/",$," "):null)}function
fV4(H){let $=dD8.c(6),{isAnimating:q,title:K,disabled:_,noPrefix:A}=H,z=
xY(),[f,Y]=s$.useState(0),O,M;if($[0]!==_||$[1]!==q||$[2]!==A||$[3]!==z)
O=()=>{if(_||A||!q||!z)return;let
w=setInterval(Gv5,Wv5,Y);return()=>clearInterval(w)},M=[_,A,q,z],$[0]=_,
$[1]=q,$[2]=A,$[3]=z,$[4]=O,$[5]=M;else
O=$[4],M=$[5];s$.useEffect(O,M);let D=q?YV4[f]??zV4:zV4;return
o_H(_?null:A?K:),null}function Gv5(H){return H(Zv5)}function[REPL:mount] REPL mounted, disabled=${P}
Zv5(H){return(H+1)%YV4.length}function
QC6({commands:H,debug:$,initialTools:q,initialMessages:K,pendingHookMess
ages:_,initialFileHistorySnapshots:A,initialContentReplacements:z,initia
lAgentName:f,initialAgentColor:Y,mcpClients:O,dynamicMcpConfig:M,autoCon
nectIdeFlag:D,strictMcpConfig:w=!1,systemPrompt:j,appendSystemPrompt:X,o
nBeforeQuery:J,onTurnComplete:L,disabled:P=!1,mainThreadAgentDefinition:
G,disableSlashCommands:W=!1,remoteSessionConfig:Z,directConnectConfig:v,
sshSession:k,thinkingConfig:N}){let
h=!!Z,R=s$.useMemo(()=>hH(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE
),[]),I=s$.useMemo(()=>!1,[]),C=s$.useMemo(()=>hH(process.env.CLAUDE_COD
E_DISABLE_VIRTUAL_SCROLL),[]),B=!1;s$.useEffect(()=>{return
E(),()=>E("[REPL:unmount] REPLapprove
unmounting")},[P]);let[x,S]=s$.useState(G),F=w$((j$)=>j$.toolPermission
Context),U=w$((j$)=>j$.verbose),g=w$((j$)=>j$.mcp),Q=w$((j$)=>j$.plugins
),i=w$((j$)=>j$.agentDefinitions),n=w$((j$)=>j$.initialMessage),o=Es(),$
H=w$((j$)=>j$.expandedView)==="tasks",r=w$((j$)=>j$.pendingWorkerRequest
),HH=w$((j$)=>j$.pendingSandboxRequest),t=w$((j$)=>j$.teamContext),fH=w$
((j$)=>j$.tasks),YH=w$((j$)=>j$.workerSandboxPermissions),XH=w$((j$)=>j$
.elicitation),s=w$((j$)=>j$.ultraplanPendingChoice),a=w$((j$)=>j$.ultrap
lanLaunchPending),KH=w$((j$)=>j$.viewingAgentTaskId),e=F6(),zH=KH?fH[KH]
:void 0,_H=xX(zH)&&zH.retain&&!zH.diskLoaded;s$.useEffect(()=>{if(!KH||!
_H)return;let j$=KH;VzH(hz(j$)).then((r$)=>{e((_8)=>{let
Hq=_8.tasks[j$];if(!xX(Hq)||Hq.diskLoaded||!Hq.retain)return _8;let
Eq=Hq.messages??[],OK=new Set(Eq.map((lK)=>lK.uuid)),qK=r$?r$.messages.f
ilter((lK)=>!OK.has(lK.uuid)):[];return{..._8,tasks:{..._8.tasks,[j$]:{.
..Hq,messages:[...qK,...Eq],diskLoaded:!0}}}})})},[KH,_H,e]);let
DH=B9(),OH=s$.useMemo(()=>$E(()=>DH.getState(),e),[DH,e]),LH=s$.useMemo(
()=>o0H(()=>DH.getState(),e),[DH,e]),jH=vi(),ZH=Zw(),[VH,WH]=s$.useState
(H);DG4(h?void 0:Z_(),WH);let
vH=w$((j$)=>j$.isBriefOnly),RH=s$.useMemo(()=>sZ(F),[F,vH]);nj7(),ij7();
let[BH,sH]=s$.useState(M),dH=s$.useCallback((j$)=>{sH(j$)},[sH]),[f$,O$]
=s$.useState("prompt"),[TH,CH]=s$.useState(!1),[mH,xH]=s$.useState(!1),[
aH,rH]=s$.useState(""),nH=s$.useRef(0),cH=s$.useRef(void
0),tH=s$.useRef(!1),{addNotification:v$,removeNotification:B$}=A7(),H8=w
v5,d$=fG4(O,g.clients),[iH,x$]=s$.useState(void
0),[FH,A$]=s$.useState(null),[kH,oH]=s$.useState(null),[M$,W$]=s$.useSta
te(!1),[AH,wH]=s$.useState(()=>{return!1}),uH=w$((j$)=>j$.showRemoteCall
out),[bH,eH]=s$.useState(()=>w04());aT4(),tT4(),iT4({ideSelection:iH,mcp
Clients:d$,ideInstallationStatus:kH}),F04({mcpClients:d$}),g04(),PT4(),Z
T4(),L58(),RT4(ZH),Ov4(),wv4(),xT4(ZH),mT4(),cT4(),UT4(),Mv5(),cZ4(),$04
(),z04(),c04(),Kv4();let{recommendation:SH,handleResponse:T$}=_T4(),{rec
ommendation:D$,handleResponse:c$}=MT4(),{pending:F$,handleAction:l8,skip
ForSession:E8}=Ov5(),U6=s$.useMemo(()=>{return[...RH,...q]},[RH,q]);$D8(
{enabled:!h}),PG4({enabled:!h});let z6=TO7();s$.useEffect(()=>{if(h)retu
rn;NT4(e)},[e,h]),s$.useEffect(()=>{let
j$=setTimeout(Bv4,500);return()=>clearTimeout(j$)},[]),O04(h?gC6:d$,F.mo
de),s$.useEffect(()=>{WE6(F.mode)},[F.mode]),L24(e,K,{enabled:!h});let
Mq=dz8(U6,g.tools,F),{tools:AK,allowedAgentTypes:U8}=s$.useMemo(()=>{if(
!x)return{tools:Mq,allowedAgentTypes:void 0};let
j$=Td(x,Mq,!1,!0);return{tools:j$.resolvedTools,allowedAgentTypes:j$.all
owedAgentTypes}},[x,Mq]),X6=s$.useRef(AK);X6.current=AK;let
IK=s$.useMemo(()=>{if(!MX())return AK;let j$=new Set(AK.map((_8)=>_8.nam
e)),r$=ifH().filter((_8)=>!j$.has(_8.name));return
r$.length>0?[...AK,...r$]:AK},[AK]),pK=iR6(VH,Q.commands),R4=iR6(pK,g.co
mmands),g6=s$.useMemo(()=>W?[]:R4,[W,R4]);Lw4(h?gC6:g.clients),vG4(h?gC6
:g.clients,x$);let[D9,w9]=s$.useState([]),[p1,l_]=s$.useState(null);s$.u
seEffect(()=>{if(p1&&!p1.isStreaming&&p1.streamingEndedAt){let
r$=30000-(Date.now()-p1.streamingEndedAt);if(r$>0){let
_8=setTimeout(l_,r$,null);return()=>clearTimeout(_8)}else l_(null)}},[p1
]);let[f4,pA]=s$.useState(null),B1=s$.useRef(null);B1.current=f4;let
SD=s$.useRef(null),uw=s$.useRef(()=>{}),__=s$.useRef(()=>{}),N3=s$.useRe
f(null),eX=s$.useRef(null),mw=s$.useRef(0),wA=s$.useRef(new vI6).current
,zf=s$.useSyncExternalStore(wA.subscribe,wA.getSnapshot),[A5,I_]=s$.useS
tate(Z?.hasInitialPrompt??!1),B7=zf||A5,[jA,q1]=s$.useState(void
0),N5=s$.useRef(0),K1=s$.useRef(!1),XA=s$.useRef(0),z5=s$.useRef(0),sY=s
$.useRef(null),dM=s$.useCallback(()=>{XA.current=Date.now(),z5.current=0
,sY.current=null},[]),Bj=s$.useRef(!1);if(zf&&!Bj.current)dM();Bj.curren
t=zf;let dO=s$.useCallback((j$)=>{if(I_(j$),j$)dM()},[dM]),tY=s$.useRef(
null),RD=s$.useRef(void 0),fY=s$.useRef(void
0),HJ=1500,[JA,Dz]=s$.useState(!1);s$.useEffect(()=>{if(oq())JOK().then(
(j$)=>{if(j$)v$({key:"tmux-mouse-hint",text:j$,priority:"low"})});LOK().
then((j$)=>{if(j$)v$({key:"tmux-focus-hint",text:j$,priority:"low"})})},
[]);let[cM,Fj]=s$.useState(!1);s$.useEffect(()=>{},[]);let[P8,Xq]=s$.use
State(null),WK=s$.useRef(null),oK=s$.useCallback((j$)=>{if(j$?.isLocalJS
XCommand){let{clearLocalJSX:r$,..._8}=j$;WK.current={..._8,isLocalJSXCom
mand:!0},Xq(_8);return}if(WK.current){if(j$?.clearLocalJSX){WK.current=n
ull,Xq(null);return}return}if(j$?.clearLocalJSX){Xq(null);return}Xq(j$)}
,[]),[aK,A_]=s$.useState(()=>new
Map),a1=s$.useCallback((j$)=>{A_((r$)=>sG4(r$,j$))},[]),[y4,Qq]=s$.useSt
ate([]),GK=s$.useMemo(()=>uD4(Qq),[Qq]),[b9,_9]=s$.useState(null),[cK,BA
]=s$.useState([]),[n9,yY]=s$.useState([]),pw=s$.useRef(new
Map),Uj=w$((j$)=>j$.settings.terminalTitleFromRename)!==!1,i5=s$.useSync
ExternalStore(LE6,()=>Uj?XD(y$()):void 0);s$.useEffect(()=>{return
XE6(()=>{let j$=IcH();if(!j$)return;e((r$)=>{if(r$.standaloneAgentContex
t?.name===j$)return r$;return{...r$,standaloneAgentContext:{...r$.standa
loneAgentContext,name:j$}}})})},[e]);let[f7,gj]=s$.useState(),CD=s$.useR
ef((K?.length??0)>0),K2=x?.agentType,_1=i5??K2??f7??"Claude
Code",r5=y4.length>0||n9.length>0||r||HH,y5=P8?.isLocalJSXCommand===!0&&
P8?.jsx!=null,bD=s$.useMemo(()=>Q48(fH),[fH]),$J=r5||y5?"waiting":B7||bD
?"busy":"idle",cO=s$.useMemo(()=>If4(fH),[fH]),qJ=$J==="idle"&&cO?"busy"
:$J,LA=$J==="busy";s$.useEffect(()=>{if($J==="busy")return
GD4(),()=>ZD4()},[$J]);let wz=$J!=="waiting"?void 0:y4.length>0?
${y4[0].tool.name}:r?"worker request":HH?"sandbox request":y5?"dialogrepinScroll(${r$},
open":"input
needed";s$.useEffect(()=>{BR$({status:qJ,waitingFor:wz})},[qJ,wz]);let
lO=P44(fH),kK=Zc$();s$.useEffect(()=>{XI7({tasks:lO.count,queued:kK,kind
s:lO.kinds})},[lO.count,kK,lO.kinds.join(",")]);let
y3=S$("tengu_terminal_sidebar",!1)&&(h$().showStatusInTerminalTab??!1),q
u=w$((j$)=>j$.postTurnSummary?.status_detail);Cg$(R||!y3?null:$J,qu),s$.
useEffect(()=>{return $vK(GK),()=>qvK()},[GK]);let[S9,iE]=s$.useState(K?
?[]),f5=s$.useRef(S9),k0=s$.useRef(!1),F7=s$.useCallback((j$)=>{let
r$=f5.current,_8=typeof j$==="function"?j$(f5.current):j$;if(f5.current=
_8,_8.length<N5.current)N5.current=0,K1.current=!1,q1(void 0);else
if(_8.length>r$.length&&K1.current){let
Hq=_8.length-r$.length;if((r$.length===0||_8[0]===r$[0]?_8.slice(-Hq):_8
.slice(0,Hq)).some(O_$))K1.current=!1;else N5.current=_8.length}iE(_8)},
[]),Bz=s$.useCallback((j$)=>F7((r$)=>sM8(r$,j$)),[F7]);eZ4(s$.useCallbac
k((j$)=>F7((r$)=>[...r$,K8({content:NA8(j$),isMeta:!0})]),[F7]));let
NP=s$.useCallback((j$)=>{if(j$!==void
0)N5.current=f5.current.length,K1.current=!0;else
K1.current=!1;q1(j$)},[]),{dividerIndex:yP,dividerYRef:_2,onScrollAway:C
v,onRepin:KN,jumpToNew:Bs,shiftDivider:lM}=Ze7(S9.length);oZ4(S9,F7,B7,m
w,!h);let[N0,UH]=s$.useState(null),lH=s$.useRef(N0);lH.current=N0;let
o$=s$.useRef(null),H$=s$.useMemo(()=>Te7(S9,yP),[yP,S9.length]),U$=s$.us
eCallback((j$=!1,r$="?")=>{if(!j$&&!x5("autoScrollEnabled",!0).value)ret
urn;let _8=N3.current;if(_8&&!_8.isSticky())E(
force=${j$}): yanking from scrollTop=${_8.getScrollTop()}
(max=${Math.max(0,_8.getScrollHeight()-_8.getViewportHeight())}));if(_8
?.scrollToBottom(),KN(),lH.current!==null)UH(null)},[KN]),h8=S9.at(-1),Z
8=h8!=null&&O_$(h8);s$.useEffect(()=>{if(Z8)U$(!1,"lastMsgIsHuman")},[Z8
,h8,U$]);let{maybeLoadOlder:b6}=Xv5,s6=s$.useCallback((j$,r$)=>{if(mw.cu
rrent=Date.now(),j$)KN();else Cv(r$)},[KN,Cv,b6]),k7=H24(_,F7),[Y5,F1]=s
$.useState(null);s$.useState(()=>{return fq8(gr8()),null});let
M7=s$.useRef(zq8()),i9=FX7(),n7=s$.useCallback(()=>Dz(!1),[]),V9=Ni(n7,H
J),Bf=s$.useRef(null),G_=s$.useCallback((j$)=>{if(H8(M7.current,j$))retu
rn;if(M7.current===""&&j$!==""&&Date.now()-mw.current>=Jv5)U$(!1,"typedI
ntoEmpty");M7.current=j$,fq8(j$),M6H.recordUserActivity(),kMH(!0);let
r$=j$.trim().length>0;if(Dz(r$),r$)V9();else
V9.cancel()},[Dz,U$,H8,V9]),[ff,nM]=s$.useState("prompt"),[KJ,rE]=s$.use
State(),xD=s$.useCallback((j$)=>{let r$=new
Set(j$.slash_commands);WH((_8)=>_8.filter((Hq)=>r$.has(Hq.name)||sy6.has
(Hq))),e((_8)=>_8.mainLoopModel===j$.model?_8:{..._8,mainLoopModel:j$.mo
del})},[WH,e]),[y0,_N]=s$.useState(new
Set),jR=s$.useCallback((j$)=>{_N((r$)=>{switch(j$.action){case"add":{let
_8=new Set(r$);for(let Hq of j$.ids)_8.add(Hq);return
_8}case"remove":{let _8=new Set(r$);for(let Hq of
j$.ids)_8.delete(Hq);return _8.size===r$.size?r$:_8}case"clear":return
r$.size>0?new Set:r$}})},[]),EP=s$.useRef(!1),E0=s$.useRef(0),oE=s$.useR
ef([]),EF=s$.useRef(0),mc=s$.useCallback((j$)=>{E0.current+=j$;let
r$=oE.current;if(j$>0&&r$.length>0){let
_8=r$.at(-1);if(_8.outputTokens==null)_8.lastTokenTime=Date.now(),_8.end
ResponseLength=E0.current}},[]),TvH=s$.useCallback(()=>{E0.current=0},[]
),uKH=s$.useCallback((j$)=>{if(j$.type==="start"){let
r$=Date.now(),_8=E0.current;oE.current.push({id:j$.id,ttftMs:j$.ttftMs,f
irstTokenTime:r$,lastTokenTime:r$,responseLengthBaseline:_8,endResponseL
ength:_8})}else{let r$=j$.id!=null?oE.current.find((_8)=>_8.id===j$.id):
oE.current.findLast((_8)=>_8.id==null);if(r$){if(r$.outputTokens=j$.outp
utTokens,r$.lastTokenTime=Date.now(),j$.id==null)E0.current=Math.max(E0.
current,r$.responseLengthBaseline+j$.outputTokens*4)}}},[]),hF=ZW4({conf
ig:Z,setMessages:F7,setIsLoading:dO,onInit:xD,setToolUseConfirmQueue:GK,
tools:U6,setStreamingToolUses:w9,setStreamMode:Pf$,setInProgressToolUseI
Ds:jR,recordApiMetricsEvent:uKH,permissionMode:F.mode}),Fs=kW4({config:v
,setMessages:F7,setIsLoading:dO,setToolUseConfirmQueue:GK,tools:U6,permi
ssionMode:F.mode}),IF=EW4({session:k,setMessages:F7,setIsLoading:dO,setT
oolUseConfirmQueue:GK,tools:U6,permissionMode:F.mode}),_J=s$.useMemo(()=
>IF.isRemoteMode?z_8("ssh",IF,!1):Fs.isRemoteMode?z_8("direct",Fs,!1):hF
.isRemoteMode?z_8("ccr",hF,Z?.viewerOnly??!1,Z?.sessionId):qG6,[IF,Fs,hF
,Z?.viewerOnly,Z?.sessionId]);s$.useEffect(()=>{let
j$=_J.isRemoteMode?_J:null,r$=_J.isRemoteMode&&_J.kind==="ccr"?"ccr-api"
:"local-jsonl",_8=uMH();if(_8.remote!==j$||_8.transcriptSource!==r$)zJ8(
{..._8,remote:j$,transcriptSource:r$})},[_J]);let[FA,DL]=s$.useState({})
,[XR,mKH]=s$.useState(0),[JR,bv]=s$.useState(null),pc=!(w$((j$)=>j$.sett
ings.prefersReducedMotion)??!1)&&!fXK(),LR=s$.useCallback((j$)=>{if(!pc)
return;bv(j$)},[pc]),vG=JR&&pc?JR.substring(0,JR.lastIndexOf(
9247 )+1)||null:null,[xv,Us]=s$.useState(0),[gs,Ku]=s$.useState(!1),[lOH,QsWorktree
: ]=s$.useState(void 0),[ds,pKH]=s$.useState(!1),[nOH,AN]=s$.useState(mOH.
randomUUID()),[SF,VG]=s$.useState(null),Bc=s$.useCallback((j$)=>{let
r$=XD4(j$,ZX);if(r$)VG(r$)},[]),BKH=s$.useRef(xv);BKH.current=xv;let[cs]
=s$.useState(()=>({current:eEK(K,z)})),[RF]=s$.useState(()=>({current:Xd
K(K??[])})),[Fc,AJ]=s$.useState(h$().hasAcknowledgedCostThreshold),[Uc,w
L]=s$.useState(!1),[E$,i8]=s$.useState(!1),Lq=s$.useRef("INSERT");s$.use
Effect(()=>{if(s&&Uc)wL(!1)},[s,Uc]);let
j9=xY(),A9=s$.useRef(j9);A9.current=j9;let[A1]=wK(),Xz=s$.useRef(!1),Bw=
s$.useCallback(()=>{if(Xz.current)return;Xz.current=!0;let
j$=f5.current.slice(Qc.current);for(let r$ of o_6(j$))QKH.current.add(r$
);Qc.current=f5.current.length,J04({theme:A1,readFileState:CF.current,ba
shTools:QKH.current}).then(async(r$)=>{if(r$){let _8=await
r$.content({theme:A1});e((Hq)=>({...Hq,spinnerTip:_8})),L04(r$)}else
e((_8)=>{if(_8.spinnerTip===void 0)return
_8;return{..._8,spinnerTip:void
0}})})},[e,A1]),PA=s$.useCallback(()=>{dO(!1),NP(void 0),E0.current=0,oE
.current=[],EF.current++,bv(null),w9([]),d36(),Pf$("responding"),Bw(),ir
(),ro$()},[Bw]),jL=s$.useMemo(()=>ZWH(fH).some((j$)=>j$.status==="runnin
g"),[fH]);s$.useEffect(()=>{if(!jL&&tY.current!==null){let
j$=Date.now()-tY.current,r$=RD.current;tY.current=null,RD.current=void
0,F7((_8)=>[..._8,F26(j$,r$,q6(_8,eqH))])}},[jL,F7]);let A2=s$.useRef(!1
);s$.useEffect(()=>{{if(F.mode!=="auto"){A2.current=!1;return}if(A2.curr
ent)return;if((h$().autoPermissionsNotificationCount??0)>=3)return;let
_8=setTimeout((Hq,Eq)=>{Hq.current=!0,a$((OK)=>{let
qK=OK.autoPermissionsNotificationCount??0;if(qK>=3)return OK;return{...O
K,autoPermissionsNotificationCount:qK+1}}),Eq((OK)=>[...OK,Az(MM8,"warni
ng")])},800,A2,F7);return()=>clearTimeout(_8)}},[F.mode,F7]);let glH=s$.
useRef(!1),iOH=s$.useRef(!1);s$.useEffect(()=>{if(iOH.current)return;let
j$=$z();if(!j$?.creationDurationMs||j$.usedSparsePaths)return;if(j$.cre
ationDurationMs<15000)return;iOH.current=!0;let
r$=Math.round(j$.creationDurationMs/1000);F7((_8)=>[..._8,Az(
creation took ${r$}s. For large repos, set \worktree.sparsePaths\ in
.claude/settings.json to check out only the directories you need \u2014
e.g. \{"worktree": {"sparsePaths": ["src",.
"packages/foo"]}}\,"info")])},[F7]);let{onBeforeQuery:FKH,onTurnCompltoolJsxDialog\u2192${ns}
ete:vvH,onSessionRestored:UKH,render:sJ$,ownsInput:VvH}=RW4({enabled:I,s
etMessages:F7,setInputValue:G_,setToolJSX:oK,resultDedupState:RF.current
}),rOH=(!P8||P8.showSpinner===!0)&&y4.length===0&&n9.length===0&&(B7||jA
||jL||Zc$()>0)&&!r&&(!vG||vH),ls=y4.length>0||n9.length>0||cK.length>0||
XH.queue.length>0||YH.queue.length>0;yD4({sandboxHost:cK[0]?.hostPattern
.host,promptTitle:n9[0]?.title,elicitationServer:XH.queue[0]?.serverName
,workerSandboxHost:YH.queue[0]?.host});let oOH=LZ4({hasActivePrompt:ls,o
therSurveyActive:!1}),gKH=GZ4(S9,B7,ls,{enabled:!h}),h0=XZ4(S9,B7,ls,{en
abled:!h,otherSurveyActive:oOH.state!=="closed"||gKH.state!=="closed"}),
kvH=fZ4(S9,B7,XR,"session",ls,oOH.state!=="closed"||gKH.state!=="closed"
||h0.state!=="closed"),uv=Nv4(S9,XR),QlH=s$.useMemo(()=>({...kvH,handleS
elect:(j$)=>{if(hvH.current=!1,kvH.handleSelect(j$),j$==="bad"&&Lv4("fee
dback_survey_bad"))dKH("feedback_survey_bad"),hvH.current=!0}}),[kvH]),t
J$=Yv5(S9,B7,ls,oOH.state!=="closed"||QlH.state!=="closed"||gKH.state!==
"closed"||h0.state!=="closed");lG4({autoConnectIdeFlag:D,ideToInstallExt
ension:FH,setDynamicMcpConfig:sH,setShowIdeOnboarding:W$,setIDEInstallat
ionState:oH}),R04(A,(j$)=>e((r$)=>({...r$,fileHistory:j$})));let
eJ$=s$.useCallback(async(j$,r$,_8)=>{let Hq=performance.now();try{let
Eq=Rf$(r$.messages),OK=UM$();await
A0H("resume",{getAppState:()=>DH.getState(),setAppState:e,signal:AbortSi
gnal.timeout(OK)});let{agentDefinition:qK}=_vH(r$.agentSetting,G,i);S(qK
),e((U1)=>({...U1,agent:qK?.agentType}));let lK=await
Sb("resume",{sessionId:j$,agentType:qK?.agentType,model:ZH});if(Eq.push(
...lK),_8==="fork")XFK(r$,LW(j$));else fr$(r$,LW(j$));if(r$.fileHistoryS
napshots)q68(r$);if(e((U1)=>({...U1,standaloneAgentContext:MJ$(r$.agentN
ame,r$.agentColor)})),LV(r$.agentName),$L$(Eq,r$.projectPath??K6()),_8!=
="fork")tOH.current.current=u3$(Eq,U6);PA(),pA(null),AN(j$);let
$q=D46(j$);s1$(),SVH(),b0(LW(j$),r$.fullPath?cD8.dirname(r$.fullPath):nu
ll);let{renameRecordingForSession:Y7}=await Promise.resolve().then(() =>
(YJ$(),SG4));if(await Y7(),await
oB(),OJ$(r$,e),FM$(),Ps(r$),CD.current=!0,gj(void
0),_8!=="fork")CG4(r$.worktreeSession===void
0?r$.projectPath:r$.worktreeSession?.worktreePath),DJ$(r$.worktreeSessio
n,r$.projectPath),Ls(),yO6({abortController:new AbortController,taskRegi
stry:OH}),Kl(DN().map((U1)=>U1.id)),eR6(Eq);else{let
U1=$z();if(U1)FS(U1)}if($q)lnH($q);if(cs.current&&_8!=="fork")cs.current
=Bl$(Eq,r$.contentReplacements??[]);if(F7(()=>Eq),oK(null),G_(""),_8!=="
fork")Bc(Eq);d("tengu_session_resumed",{entrypoint:_8,success:!0,resume_
duration_ms:Math.round(performance.now()-Hq)})}catch(Eq){throw
d("tengu_session_resumed",{entrypoint:_8,success:!1,failure_reason:"proc
essing_error",error_name:n8(Eq).name}),Eq}},[PA,e,OH,Bc]),[gc]=s$.useSta
te(()=>wb(Np)),CF=s$.useRef(gc),QKH=s$.useRef(new
Set),Qc=s$.useRef(0),dlH=s$.useRef(new Set),clH=s$.useRef(new
Map),NvH=s$.useRef(new Set),aOH=s$.useRef(new Map),yvH=s$.useRef(void
0),sOH=s$.useRef(AAH()),HL$=s$.useRef(X5$()),tOH=s$.useRef($gH()),$L$=s$
.useCallback((j$,r$)=>{let
_8=MpH(j$,r$,Np);CF.current=zxH(CF.current,_8);for(let Hq of
o_6(j$))QKH.current.add(Hq)},[e]);s$.useEffect(()=>{if(K&&K.length>0)$L$
(K,K6()),yO6({abortController:new AbortController,taskRegistry:OH}),eR6(
K),Bc(K),tOH.current.current=u3$(K,U6),UKH(K)},[]);let{status:qL$,reveri
fy:EvH}=q24(),[_u,dKH]=s$.useState(null),hvH=s$.useRef(!1),[llH,nlH]=s$.
useState(null),[ilH,rlH]=s$.useState(!1),olH=!B7&&ds;function
eOH(){if(ilH||llH)return;if(gs)return"message-selector";if(JA)return;if(
cK[0])return"sandbox-permission";let
j$=!P8||P8.shouldContinueAnimation;if(j$&&y4[0])return"tool-permission";
if(j$&&n9[0])return"prompt";if(j$&&YH.queue[0])return"worker-sandbox-per
mission";if(j$&&XH.queue[0])return"elicitation";if(j$&&olH)return"cost";
if(j$&&SF)return"resume-return";if(j$&&!B7&&s)return"ultraplan-choice";i
f(j$&&!B7&&a)return"ultraplan-launch";if(k4()){if(j$&&uH)return"remote-c
allout";return}if(j$&&M$)return"ide-onboarding";if(j$&&uH)return"remote-
callout";if(j$&&SH)return"lsp-recommendation";if(j$&&D$)return"plugin-hi
nt";if(j$&&bH)return"desktop-upsell";return}let
Jz=eOH(),KL$=JA&&(cK[0]||y4[0]||n9[0]||YH.queue[0]||XH.queue[0]||olH);fY
.current=Jz,s$.useEffect(()=>{if(!B7)return;let j$=Jz==="tool-permission
",r$=Date.now();if(j$&&sY.current===null)sY.current=r$;else if(!j$&&sY.c
urrent!==null)z5.current+=r$-sY.current,sY.current=null},[Jz,B7]);let
alH=s$.useRef(Jz),UA=s$.useRef(null);s$.useLayoutEffect(()=>{let
j$=alH.current==="tool-permission",r$=Jz==="tool-permission";if(alH.curr
ent=Jz,j$===r$)return;let _8=N3.current;if(r$)UA.current=_8&&!_8.isStick
y()?_8.getScrollTop():null,U$(!0,"permissionDialogAppear");else
if(UA.current!==null)_8?.scrollTo(UA.current),UA.current=null;else
U$(!0,"permissionDialogDismiss")},[Jz,U$]);let
ns=P8?.jsx!=null,_L$=s$.useRef(ns);s$.useLayoutEffect(()=>{if(_L$.curren
t!==ns&&(N3.current?.isSticky()??!0))U$(!1,);_[onCancel]
L$.current=ns},[ns,U$]);function
IvH(){if(Jz==="elicitation")return;if(E(
focusedInputDialog=${Jz} streamMode=${Pd.getState().mode}),wA.forceEnd(Allow
),JR?.trim())F7((j$)=>[...j$,Pw({content:JR})]);if(PA(),Jz==="tool-permi
ssion")y4[0]?.onAbort(),GK([]);else if(Jz==="prompt"){for(let j$ of
n9)j$.reject(Error("Prompt cancelled by
user"));yY([]),f4?.abort("user-cancel")}else
if(_J.isRemoteMode)_J.cancelRequest();else
f4?.abort("user-cancel");pA(null),vvH(f5.current,!0)}let
AL$=s$.useCallback(()=>{let j$=vc$(M7.current,0);if(!j$)return;if(G_(j$.
text),nM("prompt"),j$.images.length>0)DL((r$)=>{let _8={...r$};for(let
Hq of j$.images)_8[Hq.id]=Hq;return
_8})},[G_,nM,DL]),zL$={setToolUseConfirmQueue:GK,onCancel:IvH,getConnect
ionSummary:()=>SD.current?.summary(),onAgentsKilled:()=>F7((j$)=>[...j$,
ZB7()]),isMessageSelectorVisible:gs||!!Uc,screen:f$,abortSignal:f4?.sign
al,isExternalLoading:A5,popCommandFromQueue:AL$,isLocalJSXCommand:P8?.is
LocalJSXCommand,isInputOverlayActive:E$,inputMode:ff,isInputEmpty:i9};s$
.useEffect(()=>{if(h)return;if(LL()>=5&&!ds&&!Fc){if(d("tengu_cost_thres
hold_reached",{}),AJ(!0),YS$())pKH(!0)}},[S9,ds,Fc]);let
hw8=s$.useCallback(async(j$)=>{let r$=DH.getState(),{mode:_8,isBypassPer
missionsModeAvailable:Hq}=r$.toolPermissionContext;switch(GV$(_8,Hq)){ca
se"allow":return!0;case"deny":return!1;case"classify":return
C68(j$.host,j$.port,f5.current,X6.current,r$.toolPermissionContext,new
AbortController().signal);case"ask":break}if(yK()&&R_$()){let
OK=vQK(),qK=await VQK(j$.host,OK);return new
Promise((lK)=>{if(!qK){BA(($q)=>[...$q,{hostPattern:j$,resolvePromise:lK
}]);return}EQK({requestId:OK,host:j$.host,resolve:lK}),e(($q)=>({...$q,p
endingSandboxRequest:{requestId:OK,host:j$.host}}))})}return new
Promise((OK)=>{let qK=!1;function lK($q){if(qK)return;qK=!0,OK($q)}BA(($
q)=>[...$q,{hostPattern:j$,resolvePromise:lK}]);{let
$q=DH.getState().replBridgePermissionCallbacks;if($q){let Y7=mOH.randomU
UID();$q.sendRequest(Y7,yD8,{host:j$.host},mOH.randomUUID(),
network connection to ${j$.host}?);let
U1=$q.onResponse(Y7,(Lz)=>{U1();let
_O=Lz.behavior==="allow";BA((Fw)=>{return
Fw.filter((Uw)=>Uw.hostPattern.host===j$.host).forEach((Uw)=>Uw.resolveP
romise(_O)),Fw.filter((Uw)=>Uw.hostPattern.host!==j$.host)});let
NG=pw.current.get(j$.host);if(NG){for(let Fw of
NG)Fw();pw.current.delete(j$.host)}}),iM=()=>{U1(),$q.cancelRequest(Y7)}
,R9=pw.current.get(j$.host)??[];R9.push(iM),pw.current.set(j$.host,R9)}}
})},[e,DH]);if(s$.useEffect(()=>{let j$=E6.getSandboxUnavailableReason()
;if(!j$)return;if(E6.isSandboxRequired()){process.stderr.write(
9248: Error: sandbox required but unavailable: ${j$}
9249 + sandbox.failIfUnavailable is set \u2014 refusing to start without
: a working sandbox.
9250:
- <anonymous> (/$bunfs/root/src/entrypoints/cli.js:9247:5663)
- JR (/$bunfs/root/src/entrypoints/cli.js:492:63749)
- Bw (/$bunfs/root/src/entrypoints/cli.js:492:76948)
- Xz (/$bunfs/root/src/entrypoints/cli.js:492:76827)
- Bw (/$bunfs/root/src/entrypoints/cli.js:492:76926)
- Xz (/$bunfs/root/src/entrypoints/cli.js:492:76827)
- Bw (/$bunfs/root/src/entrypoints/cli.js:492:77745)
- Xz (/$bunfs/root/src/entrypoints/cli.js:492:76827)
- Bw (/$bunfs/root/src/entrypoints/cli.js:492:76926)
- Xz (/$bunfs/root/src/entrypoints/cli.js:492:76827)
What Should Happen?
Calude does not crash when resuming a sandboxed session
Error Messages/Logs
Steps to Reproduce
- create a claude session
- /tui fullscreen
- /sandbox
- select 1
- exit
- restart with 'claude --resume'
- crash
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.120
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗