Skip to content
TheChatArchiveThe Chat Archive
GLMz-ai/glm-5.2· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION [Bug]: Cursor CLI agent stays in loading state after task completes…

  1. 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

    1. Start a Cursor CLI agent session in Orca.
    2. Give the agent a task and wait for it to complete (agent finishes and produces final output).
    3. 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, done replaces spinner/working titles, the bare Cursor Agent title, and stale permission titles with Cursor ready; waiting or blocked uses Cursor - 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.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /orca, current file: none) bash-$

  2. GLM Assistant

    Let me start by exploring the repository structure to understand the codebase.

  3. GLM Assistant

    Now let me look at the existing terminal title handling, the agent-status store, and the IPC integration that stores titles.

  4. GLM Assistant

    Let me look at the IPC integration that stores titles - useIpcEvents.ts and the agent-status-osc.ts.

  5. GLM Assistant

    Now let me look at the part around line 2290 where the title is passed to setAgentStatus. I want to see what title is and where the resolver should be applied. The contract says: "The IPC status integration must call this resolver before storing the title."

    Let me look at the area where title comes from and where store.setAgentStatus is called with the title. The title comes from resolvePaneKey. Let me look at that whole context more carefully.

    Let me check the section around line 2280-2300.

  6. GLM Assistant

    Now I understand the integration. The title is passed to setAgentStatus. The contract says I should create a function resolveAgentStatusTerminalTitle at src/renderer/src/lib/agent-status-terminal-title.ts. Let me explore the cursor module and existing title handling.

  7. GLM Assistant

    There's already a synthetic title system. Let me look at the main/index.ts around line 620-760 and the SYNTHETIC_TITLE_PROFILES.

  8. GLM Assistant

    Now let me look at the driveSyntheticTitleFromHook function.

  9. GLM Assistant

    Let me look at the agent-status-osc.ts and the title tracker to understand the title detection and how the synthetic title interacts with the stored terminalTitle.

  10. GLM Assistant

    Now let me understand the title detection system - the detectAgentStatusFromTitle referenced in the comments. Let me look at how the terminal title is used to derive agent status, and the keyword/spinner classification. This is the basis for the resolver's "spinner/working titles", "bare Cursor Agent title", "permission titles", "descriptive completed titles".

    Let me look for detectAgentStatusFromTitle.

  11. GLM Assistant

    I now have a good understanding. Let me look at existing tests related to agent-status terminal title handling to understand the expected behavior and avoid breaking things.

  12. GLM Assistant

    Let me find all call sites of setAgentStatus in the renderer to apply the resolver consistently.

  13. GLM Assistant

    The contract says: "The IPC status integration must call this resolver before storing the title." The IPC status integration is in useIpcEvents.ts (the applyAgentStatus function). Let me look at the full applyAgentStatus to see where title is computed and where the snapshot path stores title.

  14. GLM Assistant

    Let me check how main stores the terminalTitle in the durable cache/snapshot, since the snapshot replay path also calls setAgentStatus.

  15. GLM Assistant

    Let me look at the existing src/renderer/src/lib/agent-status.ts to follow conventions.

  16. GLM Assistant

    Now let me look at the existing test conventions in agent-status.test.ts.

  17. GLM Assistant

    Now I have a good understanding. Let me check the test runner and look at how resolvePaneKey returns the title (to confirm title is the right "current title" to pass).

  18. GLM Assistant

    Now I understand the full flow. Let me check existing tests that verify terminalTitle after agent-status updates, to make sure my change won't break them.

  19. GLM Assistant

    Let me check if there's a test file for useIpcEvents and look at the imports at the top of useIpcEvents.ts.

  20. GLM Assistant

    I now have a complete understanding. Let me create the resolver file.

  21. GLM Assistant

    Now let me wire the resolver into the IPC integration. First, add the import.

  22. GLM Assistant

    Now let me update the call site to apply the resolver before storing the title.

  23. GLM Assistant

    The search text didn't match because the file has slightly different whitespace/indentation. Let me use the edit command with the exact line content. Let me use the edit command on the line range.

  24. GLM Assistant

    Both the live path and the snapshot replay path go through applyAgentStatus, which now applies the resolver. Now let me verify the resolver works. Let me create a temporary test file to validate behavior (I'll remove it before submitting).

  25. GLM Assistant

    All 16 tests pass. Let me remove the temporary test file.

  26. GLM Assistant

    Now let me verify type-checking passes. Let me check the available scripts and run a typecheck.

  27. GLM Assistant

    Typecheck passes. Let me run the existing related tests to make sure I didn't break anything.

  28. GLM Assistant

    The failures appear to be a pre-existing module resolution issue (@/lib/ipc-error). Let me verify these tests fail without my changes by stashing.

  29. GLM Assistant

    These test failures are pre-existing (they fail without my changes too) due to a test-environment module resolution issue with @/lib/ipc-error, unrelated to my change. Let me confirm the agent-status.test.ts failure is the same pre-existing issue.

  30. GLM Assistant

    Confirmed — these are pre-existing environment issues (the @/lib/ipc-error alias isn't resolved in this vitest environment), unrelated to my change. The authoritative tsgo typecheck passed. Let me verify the useIpcEvents.test.ts situation is also pre-existing.

  31. GLM Assistant

    Confirmed pre-existing. Let me run the linter on the new file and the modified file to ensure code quality.

  32. GLM Assistant

    Lint passes. Let me check the formatter (the repo uses oxfmt) on the new file.

  33. GLM Assistant

    Everything passes. Let me review the final diff.

  34. GLM Assistant

    My changes are complete. Let me do a final review of the new resolver file.

  35. GLM Assistant

    Let me run the store slice tests for agent-status to make sure nothing breaks (these don't have the @/lib/ipc-error chain).

  36. GLM Assistant

    The @/ alias isn't being resolved by vitest in this environment — a pre-existing configuration issue. Let me check the vitest config to confirm.

  37. GLM Assistant

    The vitest config is at config/vitest.config.ts, not the root. Let me run tests using the proper config (check package.json test script).

  38. GLM Assistant

    All 176 tests pass with the proper config. My earlier failures were just from not passing --config. Let me run a broader set of affected tests.

  39. GLM Assistant

    All 105 tests pass (the stderr is expected test log output). Let me run the remaining agent-status IPC-related tests.

  40. GLM Assistant

    All tests pass. My implementation is complete and verified.

    Let me provide a final summary of the checklist:

    Checklist review:

    • ✅ Reproduced the error: I traced the root cause — the main process sends the agentStatus:set IPC event before the synthesized "Cursor ready" OSC title frame (driveSyntheticTitleFromHook runs after the IPC send in src/main/index.ts). So when the renderer's applyAgentStatus reads the pane title, it's still the stale working/spinner/bare-native "Cursor Agent" title. That stale title gets stored in the agent-status snapshot, leaving the UI in a loading state. I verified the resolver behavior with a temporary test (now removed) covering all contract cases.

    • ✅ Confirmed the fix resolves the error: The temporary test confirmed resolveAgentStatusTerminalTitle maps stale spinner/working/bare-native/permission titles to "Cursor ready" on done, and waiting/blocked to "Cursor - action required", while preserving descriptive completed titles and non-profile agents. The IPC integration (applyAgentStatus) now applies the resolver before store.setAgentStatus, on both the live and snapshot-replay paths.

    • ✅ Edge cases handled: undefined currentTitle (preserved for done, permission label for waiting/blocked); working state preserved (spinner owns the title); non-profile agents (claude, codex, unknown, undefined agentType) preserved verbatim; descriptive completed titles preserved; case-insensitive/whitespace-trimmed bare-native detection; all four synthetic profiles (cursor, opencode, droid, hermes) reconciled consistently with main's SYNTHETIC_TITLE_PROFILES.

    • ✅ Existing tests pass: Ran the affected test suites (agent-status.test.ts 111, useIpcEvents.test.ts 35, pty-dispatcher-pi-routing.test.ts 6, agent-status.test.ts slice 24, store-cascades 62, dashboard/sidebar 105, pty-connection/completion 149) — all pass. tsgo typecheck, oxlint, and oxfmt --check all clean.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.