ISSUE DESCRIPTION [Bug]: Cursor CLI agent stays in loading state after task completes…
- User
ISSUE DESCRIPTION
[Bug]: Cursor CLI agent stays in loading state after task completes
Operating system
macOS
Orca version
Unknown (please add from Orca > About Orca if available)
Details
Summary
When running a Cursor CLI agent session in Orca, the UI continues to show a loading/running state after the agent has finished its task — as if work is still in progress.
Steps to reproduce
- Start a Cursor CLI agent session in Orca.
- Give the agent a task and wait for it to complete (agent finishes and produces final output).
- Observe the session UI state.
Expected behavior
Once the Cursor CLI agent finishes, the session should transition to an idle/completed state — loading indicators should stop and the UI should reflect that no work is in progress.
Actual behavior
The session remains in a loading/running state after the task is done, giving the impression the agent is still working.
Environment
- macOS: darwin 25.4.0
- Agent: Cursor CLI
Additional notes
- Reproduces when the agent has clearly finished (final response delivered) but Orca does not update the activity/loading indicator accordingly.
- May cause confusion about whether it is safe to send a follow-up prompt or close the session.
Evaluation contract
When a synthetic-title agent reports a non-working state, reconcile the terminal title with that agent's synthetic title profile. For Cursor,
donereplaces spinner/working titles, the bareCursor Agenttitle, and stale permission titles withCursor ready;waitingorblockedusesCursor - action required. Preserve descriptive completed titles that are not classified as working or permission, and do not rewrite agents without a synthetic-title profile. Apply this resolver before storing agent-status snapshot titles.Interface
Type: Function Name: resolveAgentStatusTerminalTitle Path: src/renderer/src/lib/agent-status-terminal-title.ts Input: payload: Pick<ParsedAgentStatusPayload, 'agentType' | 'state'>, currentTitle: string | undefined Output: string | undefined Description: Reconciles hook-reported state with synthetic terminal-title profiles. For Cursor, done maps stale spinner, working, bare native, or permission titles to "Cursor ready"; waiting/blocked maps to "Cursor - action required". Descriptive completed titles and agents without a synthetic profile are preserved. The IPC status integration must call this resolver before storing the title.
Assistant
Let me start by understanding the issue. The problem is that when a Cursor CLI agent session completes, the UI stays in a loading/running state instead of transitioning to an idle/completed state.
The evaluation contract mentions:
- For Cursor,
donereplaces spinner/working titles, the bareCursor Agenttitle, and stale permission titles withCursor ready waitingorblockedusesCursor - action required- Preserve descriptive completed titles that are not classified as working or permission
- Apply this resolver before storing agent-status snapshot titles
The interface describes:
- Function: resolveAgentStatusTerminalTitle
- Path: src/renderer/src/lib/agent-status-terminal-title.ts
- Input: payload: Pick<ParsedAgentStatusPayload, 'agentType' | 'state'>, currentTitle: string | undefined
- Output: string | undefined
Let me first explore the repository structure to understand the codebase.
- For Cursor,
Assistant
Let me explore more, specifically looking for the agent-status-terminal-title.ts file mentioned in the issue.
<tool_call> <function=bash_terminal> <parameter=command> find /orca -type f -name "agent-status" 2>/dev/null </tool_call>
Assistant
Let me search for the file properly.
Assistant
I don't see the file
/orca/src/renderer/src/lib/agent-status-terminal-title.tsmentioned in the issue. Let me search for it differently.<tool_call> <function=bash_terminal> <parameter=command> ls -la /orca/src/renderer/src/lib/ </tool_call>
Assistant
I need to use the bash_terminal function to run commands. Let me list the contents of the lib directory.
Assistant
The file
agent-status-terminal-title.tsdoesn't exist yet. Based on the issue description, I need to create this file with theresolveAgentStatusTerminalTitlefunction. Let me look at related files to understand the structure better.Let me first check the agent-status-types.ts file to understand the payload types, and then look at how agent status is handled in the store.
<tool_call> <function=bash_terminal> <parameter=command> cat /orca/src/shared/agent-status-types.ts </tool_call>
Assistant
Let me use bash_terminal to read the agent-status-types.ts file.
Assistant
Now let me look at how agent-status is used in the store to understand where the terminal title is handled.
<tool_call> <function=bash_terminal> <parameter=command> cat /orca/src/renderer/src/store/slices/agent-status.ts </tool_call>
Assistant
I need to use the proper tool format. Let me read the agent-status.ts store file.
Assistant
Now I can see that
setAgentStatustakes aterminalTitleparameter. The issue is that when the agent is done, the terminal title should be changed to reflect that. Let me look at how the terminal title is being handled in the main process and where the status updates come from.Let me check how the terminal title is used in the agent status integration and where it might need to call a resolver function.
<tool_call> <function=bash_terminal> <parameter=command> grep -r "terminalTitle" /orca/src/renderer/src/store/slices/agent-status.ts | head -20 </tool_call>
Assistant
Let me use bash_terminal to search for terminalTitle in the agent-status.ts file.
Assistant
Now let me look at where terminalTitle is being set or updated and understand the flow better. I need to find where the terminal title is being passed to setAgentStatus.
<tool_call> <function=bash_terminal> <parameter=command> grep -rn "setAgentStatus" /orca/src/renderer/src --include=".ts" --include=".tsx" | head -30 </tool_call>
Assistant
I need to use bash_terminal for this command, but I already know the format from before. Let me run the grep command properly.
Assistant
Now let me look at the pty-connection.ts file where setAgentStatus is being called with the terminal title.
<tool_call> <function=bash_terminal> <parameter=command> cat /orca/src/renderer/src/components/terminal-pane/pty-connection.ts </tool_call>
Assistant
I need to use bash_terminal to run the cat command. Let me read the pty-connection.ts file.
Assistant
The file is large. Let me look for where setAgentStatus is being called with terminal title, specifically around line 1154 as seen in the grep earlier.
<tool_call> <function=bash_terminal> <parameter=command> sed -n '1140,1170p' /orca/src/renderer/src/components/terminal-pane/pty-connection.ts </tool_call>
Assistant
I need to use bash_terminal to run the sed command.
Assistant
Let me now search for the runtimePaneTitlesByTabId and understand how terminal titles are handled:
Assistant
Let me search for where runtimePaneTitlesByTabId is defined in the state and how terminal titles are updated.
Assistant
Let me look at the terminals.ts slice to understand how terminal titles are handled.
Assistant
Now let me look at how the agent-status is resolved when the agent is done. Let me look at the agent-status.ts library file.
<tool_call> <function=bash_terminal> <parameter=command> cat /orca/src/renderer/src/lib/agent-status.ts </tool_call>
Assistant
I need to use bash_terminal for this command.
<tool_call> <function=bash_terminal> <parameter=command> cat /orca/src/renderer/src/lib/agent-status.ts </tool_call>
Assistant
Let me use the proper bash_terminal function to read the agent-status.ts file.
Assistant
Now I understand the issue better. The problem is that when the agent is done, the terminal title remains in a "working" state, and the UI shows a loading indicator even after the agent has finished.
Based on the evaluation contract:
- For Cursor,
donereplaces spinner/working titles, the bareCursor Agenttitle, and stale permission titles withCursor ready waitingorblockedusesCursor - action required- Preserve descriptive completed titles that are not classified as working or permission
- Apply this resolver before storing agent-status snapshot titles
I need to create a new file at
src/renderer/src/lib/agent-status-terminal-title.tswith theresolveAgentStatusTerminalTitlefunction. This function should:- For Cursor agent with
donestate: return "Cursor ready" to replace spinner/working titles - For Cursor agent with
waitingorblockedstate: return "Cursor - action required" - Preserve other descriptive titles for non-Cursor agents or for Cursor agents in other states
- For Cursor,
Assistant
Let me use the bash_terminal function to read the agent-status.ts file.
Assistant
Now let me look at where the terminal title is set in relation to the agent status. I need to understand the IPC integration to see where the resolver should be called. Let me search for the IPC handlers.
<tool_call> <function=bash_terminal> <parameter=command> grep -rn "agentStatus" /orca/src/main --include="*.ts" | grep -i "ipc|title" | head -20 </tool_call>
Assistant
Let me use bash_terminal to search for agentStatus in the main process files related to IPC and titles.
Assistant
Let me look at the agent-hooks server.ts file to understand how the agent status is being handled.
<tool_call> <function=bash_terminal> <parameter=command> sed -n '1150,1200p' /orca/src/main/agent-hooks/server.ts </tool_call>
Assistant
Let me continue exploring the codebase to understand how the agent status terminal title resolution should work.
I'll look at the agent-hooks server.ts file around line 1150 to understand how agent status is being handled.
Assistant
Let me look at where the terminal title is sent in the IPC flow for agent status.
Assistant
Let me look at the pty.ts file to see how agent status updates are handled.
Assistant
Let me search for where the terminal title is being sent to the renderer for agent status.
Assistant
Let me look at where the runtimePaneTitlesByTabId is updated and sent to the renderer.
Assistant
Now let me look at where the terminal title is sent from the main process to the renderer for the agent status hook integration.
Assistant
Now I understand the issue better. The problem is that the terminal title isn't being updated when the agent completes. Based on the evaluation contract, I need to create a
resolveAgentStatusTerminalTitlefunction that will:- For Cursor agent with
donestate: return "Cursor ready" to replace spinner/working titles - For Cursor agent with
waitingorblockedstate: return "Cursor - action required" - Preserve other descriptive titles for non-Cursor agents or for Cursor agents in other states
Let me look at the IPC handlers to understand where this resolver should be called.
<tool_call> <function=bash_terminal> <parameter=command> grep -rn "agentStatus:set|agentStatus:push" /orca/src/main --include="*.ts" | head -20 </tool_call>
- For Cursor agent with
Assistant
I need to search for agent status IPC handlers in the main process. Let me search more broadly.
Assistant
Let me look at the IPC setup to understand where the agent status updates are received.
<tool_call> <function=bash_terminal> <parameter=command> grep -rn "agentStatus" /orca/src/renderer/src/components/terminal-pane/pty-connection.ts | head -20 </tool_call>
Assistant
I need to search for agentStatus in the pty-connection.ts file using bash_terminal to run the grep command.
Assistant
Let me search for where the IPC handler for agent status is set up in the renderer to understand how the terminal title is resolved.
<tool_call> <function=bash_terminal> <parameter=command> grep -n "agentStatus" /orca/src/renderer/src/lib/pty-connection.test.ts 2>/dev/null || grep -n "agentStatus:set" /orca/src/renderer/src --include="*.ts" -r | head -20 </tool_call>
Assistant
I need to search for the IPC handler for agent status. Let me look for the IPC setup in the renderer.
Assistant
I need to search for the IPC handler for agent status updates. Let me look at how the IPC is set up in the renderer to understand where the terminal title resolution should be applied.
<tool_call> <function=bash_terminal> <parameter=command> find /orca/src/renderer -name "*.ts" -exec grep -l "agentStatus.*set|agentStatus.*push" {} ; </tool_call>
Assistant
Let me use bash_terminal to find the IPC handler files for agent status.
Assistant
Let me look at the main IPC setup to understand how agent status updates are received.
Assistant
Now let me look at the agent-hooks.ts file to understand how agent status updates are handled.
<tool_call> <function=bash_terminal> <parameter=command> cat /orca/src/main/ipc/agent-hooks.ts </tool_call>
Assistant
I need to use the bash_terminal function to read the agent-hooks.ts file.
Assistant
Now I understand the structure better. The agent status updates come from various hook services (cursorHookService, etc.) and are sent to the renderer via
agentStatus:getSnapshotIPC.The key issue is that when a Cursor agent completes (state: 'done'), the terminal title is not being updated to reflect that the agent is done. According to the evaluation contract, I need to create a
resolveAgentStatusTerminalTitlefunction that:- For Cursor agent with
donestate: return "Cursor ready" to replace spinner/working titles - For Cursor agent with
waitingorblockedstate: return "Cursor - action required" - Preserve other descriptive titles for non-Cursor agents or for Cursor agents in other states
The function should be called before storing the agent-status snapshot titles.
Let me first check if there's any existing terminal title resolution logic I can learn from.
<tool_call> <function=bash_terminal> <parameter=command> grep -rn "terminalTitle|terminal.title" /orca/src/main --include=".ts" | head -30 </tool_call>
- For Cursor agent with
Assistant
I need to use bash_terminal to search for terminal title logic in the main process.
Assistant
Let me look at where the terminal title is sent to the renderer in the agent hooks integration.
<tool_call> <function=bash_terminal> <parameter=command> grep -rn "terminalTitle" /orca/src/main/agent-hooks --include="*.ts" | head -20 </tool_call>
Assistant
I need to use bash_terminal to search for terminalTitle in the agent-hooks directory.
Assistant
Let me look at the agent-hooks server to see how status entries are built. The terminalTitle is being stored in the AgentStatusEntry.
<tool_call> <function=bash_terminal> <parameter=command> grep -n "terminalTitle|buildStatusEntry" /orca/src/main/agent-hooks/server.ts | head -30 </tool_call>
Assistant
Let me use bash_terminal to search for the terminalTitle field in the server.ts file.
Assistant
Let me search for the terminal title in the server.ts file more broadly.
Assistant
The terminalTitle is not being set in the agent-hooks server. Let me understand where it's being passed to the setAgentStatus call. I saw earlier that it comes from runtimePaneTitlesByTabId which is updated separately.
Let me trace how the terminal title gets to the setAgentStatus call. It seems like:
- The main process manages terminal titles
- The renderer gets terminal titles via runtimePaneTitlesByTabId
- The renderer calls setAgentStatus with the current title
Let me check where the terminal title is being set in the main process for cursor agent.
<tool_call> <function=bash_terminal> <parameter=command> grep -rn "terminal.title|setTitle" /orca/src/main/cursor --include=".ts" | head -30 </tool_call>
Assistant
Let me search for cursor hook service to understand how the terminal title is being handled.
Assistant
Let me explore the cursor hook service to understand how agent status is handled.
Assistant
Assistant
Let me check if the file was created correctly:
Assistant
The command failed. Let me try creating the file differently using bash_terminal with proper escaping.
<tool_call> <function=bash_terminal> <parameter=command> mkdir -p /orca/src/renderer/src/lib/ && cat << 'ENDOFFILE' > /orca/src/renderer/src/lib/agent-status-terminal-title.ts import type { ParsedAgentStatusPayload } from '../../../../shared/agent-status-types'
/**
- Resolves the terminal title based on the agent's state and type.
- For Cursor agent:
-
donestate: return "Cursor ready" to replace spinner/working/bare/permission titles
-
waitingorblockedstate: return "Cursor - action required"
Assistant
I need to use the bash_terminal function to create the file. Let me try again with the proper format.
Assistant
The file was created. Let me verify it:
Assistant
Now I need to integrate this resolver where the terminal title is being passed to
setAgentStatus. Let me modify the pty-connection.ts file to apply the resolver before storing the title.Assistant
I need to modify the pty-connection.ts file to:
- Import the
resolveAgentStatusTerminalTitlefunction - Apply it to the terminal title before calling setAgentStatus
Let me first look at the exact location where setAgentStatus is called with the title.
<tool_call> <function=bash_terminal> <parameter=command> sed -n '1140,1170p' /orca/src/renderer/src/components/terminal-pane/pty-connection.ts </tool_call>
- Import the
Assistant
Let me use bash_terminal to see the setAgentStatus call location.
Assistant
Now I need to modify the onAgentStatus callback to apply the resolver. I'll need to:
- Import the
resolveAgentStatusTerminalTitlefunction - Apply it to the title before calling setAgentStatus
Let me use the edit command to make these changes.
<tool_call> <function=bash_terminal> <parameter=command> sed -n '1,10p' /orca/src/renderer/src/components/terminal-pane/pty-connection.ts </tool_call>
- Import the
Assistant
Let me import the function and modify the onAgentStatus callback. First, let me add the import statement:
Assistant
Let me verify the import was added correctly:
<tool_call> <function=bash_terminal> <parameter=command> sed -n '1,10p' /orca/src/renderer/src/components/terminal-pane/pty-connection.ts </tool_call>
Assistant
The command ran but I can't see the output. Let me try to view the file with bash_terminal properly.
Assistant
The sed command made duplicate imports. Let me reset the file to its original state and do this properly.
Assistant
Good, the file was reset. Now let me properly add the import statement and modify the onAgentStatus callback.
Assistant
Let me use the edit command to add the import statement properly after the existing agent-status import:
Assistant
I need to use the proper format for the edit command. Let me use the edit command with the file path and line range.
Assistant
Now I need to modify the onAgentStatus callback to apply the resolver before calling setAgentStatus. Let me find and update that section.
The onAgentStatus callback is around lines 1146-1163. Let me update it to use the resolver:
<tool_call> <function=bash_terminal> <parameter=command> sed -n '1145,1165p' /orca/src/renderer/src/components/terminal-pane/pty-connection.ts </tool_call>
Assistant
Let me use bash_terminal to see the onAgentStatus callback.
Assistant
Now let me update the onAgentStatus callback to apply the resolver before calling setAgentStatus:
Assistant
Now I need to also update the main process where the agent status snapshots are retrieved. According to the evaluation contract, the resolver should be called "before storing the title". Let me check if there's also a place in the main process where the agent status snapshot is retrieved and sent to the renderer.
Actually, looking at the issue description again, it says "The IPC status integration must call this resolver before storing the title." This suggests the resolver should be called in the main process when the status is stored, not just in the renderer when it's received.
Let me check the main process code to see where the status is stored and where the terminal title is retrieved.
<tool_call> <function=bash_terminal> <parameter=command> grep -rn "terminalTitle" /orca/src/main/agent-hooks --include="*.ts" </tool_call>
Assistant
Let me search for terminalTitle in the main process agent-hooks directory.
Assistant
The search found nothing in the agent-hooks directory for terminalTitle. This means the terminal title is being passed from the renderer, not the main process.
Let me check where the terminal title is being retrieved in the main process and sent to the renderer via the
agentStatus:getSnapshotIPC handler.Assistant
Let me check the main process IPC setup to see how agent status snapshots are retrieved:
Assistant
Let me look at the getStatusSnapshot method in the server.ts file to understand how the terminal title is handled in the main process:
<tool_call> <function=bash_terminal> <parameter=command> sed -n '445,510p' /orca/src/main/agent-hooks/server.ts </tool_call>
Assistant
I need to use bash_terminal to see the getStatusSnapshot method.
Assistant
The terminal title is not being passed from the main process agent-hooks server. It seems like the terminal title is only available in the renderer where the runtimePaneTitlesByTabId is maintained.
Based on the issue description and the evaluation contract, the resolver should be applied "before storing the title" in the IPC status integration. Looking at the code flow:
- The main process manages the agent status (via agentHooks)
- The renderer maintains runtimePaneTitlesByTabId for terminal titles
- The renderer calls setAgentStatus with the current title from runtimePaneTitlesByTabId
- The resolver I created is now being called in the renderer before setAgentStatus
However, the issue says the IPC status integration should call the resolver. This might mean the main process should also call the resolver when it builds the status snapshot. But since terminal titles are not available in the main process for managed agents (they're managed by the agent process itself), the fix in the renderer should be sufficient.
Assistant
Let me use bash_terminal to search for setRuntimePaneTitle in the main process.
Assistant
There's no setRuntimePaneTitle in the main process, which confirms that the terminal title management is renderer-side only.
Now, let me also check if there's any other place where setAgentStatus is called that needs to apply the resolver. I saw earlier that there are multiple places where setAgentStatus is called.
Assistant
Let me check each of these setAgentStatus calls to see if they also need to apply the resolver.
Assistant
These setAgentStatus calls are for command-code agent, not Cursor agent. The resolver I created only applies to Cursor agent, so these calls should be fine as-is (they'll just pass through the currentTitle).
However, I should also check if there are other places in the codebase that call setAgentStatus and might need to apply the resolver. Let me check the other files that call setAgentStatus.
But first, let me verify that the changes I made to pty-connection.ts are correct by checking the full onAgentStatus callback:
Now I need to verify the changes are correct and run any relevant tests.
<tool_call> <function=bash_terminal> <parameter=command> sed -n '1145,1170p' /orca/src/renderer/src/components/terminal-pane/pty-connection.ts </tool_call>
Assistant
Let me verify the changes to pty-connection.ts are correct.
Assistant
Now let me check if there are any tests related to the agent-status-terminal-title module that I should create:
Assistant
Let me also check if there are any related tests in the main process that might need to be updated.
<tool_call> <function=bash_terminal> <parameter=command> grep -rn "agentStatus" /orca/src/renderer/src/components/terminal-pane/pty-connection.test.ts | head -20 </tool_call>
Assistant
Let me verify my changes work by running the tests. I need to first create a test for the new function to ensure it works correctly, then run the existing tests to make sure I didn't break anything.
Assistant
Now let me run the tests to ensure the new function works correctly:
Assistant
The test environment needs native modules to be built first, which takes time. Let me try a simpler approach to verify the changes are correct - just checking the TypeScript compilation:
Assistant
The TypeScript compilation seems to have completed without errors. Let me also verify the test file was created correctly:
Assistant
Let me now verify that the import in the pty-connection.ts file is correct:
<tool_call> <function=bash_terminal> <parameter=command> head -15 /orca/src/renderer/src/components/terminal-pane/pty-connection.ts </tool_call>
Assistant
Let me check the imports in the pty-connection.ts file to ensure the resolveAgentStatusTerminalTitle function is properly imported.
Assistant
The import looks correct. Now let me also check the evaluation contract more carefully. The issue mentions that the function should be called "before storing agent-status snapshot titles" in the IPC integration. Let me check if there's also a need to update the main process to call this resolver when it gets agent status snapshots.
Looking at the code, I see that the main process's agent-hook server doesn't have access to the terminal title - the terminal title is maintained in the renderer's runtimePaneTitlesByTabId. The main process only knows about the agent status states (working, done, etc.) and the agent type.
The terminal title is being passed from the renderer to setAgentStatus in the onAgentStatus callback, where I've added the resolver. This should be sufficient to fix the issue.
Assistant
I need to use bash_terminal to grep for the AgentStatusIpcPayload type.
Assistant
I see that AgentStatusIpcPayload doesn't include a terminalTitle field, which confirms that the terminal title is managed in the renderer, not the main process. The resolver I've added in the renderer's onAgentStatus callback should be sufficient.
Let me also check if there's any other place in the renderer that might need the resolver. Let me search for other places where setAgentStatus is called with a terminal title.
Let me check if there's a need to also update the agent-status slice itself to apply the resolver. Looking at the setAgentStatus function in agent-status.ts, it takes a terminalTitle parameter and stores it in the entry. The resolver is now being called before this, so the stored title should be the resolved one.
Assistant
Let me check if there are any other places that might need the resolver applied.
Assistant
These setAgentStatus calls in the lib directory are for specific scenarios (launching agents, automation sessions) and they either don't have a terminal title context or pass undefined. The main place where the terminal title is relevant is in the pty-connection.ts file where the agent status is received from the hook.
Let me also verify that my changes don't break any existing functionality by looking at the agent-status.ts slice tests:
Assistant
Assistant
Let me verify the final state of my changes by viewing the created files and modified files.
Assistant
Now let me verify the test file:
Assistant
Now let me verify the changes to pty-connection.ts by checking the relevant section:
Assistant
Let me verify all the changes are complete by listing the files I've created or modified:
Assistant
The git diff shows that only the pty-connection.ts file was modified, but I also created two new files (agent-status-terminal-title.ts and agent-status-terminal-title.test.ts). Let me check the git status to see the untracked files:
Assistant
The changes look complete. I have:
- Created the
resolveAgentStatusTerminalTitlefunction insrc/renderer/src/lib/agent-status-terminal-title.ts - Added a test file for the function in
- Created the
Assistant
Let me check the diff of the changes to pty-connection.ts.
Assistant
The diff shows that I accidentally removed the
useAppStoreimport. Let me fix this by adding the import back:<tool_call> <function=bash_terminal> <parameter=command> head -15 /orca/src/renderer/src/components/terminal-pane/pty-connection.ts </tool_call>
Assistant
The command exited with exit code 0 but the output was truncated. Let me check the imports section more carefully to ensure the useAppStore import is present.
Assistant
I see that the
useAppStoreimport is missing. Let me fix this:Assistant
The import was added correctly. Now let me verify the final diff:
<tool_call> <function=bash_terminal> <parameter=command> git diff HEAD src/renderer/src/components/terminal-pane/pty-connection.ts </tool_call>
Assistant
I need to check the git diff to make sure the changes are correct. Let me run that command.
Assistant
I notice that the diff shows I accidentally removed the
PtyConnectResultimport. This is a type import, and removing it might cause issues. Let me add it back.<tool_call> <function=bash_terminal> <parameter=command> edit --file /orca/src/renderer/src/components/terminal-pane/pty-connection.ts 10:15 "import { scheduleRuntimeGraphSync } from '@/runtime/sync-runtime-graph' import { useAppStore } from '@/store' import { getRepoMapFromState, getWorktreeMapFromState } from '@/store/selectors' import type { PtyConnectResult } from './pty-transport' import { createIpcPtyTransport } from './pty-transport'" </tool_call>
Assistant
Let me check if
PtyConnectResultis actually used in the file:Assistant
The
PtyConnectResulttype is used in the file, so I need to add back the import. Let me fix this:<tool_call> <function=bash_terminal> <parameter=command> sed -i 's/import { getRepoMapFromState, getWorktreeMapFromState } from '''@/store/selectors'''/import { getRepoMapFromState, getWorktreeMapFromState } from '''@/store/selectors'''\nimport type { PtyConnectResult } from '''./*pty-transport'''/' /orca/src/renderer/src/components/terminal-pane/pty-connection.ts </tool_call>
Assistant
The sed command didn't work as expected. Let me try a different approach - I'll use the edit command to fix the imports properly.
Let me first check the current state of the imports section:
Assistant
I see the
PtyConnectResultimport is missing. Let me add it back:Assistant
Now the import is added back. But I notice I removed
createRemoteRuntimePtyTransportimport. Let me check if it's still there:Assistant
The import is missing but the type is used. Let me add it back:
<tool_call> <function=bash_terminal> <parameter=command> edit --file /orca/src/renderer/src/components/terminal-pane/pty-connection.ts 14:16 "import { createIpcPtyTransport } from './pty-transport' import { createRemoteRuntimePtyTransport } from './remote-runtime-pty-transport' import { shouldSeedCacheTimerOnInitialTitle } from './cache-timer-seeding'" </tool_call>
Assistant
Let me verify the current state of the imports section:
The imports section now has:
- line 12: getRepoMapFromState, getWorktreeMapFromState
- line 13: PtyConnectResult import
- line 14: createIpcPtyTransport import
But I'm missing the
createRemoteRuntimePtyTransportimport. Let me add it after line 14.Assistant
I need to add the
createRemoteRuntimePtyTransportimport. Let me add it after line 14.<tool_call> <function=bash_terminal> <parameter=command> edit --file /orca/src/renderer/src/components/terminal-pane/pty-connection.ts 14:14 "import { createIpcPtyTransport } from './pty-transport' import { createRemoteRuntimePtyTransport } from './remote-runtime-pty-transport' import { shouldSeedCacheTimerOnInitialTitle } from './cache-timer-seeding'" </tool_call>
Assistant
Let me check if the file was updated correctly by viewing the imports section again.
Assistant
The edit command didn't seem to add the import. Let me try a different approach - use the bash_terminal to add the missing import.
<tool_call> <function=bash_terminal> <parameter=command> sed -i '14a import { createRemoteRuntimePtyTransport } from '''./remote-runtime-pty-transport'''' /orca/src/renderer/src/components/terminal-pane/pty-connection.ts </tool_call>
Assistant
Let me try a different approach to add the import. I'll use the bash_terminal function with proper escaping.
Assistant
Let me verify that the import was added:
<tool_call> <function=bash_terminal> <parameter=command> sed -n '12,18p' /orca/src/renderer/src/components/terminal-pane/pty-connection.ts </tool_call>
Assistant
The sed command seems to have worked. Let me check the imports section to verify.
Assistant
Now let me verify the final state of all changes:
Assistant
The diff looks correct now. The changes include:
- Adding the import for
resolveAgentStatusTerminalTitle - Applying the resolver before calling
setAgentStatus
Let me also verify that the untracked files are still present:
<tool_call> <function=bash_terminal> <parameter=command> git status </tool_call>
- Adding the import for
Assistant
Let me run the git status command to see the status of all files.
Assistant
Now let me verify the solution is complete by checking all the files that were created or modified:
Assistant
I have successfully implemented the fix for the issue where the Cursor CLI agent session stays in a loading/running state after task completion.
Summary of Changes
1. Created
src/renderer/src/lib/agent-status-terminal-title.tsA new module implementing the
resolveAgentStatusTerminalTitlefunction that reconciles terminal titles with agent status according to the evaluation contract:- Cursor agent with
donestate: Returns "Cursor ready" to replace spinner/working/bare/permission titles - Cursor agent with
waitingorblockedstate: Returns "Cursor - action required" - Non-Cursor agents: Preserves the existing title
- Cursor agent with
workingstate: Preserves the existing title
2. Created
src/renderer/src/lib/agent-status-terminal-title.test.ts- Cursor agent with
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.