Skip to content

fix(http): keep timeout diagnostics tied to elapsed time - #187765

Closed
Alix-007 wants to merge 2 commits into
openclaw:mainfrom
Alix-007:fix/alix-fetch-timeout-clock-20261029
Closed

Alix-007 wants to merge 2 commits into
openclaw:mainfrom
Alix-007:fix/alix-fetch-timeout-clock-20261029

Conversation

@Alix-007

@Alix-007 Alix-007 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Current PR head: 15c8c77594a72c7c7c3d4a64937119b03b388b67. The follow-up commit adds only the missing src/shared/monotonic-time.ts entry to scripts/pr-lib/wrapper-components.txt. The timeout owner, helper, tests, dependencies and runtime configuration are byte-identical to the actual normal-build/CLI-proof head eca1e829005150e72bb157065b03a73c707d20f4. All original runtime observations below retain that executed head and are reused; no new build or CLI replay at 15c8c775 is claimed.

CI exposed this attributable packaging omission: the trusted-anchor wrapper extracts this inventory, so its existing two closure checks failed with a missing path and an unresolved ../shared/monotonic-time.js import. The one-line repair restores that complete extraction closure without changing wrapper trust or admission logic.

A wall-clock correction can make an ordinary HTTP timeout claim that its timer was delayed by a minute and suggest event-loop starvation. Backward corrections can instead hide genuine elapsed time.

User Impact

Existing timeout logs report elapsed duration and timer lateness accurately across clock changes. Request budgets, cancellation, refresh, URL redaction and healthy lookup behavior retain their contracts.

Why This Change Was Made

Use the existing canonical monotonic clock for the shared timeout's private start/end samples. All callers keep the same signal and response APIs; no new diagnostic event, flag or configuration is added.

Evidence

Current packaging-only head 15c8c77594a72c7c7c3d4a64937119b03b388b67 received independent source review PASS with no P0–P3 findings. Repair diff SHA256 819b8dd76885726fc458816f002a01e9551541ddaebdfa2f46404d20741dc80e; inventory SHA256 bfbe1df6d3dd633f5baeed7085054a8b7120a425dfb30561dff509709621cfe8. Actual hosted failed-job log 123552842289 is retained at SHA256 02c25d79e3c79fa111eb3f8af31b2405efc8aa26ece79d0f5ba0a1684e2c07cd. This failure was caused by the new dependency and is not attributed to an unrelated flake or upstream baseline.

Existing focused command node scripts/run-vitest.mjs test/scripts/eager-import-closure.test.ts --maxWorkers=1 -t 'PR wrapper inventory|extracted dependency context' passes both selected tests (33 unselected), exit0,52.462s process wall on repair snapshot 819b8dd76885726fc458816f002a01e9551541ddaebdfa2f46404d20741dc80e. Original assertions and test sources are unchanged. The native CLI proof remains pinned to eca1e829005150e72bb157065b03a73c707d20f4, whose product source is unchanged here. Hosted CI at the follow-up head is pending, not claimed green.

  • Scenario: An ordinary request timeout is not misreported as event-loop starvation after wall time changes; Original timeout abort, healthy lookup and genuine delayed-callback diagnostics retain their behavior.
  • Entry: node --import clock-step.mjs openclaw.mjs channels resolve --channel telegram --kind user @fixture --json; disputed owner ran unmocked: src/utils/fetch-timeout.ts buildTimeoutAbortSignal scheduleTimeout and abortDueToTimeout; actual bundled Telegram lookup uses this existing owner without replacement.
  • Same command on base 5598c3d and head eca1e82: python3 fetch-timeout-clock-proof.py --checkout "$CHECKOUT" --node "$NODE" --output "$OUTPUT" --expect "$PHASE"
    • Before (base): RED a forward60s child-wall step produces elapsed75004ms, timerDelay60004ms and likely event-loop starvation while the native request closes after14990.991ms. Ordinary elapsed15003/native14989.735ms has no hint; genuine blocked timer elapsed24028/native24015.052ms has the existing valid starvation hint. Healthy lookup resolves424242.
    • After (head): GREEN at the actual original proof head eca1e82: forward-step timeout follows native elapsed time and omits timerDelayMs/eventLoopDelayHint; normal and healthy output unchanged, genuine delayed callback retains its hint. Full selected actual readbacks embedded below.
  • Readback (subprocess,http,disk,network-recorder): Real CLI stdout/stderr/status, raw structured timeout warning from private log file, independently measured native GET/close duration, child clock records, unchanged config hash and resource cleanup.
  • Proof harness: Unchanged fetch-timeout-clock-proof.py SHA256 d4f9ff5619d2ff03ffd664df439d91e5e7b94f1bfb1ba5de860a8b46d8da52f6, same four cases, same child preload SHA256 0e069fa6e78f4130efd4f636e17c08d414b1fdbaa19de295f6150ff8b2c84b9a; private native HTTP server has no product-owner stub and never sends timeout response headers.
  • Control: All eight commands exit0 with one native GET each and no watchdog; the three timeout cases close actual sockets without response headers, the healthy case resolves424242. Both refs have identical parsed CLI output per scenario; config bytes unchanged, offset restored0, serving threads stopped and listening ports closed. Actual native Atomics.wait block proves that genuine timer lateness still fires the positive diagnostic.
  • Other callers checked: Shared helper returns only signal/cleanup/refresh, and fetchWithTimeout returns a Response; elapsed state remains private to logging. Full reference/diagnostic-assertion audit found no outside consumer asserting that clock. No per-caller patch or ABI/config change. Runtime covers existing Telegram lookup only.
  • Tests: Existing canonical src/utils/fetch-timeout.test.ts passes14/14 (old12 retained plus2 independent refreshed-timer wall controls) in7.652s process wall; original production failed both new regressions in8.978s. Focused types105.440s, typed lint132.831s, format0.280s and four ratchets/diff pass. Normal clean cliStartup build at the original proof head eca1e82 passes272.171s; its result is reused for unchanged product source. (measured cost: Single owner14tests7.652s wall, types105.440s/lint132.831s including normal tool preparation; staged ratchets linecap2.446s/maxlines10.977s/testlines2.072s/mockexports28.314s/diff0.140s; net23testLF with exact23 allocation, shared scalar unchanged. No full-suite run, assertion/deadline relaxation or equivalent repeated build.)
  • Not tested: Actual OS/NTP clock adjustment, native macOS/Windows, live Telegram bot/users/messages, all shared runtime callers, full suite and hosted CI. No changes to timeout duration, provider/config/permission/protocol/schema/default/migration or installed upgrade behavior are claimed. CLI unresolved-result exit0 remains existing policy.

Actual executed production-proof head eca1e829005150e72bb157065b03a73c707d20f4; normal clean cliStartup build 272.171s. BASE 5598c3d76bcb28cacaf864724d52ccb4c8ccdd26 uses the existing clean normal build262.108s. Both actual build-info/stamps and selected file hashes are below. Linux x64, Node26.12.1, OpenClaw2026.10.8.

Same frozen collector on both refs:

python3 fetch-timeout-clock-proof.py --checkout "$CHECKOUT" --node "$NODE" --output "$OUTPUT" --expect "$PHASE"

The shipped channels resolve entry loads the actual bundled Telegram resolver and its native HTTP client. A configured synthetic Bot API peer receives its real getChat GET. Three cases hold headers until the product timeout aborts the actual socket; one case returns a valid local response. The collector reads the actual structured file log, stdout/status, peer close/timing and child clock records. No shared timeout/fetch/logger owner is replaced or imported directly by the collector, and no Telegram user or group receives a message.

Scenario BASE logged elapsed ms HEAD logged elapsed ms HEAD native peer duration ms HEAD starvation hint
healthy-getchat healthy healthy 0.873 no
ordinary-timeout 15003 15004.074626000001 14991.110 no
forward-wall-timeout 75004 15003.208627000002 14990.569 no
actual-delayed-timer 24028 24025.758763 24012.386 yes

The ordinary and forward-step native timers still abort at the original15s. The positive lateness control blocks the CLI main thread for10s with native Atomics.wait after a real14s timer; it correctly produces an approximately24s request and the existing starvation hint. Forward stepping changes only Date.now in the disposable CLI child after the peer has accepted the request; timers, performance clock, parent and OS remain normal. Actual logging epoch timestamps may move because they remain wall time. This proves diagnostic correctness, not performance or NTP behavior.

All eight processes exit0, exactly one native GET each, no watchdog; per-scenario parsed CLI outputs match between refs. Timeout cases send no response headers and observe native client close; healthy lookup returns424242. The collector restores each clock offset, closes the actual peer/thread/port and verifies config bytes unchanged. Private fixture directories and raw observations are retained locally; their hashes and complete relevant readbacks are public below.

Focused regressions retain all12 existing cases and add2 independent ±wall controls after refresh. The old genuine-late assertion now advances elapsed time independently; abort reason, parent cancellation, response-body lifetime, timeout bounds, cleanup and URL/token redaction assertions remain.14/14 passes in7.652s; original production fails both new cases in8.978s. Exact test growth23LF has its own23LF allocation. Production +3/−2; tests +25/−2; no shared budget increase. Independent P0–P3 source review passed under the user-authorized delegated fallback; standard autoreview helper is unavailable and was not run.

Existing alternatives/history: this repairs values already emitted by the accepted timeout logger. The former closed diagnostic-event proposal #84836/#84835 sought a new event; this PR adds none and preserves genuine-lateness detection. All-state symbol/semantic scans plus complete active-PR files found no viable same-owner competitor; a broad incomplete scan is not used as absence evidence. All shared callers retain their contracts; no caller-specific split. Outside fixture audit found no other diagnostic elapsed assertions requiring migration.

Limits: actual OS/NTP steps, native Windows/macOS, live accounts/channels/messages, all runtime consumers, full suite, hosted CI and upgrade execution are not run. There is no public config/schema/security/default/ABI or storage change; normal CLI unresolved lookup still exits0 as before.

Actual paired CLI, native HTTP and log readback

Only local executable paths in commands are presented portably; every numeric observation, parsed CLI output, complete stderr, timeout log field, clock record, request and raw hash is retained. The invented synthetic fixture token uses JSON unicode notation; decoding restores the recorded value. This is not a real account credential.

{
  "base": "5598c3d76bcb28cacaf864724d52ccb4c8ccdd26",
  "head": "eca1e829005150e72bb157065b03a73c707d20f4",
  "sourceSnapshot": "413720d2b2dd63c315f74195fd665b6fec6ded37a4f92a31154c84c64c7bafbb",
  "fileSha256": {
    "src/utils/fetch-timeout.ts": "0b511cf8b0bce45bf99a1697d3c76f8214c9288922a49341b5e2fd91cdcc1094",
    "src/utils/fetch-timeout.test.ts": "4422d83ca58d4088684d1c6839c06e3bddb808fe00b977d28e61d07c843943db",
    "config/test-lines-allocations/alix-fetch-timeout-clock-20261029.txt": "076320a2a08267b4c026d06573bba408ea68841e73cdc20e62cce59de165ece3"
  },
  "collectorSha256": "d4f9ff5619d2ff03ffd664df439d91e5e7b94f1bfb1ba5de860a8b46d8da52f6",
  "preloadSha256": "0e069fa6e78f4130efd4f636e17c08d414b1fdbaa19de295f6150ff8b2c84b9a",
  "baseReceiptSha256": "bdb2ce6e98c35e4151edb124dd48e35af5128c791460f40ef4537219ad499ebe",
  "headReceiptSha256": "859f2adee3fc9541262b5615549930df94989d27d4be8469e99543c21cc3f4b3",
  "baseBuild": {
    "version": "2026.10.8",
    "commit": "5598c3d76bcb28cacaf864724d52ccb4c8ccdd26",
    "builtAt": "2026-10-29T10:34:34.652Z",
    "buildId": "2026.10.8-5598c3d76bcb-2026-10-29T10-34-34.652Z"
  },
  "headBuild": {
    "version": "2026.10.8",
    "commit": "eca1e829005150e72bb157065b03a73c707d20f4",
    "builtAt": "2026-10-29T15:12:49.466Z",
    "buildId": "2026.10.8-eca1e8290051-2026-10-29T15-12-49.466Z"
  },
  "headBuildStamp": {
    "builtAt": 1793287028000,
    "head": "eca1e829005150e72bb157065b03a73c707d20f4",
    "inputsClean": true,
    "inputSignature": "dbda74dc70db04cb2ebcc897ae83400738b769a9a4e5514d1e05cee926b86808"
  },
  "headBuildWallSeconds": 272.171,
  "scope": "Linux x64 Node26.12.1 normally built CLI; actual bundled Telegram lookup and native HTTP peer, synthetic private account/config; child-only Date.now offset, no OS clock changes.",
  "pairs": [
    {
      "case": "healthy-getchat",
      "base": {
        "case": "healthy-getchat",
        "mode": "healthy",
        "peerPort": 44039,
        "code": 0,
        "watchdog": false,
        "processElapsedMs": 13763.152178842574,
        "requests": [
          {
            "method": "GET",
            "path": "/bot123456789\u003aABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi/getChat?chat_id=%40fixture",
            "acceptedAtMonotonic": 2422866.76381653,
            "responseStatus": 200,
            "responseBytes": 80,
            "elapsedMs": 0.583237037062645
          }
        ],
        "stdoutSha256": "645ed975be368017756d5dc7424a9354a9838adb5215628f7fccf98f7419b508",
        "stderrSha256": "4738990d88db066256b000ccee51094eb9435d8dcf24fc05e202bb321bb9ad92",
        "configBeforeSha256": "f2ccbb240ce08f8735f40e9f9ebad7560866aaa5deb300c3acb237e8c2cc499e",
        "configAfterSha256": "f2ccbb240ce08f8735f40e9f9ebad7560866aaa5deb300c3acb237e8c2cc499e",
        "clock": [
          {
            "at": 1877.835951,
            "event": "date-offset",
            "offsetMs": 0
          },
          {
            "at": 13535.757131,
            "event": "native-peer-accepted"
          },
          {
            "at": 13697.730262,
            "event": "exit-restore",
            "offsetMs": 0
          }
        ],
        "timeoutWarnings": [],
        "logSha256": "659c2a499001767f6fa390afd755e9104564278dd19da0ce6ed16d6cfe389901",
        "stdout": [
          {
            "input": "@fixture",
            "resolved": true,
            "id": "424242",
            "name": "@fixture"
          }
        ],
        "result": "PASS",
        "cleanup": {
          "offsetRestored": true,
          "peerThreadStopped": true,
          "peerPortClosed": true
        },
        "command": [
          "node",
          "--import",
          "clock-step.mjs",
          "openclaw.mjs",
          "channels",
          "resolve",
          "--channel",
          "telegram",
          "--kind",
          "user",
          "@fixture",
          "--json"
        ],
        "stderr": "(node:1455341) [DEP_PLUGIN_SDK] DeprecationWarning: Plugin telegram: createApproverRestrictedNativeApprovalCapability is deprecated; use createApproverRestrictedNativeApprovalCapabilityAsync instead. The legacy contract remains supported during its deprecation period. Final compatibility day: 2026-12-31. Removal ships in the first January 2027 stable release; no SDK major is required.\n(Use `node --trace-deprecation ...` to show where the warning was created)\n"
      },
      "head": {
        "case": "healthy-getchat",
        "mode": "healthy",
        "peerPort": 35413,
        "code": 0,
        "watchdog": false,
        "processElapsedMs": 8215.837797150016,
        "requests": [
          {
            "method": "GET",
            "path": "/bot123456789\u003aABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi/getChat?chat_id=%40fixture",
            "acceptedAtMonotonic": 2426930.154422223,
            "responseStatus": 200,
            "responseBytes": 80,
            "elapsedMs": 0.8731787092983723
          }
        ],
        "stdoutSha256": "645ed975be368017756d5dc7424a9354a9838adb5215628f7fccf98f7419b508",
        "stderrSha256": "0690ecd34e913a414ded7db88d3db599123331a7fbad7137fa52baa978aa22cf",
        "configBeforeSha256": "80272efd8941d067b4f99de06e6c3eb47796071a66b795b50f7b1a4eddb476c0",
        "configAfterSha256": "80272efd8941d067b4f99de06e6c3eb47796071a66b795b50f7b1a4eddb476c0",
        "clock": [
          {
            "at": 921.519617,
            "event": "date-offset",
            "offsetMs": 0
          },
          {
            "at": 8065.371069,
            "event": "native-peer-accepted"
          },
          {
            "at": 8141.303013,
            "event": "exit-restore",
            "offsetMs": 0
          }
        ],
        "timeoutWarnings": [],
        "logSha256": "a9f85cefea7b5a2c9a3881304067eea8333da91fe660dc3d77f8e16dd1512f0a",
        "stdout": [
          {
            "input": "@fixture",
            "resolved": true,
            "id": "424242",
            "name": "@fixture"
          }
        ],
        "result": "PASS",
        "cleanup": {
          "offsetRestored": true,
          "peerThreadStopped": true,
          "peerPortClosed": true
        },
        "command": [
          "node",
          "--import",
          "clock-step.mjs",
          "openclaw.mjs",
          "channels",
          "resolve",
          "--channel",
          "telegram",
          "--kind",
          "user",
          "@fixture",
          "--json"
        ],
        "stderr": "(node:1585304) [DEP_PLUGIN_SDK] DeprecationWarning: Plugin telegram: createApproverRestrictedNativeApprovalCapability is deprecated; use createApproverRestrictedNativeApprovalCapabilityAsync instead. The legacy contract remains supported during its deprecation period. Final compatibility day: 2026-12-31. Removal ships in the first January 2027 stable release; no SDK major is required.\n(Use `node --trace-deprecation ...` to show where the warning was created)\n"
      }
    },
    {
      "case": "ordinary-timeout",
      "base": {
        "case": "ordinary-timeout",
        "mode": "normal",
        "peerPort": 39239,
        "code": 0,
        "watchdog": false,
        "processElapsedMs": 22670.23063916713,
        "requests": [
          {
            "method": "GET",
            "path": "/bot123456789\u003aABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi/getChat?chat_id=%40fixture",
            "acceptedAtMonotonic": 2422874.825739619,
            "noResponseHeadersSent": true,
            "nativeClientClosed": true,
            "elapsedMs": 14989.735336974263
          }
        ],
        "stdoutSha256": "4ea7d3f94c368e39af4cdbf7a5d2996a1620d651480a96023ab3f2c8bd35bac5",
        "stderrSha256": "97726b1ee9df902a6a73c27f2a320c46153bfa5d85324b4559929afb2729038f",
        "configBeforeSha256": "f575c2844d37df5a5f3284e2de4a5fd01913fc2aa9c6e7ab34ef6c21dddd731f",
        "configAfterSha256": "f575c2844d37df5a5f3284e2de4a5fd01913fc2aa9c6e7ab34ef6c21dddd731f",
        "clock": [
          {
            "at": 888.750261,
            "event": "date-offset",
            "offsetMs": 0
          },
          {
            "at": 7569.357641,
            "event": "native-peer-accepted"
          },
          {
            "at": 22607.375953,
            "event": "exit-restore",
            "offsetMs": 0
          }
        ],
        "timeoutWarnings": [
          {
            "timeoutMs": 15000,
            "elapsedMs": 15003,
            "operation": "telegram-getchat-lookup",
            "url": "http://127.0.0.1:39239/bot***/getChat"
          }
        ],
        "logSha256": "b5018f3fb762b0596ef161f848669fb266c926db61c67dff98e156e6453773ae",
        "stdout": [
          {
            "input": "@fixture",
            "resolved": false,
            "note": "Telegram username could not be resolved by the configured bot."
          }
        ],
        "result": "PASS",
        "cleanup": {
          "offsetRestored": true,
          "peerThreadStopped": true,
          "peerPortClosed": true
        },
        "command": [
          "node",
          "--import",
          "clock-step.mjs",
          "openclaw.mjs",
          "channels",
          "resolve",
          "--channel",
          "telegram",
          "--kind",
          "user",
          "@fixture",
          "--json"
        ],
        "stderr": "(node:1455661) [DEP_PLUGIN_SDK] DeprecationWarning: Plugin telegram: createApproverRestrictedNativeApprovalCapability is deprecated; use createApproverRestrictedNativeApprovalCapabilityAsync instead. The legacy contract remains supported during its deprecation period. Final compatibility day: 2026-12-31. Removal ships in the first January 2027 stable release; no SDK major is required.\n(Use `node --trace-deprecation ...` to show where the warning was created)\n"
      },
      "head": {
        "case": "ordinary-timeout",
        "mode": "normal",
        "peerPort": 41479,
        "code": 0,
        "watchdog": false,
        "processElapsedMs": 23905.426557641476,
        "requests": [
          {
            "method": "GET",
            "path": "/bot123456789\u003aABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi/getChat?chat_id=%40fixture",
            "acceptedAtMonotonic": 2426939.430375262,
            "noResponseHeadersSent": true,
            "nativeClientClosed": true,
            "elapsedMs": 14991.11016606912
          }
        ],
        "stdoutSha256": "4ea7d3f94c368e39af4cdbf7a5d2996a1620d651480a96023ab3f2c8bd35bac5",
        "stderrSha256": "6d82499fe765e9d562820c1776022e127bf220276ac67a93cc34cbe01c0b2098",
        "configBeforeSha256": "b5fd92e2bf879eef5f21bab6286238b963a1212acc6704bff9f2ca876b4a71bb",
        "configAfterSha256": "b5fd92e2bf879eef5f21bab6286238b963a1212acc6704bff9f2ca876b4a71bb",
        "clock": [
          {
            "at": 974.027533,
            "event": "date-offset",
            "offsetMs": 0
          },
          {
            "at": 8777.155454,
            "event": "native-peer-accepted"
          },
          {
            "at": 23832.597249,
            "event": "exit-restore",
            "offsetMs": 0
          }
        ],
        "timeoutWarnings": [
          {
            "timeoutMs": 15000,
            "elapsedMs": 15004.074626000001,
            "operation": "telegram-getchat-lookup",
            "url": "http://127.0.0.1:41479/bot***/getChat"
          }
        ],
        "logSha256": "3a85bcda4d9590c39acbb18046718fc4bd5f825084d8b01eec7d999ba688a3cf",
        "stdout": [
          {
            "input": "@fixture",
            "resolved": false,
            "note": "Telegram username could not be resolved by the configured bot."
          }
        ],
        "result": "PASS",
        "cleanup": {
          "offsetRestored": true,
          "peerThreadStopped": true,
          "peerPortClosed": true
        },
        "command": [
          "node",
          "--import",
          "clock-step.mjs",
          "openclaw.mjs",
          "channels",
          "resolve",
          "--channel",
          "telegram",
          "--kind",
          "user",
          "@fixture",
          "--json"
        ],
        "stderr": "(node:1585526) [DEP_PLUGIN_SDK] DeprecationWarning: Plugin telegram: createApproverRestrictedNativeApprovalCapability is deprecated; use createApproverRestrictedNativeApprovalCapabilityAsync instead. The legacy contract remains supported during its deprecation period. Final compatibility day: 2026-12-31. Removal ships in the first January 2027 stable release; no SDK major is required.\n(Use `node --trace-deprecation ...` to show where the warning was created)\n"
      }
    },
    {
      "case": "forward-wall-timeout",
      "base": {
        "case": "forward-wall-timeout",
        "mode": "forward",
        "peerPort": 42483,
        "code": 0,
        "watchdog": false,
        "processElapsedMs": 22384.0796276927,
        "requests": [
          {
            "method": "GET",
            "path": "/bot123456789\u003aABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi/getChat?chat_id=%40fixture",
            "acceptedAtMonotonic": 2422897.609592126,
            "noResponseHeadersSent": true,
            "nativeClientClosed": true,
            "elapsedMs": 14990.990868769586
          }
        ],
        "stdoutSha256": "4ea7d3f94c368e39af4cdbf7a5d2996a1620d651480a96023ab3f2c8bd35bac5",
        "stderrSha256": "dbf3cf21e7df2df8aad66359e7b46955c047ba9bc136c11254fd3b4ccfc730e1",
        "configBeforeSha256": "359c4acb4ea0e14d8bfa91ea69a12142249f218f8b6b7896f72e38cf4cdd66d2",
        "configAfterSha256": "359c4acb4ea0e14d8bfa91ea69a12142249f218f8b6b7896f72e38cf4cdd66d2",
        "clock": [
          {
            "at": 854.573133,
            "event": "date-offset",
            "offsetMs": 0
          },
          {
            "at": 7267.932715,
            "event": "native-peer-accepted"
          },
          {
            "at": 7268.476357,
            "event": "offset-set",
            "offsetMs": 60000
          },
          {
            "at": 22250.086706,
            "event": "date-offset",
            "offsetMs": 60000
          },
          {
            "at": 22256.233411,
            "event": "date-offset",
            "offsetMs": 0
          },
          {
            "at": 22311.028702,
            "event": "exit-restore",
            "offsetMs": 0
          }
        ],
        "timeoutWarnings": [
          {
            "timeoutMs": 15000,
            "elapsedMs": 75004,
            "timerDelayMs": 60004,
            "eventLoopDelayHint": "timer delayed 60004ms, likely event-loop starvation",
            "operation": "telegram-getchat-lookup",
            "url": "http://127.0.0.1:42483/bot***/getChat"
          }
        ],
        "logSha256": "7c1f20fb53fd03818e5bfee70fe499742b186ed410dafe06622e1dec43c5da4a",
        "stdout": [
          {
            "input": "@fixture",
            "resolved": false,
            "note": "Telegram username could not be resolved by the configured bot."
          }
        ],
        "result": "PASS",
        "cleanup": {
          "offsetRestored": true,
          "peerThreadStopped": true,
          "peerPortClosed": true
        },
        "command": [
          "node",
          "--import",
          "clock-step.mjs",
          "openclaw.mjs",
          "channels",
          "resolve",
          "--channel",
          "telegram",
          "--kind",
          "user",
          "@fixture",
          "--json"
        ],
        "stderr": "(node:1456533) [DEP_PLUGIN_SDK] DeprecationWarning: Plugin telegram: createApproverRestrictedNativeApprovalCapability is deprecated; use createApproverRestrictedNativeApprovalCapabilityAsync instead. The legacy contract remains supported during its deprecation period. Final compatibility day: 2026-12-31. Removal ships in the first January 2027 stable release; no SDK major is required.\n(Use `node --trace-deprecation ...` to show where the warning was created)\n"
      },
      "head": {
        "case": "forward-wall-timeout",
        "mode": "forward",
        "peerPort": 35181,
        "code": 0,
        "watchdog": false,
        "processElapsedMs": 23146.761301904917,
        "requests": [
          {
            "method": "GET",
            "path": "/bot123456789\u003aABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi/getChat?chat_id=%40fixture",
            "acceptedAtMonotonic": 2426962.978012359,
            "noResponseHeadersSent": true,
            "nativeClientClosed": true,
            "elapsedMs": 14990.569178014994
          }
        ],
        "stdoutSha256": "4ea7d3f94c368e39af4cdbf7a5d2996a1620d651480a96023ab3f2c8bd35bac5",
        "stderrSha256": "bd5ed011d435f5847d607b1641ec53d0b655779b9e2181f7c81f1d315abf7edc",
        "configBeforeSha256": "5154f091e6cec0fa54795467fe3bd8c724c8ea2cc5054ac5f38c1235ba6a67c6",
        "configAfterSha256": "5154f091e6cec0fa54795467fe3bd8c724c8ea2cc5054ac5f38c1235ba6a67c6",
        "clock": [
          {
            "at": 890.846055,
            "event": "date-offset",
            "offsetMs": 0
          },
          {
            "at": 8024.683657,
            "event": "native-peer-accepted"
          },
          {
            "at": 8025.157219,
            "event": "offset-set",
            "offsetMs": 60000
          },
          {
            "at": 23076.914872,
            "event": "exit-restore",
            "offsetMs": 0
          }
        ],
        "timeoutWarnings": [
          {
            "timeoutMs": 15000,
            "elapsedMs": 15003.208627000002,
            "operation": "telegram-getchat-lookup",
            "url": "http://127.0.0.1:35181/bot***/getChat"
          }
        ],
        "logSha256": "760a5eda3285c2faa1d7d02cc095e4539398ef14cc0128c4b71741ea7bb3b6cc",
        "stdout": [
          {
            "input": "@fixture",
            "resolved": false,
            "note": "Telegram username could not be resolved by the configured bot."
          }
        ],
        "result": "PASS",
        "cleanup": {
          "offsetRestored": true,
          "peerThreadStopped": true,
          "peerPortClosed": true
        },
        "command": [
          "node",
          "--import",
          "clock-step.mjs",
          "openclaw.mjs",
          "channels",
          "resolve",
          "--channel",
          "telegram",
          "--kind",
          "user",
          "@fixture",
          "--json"
        ],
        "stderr": "(node:1586177) [DEP_PLUGIN_SDK] DeprecationWarning: Plugin telegram: createApproverRestrictedNativeApprovalCapability is deprecated; use createApproverRestrictedNativeApprovalCapabilityAsync instead. The legacy contract remains supported during its deprecation period. Final compatibility day: 2026-12-31. Removal ships in the first January 2027 stable release; no SDK major is required.\n(Use `node --trace-deprecation ...` to show where the warning was created)\n"
      }
    },
    {
      "case": "actual-delayed-timer",
      "base": {
        "case": "actual-delayed-timer",
        "mode": "blocked",
        "peerPort": 35283,
        "code": 0,
        "watchdog": false,
        "processElapsedMs": 31789.90539908409,
        "requests": [
          {
            "method": "GET",
            "path": "/bot123456789\u003aABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi/getChat?chat_id=%40fixture",
            "acceptedAtMonotonic": 2422920.784115411,
            "noResponseHeadersSent": true,
            "nativeClientClosed": true,
            "elapsedMs": 24015.052408911288
          }
        ],
        "stdoutSha256": "4ea7d3f94c368e39af4cdbf7a5d2996a1620d651480a96023ab3f2c8bd35bac5",
        "stderrSha256": "ab9fc523757f42f10b5a72df7177677111688598c7ec03087430f39c63582e38",
        "configBeforeSha256": "a1c4c293a2555fdfe2624fac0100734c7d6fddc18134b861ce22e60df3590f19",
        "configAfterSha256": "a1c4c293a2555fdfe2624fac0100734c7d6fddc18134b861ce22e60df3590f19",
        "clock": [
          {
            "at": 910.185942,
            "event": "date-offset",
            "offsetMs": 0
          },
          {
            "at": 7658.216991,
            "event": "native-peer-accepted"
          },
          {
            "at": 21660.251711,
            "event": "block-begin"
          },
          {
            "at": 31660.823674,
            "event": "block-end"
          },
          {
            "at": 31726.592879,
            "event": "exit-restore",
            "offsetMs": 0
          }
        ],
        "timeoutWarnings": [
          {
            "timeoutMs": 15000,
            "elapsedMs": 24028,
            "timerDelayMs": 9028,
            "eventLoopDelayHint": "timer delayed 9028ms, likely event-loop starvation",
            "operation": "telegram-getchat-lookup",
            "url": "http://127.0.0.1:35283/bot***/getChat"
          }
        ],
        "logSha256": "dfbb91b5a34cf08cef6a4024db8c276de7b0bc50c2a2c3f78b23eb08dc5bb1a5",
        "stdout": [
          {
            "input": "@fixture",
            "resolved": false,
            "note": "Telegram username could not be resolved by the configured bot."
          }
        ],
        "result": "PASS",
        "cleanup": {
          "offsetRestored": true,
          "peerThreadStopped": true,
          "peerPortClosed": true
        },
        "command": [
          "node",
          "--import",
          "clock-step.mjs",
          "openclaw.mjs",
          "channels",
          "resolve",
          "--channel",
          "telegram",
          "--kind",
          "user",
          "@fixture",
          "--json"
        ],
        "stderr": "(node:1457196) [DEP_PLUGIN_SDK] DeprecationWarning: Plugin telegram: createApproverRestrictedNativeApprovalCapability is deprecated; use createApproverRestrictedNativeApprovalCapabilityAsync instead. The legacy contract remains supported during its deprecation period. Final compatibility day: 2026-12-31. Removal ships in the first January 2027 stable release; no SDK major is required.\n(Use `node --trace-deprecation ...` to show where the warning was created)\n"
      },
      "head": {
        "case": "actual-delayed-timer",
        "mode": "blocked",
        "peerPort": 34327,
        "code": 0,
        "watchdog": false,
        "processElapsedMs": 31830.131805036217,
        "requests": [
          {
            "method": "GET",
            "path": "/bot123456789\u003aABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi/getChat?chat_id=%40fixture",
            "acceptedAtMonotonic": 2426986.19187466,
            "noResponseHeadersSent": true,
            "nativeClientClosed": true,
            "elapsedMs": 24012.386161834
          }
        ],
        "stdoutSha256": "4ea7d3f94c368e39af4cdbf7a5d2996a1620d651480a96023ab3f2c8bd35bac5",
        "stderrSha256": "5b32127b4e76f969890722f41f90492e5c8bf55f005cbcbf0daf65f61abcdfdd",
        "configBeforeSha256": "c338b12e0214d0a48fdfe1b2f3225e6460d5ce90db47fb9c567ed4a69532e8ba",
        "configAfterSha256": "c338b12e0214d0a48fdfe1b2f3225e6460d5ce90db47fb9c567ed4a69532e8ba",
        "clock": [
          {
            "at": 893.169056,
            "event": "date-offset",
            "offsetMs": 0
          },
          {
            "at": 7694.690792,
            "event": "native-peer-accepted"
          },
          {
            "at": 21694.846159,
            "event": "block-begin"
          },
          {
            "at": 31695.547826,
            "event": "block-end"
          },
          {
            "at": 31766.21679,
            "event": "exit-restore",
            "offsetMs": 0
          }
        ],
        "timeoutWarnings": [
          {
            "timeoutMs": 15000,
            "elapsedMs": 24025.758763,
            "timerDelayMs": 9025.758763000002,
            "eventLoopDelayHint": "timer delayed 9025.758763000002ms, likely event-loop starvation",
            "operation": "telegram-getchat-lookup",
            "url": "http://127.0.0.1:34327/bot***/getChat"
          }
        ],
        "logSha256": "09484048eaffe62dbb94a0862eccc1267840b761ee91b77de9c5ea3c218a6cb4",
        "stdout": [
          {
            "input": "@fixture",
            "resolved": false,
            "note": "Telegram username could not be resolved by the configured bot."
          }
        ],
        "result": "PASS",
        "cleanup": {
          "offsetRestored": true,
          "peerThreadStopped": true,
          "peerPortClosed": true
        },
        "command": [
          "node",
          "--import",
          "clock-step.mjs",
          "openclaw.mjs",
          "channels",
          "resolve",
          "--channel",
          "telegram",
          "--kind",
          "user",
          "@fixture",
          "--json"
        ],
        "stderr": "(node:1586710) [DEP_PLUGIN_SDK] DeprecationWarning: Plugin telegram: createApproverRestrictedNativeApprovalCapability is deprecated; use createApproverRestrictedNativeApprovalCapabilityAsync instead. The legacy contract remains supported during its deprecation period. Final compatibility day: 2026-12-31. Removal ships in the first January 2027 stable release; no SDK major is required.\n(Use `node --trace-deprecation ...` to show where the warning was created)\n"
      }
    }
  ]
}
Complete unchanged collector

JSON decoding restores exact executable source, checked against its declared SHA256.

{
  "sha256": "d4f9ff5619d2ff03ffd664df439d91e5e7b94f1bfb1ba5de860a8b46d8da52f6",
  "source": "#!/usr/bin/env python3\n\"\"\"Normal built Telegram resolve CLI, native HTTP peer and actual timeout log.\"\"\"\nimport argparse\nimport hashlib\nimport http.server\nimport json\nimport os\nimport socket\nimport subprocess\nimport threading\nimport time\nfrom datetime import datetime, timezone\nfrom pathlib import Path\n\np = argparse.ArgumentParser()\np.add_argument('--checkout', type=Path, required=True)\np.add_argument('--node', type=Path, required=True)\np.add_argument('--output', type=Path, required=True)\np.add_argument('--expect', choices=['base', 'head'], required=True)\na = p.parse_args()\ncheckout, node, output = a.checkout.resolve(), a.node.resolve(), a.output.resolve()\noutput.mkdir(mode=0o700)\nsha = lambda value: hashlib.sha256(value).hexdigest()\ngit = lambda *args: subprocess.check_output(['git', *args], cwd=checkout, text=True).strip()\nhead = git('rev-parse', 'HEAD')\nassert not git('status', '--porcelain=v1', '--untracked-files=all')\nbuild = json.loads((checkout / 'dist/build-info.json').read_text())\nstamp = json.loads((checkout / 'dist/.buildstamp').read_text())\nassert head == build['commit'] == stamp['head'] and stamp['inputsClean'] is True\npreload = r'''import fs from 'node:fs';\nimport {performance} from 'node:perf_hooks';\nconst originalNow=Date.now.bind(Date);\nconst record=value=>fs.appendFileSync(process.env.FETCH_CLOCK_RECORD,JSON.stringify({at:performance.now(),...value})+'\\n');\nlet lastOffset,accepted=false;\nDate.now=()=>{const offset=Number(fs.readFileSync(process.env.FETCH_CLOCK_OFFSET,'utf8'));if(offset!==lastOffset){lastOffset=offset;record({event:'date-offset',offsetMs:offset});}return originalNow()+offset;};\nconst observer=setInterval(()=>{\n if(accepted||!fs.existsSync(process.env.FETCH_PEER_MARKER))return;\n accepted=true;record({event:'native-peer-accepted'});\n if(process.env.FETCH_CLOCK_MODE==='forward'){fs.writeFileSync(process.env.FETCH_CLOCK_OFFSET,'60000');record({event:'offset-set',offsetMs:60000});}\n if(process.env.FETCH_CLOCK_MODE==='blocked')setTimeout(()=>{record({event:'block-begin'});Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,10000);record({event:'block-end'});},14000);\n},5);observer.unref();\nprocess.once('exit',()=>{fs.writeFileSync(process.env.FETCH_CLOCK_OFFSET,'0');record({event:'exit-restore',offsetMs:0});});\n'''\n(output / 'clock-step.mjs').write_text(preload)\nreceipt = {'startedAt': datetime.now(timezone.utc).isoformat(), 'head': head, 'buildInfo': build, 'buildStamp': stamp,\n           'expected': a.expect, 'collectorSha256': sha(Path(__file__).read_bytes()), 'preloadSha256': sha(preload.encode()),\n           'ownerSha256': sha((checkout / 'src/utils/fetch-timeout.ts').read_bytes()), 'cases': []}\nsave = lambda: (output / 'receipt.json').write_text(json.dumps(receipt, indent=2) + '\\n')\nstarted = time.monotonic()\ntry:\n    for name, mode in [('healthy-getchat', 'healthy'), ('ordinary-timeout', 'normal'), ('forward-wall-timeout', 'forward'), ('actual-delayed-timer', 'blocked')]:\n        case = output / name\n        case.mkdir()\n        (case / 'home').mkdir()\n        offset, marker, clock = case / 'offset', case / 'peer-accepted', case / 'clock.jsonl'\n        offset.write_text('0')\n        requests = []\n        class Handler(http.server.BaseHTTPRequestHandler):\n            def do_GET(self):\n                at = time.monotonic()\n                row = {'method': 'GET', 'path': self.path, 'acceptedAtMonotonic': at}\n                requests.append(row)\n                marker.write_text('accepted')\n                if mode == 'healthy':\n                    body = json.dumps({'ok': True, 'result': {'id': 424242, 'type': 'private', 'username': 'fixture'}}).encode()\n                    self.send_response(200)\n                    self.send_header('Content-Type', 'application/json')\n                    self.send_header('Content-Length', str(len(body)))\n                    self.send_header('Connection', 'close')\n                    self.end_headers()\n                    self.wfile.write(body)\n                    self.wfile.flush()\n                    self.close_connection = True\n                    row.update({'responseStatus': 200, 'responseBytes': len(body), 'elapsedMs': (time.monotonic() - at) * 1000})\n                else:\n                    self.connection.settimeout(40)\n                    try:\n                        received = self.connection.recv(1)\n                        row.update({'noResponseHeadersSent': True, 'nativeClientClosed': received == b'', 'elapsedMs': (time.monotonic() - at) * 1000})\n                    except socket.timeout:\n                        row['peerWatchdog'] = True\n                    finally:\n                        offset.write_text('0')\n                        self.close_connection = True\n            def log_message(self, *args):\n                pass\n        server = http.server.ThreadingHTTPServer(('127.0.0.1', 0), Handler)\n        server.daemon_threads = True\n        port = server.server_port\n        thread = threading.Thread(target=server.serve_forever, daemon=True)\n        thread.start()\n        config = case / 'openclaw.json'\n        logfile = case / 'openclaw.log'\n        config.write_text(json.dumps({'plugins': {'allow': ['telegram']}, 'channels': {'telegram': {'enabled': True, 'botToken': '123456789\u003aABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi', 'apiRoot': f'http://127.0.0.1:{port}', 'network': {'autoSelectFamily': False}}}, 'logging': {'level': 'warn', 'consoleLevel': 'silent', 'file': str(logfile)}}) + '\\n')\n        config_hash = sha(config.read_bytes())\n        env = {'PATH': str(node.parent) + ':/usr/bin:/bin', 'HOME': str(case / 'home'), 'USERPROFILE': str(case / 'home'),\n               'OPENCLAW_CONFIG_PATH': str(config), 'OPENCLAW_STATE_DIR': str(case / 'state'), 'OPENCLAW_NO_RESPAWN': '1',\n               'NODE_DISABLE_COMPILE_CACHE': '1', 'NO_COLOR': '1', 'FETCH_CLOCK_MODE': mode,\n               'FETCH_PEER_MARKER': str(marker), 'FETCH_CLOCK_OFFSET': str(offset), 'FETCH_CLOCK_RECORD': str(clock)}\n        command = [str(node), '--import', str(output / 'clock-step.mjs'), str(checkout / 'openclaw.mjs'), 'channels', 'resolve', '--channel', 'telegram', '--kind', 'user', '@fixture', '--json']\n        row = {'case': name, 'mode': mode, 'command': command, 'peerPort': port}\n        receipt['cases'].append(row)\n        before = time.monotonic()\n        try:\n            try:\n                result = subprocess.run(command, cwd=checkout, env=env, capture_output=True, timeout=55)\n                stdout, stderr, code = result.stdout, result.stderr, result.returncode\n                watchdog = False\n            except subprocess.TimeoutExpired as error:\n                stdout, stderr, code, watchdog = error.stdout or b'', error.stderr or b'', None, True\n            (case / 'stdout.log').write_bytes(stdout)\n            (case / 'stderr.log').write_bytes(stderr)\n            row.update({'code': code, 'watchdog': watchdog, 'processElapsedMs': (time.monotonic() - before) * 1000, 'requests': requests,\n                        'stdoutSha256': sha(stdout), 'stderrSha256': sha(stderr), 'configBeforeSha256': config_hash,\n                        'configAfterSha256': sha(config.read_bytes()), 'clock': [json.loads(line) for line in clock.read_text().splitlines()] if clock.exists() else []})\n            logs = [json.loads(line) for line in logfile.read_text().splitlines()] if logfile.exists() else []\n            warnings = [value for log in logs for value in log.values() if isinstance(value, dict) and value.get('operation') == 'telegram-getchat-lookup']\n            row['timeoutWarnings'] = warnings\n            row['logSha256'] = sha(logfile.read_bytes()) if logfile.exists() else None\n            save()\n            assert code == 0 and not watchdog, f'Normal CLI entry did not complete: code={code}'\n            row['stdout'] = json.loads(stdout)\n            assert len(requests) == 1 and requests[0]['method'] == 'GET' and requests[0]['path'] == '/bot123456789\u003aABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi/getChat?chat_id=%40fixture'\n            assert config_hash == row['configAfterSha256']\n            assert row['clock'][-1]['event'] == 'exit-restore' and row['clock'][-1]['offsetMs'] == 0\n            if mode == 'healthy':\n                assert row['stdout'] == [{'input': '@fixture', 'resolved': True, 'id': '424242', 'name': '@fixture'}]\n                assert warnings == [] and requests[0]['responseStatus'] == 200\n            else:\n                assert row['stdout'] == [{'input': '@fixture', 'resolved': False, 'note': 'Telegram username could not be resolved by the configured bot.'}]\n                assert len(warnings) == 1 and warnings[0]['timeoutMs'] == 15000\n                assert requests[0]['nativeClientClosed'] and requests[0]['noResponseHeadersSent'] and not requests[0].get('peerWatchdog')\n                warning = warnings[0]\n                if mode == 'blocked':\n                    block = [event for event in row['clock'] if event['event'] in ('block-begin', 'block-end')]\n                    assert len(block) == 2 and block[1]['at'] - block[0]['at'] >= 9900\n                    assert warning['elapsedMs'] >= 23000 and warning['timerDelayMs'] >= 8000 and 'likely event-loop starvation' in warning['eventLoopDelayHint']\n                    assert 23000 <= requests[0]['elapsedMs'] < 35000\n                elif mode == 'forward' and a.expect == 'base':\n                    assert warning['elapsedMs'] >= 74000 and warning['timerDelayMs'] >= 59000 and 'likely event-loop starvation' in warning['eventLoopDelayHint']\n                    assert 14000 <= requests[0]['elapsedMs'] < 20000\n                else:\n                    assert 14000 <= warning['elapsedMs'] < 20000 and 'eventLoopDelayHint' not in warning and 'timerDelayMs' not in warning\n                    assert 14000 <= requests[0]['elapsedMs'] < 20000\n            row['result'] = 'PASS'\n        finally:\n            offset.write_text('0')\n            server.shutdown()\n            server.server_close()\n            thread.join(timeout=3)\n            with socket.socket() as check:\n                check.settimeout(1)\n                row['cleanup'] = {'offsetRestored': offset.read_text() == '0', 'peerThreadStopped': not thread.is_alive(), 'peerPortClosed': check.connect_ex(('127.0.0.1', port)) != 0}\n            save()\n        assert all(row['cleanup'].values())\n        print(json.dumps({'case': name, 'result': row['result'], 'processElapsedMs': row['processElapsedMs'], 'requests': requests, 'timeoutWarnings': warnings, 'cleanup': row['cleanup']}), flush=True)\n    assert git('rev-parse', 'HEAD') == head and not git('status', '--porcelain=v1', '--untracked-files=all')\n    receipt['result'] = 'PASS'\n    receipt['observed'] = 'RED_FALSE_STARVATION_LABEL_AFTER_WALL_STEP' if a.expect == 'base' else 'GREEN_WALL_STEP_DIAGNOSTIC'\nexcept Exception as error:\n    receipt['result'] = 'HOLD'\n    receipt['error'] = repr(error)\n    raise\nfinally:\n    receipt['elapsedMs'] = (time.monotonic() - started) * 1000\n    receipt['finishedAt'] = datetime.now(timezone.utc).isoformat()\n    save()\n"
}

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Oct 29, 2026
@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR uses the existing monotonic clock to measure HTTP timeout elapsed time and includes that helper in the PR wrapper inventory.

Example: A 15-second Telegram lookup times out after the process wall clock advances by 60 seconds.

  • Before: The recorded CLI run logs 75004ms elapsed and incorrectly suggests event-loop starvation.
  • After: The recorded patched run logs approximately 15003ms elapsed without a starvation hint.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused implementation with inspected shipped-entry-point evidence, meaningful regression controls, and no open findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The supplied Linux built-CLI Telegram lookup traces exercise the real shared timeout owner and native HTTP client, showing corrected clock-step diagnostics, unchanged ordinary timeout and healthy lookup behavior, and retained genuine-starvation hints; the final inventory-only commit leaves that executed product source unchanged.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Operators can receive false event-loop-starvation hints or understated elapsed durations after wall-clock corrections.
Reason: The repair restores the meaning of existing diagnostics without adding configuration, public APIs, or another timing owner.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current diagnostic bug with a focused shared-owner change; no actionable defects remain, and current-head CI is still pending.

Priority: P2
Reviewed head: 15c8c77594a72c7c7c3d4a64937119b03b388b67

Before merge

None.

Findings

None.

Agent review details

How this fits together

HTTP callers use the shared timeout owner to compose cancellation signals; its timer aborts stalled requests and emits sanitized elapsed-time diagnostics.

flowchart TD
  A[Channels resolve CLI] --> B[Telegram HTTP lookup]
  B --> C[Shared timeout owner]
  D[Monotonic clock] --> C
  C --> E[Sanitized warning log]
  C --> F[Abort request signal]
Loading

Technical review

Best possible solution:

Merge the focused shared-clock repair once the existing checks for the current head pass.

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

Current-main source shows the clock-domain error, and the contributor's paired CLI traces demonstrate it on the base; this review executed no target code.

Is this the best way to solve the issue?

The patch is the smallest complete fix: sample the existing monotonic owner at scheduling and expiry, retain genuine-lateness coverage, and include its dependency in wrapper extraction.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 50bb9ed91608.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current main still contains the defect: Current main samples Date.now() both when scheduling and when reporting elapsed time, allowing wall-clock corrections to alter diagnostic duration. (src/utils/fetch-timeout.ts:77, 50bb9ed91608)
  • Pinned introduced change: Both private clock samples switch to monotonicNow(); timer budgets, cancellation, refresh, redaction, and public signatures remain unchanged. (src/utils/fetch-timeout.ts:78, 15c8c77594a7)
  • Distinct regression coverage: The added cases exercise forward and backward wall-clock steps after refresh; the retained lateness test now advances elapsed time independently, preserving genuine-starvation coverage. (src/utils/fetch-timeout.test.ts:134, 15c8c77594a7)
  • Shipped CLI proof inspected: The full PR body contains paired built-CLI output, native HTTP socket observations, structured logs, and the complete collector for healthy lookup, ordinary timeout, forward clock step, and genuine event-loop blockage. Body SHA256 matches bf3fe80fd3e2acc0c021556566c153a203c7d52e49a7e128e801814317e2150f; the decoded collector matches its declared SHA256. (eca1e8290051)
  • Proof reuse and packaging repair: The follow-up commit adds only src/shared/monotonic-time.ts to the extraction inventory; executed product source and tests are unchanged from the CLI-proof head. The existing wrapper contract requires this transitive dependency to be inventoried. (scripts/pr-lib/wrapper-components.txt:1864, 15c8c77594a7)
  • Diagnostic intent preserved: fix(discord): surface stalled transport health #76327 introduced timer-lateness hints to distinguish delayed callbacks from ordinary timeouts; the patch preserves that distinction and its threshold. (src/utils/fetch-timeout.ts:81, ba31afb0992a)

Likely related people:

  • Kevin Lin: Raw commit f351961 adds src/utils/fetch-timeout.ts:55 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f35196117331; files: src/utils/fetch-timeout.ts)

PR surface

Source +1, Tests +23, Other +2. Total +26 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 3 2 +1
Tests 1 25 2 +23
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 2 0 +2
Total 4 30 4 +26

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Clock corrections can produce misleading timeout diagnostics, but this bug does not change request budgets or delivery behavior.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-29T15:50:51.398Z sha eca1e82 :: needs maintainer review before merge. :: none

Reviewed October 29, 2026, 12:38 PM ET / 16:38 UTC (Revision 2).

@Alix-007

Copy link
Copy Markdown
Contributor Author

Thanks @clawsweeper for the review. CI exposed a missing entry in the trusted-anchor wrapper inventory; I added the existing clock helper and both original dependency-closure checks now pass. Production and tests are unchanged, and the body explicitly retains the original built-CLI proof identity.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Oct 29, 2026
obviyus added a commit that referenced this pull request Nov 2, 2026
…ions (#190894)

fix: measure durations, timeouts and cache ages with the monotonic clock

Several timeouts, cache TTLs and retry backoffs measured elapsed time with the wall clock. When the system clock jumped (NTP correction, sleep and resume, manual change), they fired too early, never fired, or ignored server backoff. These callers now use the monotonic clock (`src/shared/monotonic-time.ts` in core, `performance.now()` in extensions). Stored and displayed timestamps stay on the wall clock, and SDK signatures and public epochs are unchanged.

This sweep includes #190846, #190852, #190853, #187703, #187689, #187782, #187765, #189161, #189160 and #190098, with the contributors' commits kept for credit.

Evidence: built Gateway, CLI and real Chromium, main twice and candidate twice, stepping only the process wall clock (`Date.now`); no system clock change. On main, a Discord deployment timeout aborted or overran after a 60-second step, the Chromium context popover retried after about 100 ms despite server backoff, and the `sessions.usage`, Pi session catalog and GitHub project caches refreshed too early or too late. With this change, each followed real elapsed time. Ordinary controls passed, and epoch timestamps were unchanged. Details: #190894 (comment).

Thanks @Alix-007, @chengzhichao-xydt, @huwei-xydt.

Co-authored-by: Alix-007 <[email protected]>
Co-authored-by: chengzhichao-xydt <[email protected]>
Co-authored-by: Claude Code <[email protected]>
Co-authored-by: 胡伟0668000622 <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
@obviyus

obviyus commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Thank you! Your fix is included in #190894, landed in fca1c6e with your commit kept for credit.

@obviyus obviyus closed this Nov 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 3, 2026
…ions (openclaw#190894)

fix: measure durations, timeouts and cache ages with the monotonic clock

Several timeouts, cache TTLs and retry backoffs measured elapsed time with the wall clock. When the system clock jumped (NTP correction, sleep and resume, manual change), they fired too early, never fired, or ignored server backoff. These callers now use the monotonic clock (`src/shared/monotonic-time.ts` in core, `performance.now()` in extensions). Stored and displayed timestamps stay on the wall clock, and SDK signatures and public epochs are unchanged.

This sweep includes openclaw#190846, openclaw#190852, openclaw#190853, openclaw#187703, openclaw#187689, openclaw#187782, openclaw#187765, openclaw#189161, openclaw#189160 and openclaw#190098, with the contributors' commits kept for credit.

Evidence: built Gateway, CLI and real Chromium, main twice and candidate twice, stepping only the process wall clock (`Date.now`); no system clock change. On main, a Discord deployment timeout aborted or overran after a 60-second step, the Chromium context popover retried after about 100 ms despite server backoff, and the `sessions.usage`, Pi session catalog and GitHub project caches refreshed too early or too late. With this change, each followed real elapsed time. Ordinary controls passed, and epoch timestamps were unchanged. Details: openclaw#190894 (comment).

Thanks @Alix-007, @chengzhichao-xydt, @huwei-xydt.

Co-authored-by: Alix-007 <[email protected]>
Co-authored-by: chengzhichao-xydt <[email protected]>
Co-authored-by: Claude Code <[email protected]>
Co-authored-by: 胡伟0668000622 <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: XS 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.

2 participants