Skip to content

Commit cd3428b

Browse files
committed
fix: dispatchToGateway timeoutId scoping bug and agent doc consistency
- Move timeoutId declaration outside try block so catch can clear it. Previously timeoutId was const inside try, making it invisible in catch — network errors (ECONNREFUSED, AbortError) left the 10s timeout active and clearTimeout threw ReferenceError silently. - Remove redundant clearTimeout on 5xx retry path (already cleared after fetch on line 313). - Standardize agent IDENTITY.md headings: "What I Don't Do" → "What I Do Not Do" in responder and reporting agents to match other 5 agents.
1 parent 4252e1d commit cd3428b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

openclaw/agents/reporting/IDENTITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- Perform trend analysis using moving average, linear regression, seasonal decomposition, and anomaly detection to classify trends as improving, stable, or degrading
1010
- Produce actionable recommendations for rule tuning, coverage improvement, efficiency, and resource optimization
1111

12-
## What I Don't Do
12+
## What I Do Not Do
1313
- Execute any response or containment actions -- strictly read-only
1414
- Make triage or investigation decisions -- upstream agents handle that
1515
- Approve or reject response plans -- the Policy Guard and humans own that

openclaw/agents/responder/IDENTITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- Maintain rollback capability and execution evidence for every action taken
1010
- Enforce safeguards: action limits, timing controls, circuit breaker, protected entity checks
1111

12-
## What I Don't Do
12+
## What I Do Not Do
1313
- Initiate or approve response actions -- humans control both approval and execution triggers
1414
- Analyze alerts or make triage decisions -- that belongs to upstream agents
1515
- Generate reports or metrics -- the Reporting Agent handles that

runtime/autopilot-service/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,10 @@ async function dispatchToGateway(webhookPath, payload) {
296296
const outgoingPayload = { ...payload, dispatched_at: new Date().toISOString() };
297297

298298
for (let attempt = 0; attempt < 2; attempt++) {
299+
let timeoutId;
299300
try {
300301
const controller = new AbortController();
301-
const timeoutId = setTimeout(() => controller.abort(), 10000);
302+
timeoutId = setTimeout(() => controller.abort(), 10000);
302303

303304
const response = await fetch(url, {
304305
method: "POST",
@@ -341,7 +342,6 @@ async function dispatchToGateway(webhookPath, payload) {
341342

342343
// 5xx — retry once
343344
if (attempt === 0) {
344-
clearTimeout(timeoutId);
345345
await response.text().catch(() => ""); // drain body
346346
continue;
347347
}

0 commit comments

Comments
 (0)