Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
Document unbound credential denial and remove the credential-fill test shim (#7969)
Aaron Perez2f1e15e1d312
diff --git a/skyvern/forge/sdk/copilot/tools/credential_fill.py b/skyvern/forge/sdk/copilot/tools/credential_fill.pyindex d9099c46d..a2a8140c4 100644--- a/skyvern/forge/sdk/copilot/tools/credential_fill.py+++ b/skyvern/forge/sdk/copilot/tools/credential_fill.py@@ -182,6 +182,8 @@ async def _credential_fill_origin_grant(return None, _missing_credential_origin_error(credential_id)intended_url = _resolved_credential_intended_url(policy, credential_id)if not intended_url:+ # API/import-created credentials remain unbound until tested against a login page.+ # Denying that onboarding state is intentional: there is no origin safe to release to.return None, _missing_credential_origin_error(credential_id)return _CredentialFillOriginGrant(intended_url), None@@ -207,12 +209,6 @@ async def _credential_fill_origin_grant(return None, admission.steer or authority_error-async def _credential_fill_gate_error(copilot_ctx: AgentContext, credential_id: str) -> tuple[str | None, str | None]:- """Compatibility view of the origin-grant gate for tests and policy callers."""- grant, error = await _credential_fill_origin_grant(copilot_ctx, credential_id)- return error, grant.intended_url if grant else None--async def _resolve_credential_fill_value(copilot_ctx: AgentContext,credential_id: str,diff --git a/tests/unit/test_copilot_fill_credential_field.py b/tests/unit/test_copilot_fill_credential_field.pyindex 6fd651798..29ec9d59d 100644--- a/tests/unit/test_copilot_fill_credential_field.py+++ b/tests/unit/test_copilot_fill_credential_field.py@@ -560,7 +560,7 @@ class TestCredentialFillLivePageAdmission:patch("skyvern.forge.app.DATABASE.credentials.get_credentials", new=load_mock),patch.object(credential_fill_module, "_live_working_page_url", AsyncMock(return_value=page_url)),):- error, _ = await credential_fill_module._credential_fill_gate_error(ctx, credential_id)+ _, error = await credential_fill_module._credential_fill_origin_grant(ctx, credential_id)return error, policy, load_mock@pytest.mark.asyncio@@ -624,10 +624,11 @@ class TestCredentialFillLivePageAdmission:AsyncMock(return_value="https://analytics.example.com/login"),),):- error, intended_url = await credential_fill_module._credential_fill_gate_error(ctx, "cred_123")+ grant, error = await credential_fill_module._credential_fill_origin_grant(ctx, "cred_123")assert error is None- assert intended_url == _FIXTURE_LOGIN_URL+ assert grant is not None+ assert grant.intended_url == _FIXTURE_LOGIN_URLload_mock.assert_not_awaited()@pytest.mark.asyncio@@ -854,12 +855,13 @@ class TestObservationSeamCredentialBinding:)with patch.object(credential_fill_module, "_live_working_page_url", AsyncMock(return_value=_FIXTURE_LOGIN_URL)):- error, admitted_url = await credential_fill_module._credential_fill_gate_error(+ grant, error = await credential_fill_module._credential_fill_origin_grant(ctx, result["resolved_login_credential_id"])assert error is None- assert admitted_url == _FIXTURE_LOGIN_URL+ assert grant is not None+ assert grant.intended_url == _FIXTURE_LOGIN_URL@pytest.mark.asyncioasync def test_leaving_the_admitted_origin_after_the_seam_bind_refuses_the_fill(