Reject deploy error URLs in builder
All checks were successful
build / build (push) Successful in 3s
All checks were successful
build / build (push) Successful in 3s
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user