Reject deploy error URLs in builder
All checks were successful
build / build (push) Successful in 3s

This commit is contained in:
robert
2026-06-07 09:19:59 -03:00
parent 451a67e4f8
commit 96749be014
2 changed files with 77 additions and 9 deletions

View File

@@ -70,6 +70,39 @@ class FakeGraph:
}
class FakePlanLimitGraph:
async def astream_events(self, *_args, **_kwargs):
yield {
"event": "on_tool_end",
"name": "cp_deploy_tarball",
"data": {
"output": {
"error": "cp 402",
"detail": (
'{"detail":{"error":"plan_limit","feature":"agents",'
'"upgrade_url":"https://app.a2acloud.io/billing"}}'
),
}
},
}
yield {
"event": "on_chain_end",
"parent_ids": [],
"data": {
"output": {
"messages": [
{
"content": (
"Deployment failed. Upgrade: "
"https://app.a2acloud.io/billing"
)
}
]
}
},
}
class AgentBuilderBuildTests(unittest.IsolatedAsyncioTestCase):
async def test_build_captures_nested_graph_state_and_deployed_url(self) -> None:
ctx = FakeRunContext()
@@ -87,6 +120,22 @@ class AgentBuilderBuildTests(unittest.IsolatedAsyncioTestCase):
self.assertIn("Deployed at https://generated-agent.a2acloud.io", result["reply"])
self.assertIn("deployed: https://generated-agent.a2acloud.io", ctx.progress)
async def test_build_does_not_treat_billing_url_as_deployed_agent(self) -> None:
ctx = FakeRunContext()
with patch("agent.build_agent_builder", return_value=FakePlanLimitGraph()):
result = await AgentBuilder().build(
ctx,
name="generated-agent",
prompt="make a test agent",
public=False,
)
self.assertEqual(result["ok"], False)
self.assertNotIn("url", result)
self.assertIn("no live URL was found", result["warning"])
self.assertNotIn("deployed: https://app.a2acloud.io/billing", ctx.progress)
class BuilderPromptTests(unittest.TestCase):
def test_outer_agent_uses_500_recursion_limit(self) -> None: