Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
Log scrape-retry exhaustion at warning, not error (SKY-15724) (#8461)
Aaron Perez7ef6e8bc2295
diff --git a/skyvern/forge/agent.py b/skyvern/forge/agent.pyindex cb507ac6b..febf74505 100644--- a/skyvern/forge/agent.py+++ b/skyvern/forge/agent.py@@ -5770,14 +5770,16 @@ class ForgeAgent:step_retry=step.retry_index,)raise e- LOG.error(+ # Warning, not error: every caller re-records this with a traceback. agent_step+ # logs it at error and fails the step, execute_step turns ScrapingFailed into a+ # run failure_reason, and the speculative prefetch swallows it at warning.+ LOG.warning("All scrape attempts failed",total_attempts=len(SCRAPE_TYPE_ORDER),error_type=e.__class__.__name__,url=task.url,step_order=step.order,step_retry=step.retry_index,- exc_info=True,)raise ediff --git a/tests/unit/test_screenshot_target_closed_callers.py b/tests/unit/test_screenshot_target_closed_callers.pyindex 76259b771..fb1cb2490 100644--- a/tests/unit/test_screenshot_target_closed_callers.py+++ b/tests/unit/test_screenshot_target_closed_callers.py@@ -175,7 +175,7 @@ class TestScrapeWebsiteTargetClosed:class TestScrapeRetryLoopTargetClosed:- """The terminal scrape attempt re-raises, and its own ERROR is what Error Tracking would file."""+ """The terminal scrape attempt re-raises and logs at warning; its callers own the error record."""def _rig(self, monkeypatch: pytest.MonkeyPatch, error: Exception) -> tuple[ForgeAgent, MagicMock, dict]:now = datetime.now(UTC)@@ -208,13 +208,14 @@ class TestScrapeRetryLoopTargetClosed:assert any("browser target closed" in str(call.args[0]).lower() for call in log.warning.call_args_list)@pytest.mark.asyncio- async def test_final_attempt_still_errors_on_other_failures(self, monkeypatch: pytest.MonkeyPatch) -> None:+ async def test_final_attempt_warns_on_other_failures(self, monkeypatch: pytest.MonkeyPatch) -> None:agent, log, kwargs = self._rig(monkeypatch, FailedToTakeScreenshot(error_message="Target crashed"))with pytest.raises(FailedToTakeScreenshot):await agent.build_and_record_step_prompt(**kwargs)- assert any("All scrape attempts failed" in str(call.args[0]) for call in log.error.call_args_list)+ assert any("All scrape attempts failed" in str(call.args[0]) for call in log.warning.call_args_list)+ assert not any("All scrape attempts failed" in str(call.args[0]) for call in log.error.call_args_list)def _browser_gone() -> MissingBrowserStatePage: