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 explore the repository structure first to understand the codebase.
Assistant
Let me look at the issue. The interface mentions
src/renderer/src/lib/agent-status-terminal-title.ts. Let me look for this file and related files.Assistant
The file doesn't exist yet. Let me explore the structure to understand the existing code patterns.
Assistant
Now let me look at the existing lib files and how terminal titles are handled.
Assistant
Let me look at the agent-detection shared module and the store slice that handles terminal titles.
Assistant
I'll make one command at a time.
Assistant
Now let me look at the store slice that handles agent status and where titles are stored.
Assistant
Let me find where
setAgentStatusis called with the terminal title in the IPC integration.Assistant
Let me look at the start of the
applyAgentStatusfunction to see wheretitlecomes from.Assistant
Let me look at the existing test files for agent status to understand testing patterns.
Assistant
Let me search for how Cursor titles are synthesized elsewhere.
Assistant
Now I understand the synthetic title profiles. Let me look at how the spinner works and where titles are synthesized in the main process. Let me look at the broader context of
src/main/index.tsaround these spinner mechanisms.Assistant
Let me look at the
resolvePaneKeyfunction to understand whattitlerepresents.Assistant
Let me look at the agent-status test to understand cursor title expectations.
Assistant
Let me check where synthetic title profiles might be shared or defined.
Assistant
The profiles are only in
src/main/index.ts. The new file should be in the renderer (src/renderer/src/lib/agent-status-terminal-title.ts). I'll define the cursor synthetic profile in the new file (or replicate it).Let me focus on what the contract requires. The contract is specific to Cursor. But to be general, I should make the function handle the synthetic profile concept. Let me look at how the runtime
orca-runtime.tshandles cursor titles to make sure I align with that.Assistant
Let me look at where the stored
terminalTitledrives loading/working indicators in the renderer.Assistant
Let me look at the agent-status-osc and how the title drives status indicators.
Assistant
Let me check if there are existing tests referencing the new function name.
Assistant
Let me look at how the loading/working state is determined from both explicit status and title-scraping.
Assistant
Let me look at the pty-transport.ts to understand how title drives the loading state.
Assistant
Let me look at how explicit hook status combines with title-scraping in the workspace presentation and worktree-card-status.
Assistant
So
deriveWorktreeCardStatususes the explicit hook state (worktreeAgentEntries) when fresh, and falls back to title-scraping for panes without explicit status. So when the explicit hook reportsdoneand it's fresh, the title-scraping is skipped for that pane (becauseexplicitPaneIds?.has(paneId)is true).So the worktree card status would correctly show
donebased on the hook state.But the loading state described in the issue ("UI continues to show a loading/running state") might be driven by another path. Let me look at the workspace-space-presentation.ts which uses
runtimePaneTitlesByTabId.Assistant
Let me look at how
onTitleChangeupdates the runtime pane title and tab title in pty-connection.ts.Assistant
Let me look at how
onTitleChangeupdates runtime pane titles in pty-connection.Assistant
Let me look at the worktree-title-derived-agent-rows and how the stored title is used for activity.
Assistant
Let me look at how the dashboard builds agent rows and how the stored terminalTitle drives the spinner.
Assistant
Now I have a solid understanding. Let me look at the imports and structure used in the lib directory to match the style, then check the test conventions.
Assistant
Now I understand the structure and conventions. Let me create the resolver function file.
Assistant
Now let me integrate the resolver into the IPC status integration. Let me look at the exact call site and imports in
useIpcEvents.ts.Assistant
Let me add the import and integrate the resolver. First, let me view the import block to find a good spot.
Assistant
Let me open the file at the relevant line first.
Assistant
Now let me integrate the resolver at the
setAgentStatuscall site. Let me view that area.Assistant
Now I'll integrate the resolver. I'll reconcile the
titlebefore callingsetAgentStatus. ThestatusPayloadhasagentTypeandstate— that's exactly thePick<ParsedAgentStatusPayload, 'agentType' | 'state'>the resolver expects.Let me edit the call site.
Assistant
Now let me verify the types compile and run a quick check. Let me look at the test config to know how to run tests.
Assistant
Let me create a temporary test to verify the function behavior, then remove it before submitting.
Assistant
All 8 tests pass. Let me check if there are existing tests that exercise the IPC
applyAgentStatuspath that might be affected.Assistant
No tests directly test
applyAgentStatus. Let me remove the temp test and run the existing related tests.Assistant
All existing tests pass. Let me run the typecheck for the renderer/web config to make sure my changes compile correctly.
Assistant
Typecheck passes. Let me run the linter on the new and modified files.
Assistant
Let me run the switch-exhaustiveness lint check on my new file to be safe.
Assistant
The switch is exhaustive, so the
defaultis unnecessary. Let me restructure to remove it.Assistant
Let me re-run the switch-exhaustiveness lint, typecheck, and the temp test to confirm everything still works.
Assistant
Let me re-create the temp test to confirm behavior after the refactor, then remove it.
Assistant
Let me review the pty-connection.ts call sites that pass a title to
setAgentStatus, to see if the OSC 9999 path also needs reconciliation.Assistant
Let me run a broader set of related tests to ensure nothing breaks.
Assistant
Let me run the full set of agent-status-related tests across the renderer to be thorough.
Assistant
All tests pass. Let me review the final diff of my changes.
Assistant
The changes look clean. Let me do a final review of the new file.
Assistant
Let me verify how
titlesByLeafId(used byresolvePaneKeyfor the title) gets updated, to ensure my integration reads the right title source.Assistant
The
titlesByLeafIdis the captured/debounced pane title (the synthesized cursor title), which is exactly the stale title source the resolver fixes. Let me confirm no temp files remain and run a final broad test.Assistant
Only the new file remains (temp test removed). Let me run the full typecheck to be thorough.
Assistant
All tests pass and the typecheck is clean. Let me do a final review of the complete diff before submitting.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.