Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

MagMueller
Copy link
Collaborator

@MagMueller MagMueller commented Sep 6, 2025

Auto-generated PR for branch: fix/issue-1716-event-driven-pause-resume


Summary by cubic

Switches agent pause/resume to an event-driven model using asyncio.Event and consolidates pause state in AgentState. Removes polling, reduces CPU use while paused, and treats stop as an immediate interrupt (addresses #1716).

  • Refactors
    • Replace _external_pause_event with _pause_event and await it in the main loop.
    • Remove busy-wait loop and the wait_until_resumed() helper.
    • Use state.paused as the single source of truth; keep it serializable.
    • Add model_config = ConfigDict(arbitrary_types_allowed=True) to AgentState.
    • Update checks to prioritize stopped before paused in _raise_if_stopped_or_paused.

MagellaX and others added 16 commits August 1, 2025 14:23
- Add fallback return statement to satisfy type checker (fixes 'must return value on all code paths' error)
- Use setattr() for model_kwargs assignment (fixes 'Cannot assign to attribute' error)

These fixes resolve the failing CI jobs in PR #2583.
Remove trailing whitespace on line 242 that was causing ruff-format to fail in CI.
- Renamed the internal pause event from `_pause_event` to `_external_pause_event` for clarity and to better reflect its purpose in managing external pause control.
- Updated all references to the renamed event to ensure consistent functionality.

This change enhances the readability and maintainability of the code related to agent pause/resume operations.
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

cursor[bot]

This comment was marked as outdated.

Copy link

github-actions bot commented Sep 6, 2025

Agent Task Evaluation Results: 2/4 (50%)

View detailed results
Task Result Reason
amazon_laptop ✅ Pass The agent successfully navigated to amazon.com, performed a search for 'laptop', and returned the name of the first laptop result along with additional relevant details. This meets all the criteria specified for the task.
google_maps_3d ❌ Fail The agent performed most of the steps correctly: it searched for ETH Zürich Hauptgebäude on Google Maps, closed the side panel, ensured Satellite View was enabled, and panned the map to show both ETH Zürich Hauptgebäude and Zurich Lake. However, the agent failed to enable 3D view because it stated that the 3D view was disabled or unavailable at this location. The task explicitly required clicking the correct 3D button to enable 3D mode. Since the agent did not successfully enable 3D mode, the task is not fully complete and thus unsuccessful according to the criteria.
browser_use_pip ✅ Pass The agent correctly provided the pip installation command 'pip install browser-use' as requested, fulfilling the task requirements.
captcha_cloudflare ❌ Fail The agent failed to solve the Cloudflare Turnstile captcha and did not extract the 'hostname' value from the success message as required. The hostname value 'example.com' was not retrieved, indicating the task was incomplete.

Check the evaluate-tasks job for detailed task execution logs.

- Added a signal to the external pause event when the agent is stopped, allowing any waiting code to check the stopped state. This improves the responsiveness of the agent's pause functionality.
- Removed unnecessary blank line in the `stop` method of the Agent class to improve code cleanliness and maintainability.
@MagMueller MagMueller merged commit 7574dc2 into main Sep 6, 2025
54 checks passed
@MagMueller MagMueller deleted the fix/issue-1716-event-driven-pause-resume branch September 6, 2025 16:31
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.

3 participants