Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| async def test_browser_start(): | ||
| """Test starting the browser.""" | ||
| with patch("src.browser.async_playwright") as mock_playwright: | ||
| mock_pw = AsyncMock() | ||
| mock_playwright.return_value = mock_pw | ||
| mock_browser = MagicMock() | ||
| mock_pw.chromium.launch = AsyncMock(return_value=mock_browser) | ||
| mock_context = MagicMock() | ||
| mock_browser.new_context = AsyncMock(return_value=mock_context) | ||
| mock_page = MagicMock() | ||
| mock_context.new_page = AsyncMock(return_value=mock_page) | ||
|
|
||
| controller = BrowserController(headless=True) | ||
| await controller.start() | ||
|
|
||
| assert controller.playwright == mock_pw | ||
| assert controller.browser == mock_browser | ||
| assert controller.context == mock_context |
There was a problem hiding this comment.
Fix async_playwright mock so tests exercise BrowserController
In test_browser_start the chromium.launch mock is attached to mock_pw, but BrowserController.start() awaits async_playwright().start() and uses the return value of start() as the Playwright instance. Because the test never assigns mock_pw.start.return_value to mock_pw, the controller interacts with a different AsyncMock that lacks the configured chromium.launch stub and controller.playwright will never equal mock_pw. The same pattern appears in test_browser_context_manager. As written, these tests will fail (or silently exercise the wrong object). Set mock_pw.start.return_value to an object with the mocked chromium, context, and page to ensure the controller uses the intended mock.
Useful? React with 👍 / 👎.
Introduces a Claude 4.5 computer-use agent to autonomously play Heatseeker, with full docs, tests, packaging, and Docker support
Note
Introduces a Claude 4.5 Sonnet computer-use agent to play Heatseeker via browser automation, packaged with Docker, tests, and documentation.
ComputerUseAgent(models/claude/src/agent.py) integrating Anthropic Claude 4.5 computer-use tool; drives action loop, executes clicks/keys/typing, returns screenshots.BrowserController(models/claude/src/browser.py) for Playwright-based navigation, screenshots, and input; entrypointsrc/main.pyto run the agent.claude-heatseeker(pyproject.toml,src/__init__.py).Dockerfile,docker-compose.yml) with uv setup and Chromium install; repo ignores (.gitignore,.dockerignore).models/claude/tests/), including tool-use flow and browser ops.docs/computer_use/claude-4_5-api.mdand module README.claude.md.Written by Cursor Bugbot for commit 7fea098. This will update automatically on new commits. Configure here.