You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(11.3-01): prevent agent from polling deployment status in infinite loop
The agent was calling get_deployment_status repeatedly without waiting,
creating an infinite polling loop. Updated the tool to:
1. Add explicit "action" field in response:
- STOP_POLLING: deployment done (success/failure)
- INFORM_USER_AND_WAIT: tell user to wait, let them ask for updates
2. Updated tool description with CRITICAL warning about not polling in loop
3. Changed next_steps to explicitly say "DO NOT call again automatically"
The agent should now check status once, inform the user, and wait for
them to request updates.
Co-Authored-By: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: src/agent/tools/platform/get_deployment_status.rs
+28-12Lines changed: 28 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -55,6 +55,13 @@ impl Tool for GetDeploymentStatusTool {
55
55
Returns the current status of a deployment, including progress percentage,
56
56
current step, overall status, and optionally the public URL if the service is ready.
57
57
58
+
**CRITICAL - DO NOT POLL IN A LOOP:**
59
+
After checking status, you MUST inform the user and WAIT for them to ask again.
60
+
DO NOT call this tool repeatedly in succession. Deployments take 1-3 minutes.
61
+
The response includes an "action" field - follow it:
62
+
- "STOP_POLLING": Deployment is done (success or failure). Tell the user.
63
+
- "INFORM_USER_AND_WAIT": Tell user the current status and wait for them to ask for updates.
64
+
58
65
**IMPORTANT for Cloud Runner:**
59
66
The task may show "completed" when infrastructure is provisioned, but the actual
60
67
service build and deployment takes longer. Pass project_id and service_name to
@@ -70,8 +77,8 @@ also check if the service has a public URL (meaning it's actually ready).
70
77
- A deployment must have been triggered (use trigger_deployment first)
71
78
72
79
**Use Cases:**
73
-
- Monitor deployment progress after triggering
74
-
- Check if a deployment has completed AND is actually serving traffic
80
+
- Check deployment status ONCE after triggering, then inform user
81
+
- Let user ask for updates when they want them
75
82
- Get error details if deployment failed"#
76
83
.to_string(),
77
84
parameters:json!({
@@ -182,31 +189,40 @@ also check if the service has a public URL (meaning it's actually ready).
182
189
}
183
190
184
191
// Add next steps based on actual status
192
+
// IMPORTANT: Guide agent to STOP polling and inform user
185
193
if is_failed {
186
194
result["next_steps"] = json!([
195
+
"STOP - Deployment failed. Inform the user of the error.",
187
196
"Review the error message for details",
188
197
"Check the deployment configuration",
189
-
"Verify the code builds successfully locally",
190
-
"Try triggering a new deployment after fixing the issue"
198
+
"Verify the code builds successfully locally"
191
199
]);
200
+
result["action"] = json!("STOP_POLLING");
192
201
}elseif truly_ready && public_url.is_some(){
193
202
result["next_steps"] = json!([
194
-
format!("Service is live at: {}", public_url.as_ref().unwrap()),
203
+
format!("STOP - Service is live at: {}", public_url.as_ref().unwrap()),
195
204
"Deployment completed successfully!",
196
-
"Use get_service_logs to view container logs"
205
+
"Inform the user their service is ready"
197
206
]);
207
+
result["action"] = json!("STOP_POLLING");
198
208
}elseif task_complete && !truly_ready {
199
209
result["next_steps"] = json!([
200
-
"Infrastructure task completed, but service is still deploying",
201
-
"Cloud Runner is building and deploying your container",
202
-
"Call get_deployment_status again in 30-60 seconds to check for public_url"
210
+
"STOP POLLING - Inform the user that deployment is in progress",
211
+
"Infrastructure is ready, Cloud Runner is building the container",
212
+
"Tell the user to wait 1-2 minutes, then they can ask you to check status again",
213
+
"DO NOT call get_deployment_status again automatically - wait for user to ask"
203
214
]);
204
-
result["note"] = json!("Task shows 100% but service is still being built/deployed. This is normal for Cloud Runner.");
215
+
result["action"] = json!("INFORM_USER_AND_WAIT");
216
+
result["estimated_wait"] = json!("1-2 minutes");
217
+
result["note"] = json!("Task shows 100% but container is still being built/deployed. This is normal. DO NOT poll repeatedly - inform the user and wait for them to ask for status.");
205
218
}elseif !task_complete {
206
219
result["next_steps"] = json!([
207
-
format!("Deployment is {} ({}% complete)", status.overall_status, status.progress),
208
-
"Call get_deployment_status again to check progress"
220
+
format!("STOP POLLING - Deployment is {} ({}% complete)", status.overall_status, status.progress),
221
+
"Inform the user of current progress",
222
+
"Tell them to wait and ask again in 30 seconds if they want an update",
223
+
"DO NOT call get_deployment_status again automatically"
0 commit comments