Skip to content

fix(frontend): Separate pause state from agent loading#12041

Merged
amanape merged 3 commits intoOpenHands:mainfrom
Mariam-Saeed:fix-Separate-pause-state-from-agent-loading
Dec 16, 2025
Merged

fix(frontend): Separate pause state from agent loading#12041
amanape merged 3 commits intoOpenHands:mainfrom
Mariam-Saeed:fix-Separate-pause-state-from-agent-loading

Conversation

@Mariam-Saeed
Copy link
Copy Markdown
Contributor

Summary of PR

This PR fixes the issue where pausing the agent incorrectly triggered loading on the action panel.

  • The pause button now shows a loading indicator only in the chat input area.
  • Pausing no longer triggers the loading state on the action panel.
  • Other loading conditions (INIT, LOADING, CONNECTING, task polling) continue to work for both the chat input and the action panel.

This separates the pause state from the global loading state, improving UI consistency.

Change Type

  • Bug fix
  • New feature
  • Breaking change
  • Refactor
  • Other (dependency update, docs, typo fixes, etc.)

Checklist

  • I have read and reviewed the code and I understand what the code is doing.
  • I have tested the code to the best of my ability and ensured it works as expected.

Fixes

Resolves #12035

Release Notes

  • Include this change in the Release Notes.

@Mariam-Saeed Mariam-Saeed changed the title fix:Separate pause state from agent loading fix(frontend): Separate pause state from agent loading Dec 13, 2025
@hieptl
Copy link
Copy Markdown
Collaborator

hieptl commented Dec 15, 2025

Hi @Mariam-Saeed, could you please add tests for your changes? We are aiming to enforce stronger testing practices on the frontend. Thank you! 🙏

Copy link
Copy Markdown
Contributor

@amanape amanape left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thank you very much for opening this PR! I just have one suggestion:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are multiple shouldShownAgentLoading conditions used in this file. Your change only updates line 100, but the other conditions still use shouldShownAgentLoading without considering isPausing. Consider introducing a local variable that combines both states for UI rendering, while keeping the current shouldShownAgentLoading for the global state update:

const shouldShownAgentLoading =
    curAgentState === AgentState.INIT ||
    curAgentState === AgentState.LOADING ||
    (webSocketStatus === "CONNECTING" && taskStatus !== "ERROR") ||
    isTaskPolling(taskStatus) ||
    isTaskPolling(subConversationTaskStatus);

// For UI rendering - includes pause state
const isLoading = shouldShownAgentLoading || isPausing;

Then use isLoading in the JSX for consistent behavior across all conditions, while shouldShownAgentLoading continues to be used for the global state in the useEffect.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a local variable to handle the loading state, with unit tests to cover its behavior and ensure it works correctly.

Copy link
Copy Markdown
Contributor

@amanape amanape left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve simplified the test file, I encourage you to take a look at it and the diff (53fd19a).

Thank you very much for this fix! 😄

@amanape amanape enabled auto-merge (squash) December 16, 2025 13:19
@amanape amanape merged commit 3b7b2fd into OpenHands:main Dec 16, 2025
24 of 25 checks passed
afanty2021 pushed a commit to afanty2021/OpenHands that referenced this pull request Dec 17, 2025
Co-authored-by: amanape <83104063+amanape@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Action panel shows loading state when pausing agent

3 participants