Skip to content

fix(exec): arm the gateway node invoke deadline from exec host=node - #116591

Merged
omarshahine merged 1 commit into
mainfrom
fix/exec-node-invoke-deadline
Aug 1, 2026
Merged

omarshahine merged 1 commit into
mainfrom
fix/exec-node-invoke-deadline

Conversation

@omarshahine

@omarshahine omarshahine commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Follow-up to #115248. That PR landed the Gateway-side invocation deadline machinery (awaitNodeInvokeWithinDeadline, NODE_INVOKE_DEADLINE_EXPIRED, typed dispatch provenance), but the exec host=node path never arms it.

buildNodeSystemRunInvoke() emits nodeId / command / params / idempotencyKey and puts the command budget only in nested params.timeoutMs. There is no top-level timeoutMs, which is exactly what src/gateway/server-methods/nodes.invoke.ts reads to derive invokeDeadlineAtMs:

const invokeDeadlineAtMs =
  typeof p.timeoutMs === "number" && p.timeoutMs > 0 ? Date.now() + p.timeoutMs : undefined;

With it undefined, src/gateway/node-registry.ts falls back to a fixed timer:

const timeoutMs = resolveTimerTimeoutMs(params.timeoutMs, 30_000, 0);

So every exec host=node invocation gets a 30s Gateway deadline no matter what the caller asked for. The pending invoke is deleted at 30s, and the node's later success is acknowledged and thrown away as { ok: true, ignored: true } in nodes.handlers.invoke-result.ts.

The longer budget was only ever used as the caller's websocket wait (callGatewayTool("node.invoke", { timeoutMs: target.invokeTimeoutMs }, invoke)), which does not control the server-side registry deadline.

Repro

An approval-required exec host=node command that runs a bit over 30s:

  • Before: the command completes successfully on the paired node, but the Gateway already dropped the pending invoke at 30s. The result arrives, is logged as ignored, and the caller never receives a terminal outcome.
  • After: the Gateway deadline matches the command budget (35s for a 30s program budget, 125s for a 120s one), the pending invoke is still registered when the node answers, and the result is delivered normally.

Approval wall-clock makes this worse: the 30s registry timer starts at dispatch, so an approval that takes 20s leaves 10s of usable runtime.

Why This Change Was Made

Serialize the resolved invocation deadline as a top-level timeoutMs on the node.invoke payload, so the existing machinery is armed instead of dormant. This is the same top-level shape src/cli/nodes-cli/register.location.ts already uses.

Three ordered budgets, all derived in resolveNodeExecutionTarget from values that already exist — no new config knob, no new constants:

Budget Meaning Value
program runtime node-side process timer nested params.timeoutMs (unchanged)
gateway deadline invokeDeadlineAtMs runtime + 5s transport grace (the existing helper, just renamed)
caller wait websocket wait deadline + 5s (same grace convention)

runtime < deadline < caller wait holds for every finite positive budget, so the Gateway's deadline-expiry answer wins the race rather than the caller giving up first. Both upper budgets saturate together at MAX_SAFE_TIMEOUT_DELAY_MS, where the ordering degenerates by design.

timeout: 0 semantics are preserved exactly: the nested value stays 0 (no program-runtime timer on the node) and is never rewritten to a default or a finite process timeout, while the deadline and caller wait fall back to the default budget so neither the Gateway nor the caller can hang forever.

The NodeExecutionTarget.invokeTimeoutMs field is split into invokeDeadlineMs and invokeWaitMs so the two are not confusable at the call sites.

User Impact

exec host=node commands with a budget longer than 30s now complete instead of silently producing no terminal outcome. Shorter commands are unaffected apart from a 5s longer caller-side wait. No config surface, no new flags, no behavior change for system.run.prepare (still a 15s round-trip with no deadline) or for any non-exec node path.

Evidence

src/agents/bash-tools.exec-host-node.test.ts previously asserted only the caller option and the nested params.timeoutMs, which is precisely why this gap went uncovered. expectSystemRunInvoke now asserts the top-level payload value too and checks the budget ordering. New/extended coverage:

  • direct invoke, default budget: 30_000 / 35_000 / 40_000
  • explicit timeoutSec: 12: 12_000 / 17_000 / 22_000
  • new timeoutSec: 120 regression test — proves the budget is not clipped to the 30s registry fallback
  • timeout: 0 — nested stays 0; deadline and caller wait stay positive and finite
  • oversized budgets clamp to MAX_SAFE_TIMEOUT_DELAY_MS without producing a zero/undefined deadline
  • approved continuation dispatch and inline/prepared dispatch both carry the top-level deadline
  • new system.run.prepare test pins that the short prepare round-trip gains no deadline

Reverting only the payload line fails 9 tests in this suite, so the coverage is real rather than tautological.

node scripts/run-vitest.mjs src/agents/bash-tools.exec-host-node.test.ts \
  src/agents/bash-tools.exec-host-node.cancellation.test.ts \
  src/agents/bash-tools.exec-host-node-phases.cancellation.test.ts
# Test Files 3 passed (3) | Tests 86 passed (86)

tsgo --noEmit reports no errors in the touched files; remaining output is pre-existing and unrelated (openai-transport-stream.test-support.ts, ui/src/e2e/*). oxfmt clean.

Runtime behavior proof (before/after)

Test assertions alone only prove the payload shape, so this drives the real NodeRegistry with a fake node connection over a 120s budget, where the node finishes at 35s — past the registry's 30s fallback, well inside the requested budget. Run in a Crabbox lease against a fresh remote checkout of this PR's head (provider local-container, node:24-bookworm; lease cbx_90564ed15345, run run_30359597aed5, exit 0).

Before — no top-level timeoutMs:

{
  "armedTimeoutMs": 30000,
  "resultAccepted": false,
  "gatewayAckToNode": { "ok": true, "ignored": true },
  "callerResult": { "ok": false, "error": { "code": "TIMEOUT", "message": "node invoke timed out" } }
}

The registry arms 30s instead of the requested 125s, deletes the pending invoke, and handleInvokeResult() returns false for the node's success at 35s — which nodes.handlers.invoke-result.ts acknowledges as { ok: true, ignored: true }. The command really did succeed on the node; the caller is told it timed out.

After — deadline serialized on the payload:

{
  "armedTimeoutMs": 125000,
  "resultAccepted": true,
  "gatewayAckToNode": { "ok": true },
  "callerResult": { "ok": true, "payload": { "exitCode": 0, "aggregated": "done" } }
}

The pending invoke is still registered at 35s and the node's result reaches the caller.

Same-checkout suite contrast, where the revert phase deletes exactly one line (timeoutMs: params.target.invokeDeadlineMs,):

CRABBOX_PHASE:gateway-deadline-proof   20.2s   2 passed
CRABBOX_PHASE:payload-shape-after       0.1s   payload emits top-level timeoutMs: true
CRABBOX_PHASE:tests-after              12.2s   86 passed (3 files)
CRABBOX_PHASE:revert-payload-line       0.0s   reverted the single payload line
CRABBOX_PHASE:tests-before              9.9s   9 failed | 70 passed

Physical paired-node proof (macOS)

Verified end to end on exact PR head 809a73433fbd7acf4da437e69f1c6aeb9f04a9a0 using a fresh build of that revision. The Gateway and node host ran as separate processes with separate state directories and separate signed device identities. No shared Gateway token or password was supplied.

The isolated Gateway used loopback gateway.auth.mode=none. In that supported no-shared-secret configuration, first-time physical device identity pairing was silently auto-approved by the Gateway (approvedVia: silent); it was not manually approved. SSH verification was disabled. The distinct node command-surface pairing request was then manually approved. Final status reported:

{
  "displayName": "ProofNode-116591-809a7343",
  "version": "2026.7.2",
  "approvalState": "approved",
  "paired": true,
  "connected": true,
  "commands": ["system.run"]
}

The real executeNodeHostCommand caller then dispatched unique 35-second system.run commands through that paired node:

Case nested node runtime Gateway invocation deadline caller wait elapsed terminal result
timeoutSec: 45 45,000ms 50,000ms 55,000ms 35,347ms completed; unique marker delivered exactly once
timeoutSec: 0 0 (unbounded node process timer) 50,000ms 55,000ms 35,062ms completed; unique marker delivered exactly once

Gateway transport timing independently confirms that both results crossed the old 30-second boundary and reached the originating caller:

bounded:  [ws] res ✓ node.invoke 35044ms at 18:31:40.766Z
timeout:0 [ws] res ✓ node.invoke 35026ms at 18:32:15.831Z

There was no timeout or ignored result in either PR-head run. This also directly verifies that timeout: 0 preserves nested params.timeoutMs: 0 while still arming finite Gateway and caller budgets.

For contrast, current main at a1c689e375ec9daf1b6522e8a0aee1ff9805c1fe ran the same separate-node 35-second path and returned TIMEOUT: node invoke timed out after 30,004ms; the unique completion marker never reached the caller. That control was canceled at timeout, so it did not emit a later ignored-result log line.

Rebased on current main

Branch refreshed onto fd343ca8cc95 and the focused suites re-run on exact head 809a73433fbd: 3 files, 87 passed. Core production and test type checks, targeted Oxlint/Oxfmt, Knip unused-export scans, git diff --check, pnpm build, and fresh structured autoreview all passed. The delegated changed-check failed before execution during Daytona sync prune, so the same repository-planned gates ran through the documented trusted-source local fallback.

Out of scope

No typed unknown-execution outcome or failureKind enum; no stricter timeout validation (rejecting null/negative/sub-millisecond/oversized values is a separate compatibility-affecting change); no gateway.nodes.invokeTimeoutMs style config knob; no changes to src/agents/tools/nodes-tool.ts.

system.run.prepare is intentionally excluded because it is a short, non-execution preflight and retains its existing 15s caller wait / registry-default behavior; aligning prepare deadlines is separate follow-up scope.

@omarshahine
omarshahine marked this pull request as ready for review July 31, 2026 00:10
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Jul 31, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jul 31, 2026
@clawsweeper

clawsweeper Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 2:40 PM ET / 18:40 UTC.

ClawSweeper review

What this changes

The PR adds a top-level Gateway invocation deadline to exec host=node system-run requests and separates that deadline from the node process timeout and caller wait.

Merge readiness

✅ Ready for maintainer review

Keep this PR open for normal maintainer merge review. Current main still sends the node program timeout only inside system.run parameters, while the Gateway reads the top-level invocation timeout and otherwise uses its 30-second fallback; this patch supplies the missing owner-boundary value and has direct paired-node proof on its exact head.

Priority: P1
Reviewed head: 809a73433fbd7acf4da437e69f1c6aeb9f04a9a0

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with strong real paired-node evidence, clear owner-boundary behavior, and no actionable correctness finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The PR body provides exact-head physical paired-node evidence showing 35-second commands cross the former 30-second boundary and return one terminal result; the included logs are appropriately redacted.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The PR body provides exact-head physical paired-node evidence showing 35-second commands cross the former 30-second boundary and return one terminal result; the included logs are appropriately redacted.
Evidence reviewed 6 items Current-main omission: Current main builds system.run with only nested params.timeoutMs; it does not serialize a top-level timeoutMs, so this user path still lacks the value the Gateway deadline machinery consumes.
Gateway deadline contract: The Gateway creates an absolute deadline only from top-level request timeoutMs; the node registry otherwise resolves its pending invoke timer with a 30,000 ms fallback, and late results are intentionally acknowledged as ignored.
Patch repairs the request boundary: The PR writes the resolved Gateway deadline to top-level timeoutMs, retains the node-side runtime timeout inside params, and gives the caller a later wait deadline.
Findings None None.
Security None None.

How this fits together

exec host=node turns an agent shell request into a node.invoke Gateway request for a paired node. The Gateway holds the invocation pending until the node returns a terminal result or its invocation deadline expires, then returns that outcome to the agent.

flowchart LR
  A[Agent exec request] --> B[Node execution target]
  B --> C[Gateway invocation request]
  C --> D[Pending invocation deadline]
  D --> E[Paired node command]
  E --> F[Terminal node result]
  F --> G[Agent terminal outcome]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +17, Tests +65. Total +82 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 26 9 +17
Tests 3 83 18 +65
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 109 27 +82

Review metrics

None.

Technical review

Best possible solution:

Merge the focused request-boundary repair after the normal maintainer review and required checks for the exact head complete.

Do we have a high-confidence way to reproduce the issue?

Yes. The supplied exact-head paired-node proof runs real 35-second system.run commands beyond the previous 30-second Gateway fallback and records successful terminal delivery for bounded and zero node-runtime timeout cases.

Is this the best way to solve the issue?

Yes. Adding the existing top-level node.invoke.timeoutMs contract at the missing exec request boundary is narrower and safer than changing the registry fallback or adding a second timeout mechanism.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 560eda25b085.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P1: Without this repair, node commands that run longer than the fallback can complete remotely while their originating agent receives a timeout instead of a terminal result.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR body provides exact-head physical paired-node evidence showing 35-second commands cross the former 30-second boundary and return one terminal result; the included logs are appropriately redacted.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head physical paired-node evidence showing 35-second commands cross the former 30-second boundary and return one terminal result; the included logs are appropriately redacted.

Evidence

What I checked:

Likely related people:

  • steipete: The merged Gateway deadline implementation in the related PR is the direct feature predecessor whose top-level deadline contract this repair completes. (role: introduced related deadline machinery; confidence: high; commits: 2b8e6395b9e6; files: src/gateway/server-methods/nodes.invoke.ts, src/gateway/node-registry.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (7 earlier review cycles)
  • reviewed 2026-07-31T00:44:30.940Z sha 80930c4463a2e454f9f86fdde9a382ee0678ad10 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-31T01:16:51.674Z sha f8fa0ae :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-31T01:22:00.548Z sha f8fa0ae :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-31T23:21:00.746Z sha f8fa0ae :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-01T00:49:24.294Z sha f8fa0ae :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T00:57:20.542Z sha f8fa0ae :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T17:12:26.395Z sha f8fa0ae :: needs maintainer review before merge. :: none

@omarshahine

Copy link
Copy Markdown
Contributor Author

Crabbox before/after proof

Ran the fix against a fresh remote checkout of this PR's head (80930c4463a2e454f9f86fdde9a382ee0678ad10) in a Crabbox lease. The interesting part isn't the payload shape — it's the Gateway behavior the missing field causes, so the proof drives the real NodeRegistry with a fake node connection and a 120s command budget, plus a code-level before/after on the same checkout.

  • provider: local-container (Docker/Colima Linux lease, node:24-bookworm) — this machine has no coordinator auth, so this is not a Blacksmith Testbox or AWS run
  • lease cbx_90564ed15345, run run_30359597aed5, exit=0, sync 53.7s / command 2m18.7s

Scenario

Operator runs exec host=node with a 120s budget. The node finishes at 35s — past the registry's 30s fallback, well inside the requested budget.

Before — no top-level timeoutMs

{
  "armedTimeoutMs": 30000,
  "resultAccepted": false,
  "gatewayAckToNode": { "ok": true, "ignored": true },
  "callerResult": { "ok": false, "error": { "code": "TIMEOUT", "message": "node invoke timed out" } }
}

The registry arms 30s instead of the requested 125s, deletes the pending invoke, and handleInvokeResult() returns false for the node's success at 35s — which nodes.handlers.invoke-result.ts acknowledges as { ok: true, ignored: true }. The command really did succeed on the node; the caller is told it timed out.

After — deadline serialized on the payload

{
  "armedTimeoutMs": 125000,
  "resultAccepted": true,
  "gatewayAckToNode": { "ok": true },
  "callerResult": { "ok": true, "payload": { "exitCode": 0, "aggregated": "done" } }
}

The pending invoke is still registered at 35s and the node's result is delivered to the caller.

Suite before/after on the same checkout

Phase Result
PR head, bash-tools.exec-host-node + both cancellation suites 3 files, 86 passed
Same checkout with the single payload line reverted 9 failed, 70 passed
CRABBOX_PHASE:gateway-deadline-proof   20.2s   2 passed
CRABBOX_PHASE:payload-shape-after       0.1s   payload emits top-level timeoutMs: true
CRABBOX_PHASE:tests-after              12.2s   86 passed (3 files)
CRABBOX_PHASE:revert-payload-line       0.0s   reverted the single payload line
CRABBOX_PHASE:tests-before              9.9s   9 failed | 70 passed

The revert phase deletes exactly one line (timeoutMs: params.target.invokeDeadlineMs,), so the 9 failures are attributable to the fix itself rather than to unrelated churn. The scratch proof file used for the registry scenario is not part of the diff.

@omarshahine
omarshahine force-pushed the fix/exec-node-invoke-deadline branch from 80930c4 to f8fa0ae Compare July 31, 2026 01:12
@omarshahine

Copy link
Copy Markdown
Contributor Author

Both rank-up moves are done.

Runtime behavior proof is now in the PR body under "Runtime behavior proof (before/after)", with the full write-up in this comment. It drives the real NodeRegistry with a 120s budget and a node that returns at 35s: before, the registry arms 30s, drops the pending invoke, and the gateway acks the node's success as { ok: true, ignored: true } while the caller gets TIMEOUT; after, it arms 125s and the result reaches the caller as { ok: true, exitCode: 0 }. Stated plainly in the body: this is a simulated node connection at the Gateway boundary, not physically paired hardware.

Rebased on current main (3a6ee79a72e4), focused suites re-run on that result: 3 files, 86 passed. New head is f8fa0ae52b5b0ae18ed975eb9c17cfb5d232e820.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 31, 2026
@omarshahine omarshahine self-assigned this Jul 31, 2026
@domokos-lorant

Copy link
Copy Markdown

Maintainer review at f8fa0ae52b5b0ae18ed975eb9c17cfb5d232e820.

This fixes exec host=node commands whose requested runtime exceeds 30 seconds: the node received the process timeout, but the Gateway did not receive its top-level invocation deadline, so it removed the pending invocation after its 30-second fallback and ignored a later successful result.

LOC: +109/-27 (5 files)

Findings

No code findings. The implementation is focused, and the targeted tests cover direct, approved, prepared, zero-timeout, long-timeout, saturated-budget, and cancellation paths.

Best-fix verdict: best fix. Supplying the existing top-level node.invoke.timeoutMs contract at the missing exec host=node request boundary is cleaner than changing the registry fallback or adding another timeout mechanism. Keeping separate node runtime, Gateway deadline, and caller-wait budgets preserves ownership across the process, Gateway, and caller layers.

Provenance: PR #115248 added the Gateway absolute-deadline machinery; this PR repairs the remaining caller omission. Current main and shipped v2026.7.1 still leave this path on the 30-second registry fallback.

Code read: src/agents/bash-tools.exec-host-node-phases.ts, src/agents/bash-tools.exec-host-node.ts, src/gateway/server-methods/nodes.invoke.ts, src/gateway/node-registry.ts, src/gateway/server-methods/nodes.handlers.invoke-result.ts, src/gateway/call.ts, src/node-host/invoke-system-run.ts, protocol schema, sibling node callers, adjacent tests, and exec timeout docs.

Remaining uncertainty / merge proof: the current before/after proof exercises the real registry and result handler with a simulated node connection. Before merge, run a physically paired node command lasting over 30 seconds and show that the originating exec caller receives the terminal result.

By: Omar Shahine (@omarshahine, acct 2014-12-29), an established OpenClaw contributor.

@omarshahine
omarshahine requested a review from steipete July 31, 2026 22:40
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 31, 2026
@omarshahine

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 1, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Aug 1, 2026

@Yigtwxx Yigtwxx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at f8fa0ae, focused on whether the three-budget model is actually enforced rather than just asserted.

The new coverage is load-bearing — I verified it by mutation rather than by reading. I broke the derivation (resolveNodeInvokeWaitMs returning invokeDeadlineMs - 5_000, i.e. a caller wait shorter than the Gateway deadline) and ran the suite twice:

run what changed result
1 mutated production only 9 failed / 70 passed — every failure at expectSystemRunInvoke L433, expected 30000 to be 40000
2 mutation + all 7 call-site literals updated to match the mutant (simulating an author "fixing" the reds) 9 failed / 70 passed — 7 failures now at L435, expected 35000 to be less than or equal to 30000

That second run is the interesting one. The ordering assertions at L434-436 read the helper's own parameters rather than the recorded call, so at first glance they look tautological and unable to catch a production regression. They aren't: L432-433 pin those parameters to the recorded payload, so the only way to silence them is to make the literals inconsistent with each other, which is exactly what L434-436 then catch. The two layers cover each other, and it("arms the gateway invocation deadline for a budget longer than the 30s registry fallback") fails in both directions. Worth stating explicitly since "these three lines don't touch call" is the natural first objection to this helper.

Also confirmed the small-timeout case can't invert: the Math.max(10_000, ...) floor is applied to the deadline at L101 before the wait derives from it at L108, which is what keeps timeout: 1 from producing a wait below its own deadline.

One finding, inline: the invariant this establishes holds for system.run but not for the other node.invoke hop in the same file. prepareNodeSystemRun sends a 15 s caller wait with no top-level timeoutMs, so the Gateway falls back to its fixed 30 s pending timer — the inverted ordering, and the same abandoned-invoke shape the PR is fixing. The branch pins that gap deliberately with a test, so this is a scope question rather than a defect; details and two low-cost options are in the inline comment.

For the record, hypotheses I checked that came back clean: the tests are not mock-shielded (bash-tools.exec-host-node-phases.js is unmocked in this suite, so call.params?.timeoutMs reads the real payload); timeout: 0 is not treated as 0 ms (resolveNodeRunTimeoutMs keeps the literal 0 for the node while the deadline independently falls back to the default budget); and the saturation case where all three collapse to MAX_SAFE_TIMEOUT_DELAY_MS is documented at L104-106 and unreachable in practice.

The gateway deadline machinery from #115248 reads a top-level timeoutMs on
the node.invoke payload, but buildNodeSystemRunInvoke() only ever emitted
the nested program budget. With p.timeoutMs undefined the registry falls
back to a fixed 30s pending-invoke timer, drops the pending entry, and
discards the node's later success as ignored, so the caller never sees a
terminal outcome.

Serialize the resolved invocation deadline as the top-level timeoutMs and
keep three ordered budgets: node program runtime < gateway deadline <
caller wait. A zero timeout still means "no program-runtime timer" and is
never rewritten, while the gateway deadline and caller wait stay positive
and finite so neither side can hang forever.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 8ea5a828-596c-4bf9-9382-0081bd0d50cd
@omarshahine
omarshahine force-pushed the fix/exec-node-invoke-deadline branch from f8fa0ae to 809a734 Compare August 1, 2026 18:34
@omarshahine

Copy link
Copy Markdown
Contributor Author

Restacked exact head 809a73433fbd7acf4da437e69f1c6aeb9f04a9a0 onto fd343ca8cc956d4af650a35c2957a8a8e700651c. The PR body now includes fresh physical paired-node proof for both 35-second one-shot cases: timeoutSec: 45 completed once in 35,347ms with 45s/50s/55s ordered budgets, and timeoutSec: 0 completed once in 35,062ms with nested runtime 0 and finite 50s/55s outer budgets. Focused tests, core production/test type checks, targeted lint/format/deadcode, build, and fresh autoreview are clean.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Aug 1, 2026
@omarshahine
omarshahine merged commit 9d32dd0 into main Aug 1, 2026
130 of 132 checks passed
@omarshahine
omarshahine deleted the fix/exec-node-invoke-deadline branch August 1, 2026 21:22
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
…penclaw#116591)

The gateway deadline machinery from openclaw#115248 reads a top-level timeoutMs on
the node.invoke payload, but buildNodeSystemRunInvoke() only ever emitted
the nested program budget. With p.timeoutMs undefined the registry falls
back to a fixed 30s pending-invoke timer, drops the pending entry, and
discards the node's later success as ignored, so the caller never sees a
terminal outcome.

Serialize the resolved invocation deadline as the top-level timeoutMs and
keep three ordered budgets: node program runtime < gateway deadline <
caller wait. A zero timeout still means "no program-runtime timer" and is
never rewritten, while the gateway deadline and caller wait stay positive
and finite so neither side can hang forever.

Co-authored-by: Omar Shahine <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 8ea5a828-596c-4bf9-9382-0081bd0d50cd
@giodl73-repo

Copy link
Copy Markdown
Contributor

@omarshahine, following up on this PR's explicitly deferred strict-timeout compatibility decision, not reopening the merged deadline fix.

Would the exec/runtime owners accept a separate change that rejects invalid explicit timeouts before node discovery, approval, or dispatch, while preserving omitted/default and explicit-zero semantics? The requested contract rejects null/nonfinite values at direct API boundaries, negative values, positive sub-millisecond values, and values above the supported timer range. The public JSON/schema boundary needs its own validation proof; nonfinite numbers are not JSON inputs.

Public-source evidence:

  • At 2ff4a4903c6fe60d8419053b3acda108b6e62f54, a seven-case characterization through real executeNodeHostCommand with mocked inventory/approval/Gateway transport observed fallback for null/nonfinite values, a zero process timeout for -1 and 0.0005, and saturation for 3000000 and Number.MAX_VALUE. Each case reached a mocked system.run. This was not a real-device or public tool-parser test.
  • The unchanged node-host/phases/approval-followup and timeout-seconds suites passed 170 distinct tests. The stricter rejection oracle deliberately failed against native normalization; that is a policy difference, not an established upstream bug.
  • Source recheck of exec-tool-timeout.ts at ece27a12d64cd374f539989b168541f547995286 on September26 still shows the native fallback/zero/saturation contract. The whole latest-main composition was not executed.

We intend to retain strict rejection downstream pending owner direction. Should this become a focused compatibility proposal, or remain downstream policy? In particular, please confirm the intended validation boundary and upper-limit/grace rule before implementation. No new timeout setting, deadline machinery, retry policy, or change to system.run.prepare is proposed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants