Skip to content

fix(search): report test latency across clock changes - #187782

Closed
Alix-007 wants to merge 1 commit into
openclaw:mainfrom
Alix-007:fix/alix-search-test-clock-20261029
Closed

Alix-007 wants to merge 1 commit into
openclaw:mainfrom
Alix-007:fix/alix-search-test-clock-20261029

Conversation

@Alix-007

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes incorrect search-provider test latency when the host wall clock changes during a request: Settings Search can report a negative duration or include the clock adjustment.

User Impact

The existing provider test reports elapsed request time while retaining its normal results and error guidance. No configuration or migration is required.

Why This Change Was Made

Use the existing monotonic clock for the test handler's private start and both result paths. This keeps the duration consistent with the existing nonnegative-number protocol contract.

Evidence

  • Scenario: The configured search-provider test reports elapsed latency across forward and backward wall-clock changes; The existing public test keeps successful results, authentication-error guidance, one native request per test and unchanged config bytes.
  • Entry: node --import clock-step.mjs openclaw.mjs gateway run --bind loopback --auth token --token synthetic-search-clock-fixture --port 19485; official built GatewayClient requests webSearch.status and webSearch.test with providerId:brave.; disputed owner ran unmocked: src/gateway/server-methods/web-search.ts webSearch.test seed plus normalized-result and thrown-error elapsed samples; shipped Brave adapter and native HTTP execute without replacing the disputed owner.
  • Same command on base 5598c3d and head 9114c45: python3 web-search-clock-proof.py --checkout "$CHECKOUT" --node-dir "$NODE_DIR" --output "$OUTPUT" --expect "$PHASE"
    • Before (base): RED at5598: ordinary success296ms; forward-step success60171ms; backward success-59829ms; backward403error-59665ms, despite native HTTP responses taking151–154ms.
    • After (head): GREEN at exact clean9114: ordinary success232.445027ms; forward success163.486621ms; backward success160.927037ms; backward403error162.629886ms. Actual four RPC payloads match BASE apart from latencyMs, and configured search status is identical.
  • Readback (subprocess,http,websocket,config-file,network-recorder): Actual RPC result payloads, four native GETs per ref, independently timed HTTP responses, per-child Date offset log, exact normal build-info/stamp, config digests and normal process/port/container cleanup.
  • Proof harness: Unchanged frozen Python SHA256 a227b6de2c8006ad6d5504edbf3065566449390b08da882dff311f28ff4379ad and inner SHA256 ff61973920802c105525fd167554cfc092005ba11b4058a7849b563be9bcb9a0; identical scenarios/inputs on both refs, only expected BASE/HEAD assertions vary. Existing Ubuntu24 image sha256:39a6e6f0c5f1fc700b3eab6c19b973f8c01105e2a5efa37c264d0d8130353873 and Node26.12.1; no browser or live provider is used.
  • Control: Exactly1 native GET per test on both refs (8total); HEAD has0 negative or clock-inflated returned durations. Ordinary200 is the positive timing/result control; actual403 still returns status:error with redacted authentication guidance. Config hashes are unchanged within each run, each offset restores in finally without its1s guard firing, both Gateways exit0 without force and peer/Gateway ports and containers close.
  • Other callers checked: Complete handler and canonical monotonic helper, protocol Number minimum0, operator.admin descriptor, SearchPage/SearchResults and all three direct sibling suites inspected. No consumer treats latencyMs as an epoch/deadline. OAuth expiry Date fixtures remain intentional epochs; UI fixtures use literal latency and timeout-only fake scheduling. One private seed and both end samples change together; no schema/config/auth/cache policy or caller change.
  • Tests: pnpm test src/gateway/server-methods/web-search.test.ts --maxWorkers=1 selects17/17 PASS; original production with the final regression selects4 intended FAIL and13 skipped. Canonical pnpm test on web-search.authority.test.ts,web-search-status.test.ts,web-search-status.auth.test.ts selects20/20 PASS. Focused types, typed lint, format and line/max/test-line/mock-export/diff checks PASS. Exact clean HEAD normal cliStartup build retry exits0; original network-transfer failure is retained separately. (measured cost: Changed owner test canonical single-worker wall149.908s (Vitest132.54s,96percent transform);13 original cases remain byte-identical plus4 independent wall/elapsed regressions, net26LF with exact unique26 allocation. Original-production RED161.667s; three unchanged sibling files52.738s. Types106.540s,typedlint150.769s,format0.502s,cheaplint2.727s,linecap1.368s,maxlines14.096s,testlines3.784s,mockexports36.392s,diff0.144s. CI seconds not available. No test retry settings, timeouts, assertion coverage or baselines were relaxed.)
  • Not tested: Actual OS/NTP changes, native macOS/Windows, live Brave services or accounts, model/chat search, other provider runtimes, full suite, hosted CI, timing benchmarks or upgrades. Separate Gateway log/heartbeat duration clocks are unchanged and their warnings are disclosed. This is not an assertion that every clock-based diagnostic is fixed.

Current clean head is 9114c452faa50a811e0d33ff7a5a1684dbc92e29; BASE is 5598c3d76bcb28cacaf864724d52ccb4c8ccdd26. One complete handler changes: production +4/-3 LF, the existing test +26 LF (four cases), and the exact unique26 allocation. The public protocol, query, permissions, provider selection, cache bypass, timeout signals, normalization and redaction are unchanged.

Actual normal-built RPC case BASE latency HEAD latency Native HTTP
Ordinary success 296ms 232.445027ms 200;154ms response
+60000ms wall step, success 60171ms 163.486621ms 200;151–152ms response
-60000ms wall step, success -59829ms 160.927037ms 200;151ms response
-60000ms wall step, error -59665ms 162.629886ms 403;151–152ms response

Display timings are rounded; complete precision is retained below. Exactly one native GET occurred per case (eight total). Configured webSearch.status is identical across refs; each complete returned test value matches after removing latencyMs alone. Success returns the expected source and cached:false;403 retains redacted authentication guidance.

The fixture uses the existing Brave baseUrl setting and explicit providerId:brave. Status identifies that configured test provider while the unused model route is not prepared; this is the existing supported separate provider-test path. Official Doctor provisions local client credentials before the RPCs. Known synthetic subscription/auth strings are fixture-only. No live Brave account or model turn runs; the container network is disabled.

Config hashes are unchanged within each run after explicit bootstrap. Each child Date offset resets in finally and its1s guard never fires. This does not assert that the state database performs no coordination writes. Both Gateways exit0 without force, the private HTTP/Gateway ports close, and both containers are absent. BASE/HEAD wrapper walls27.317s/22.460s include startup/cleanup, not a performance comparison.

The first HEAD normal build failed after54.954s in worker-deploy network transfer (terminated, caused by ResponseContentLengthMismatchError). The identical command on unchanged clean9114 was retried once and passed240.780s. Both receipts and the original error excerpt remain below. BASE normal build passed262.108s. Actual build-info/stamp match each executed commit and inputsClean:true.

This fixes the returned RPC duration. Separate log clocks are unchanged: HEAD still logged a60170ms generic WS duration and heartbeat-delay warning during the injected Date step. BASE retained startup-stall/sidecars-draining diagnostics; HEAD retained a shutdown prewarm abort. All non-startup-phase stderr and selected WS/shutdown stdout are reproduced below, with complete-log hashes. No warning-free-runtime claim is made.

Canonical owner tests pass17/17 in149.908s (13 unchanged cases plus4 independent wall/elapsed cases); three direct sibling files pass20/20 in52.738s. Original production fails the intended four latency assertions in161.667s. Types/lint/format and ratchets pass; exact commands and original snapshots are below. The test-line checker reports6,263,980 total,6,323,301 ceiling,59,321 slack. No test retry settings, timeouts, assertion coverage or baselines were relaxed. Complete independent source review found no P0–P3 issues via the authorized delegated route; no standard helper execution is claimed. Final publication8Q remains a separate gate.

Not tested: actual OS/NTP changes; native macOS/Windows; live providers/accounts; model/chat search; other provider runtimes; full suite/hosted CI; latency benchmarks or upgrades. No UI code or appearance change, browser run or screenshot is claimed. This does not repair every wall-clock-based diagnostic.

Actual paired RPC/HTTP readback, build history and command receipts

Only task-local directory prefixes are replaced with $OUTPUT_BASE, $OUTPUT_HEAD, $CHECKOUT_BASE, $CHECKOUT_HEAD, $NODE_DIR, $TOOLS and $TASK. Payloads, timings, statuses, counts, config digests and hashes are actual. The hello projection excludes unrelated capabilities/snapshots and opaque admission tokens. Every non-startup-phase stderr line is included; stdout selection is labeled. Complete local logs remain hashed, without implying hashes alone make evidence public. JSON is compact to keep the complete payloads and collectors within the PR body limit.

{
  "scope": "Actual normal-built public Gateway RPC to bundled Brave and native private HTTP. Only task-local directory prefixes are replaced with named placeholders. Hello projection omits unrelated capabilities, snapshots and opaque admission/recovery tokens. Full webSearch.status and every webSearch.test returned value, HTTP recorder, clock/cleanup/build metadata and raw hashes remain. All non-startup-phase stderr and explicitly selected stdout are included. Synthetic strings are not live credentials.",
  "contribution": {"head":"9114c452faa50a811e0d33ff7a5a1684dbc92e29","base":"5598c3d76bcb28cacaf864724d52ccb4c8ccdd26","normalCommitHooks":true,"companyIdentityVerified":true,"postProofWorktreeClean":true,"sourceSnapshot":"56d9a5321f8df557a99039e7673639c316c3a1e4f4a1a80645a996b467ce299e","fileSha256":{"src/gateway/server-methods/web-search.ts":"693b7deb7cb6ed8f094a2208650a25568b9ea703103bed433d2577d716afa7d7","src/gateway/server-methods/web-search.test.ts":"88cb92fc0ba0d3d2e12e4fb92f5f57a272e60cf1a35a972bed74f602b7921148","config/test-lines-allocations/alix-web-search-clock-20261029.txt":"20d2add851bf39edcc6b5e830930f962db7e19dffa2cab8610eed551eda6c302"},"numstat":"1\t0\tconfig/test-lines-allocations/alix-web-search-clock-20261029.txt\n26\t0\tsrc/gateway/server-methods/web-search.test.ts\n4\t3\tsrc/gateway/server-methods/web-search.ts"},
  "collectors": {"pythonSha256":"a227b6de2c8006ad6d5504edbf3065566449390b08da882dff311f28ff4379ad","innerSha256":"ff61973920802c105525fd167554cfc092005ba11b4058a7849b563be9bcb9a0"},
  "validation": {"status":"PASS","head":"9114c452faa50a811e0d33ff7a5a1684dbc92e29","base":"5598c3d76bcb28cacaf864724d52ccb4c8ccdd26","normalBuildMetadataMatchesBothRefs":true,"sameFrozenCollectorsBothRefs":true,"nativeGetCount":8,"oneGetPerCase":true,"allOutcomeAndQueryControlsPass":true,"completeConfiguredStatusEqual":true,"completeReturnedValuesEqualExceptLatencyMs":true,"headNegativeOrClockInflatedReturnedDurations":0,"configBytesUnchangedWithinEachRun":true,"offsetRestoredWithoutGuard":true,"gatewaysCode0AndAllOwnedEndpointsContainersClosed":true,"comparison":[{"case":"normal-success","fullReturnedValueEqualAfterRemovingOnlyLatencyMs":true,"baseLatencyMs":296,"headLatencyMs":232.44502700000157},{"case":"forward-success","fullReturnedValueEqualAfterRemovingOnlyLatencyMs":true,"baseLatencyMs":60171,"headLatencyMs":163.486621},{"case":"backward-success","fullReturnedValueEqualAfterRemovingOnlyLatencyMs":true,"baseLatencyMs":-59829,"headLatencyMs":160.9270370000013},{"case":"backward-error","fullReturnedValueEqualAfterRemovingOnlyLatencyMs":true,"baseLatencyMs":-59665,"headLatencyMs":162.6298859999988}],"scope":"Read-only validation of saved native proof; no product execution or new runtime proof."},
  "builds": [{"label":"base-cli-build","cwd":"$CHECKOUT_BASE","head":"5598c3d76bcb28cacaf864724d52ccb4c8ccdd26","baseTree":"9aebff14352ade48a1f52d0603eba05ec9144576","snapshot":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","untracked":[],"startedAt":"2026-10-29T10:34:33.374Z","finishedAt":"2026-10-29T10:38:55.482Z","elapsedMs":262108,"command":["$NODE_DIR/bin/node","--import","./scripts/tsx.mjs","scripts/build-all.mts","cliStartup"],"code":0,"signal":null,"receiptSha256":"876deea3ad4e005b5513df335aa2f050e54e54f1ccecabe0c9b4cc5f339d09a5","logSha256":"3191393b63e87923d3851e5e9aa7a163303789abfd2976dfdb3ef44c920d82ff"},{"label":"web-search-head-cli-build","cwd":"$CHECKOUT_HEAD","head":"9114c452faa50a811e0d33ff7a5a1684dbc92e29","baseTree":"bc21f6a06a14bcd663909527658d5096c3902712","snapshot":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","untracked":[],"startedAt":"2026-10-29T15:40:20.788Z","finishedAt":"2026-10-29T15:41:15.742Z","elapsedMs":54954,"command":["$NODE_DIR/bin/node","--import","./scripts/tsx.mjs","scripts/build-all.mts","cliStartup"],"code":1,"signal":null,"receiptSha256":"616274c228b228bef3f429538a023e81623e169e323653d18aad66ea3c5de3d7","logSha256":"1b87eac2cba1bd1c1c74402f4d73135b0f2da535e171a4375171659cf7994876"},{"label":"web-search-head-cli-build-retry","cwd":"$CHECKOUT_HEAD","head":"9114c452faa50a811e0d33ff7a5a1684dbc92e29","baseTree":"bc21f6a06a14bcd663909527658d5096c3902712","snapshot":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","untracked":[],"startedAt":"2026-10-29T15:43:34.307Z","finishedAt":"2026-10-29T15:47:35.087Z","elapsedMs":240780,"command":["$NODE_DIR/bin/node","--import","./scripts/tsx.mjs","scripts/build-all.mts","cliStartup"],"code":0,"signal":null,"receiptSha256":"0a9d6fa043ff45ab74480dece830847092d59d3418f056e80fd99ab0a277b275","logSha256":"01e3a66a11f8bf2022ab0272f9be74adfd0a66b4bb37f3dcc1184bf89eab6573"}],
  "phases": {"base":{"wrapper":{"head":"5598c3d76bcb28cacaf864724d52ccb4c8ccdd26","buildInfo":{"version":"2026.10.8","commit":"5598c3d76bcb28cacaf864724d52ccb4c8ccdd26","builtAt":"2026-10-29T10:34:34.652Z","buildId":"2026.10.8-5598c3d76bcb-2026-10-29T10-34-34.652Z"},"buildStamp":{"builtAt":1793270323412,"head":"5598c3d76bcb28cacaf864724d52ccb4c8ccdd26","inputsClean":true,"inputSignature":"bdde04dceb0c48d460dce8a9c35c27571cf6c86bceb0cba3de84b2dab5179f6a"},"expected":"base","collectorSha256":"a227b6de2c8006ad6d5504edbf3065566449390b08da882dff311f28ff4379ad","innerSha256":"ff61973920802c105525fd167554cfc092005ba11b4058a7849b563be9bcb9a0","imageId":"sha256:39a6e6f0c5f1fc700b3eab6c19b973f8c01105e2a5efa37c264d0d8130353873","startedAt":"2026-10-29T14:54:06Z","argv":["docker","run","--rm","--network","none","--security-opt","seccomp=unconfined","--user","1000:1000","--name","alix-web-search-clock-base-1528214","--workdir","$CHECKOUT_BASE","--volume","$CHECKOUT_BASE:$CHECKOUT_BASE:ro","--volume","$NODE_DIR:$NODE_DIR:ro","--volume","$CHECKOUT_HEAD-inner.mjs:$CHECKOUT_HEAD-inner.mjs:ro","--volume","$OUTPUT_BASE:$OUTPUT_BASE","--env","HOME=$OUTPUT_BASE/home","--env","USERPROFILE=$OUTPUT_BASE/home","--env","OPENCLAW_STATE_DIR=$OUTPUT_BASE/state","--env","OPENCLAW_CONFIG_PATH=$OUTPUT_BASE/state/openclaw.json","--env","OPENCLAW_NO_RESPAWN=1","--env","NODE_DISABLE_COMPILE_CACHE=1","--env","NO_COLOR=1","--env","PATH=$NODE_DIR/bin:/usr/local/bin:/usr/bin:/bin","alix-openclaw-webkit:pw1.64.1-ubuntu24","$NODE_DIR/bin/node","$CHECKOUT_HEAD-inner.mjs","$CHECKOUT_BASE","$OUTPUT_BASE","base"],"code":0,"containerAbsent":true,"elapsedMs":27317,"finishedAt":"2026-10-29T14:54:34Z"},"recorder":{"expected":"base","rpcs":[{"case":"normal-success","method":"webSearch.test","params":{"query":"synthetic clock fixture","providerId":"brave"},"value":{"provider":"brave","latencyMs":296,"status":"ok","results":[{"title":"Clock fixture result","url":"https://example.com/result","snippet":"Synthetic search result"}],"cached":false},"elapsedMs":322.52407799999855,"forcedRestore":false},{"case":"forward-success","method":"webSearch.test","params":{"query":"synthetic clock fixture","providerId":"brave"},"value":{"provider":"brave","latencyMs":60171,"status":"ok","results":[{"title":"Clock fixture result","url":"https://example.com/result","snippet":"Synthetic search result"}],"cached":false},"elapsedMs":201.24021899999934,"forcedRestore":false},{"case":"backward-success","method":"webSearch.test","params":{"query":"synthetic clock fixture","providerId":"brave"},"value":{"provider":"brave","latencyMs":-59829,"status":"ok","results":[{"title":"Clock fixture result","url":"https://example.com/result","snippet":"Synthetic search result"}],"cached":false},"elapsedMs":186.71693600000071,"forcedRestore":false},{"case":"backward-error","method":"webSearch.test","params":{"query":"synthetic clock fixture","providerId":"brave"},"value":{"provider":"brave","latencyMs":-59665,"status":"error","error":"The search provider could not authenticate. Check its credentials and account access."},"elapsedMs":346.5198270000001,"forcedRestore":false}],"requests":[{"case":"normal-success","method":"GET","url":"/res/v1/web/search?q=synthetic+clock+fixture&count=5","at":21859.481753,"status":200,"syntheticKeyMatches":true,"responseElapsedMs":154.29474699999992},{"case":"forward-success","method":"GET","url":"/res/v1/web/search?q=synthetic+clock+fixture&count=5","at":22069.603288,"status":200,"syntheticKeyMatches":true,"responseElapsedMs":151.96788000000015},{"case":"backward-success","method":"GET","url":"/res/v1/web/search?q=synthetic+clock+fixture&count=5","at":22304.899582,"status":200,"syntheticKeyMatches":true,"responseElapsedMs":151.37423900000067},{"case":"backward-error","method":"GET","url":"/res/v1/web/search?q=synthetic+clock+fixture&count=5","at":22486.454541,"status":403,"syntheticKeyMatches":true,"responseElapsedMs":151.58152899999914}],"stages":[{"name":"official-client-bootstrap","elapsedMs":4062.670964},{"name":"normal-gateway-hello","elapsedMs":21314.494829},{"name":"actual-bundled-brave-available","elapsedMs":21566.505081},{"name":"normal-success","elapsedMs":21890.458826000002},{"name":"forward-success","elapsedMs":22114.117786},{"name":"backward-success","elapsedMs":22313.616847},{"name":"backward-error","elapsedMs":22662.498466}],"cleanup":{"gateway":{"code":0,"signal":null},"forced":false,"peerClosed":true,"offsetRestored":true,"portClosed":true},"preloadSha256":"1a8cbd3904ebf434bbc2013a29d0056cafb8c359d0424bb08947c5495d065cc9","peerPort":36359,"configInitialSha256":"b8964b72986c13e12e794a5cc7234e78ed42102945d7f2b88c1044b918a48b0b","doctor":{"elapsedMs":4057.007111,"output":{"ok":true}},"configBeforeReadsSha256":"b8964b72986c13e12e794a5cc7234e78ed42102945d7f2b88c1044b918a48b0b","gatewayCommand":["$NODE_DIR/bin/node","--import","$OUTPUT_BASE/clock-step.mjs","$CHECKOUT_BASE/openclaw.mjs","gateway","run","--bind","loopback","--auth","token","--token","synthetic-search-clock-fixture","--port","19485"],"lastConnectError":"Error: connect ECONNREFUSED 127.0.0.1:19485","searchStatus":{"enabled":true,"provider":"brave","agentId":"main","model":{"provider":"openai","id":"gpt-6-astra","runtime":"unknown","runtimeLabel":"Not resolved"},"providers":[{"id":"brave","pluginId":"brave","label":"Brave Search","hint":"Structured results · country/language/time filters","configured":true,"installed":true,"available":true,"requiresCredential":true,"credentialSource":"config","configPath":["plugins","entries","brave","config","webSearch"],"credentialPath":"plugins.entries.brave.config.webSearch.apiKey","credential":{"path":["plugins","entries","brave","config","webSearch","apiKey"],"label":"Brave Search API key","envVars":["BRAVE_API_KEY"],"placeholder":"BSA...","signupUrl":"https://brave.com/search/api/"},"docsUrl":"https://docs.openclaw.ai/tools/brave-search","signupUrl":"https://brave.com/search/api/"}],"route":{"kind":"unavailable","label":"Model search route is not ready","testable":false,"reason":"The selected model is not in the prepared model catalog. Refresh Models, then try again. An explicitly configured search provider can still be tested separately."},"testProvider":{"id":"brave","label":"Brave Search"}},"configReadsUnchanged":true,"clock":[{"pid":30,"threadId":0,"offsetMs":0,"at":3452.86159},{"pid":30,"threadId":0,"offsetMs":60000,"at":17962.918621},{"pid":30,"threadId":0,"offsetMs":0,"at":18058.221723},{"pid":30,"threadId":0,"offsetMs":-60000,"at":18239.966062},{"pid":30,"threadId":0,"offsetMs":0,"at":18246.34457},{"pid":30,"threadId":0,"offsetMs":-60000,"at":18406.298867}],"result":"PASS","observed":"RED_WALL_STEP_SEARCH_LATENCY","elapsedMs":26488.449728,"helloProjection":{"type":"hello-ok","protocol":4,"server":{"version":"2026.10.8","buildId":"2026.10.8-5598c3d76bcb-2026-10-29T10-34-34.652Z","bootId":"6d853987-a6d6-466f-a4f7-2b2ea30f585d","controlUiBuildSource":"bundled","connId":"caaa70c3-59f2-446f-a16a-425059a60a32"},"auth":{"method":"token","role":"operator","scopes":["operator.admin"]},"availableSearchMethods":["webSearch.status","webSearch.test"]}},"logs":{"allNonStartupPhaseStderr":["2026-10-29T14:54:31.334+00:00 [event-loop] main-thread stall: elapsedMs=1334 task=unattributed stallStartMs=1793285670000 stallEndMs=1793285671334 reportedAtMs=1793285671334","2026-10-29T14:54:31.351+00:00 [event-loop] main-thread stall profile: windowMs=1334 windowStartMs=1793285670000 windowEndMs=1793285671334 reportedAtMs=1793285671351 samples=52 intervalMs=25 truncated=false inclusive=[[\"(anonymous)@node:internal/modules/esm/loader:635\",45],[\"[redacted]@node:internal/modules/esm/loader:529\",44],[\"afterResolve@node:internal/modules/esm/loader:613\",44],[\"getOrCreateModuleJob@node:internal/modules/esm/loader:603\",44],[\"syncLink@node:internal/modules/esm/module_job:261\",44],[\"link@node:internal/modules/esm/module_job:385\",44],[\"ModuleJob@node:internal/modules/esm/module_job:354\",44],[\"tracePromise@node:diagnostics_channel:580\",44]]","2026-10-29T14:54:31.953+00:00 [gateway] sidecars failed to start: GatewayDrainingError: Gateway is shutting down. Please try again once it is back online."],"selectedWsAndShutdownStdout":["2026-10-29T14:54:28.598+00:00 [ws] client connected conn=caaa70c3-59f2-446f-a16a-425059a60a32 client=cli name=cli mode=cli role=operator auth=token version=0.0.0 platform=linux build=legacy remote=127.0.0.1","2026-10-29T14:54:29.377+00:00 [ws] ⇄ res ✓ webSearch.test 60186ms bytes=264 conn=caaa70c3…0a32 id=4:9802b1fb-c…7408","2026-10-29T14:54:32.396+00:00 [shutdown] completed cleanly in 236ms"],"collectorStdout":"official-client-bootstrap\nnormal-gateway-hello\nactual-bundled-brave-available\nnormal-success\nforward-success\nbackward-success\nbackward-error\n{\"result\":\"PASS\",\"observed\":\"RED_WALL_STEP_SEARCH_LATENCY\",\"cleanup\":{\"gateway\":{\"code\":0,\"signal\":null},\"forced\":false,\"peerClosed\":true,\"offsetRestored\":true,\"portClosed\":true}}\n","collectorStderr":"","doctorStdout":"{\n  \"ok\": true\n}\n","doctorStderr":""},"rawFileSha256":{"receipt.json":"185cda5b1ecc8937fb79ca1c1160fb415cde693bc136cf37609c72dbfd2459c6","wrapper.json":"353e6ce527f3795d47987600e5d0f255529d840f5b3d9c89791997d72b0966e5","clock-step.mjs":"1a8cbd3904ebf434bbc2013a29d0056cafb8c359d0424bb08947c5495d065cc9","gateway.stdout":"206b13213d17844c3425aa972c6e0c6feb3f58406cb531de5e65825dcfbf5469","gateway.stderr":"7aedff8668683a09deffd545b388dcddea97a4299c08c8ede6855e12808c675a","collector.stdout":"d3454d2ec292c9bfc11c2a7f76f69cfb619b318365ab9c272153d895985339da","collector.stderr":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","doctor.stdout":"12b34da73b0c67a0319e6eddbd3582af66e3b558b4d44e4a6860e0cec20d726f","doctor.stderr":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","clock.jsonl":"7f114c0561f583af3955cfda4e6107c42bfbc382f8a986b9e9eac3b7c6b80cd1","clock-offset":"5feceb66ffc86f38d952786c6d696c79c2dbc239dd4e91b46729d73a27fb57e9","state/openclaw.json":"b8964b72986c13e12e794a5cc7234e78ed42102945d7f2b88c1044b918a48b0b"}},"head":{"wrapper":{"head":"9114c452faa50a811e0d33ff7a5a1684dbc92e29","buildInfo":{"version":"2026.10.8","commit":"9114c452faa50a811e0d33ff7a5a1684dbc92e29","builtAt":"2026-10-29T15:43:35.469Z","buildId":"2026.10.8-9114c452faa5-2026-10-29T15-43-35.469Z"},"buildStamp":{"builtAt":1793288843139,"head":"9114c452faa50a811e0d33ff7a5a1684dbc92e29","inputsClean":true,"inputSignature":"0d8f40fd0f876845ef5bc970f59ba440ff23af2514ce95f7f7f301a765536652"},"expected":"head","collectorSha256":"a227b6de2c8006ad6d5504edbf3065566449390b08da882dff311f28ff4379ad","innerSha256":"ff61973920802c105525fd167554cfc092005ba11b4058a7849b563be9bcb9a0","imageId":"sha256:39a6e6f0c5f1fc700b3eab6c19b973f8c01105e2a5efa37c264d0d8130353873","startedAt":"2026-10-29T15:48:57Z","argv":["docker","run","--rm","--network","none","--security-opt","seccomp=unconfined","--user","1000:1000","--name","alix-web-search-clock-head-1632610","--workdir","$CHECKOUT_HEAD","--volume","$CHECKOUT_HEAD:$CHECKOUT_HEAD:ro","--volume","$NODE_DIR:$NODE_DIR:ro","--volume","$CHECKOUT_HEAD-inner.mjs:$CHECKOUT_HEAD-inner.mjs:ro","--volume","$OUTPUT_HEAD:$OUTPUT_HEAD","--env","HOME=$OUTPUT_HEAD/home","--env","USERPROFILE=$OUTPUT_HEAD/home","--env","OPENCLAW_STATE_DIR=$OUTPUT_HEAD/state","--env","OPENCLAW_CONFIG_PATH=$OUTPUT_HEAD/state/openclaw.json","--env","OPENCLAW_NO_RESPAWN=1","--env","NODE_DISABLE_COMPILE_CACHE=1","--env","NO_COLOR=1","--env","PATH=$NODE_DIR/bin:/usr/local/bin:/usr/bin:/bin","alix-openclaw-webkit:pw1.64.1-ubuntu24","$NODE_DIR/bin/node","$CHECKOUT_HEAD-inner.mjs","$CHECKOUT_HEAD","$OUTPUT_HEAD","head"],"code":0,"containerAbsent":true,"elapsedMs":22460,"finishedAt":"2026-10-29T15:49:19Z"},"recorder":{"expected":"head","rpcs":[{"case":"normal-success","method":"webSearch.test","params":{"query":"synthetic clock fixture","providerId":"brave"},"value":{"provider":"brave","latencyMs":232.44502700000157,"status":"ok","results":[{"title":"Clock fixture result","url":"https://example.com/result","snippet":"Synthetic search result"}],"cached":false},"elapsedMs":279.2677799999983,"forcedRestore":false},{"case":"forward-success","method":"webSearch.test","params":{"query":"synthetic clock fixture","providerId":"brave"},"value":{"provider":"brave","latencyMs":163.486621,"status":"ok","results":[{"title":"Clock fixture result","url":"https://example.com/result","snippet":"Synthetic search result"}],"cached":false},"elapsedMs":172.16558299999815,"forcedRestore":false},{"case":"backward-success","method":"webSearch.test","params":{"query":"synthetic clock fixture","providerId":"brave"},"value":{"provider":"brave","latencyMs":160.9270370000013,"status":"ok","results":[{"title":"Clock fixture result","url":"https://example.com/result","snippet":"Synthetic search result"}],"cached":false},"elapsedMs":176.52642299999934,"forcedRestore":false},{"case":"backward-error","method":"webSearch.test","params":{"query":"synthetic clock fixture","providerId":"brave"},"value":{"provider":"brave","latencyMs":162.6298859999988,"status":"error","error":"The search provider could not authenticate. Check its credentials and account access."},"elapsedMs":171.82099200000084,"forcedRestore":false}],"requests":[{"case":"normal-success","method":"GET","url":"/res/v1/web/search?q=synthetic+clock+fixture&count=5","at":20351.825386,"status":200,"syntheticKeyMatches":true,"responseElapsedMs":154.0772990000005},{"case":"forward-success","method":"GET","url":"/res/v1/web/search?q=synthetic+clock+fixture&count=5","at":20554.80472,"status":200,"syntheticKeyMatches":true,"responseElapsedMs":151.31609799999933},{"case":"backward-success","method":"GET","url":"/res/v1/web/search?q=synthetic+clock+fixture&count=5","at":20738.730044,"status":200,"syntheticKeyMatches":true,"responseElapsedMs":151.1583299999984},{"case":"backward-error","method":"GET","url":"/res/v1/web/search?q=synthetic+clock+fixture&count=5","at":20909.367202,"status":403,"syntheticKeyMatches":true,"responseElapsedMs":151.26883199999793}],"stages":[{"name":"official-client-bootstrap","elapsedMs":2717.961696},{"name":"normal-gateway-hello","elapsedMs":19744.518758000002},{"name":"actual-bundled-brave-available","elapsedMs":20143.787474},{"name":"normal-success","elapsedMs":20424.379500000003},{"name":"forward-success","elapsedMs":20601.786776},{"name":"backward-success","elapsedMs":20782.85868},{"name":"backward-error","elapsedMs":20956.823195}],"cleanup":{"gateway":{"code":0,"signal":null},"forced":false,"peerClosed":true,"offsetRestored":true,"portClosed":true},"preloadSha256":"1a8cbd3904ebf434bbc2013a29d0056cafb8c359d0424bb08947c5495d065cc9","peerPort":41707,"configInitialSha256":"5d30f8b85c27764533b5a617264a70ef72677f6396cdb199297108123aeeee70","doctor":{"elapsedMs":2712.349237,"output":{"ok":true}},"configBeforeReadsSha256":"5d30f8b85c27764533b5a617264a70ef72677f6396cdb199297108123aeeee70","gatewayCommand":["$NODE_DIR/bin/node","--import","$OUTPUT_HEAD/clock-step.mjs","$CHECKOUT_HEAD/openclaw.mjs","gateway","run","--bind","loopback","--auth","token","--token","synthetic-search-clock-fixture","--port","19485"],"lastConnectError":"Error: connect ECONNREFUSED 127.0.0.1:19485","searchStatus":{"enabled":true,"provider":"brave","agentId":"main","model":{"provider":"openai","id":"gpt-6-astra","runtime":"unknown","runtimeLabel":"Not resolved"},"providers":[{"id":"brave","pluginId":"brave","label":"Brave Search","hint":"Structured results · country/language/time filters","configured":true,"installed":true,"available":true,"requiresCredential":true,"credentialSource":"config","configPath":["plugins","entries","brave","config","webSearch"],"credentialPath":"plugins.entries.brave.config.webSearch.apiKey","credential":{"path":["plugins","entries","brave","config","webSearch","apiKey"],"label":"Brave Search API key","envVars":["BRAVE_API_KEY"],"placeholder":"BSA...","signupUrl":"https://brave.com/search/api/"},"docsUrl":"https://docs.openclaw.ai/tools/brave-search","signupUrl":"https://brave.com/search/api/"}],"route":{"kind":"unavailable","label":"Model search route is not ready","testable":false,"reason":"The selected model is not in the prepared model catalog. Refresh Models, then try again. An explicitly configured search provider can still be tested separately."},"testProvider":{"id":"brave","label":"Brave Search"}},"configReadsUnchanged":true,"clock":[{"pid":30,"threadId":0,"offsetMs":0,"at":3017.067574},{"pid":30,"threadId":0,"offsetMs":60000,"at":17737.287807},{"pid":30,"threadId":0,"offsetMs":0,"at":17880.364883},{"pid":30,"threadId":0,"offsetMs":-60000,"at":18016.343422},{"pid":30,"threadId":0,"offsetMs":0,"at":18059.990531},{"pid":30,"threadId":0,"offsetMs":-60000,"at":18225.247416}],"result":"PASS","observed":"GREEN_ELAPSED_SEARCH_LATENCY","elapsedMs":21934.158527,"helloProjection":{"type":"hello-ok","protocol":4,"server":{"version":"2026.10.8","buildId":"2026.10.8-9114c452faa5-2026-10-29T15-43-35.469Z","bootId":"038f40de-234b-4d97-969b-21f2992b6f81","controlUiBuildSource":"bundled","connId":"dab836cb-eabf-4faa-a193-92e6960bea39"},"auth":{"method":"token","role":"operator","scopes":["operator.admin"]},"availableSearchMethods":["webSearch.status","webSearch.test"]}},"logs":{"allNonStartupPhaseStderr":["2026-10-29T15:49:18.351+00:00 [diagnostic] liveness heartbeat delayed: overdue=34999ms elapsed=64999ms; deferring recovery decisions","2026-10-29T15:49:18.822+00:00 [gateway] post-ready sandbox dependency prewarm failed: AbortError: Operation aborted"],"selectedWsAndShutdownStdout":["2026-10-29T15:49:17.581+00:00 [ws] client connected conn=dab836cb-eabf-4faa-a193-92e6960bea39 client=cli name=cli mode=cli role=operator auth=token version=0.0.0 platform=linux build=legacy remote=127.0.0.1","2026-10-29T15:49:18.159+00:00 [gateway] ready","2026-10-29T15:49:18.449+00:00 [ws] ⇄ res ✓ webSearch.test 60170ms bytes=269 conn=dab836cb…ea39 id=4:94dd7f83-8…cfcb","2026-10-29T15:49:19.539+00:00 [shutdown] completed cleanly in 706ms"],"collectorStdout":"official-client-bootstrap\nnormal-gateway-hello\nactual-bundled-brave-available\nnormal-success\nforward-success\nbackward-success\nbackward-error\n{\"result\":\"PASS\",\"observed\":\"GREEN_ELAPSED_SEARCH_LATENCY\",\"cleanup\":{\"gateway\":{\"code\":0,\"signal\":null},\"forced\":false,\"peerClosed\":true,\"offsetRestored\":true,\"portClosed\":true}}\n","collectorStderr":"","doctorStdout":"{\n  \"ok\": true\n}\n","doctorStderr":""},"rawFileSha256":{"receipt.json":"f8abf8f54eb8603ff680fe632a4bb48eecbdca3ff5d604b6d2a17c56a9f9b789","wrapper.json":"2a56464fb064dbcde2998d8c937555f461c5304b30d2e9793149fb89af131d56","clock-step.mjs":"1a8cbd3904ebf434bbc2013a29d0056cafb8c359d0424bb08947c5495d065cc9","gateway.stdout":"18bab3385fa9ed601b07f9b35ba6a92906a74ee1a25427c95aa0f3eca479a1fd","gateway.stderr":"2ec6b4d690833f47e9517cf61d98be686bb156e02b4cabe733dd6d74875fea75","collector.stdout":"129e7774b8fbac9bb4669a9855485a3f65aa3f4d5911ef2c992b9ef92fb248cc","collector.stderr":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","doctor.stdout":"12b34da73b0c67a0319e6eddbd3582af66e3b558b4d44e4a6860e0cec20d726f","doctor.stderr":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","clock.jsonl":"b44a274d375dda9155a93eef73f419993f2b98969a2325dbff61c422850e2a66","clock-offset":"5feceb66ffc86f38d952786c6d696c79c2dbc239dd4e91b46729d73a27fb57e9","state/openclaw.json":"5d30f8b85c27764533b5a617264a70ef72677f6396cdb199297108123aeeee70"}}},
  "checks": [{"label":"web-search-regression-red","command":["$TOOLS/bin/pnpm","test","src/gateway/server-methods/web-search.test.ts","--maxWorkers=1","-t","reports elapsed latency"],"code":1,"elapsedMs":161667,"snapshot":"5c85bda80c087d582d81046ed45c4e5a3f0a2fe8035d7a14c6dc96ff10bed529","reuse":"Original production plus final unchanged regression test: intended RED.","receiptSha256":"f3be8b856826168bbf144f948217fa9058d4cddf9485a44078246f8795336d8c","logSha256":"e7dc33c9fa534936617272d4b0e634041276a28a270ff2dc03919084a8ea6f66"},{"label":"web-search-cheap-lint","command":["$TOOLS/bin/pnpm","exec","oxlint","--config",".oxlintrc.json","src/gateway/server-methods/web-search.ts","src/gateway/server-methods/web-search.test.ts"],"code":0,"elapsedMs":2727,"snapshot":"bb8797f3bb5d7b09a1a41985c974ec4532976a7187ad7bba925b7ecbb8a0a197","reuse":"Exact final source/test bytes; allocation framing changed from untracked to staged only.","receiptSha256":"8a5d25c76265831eb43a24eb13f0137cc6da9d40d533f6f3a5a0f313e939c0d6","logSha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},{"label":"web-search-canonical","command":["$TOOLS/bin/pnpm","test","src/gateway/server-methods/web-search.test.ts","--maxWorkers=1"],"code":0,"elapsedMs":149908,"snapshot":"b8e62dc2edf6a2b92d75ad8e622fddd55bb1d8ad6501cbc74c2fc29de191e917","reuse":"Exact final source/test bytes; allocation framing changed from untracked to staged only.","receiptSha256":"d0978cdabc5f74d3a8beb0a48d1b358bc69ba9bc9f1290ab79061136210ddcce","logSha256":"c5894c55db01e0151365859e481e3efa81d7943c7617989bbfb85eb314eb5f87"},{"label":"web-search-siblings","command":["$TOOLS/bin/pnpm","test","src/gateway/server-methods/web-search.authority.test.ts","src/gateway/server-methods/web-search-status.test.ts","src/gateway/server-methods/web-search-status.auth.test.ts","--maxWorkers=1"],"code":0,"elapsedMs":52738,"snapshot":"56d9a5321f8df557a99039e7673639c316c3a1e4f4a1a80645a996b467ce299e","reuse":"Exact staged final snapshot.","receiptSha256":"4d072e1bdec0b43b29db2bb0b12d0bfb072e029f4bc9df8880faddcebe26ff7e","logSha256":"3e77d38d139c2e51851cdac976824bb31303647101993a86ad25de0bbf2f67ea"},{"label":"web-search-types","command":["$NODE_DIR/bin/node","scripts/run-tsgo.mjs","-p","../web-search-typeconfig.json"],"code":0,"elapsedMs":106540,"snapshot":"b8e62dc2edf6a2b92d75ad8e622fddd55bb1d8ad6501cbc74c2fc29de191e917","reuse":"Exact final source/test bytes; allocation framing changed from untracked to staged only.","receiptSha256":"7376a03843046bb8f7e7df43090da74c44ed63c9a5f4011555e24b35789b150a","logSha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"},{"label":"web-search-typedlint","command":["env","OPENCLAW_LINT_TOOL=oxlint","$NODE_DIR/bin/node","scripts/run-oxlint.mjs","--tsconfig","config/tsconfig/oxlint.core.json","src/gateway/server-methods/web-search.ts","src/gateway/server-methods/web-search.test.ts"],"code":0,"elapsedMs":150769,"snapshot":"b8e62dc2edf6a2b92d75ad8e622fddd55bb1d8ad6501cbc74c2fc29de191e917","reuse":"Exact final source/test bytes; allocation framing changed from untracked to staged only.","receiptSha256":"6baaf7afa9d845d2d3d23e1697f6c84fe5e309bd7662b6dd349873d8fe911aaf","logSha256":"117d32dc60ed701915f19733c81d9ae74264f0244e14842150a8d09a77f77571"},{"label":"web-search-format","command":["$TOOLS/bin/pnpm","exec","oxfmt","--check","src/gateway/server-methods/web-search.ts","src/gateway/server-methods/web-search.test.ts"],"code":0,"elapsedMs":502,"snapshot":"b8e62dc2edf6a2b92d75ad8e622fddd55bb1d8ad6501cbc74c2fc29de191e917","reuse":"Exact final source/test bytes; allocation framing changed from untracked to staged only.","receiptSha256":"73a821b3009756adbb95d85365916a408e58cfeda82e756b3ed2086d9edaeb7b","logSha256":"4f9daa080cb1c3a0809c37c3e878dc6140999a8a23025e00bf24c54502eed015"},{"label":"web-search-linecap","command":["$NODE_DIR/bin/node","scripts/check-line-cap-ratchet.mjs","--base","5598c3d76bcb28cacaf864724d52ccb4c8ccdd26"],"code":0,"elapsedMs":1368,"snapshot":"56d9a5321f8df557a99039e7673639c316c3a1e4f4a1a80645a996b467ce299e","reuse":"Exact staged final snapshot.","receiptSha256":"85ea52afcab16927059ae123aee48f113fe98917d93b61343711711215d194a2","logSha256":"4ffb0319cec8e4ddeff751071959bd20e7cd46d6ab22eca278904dbfdd5937fa"},{"label":"web-search-maxlines","command":["$NODE_DIR/bin/node","--import","./scripts/tsx.mjs","scripts/check-max-lines-ratchet.mts","--base","5598c3d76bcb28cacaf864724d52ccb4c8ccdd26"],"code":0,"elapsedMs":14096,"snapshot":"56d9a5321f8df557a99039e7673639c316c3a1e4f4a1a80645a996b467ce299e","reuse":"Exact staged final snapshot.","receiptSha256":"979d6965b914656aef679ecc89c997d090bcbcffdd30949a84cc3bee4f39a1a3","logSha256":"b89ec79f8d9224c26975f204ae5f579bdfda0e8ea96868d61302333a3ded4235"},{"label":"web-search-testlines","command":["$NODE_DIR/bin/node","--import","./scripts/tsx.mjs","scripts/check-test-lines-ratchet.mts","--base","5598c3d76bcb28cacaf864724d52ccb4c8ccdd26"],"code":0,"elapsedMs":3784,"snapshot":"56d9a5321f8df557a99039e7673639c316c3a1e4f4a1a80645a996b467ce299e","reuse":"Exact staged final snapshot.","receiptSha256":"97a88f7d9e789a524b3f655778e17074aefbe7567042881c4e34f930c49d9567","logSha256":"4e8b46e1e441bc3e5c3b02df8de8a858c15eee75cfb57952ea31b34235c167c8"},{"label":"web-search-mockexports","command":["$NODE_DIR/bin/node","--import","./scripts/tsx.mjs","scripts/check-test-mock-exports.mts","--base","5598c3d76bcb28cacaf864724d52ccb4c8ccdd26"],"code":0,"elapsedMs":36392,"snapshot":"56d9a5321f8df557a99039e7673639c316c3a1e4f4a1a80645a996b467ce299e","reuse":"Exact staged final snapshot.","receiptSha256":"05116c3a3bfed912b39fab4509310aed1e5c3aae1e2e1d5c24b6057617d627bc","logSha256":"44d4fe75846e6f85f4e15abc74b09e1f0f23e90046abcccb385781acd10c5ae5"},{"label":"web-search-diff","command":["git","diff","--check","HEAD"],"code":0,"elapsedMs":144,"snapshot":"56d9a5321f8df557a99039e7673639c316c3a1e4f4a1a80645a996b467ce299e","reuse":"Exact staged final snapshot.","receiptSha256":"6ee03230d2af1ae46cead7e34f225cee1f31f388c340d0742a29fbd79595e1de","logSha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}]
}

First HEAD build failure excerpt (the full original log is identified by its hash above):

[build-all] runtime:scripts:check
[build-all] runtime:scripts:check done in 5.52s
[build-all] tsdown
[tsdown-build] invocation 1/2 finished in 3.9s

 ERROR  Error: Build failed with 1 error:

[plugin openclaw:worker-deploy]
TypeError: terminated
    at Fetch.onAborted (node:internal/deps/undici/undici:15128:53)
    at Fetch.emit (node:events:514:20)
    at Fetch.terminate (node:internal/deps/undici/undici:14237:14)
    at Object.onResponseError (node:internal/deps/undici/undici:15269:42)
    at Request.onResponseError (node:internal/deps/undici/undici:5591:48)
    at Object.errorRequest (node:internal/deps/undici/undici:2483:17)
    at Object.abort (node:internal/deps/undici/undici:9416:14)
    at ClientHttp2Stream.onError (node:internal/deps/undici/undici:9726:13)
    at ClientHttp2Stream.emit (node:events:514:20)
    at emitErrorNT (node:internal/streams/destroy:170:8)
Caused by:
  ResponseContentLengthMismatchError: Response body length does not match content-length header
      at ClientHttp2Stream.onError (node:internal/deps/undici/undici:9718:15)
      at ClientHttp2Stream.emit (node:events:514:20)
      at emitErrorNT (node:internal/streams/destroy:170:8)
      at emitErrorCloseNT (node:internal/streams/destroy:129:3)
      at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
Portable original collectors and normal-build reproduction

These exact original files ran on both refs: Python SHA256 a227b6de2c8006ad6d5504edbf3065566449390b08da882dff311f28ff4379ad; inner SHA256 ff61973920802c105525fd167554cfc092005ba11b4058a7849b563be9bcb9a0. Save them outside the clean checkouts under the shown names. The disputed handler/provider is never imported directly, patched or mocked. Only the external HTTP response and child Date reading are controlled; native timers, performance and the OS clock are unchanged.

Prerequisites: Linux x64, Node26.12.1, normal frozen-install/build outputs, Docker and an Ubuntu24-compatible image under the recorded local tag alix-openclaw-webkit:pw1.64.1-ubuntu24. Actual existing image digest: sha256:39a6e6f0c5f1fc700b3eab6c19b973f8c01105e2a5efa37c264d0d8130353873. Its historical label does not mean a browser was used. It supplies Ubuntu24.04/glibc2.39; Node and source/build artifacts are mounted read-only. Image preparation is a reproduction prerequisite, not an additional executed product proof. The wrapper records the image identity rather than downloading it. Its per-container seccomp override accommodates the old Docker host; no shared OS setting changes.

The normal command actually executed on each clean checkout was:

"$NODE_DIR/bin/node" --import ./scripts/tsx.mjs scripts/build-all.mts cliStartup

HEAD's frozen physical install also completed with pnpm install --offline --frozen-lockfile --package-import-method copy in14.574s; no lockfile/dependency change is included.

The same actual proof command ran on each ref; only checkout/output and expected phase vary:

python3 web-search-clock-proof.py --checkout "$CHECKOUT" --node-dir "$NODE_DIR" --output "$OUTPUT" --expect "$PHASE"

Use BASE5598/PHASE=base and HEAD9114/PHASE=head, each with a fresh absent output directory. The wrapper asserts clean source and matching build-info/stamp before normal openclaw.mjs gateway run. The official built GatewayClient uses Doctor-provisioned local credentials. Each run isolates HOME/config/state and disables external container networking. Full actual argv, native readbacks and normal metadata are above. Each frozen BASE/HEAD runtime proof ran once; read-only validation of saved records did not execute the product again.

web-search-clock-proof.py:

#!/usr/bin/env python3
"""Run a frozen normal-built Gateway and native search fixture in the existing private image."""
import argparse,hashlib,json,os,subprocess,time
from pathlib import Path

p=argparse.ArgumentParser();p.add_argument('--checkout',type=Path,required=True);p.add_argument('--node-dir',type=Path,required=True);p.add_argument('--output',type=Path,required=True);p.add_argument('--expect',choices=['base','head'],required=True);a=p.parse_args()
root=Path(__file__).resolve().parent;checkout=a.checkout.resolve();node=a.node_dir.resolve();out=a.output.resolve();out.mkdir(mode=0o700)
head=subprocess.check_output(['git','rev-parse','HEAD'],cwd=checkout,text=True).strip()
assert not subprocess.check_output(['git','status','--porcelain'],cwd=checkout)
info=json.loads((checkout/'dist/build-info.json').read_text());stamp=json.loads((checkout/'dist/.buildstamp').read_text())
assert info['commit']==stamp['head']==head and stamp['inputsClean'] is True
for name in ['home','state','workspace']:(out/name).mkdir()
def sha(file):return hashlib.sha256(file.read_bytes()).hexdigest()
image='alix-openclaw-webkit:pw1.64.1-ubuntu24'
meta={'head':head,'buildInfo':info,'buildStamp':stamp,'expected':a.expect,'collectorSha256':sha(Path(__file__)),'innerSha256':sha(root/'web-search-clock-inner.mjs'),'imageId':subprocess.check_output(['docker','image','inspect',image,'--format','{{.Id}}'],text=True).strip(),'startedAt':time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime())}
name='alix-web-search-clock-'+a.expect+'-'+str(os.getpid())
argv=['docker','run','--rm','--network','none','--security-opt','seccomp=unconfined','--user',f'{os.getuid()}:{os.getgid()}','--name',name,'--workdir',str(checkout)]
for directory in [checkout,node]:argv+=['--volume',f'{directory}:{directory}:ro']
argv+=['--volume',f'{root/"web-search-clock-inner.mjs"}:{root/"web-search-clock-inner.mjs"}:ro','--volume',f'{out}:{out}']
env={'HOME':str(out/'home'),'USERPROFILE':str(out/'home'),'OPENCLAW_STATE_DIR':str(out/'state'),'OPENCLAW_CONFIG_PATH':str(out/'state/openclaw.json'),'OPENCLAW_NO_RESPAWN':'1','NODE_DISABLE_COMPILE_CACHE':'1','NO_COLOR':'1','PATH':str(node/'bin')+':/usr/local/bin:/usr/bin:/bin'}
for key,value in env.items():argv+=['--env',key+'='+value]
argv+=[image,str(node/'bin/node'),str(root/'web-search-clock-inner.mjs'),str(checkout),str(out),a.expect]
meta['argv']=argv;started=time.monotonic()
try:
 with (out/'collector.stdout').open('w') as stdout,(out/'collector.stderr').open('w') as stderr:
  result=subprocess.run(argv,stdout=stdout,stderr=stderr,timeout=220);meta['code']=result.returncode
finally:
 live=subprocess.run(['docker','container','inspect',name],capture_output=True)
 if live.returncode==0:subprocess.run(['docker','kill',name],capture_output=True,timeout=10)
 meta['containerAbsent']=subprocess.run(['docker','container','inspect',name],capture_output=True).returncode!=0
 meta['elapsedMs']=round((time.monotonic()-started)*1000);meta['finishedAt']=time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime())
 (out/'wrapper.json').write_text(json.dumps(meta,indent=2)+'\n');print(json.dumps({'output':str(out),'code':meta.get('code'),'elapsedMs':meta['elapsedMs'],'containerAbsent':meta['containerAbsent']}),flush=True)
assert meta['code']==0 and meta['containerAbsent']

web-search-clock-inner.mjs:

import assert from 'node:assert/strict';
import {spawn,execFile} from 'node:child_process';
import {createHash} from 'node:crypto';
import fs from 'node:fs';
import http from 'node:http';
import net from 'node:net';
import path from 'node:path';
import {pathToFileURL} from 'node:url';
import {promisify} from 'node:util';
const [checkout,output,expected]=process.argv.slice(2);
assert(['base','head'].includes(expected));
const {GatewayClient}=await import(pathToFileURL(path.join(checkout,'packages/gateway-client/dist/index.mjs')).href);
const runFile=promisify(execFile),started=performance.now();
const hash=x=>createHash('sha256').update(x).digest('hex');
const record={expected,rpcs:[],requests:[],stages:[],cleanup:{}};
const save=()=>fs.writeFileSync(path.join(output,'receipt.json'),JSON.stringify(record,null,2)+'\n');
const stage=name=>{record.stages.push({name,elapsedMs:performance.now()-started});save();console.log(name);};
const bounded=async(p,ms,label)=>{let t;try{return await Promise.race([p,new Promise((_,rej)=>{t=setTimeout(()=>rej(Error(label)),ms);})]);}finally{clearTimeout(t);}};
const offset=path.join(output,'clock-offset'),clockLog=path.join(output,'clock.jsonl');fs.writeFileSync(offset,'0');
const preload=`import fs from 'node:fs';import {performance} from 'node:perf_hooks';import {threadId} from 'node:worker_threads';const original=Date.now.bind(Date);let last;Date.now=()=>{const offset=Number(fs.readFileSync(process.env.SEARCH_CLOCK_OFFSET,'utf8'));if(offset!==last){last=offset;fs.appendFileSync(process.env.SEARCH_CLOCK_LOG,JSON.stringify({pid:process.pid,threadId,offsetMs:offset,at:performance.now()})+'\\n');}return original()+offset;};`;
fs.writeFileSync(path.join(output,'clock-step.mjs'),preload);record.preloadSha256=hash(preload);
let scenario={name:'setup',offsetMs:0,status:200},gateway,client,gatewayClosed;
const peer=http.createServer((req,res)=>{const at=performance.now();const r={case:scenario.name,method:req.method,url:req.url,at,status:scenario.status,syntheticKeyMatches:req.headers['x-subscription-token']==='synthetic-brave-clock-fixture'};record.requests.push(r);fs.writeFileSync(offset,String(scenario.offsetMs));setTimeout(()=>{res.writeHead(r.status,{'content-type':'application/json'});res.end(JSON.stringify(r.status===200?{web:{results:[{title:'Clock fixture result',url:'https://example.com/result',description:'Synthetic search result'}]}}:{message:'Synthetic provider failure'}));r.responseElapsedMs=performance.now()-at;save();},150);req.resume();});
try{
 await new Promise(resolve=>peer.listen(0,'127.0.0.1',resolve));const peerPort=peer.address().port;record.peerPort=peerPort;
 const configPath=process.env.OPENCLAW_CONFIG_PATH;
 const config={plugins:{allow:['brave'],entries:{brave:{enabled:true,config:{webSearch:{apiKey:'synthetic-brave-clock-fixture',baseUrl:`http://127.0.0.1:${peerPort}`}}}}},cron:{enabled:false},agents:{defaults:{workspace:path.join(output,'workspace')}},tools:{web:{search:{enabled:true,provider:'brave'}}},gateway:{mode:'local',port:19485,controlUi:{enabled:false},auth:{mode:'token',token:'synthetic-search-clock-fixture'}}};
 fs.writeFileSync(configPath,JSON.stringify(config,null,2)+'\n');record.configInitialSha256=hash(fs.readFileSync(configPath));
 const doctorArgs=[path.join(checkout,'openclaw.mjs'),'doctor','--client-credentials','--repair','--non-interactive','--json'];const at=performance.now();const d=await runFile(process.execPath,doctorArgs,{cwd:checkout,env:process.env,timeout:60000,maxBuffer:10000000});fs.writeFileSync(path.join(output,'doctor.stdout'),d.stdout);fs.writeFileSync(path.join(output,'doctor.stderr'),d.stderr);record.doctor={elapsedMs:performance.now()-at,output:JSON.parse(d.stdout)};assert.equal(record.doctor.output.ok,true);record.configBeforeReadsSha256=hash(fs.readFileSync(configPath));stage('official-client-bootstrap');
 const argv=['--import',path.join(output,'clock-step.mjs'),path.join(checkout,'openclaw.mjs'),'gateway','run','--bind','loopback','--auth','token','--token','synthetic-search-clock-fixture','--port','19485'];const stdout=fs.openSync(path.join(output,'gateway.stdout'),'w'),stderr=fs.openSync(path.join(output,'gateway.stderr'),'w');gateway=spawn(process.execPath,argv,{cwd:checkout,env:{...process.env,SEARCH_CLOCK_OFFSET:offset,SEARCH_CLOCK_LOG:clockLog},stdio:['ignore',stdout,stderr]});fs.closeSync(stdout);fs.closeSync(stderr);gatewayClosed=new Promise(resolve=>gateway.once('close',(code,signal)=>resolve({code,signal})));record.gatewayCommand=[process.execPath,...argv];const hello=Promise.withResolvers();client=new GatewayClient({url:'ws://127.0.0.1:19485',token:'synthetic-search-clock-fixture',clientName:'cli',mode:'cli',scopes:['operator.admin'],minProtocol:4,maxProtocol:4,requestTimeoutMs:20000,onHelloOk:x=>{record.hello=x;hello.resolve();},onConnectError:e=>{record.lastConnectError=String(e);}});client.start();await bounded(Promise.race([hello.promise,gatewayClosed.then(x=>{throw Error('Gateway exited '+JSON.stringify(x));})]),50000,'Gateway readiness');stage('normal-gateway-hello');
 const status=await client.request('webSearch.status',{});record.searchStatus=status;assert.equal(status.testProvider.id,'brave');stage('actual-bundled-brave-available');
 for(const row of [{name:'normal-success',offsetMs:0,status:200},{name:'forward-success',offsetMs:60000,status:200},{name:'backward-success',offsetMs:-60000,status:200},{name:'backward-error',offsetMs:-60000,status:403}]){
  scenario=row;const beforeRequests=record.requests.length;const at=performance.now();let value,timer,forcedRestore=false;try{timer=setTimeout(()=>{forcedRestore=true;fs.writeFileSync(offset,'0');},1000);value=await client.request('webSearch.test',{query:'synthetic clock fixture',providerId:'brave'});}finally{clearTimeout(timer);fs.writeFileSync(offset,'0');}
  const elapsedMs=performance.now()-at;record.rpcs.push({case:row.name,method:'webSearch.test',params:{query:'synthetic clock fixture',providerId:'brave'},value,elapsedMs,forcedRestore});save();assert.equal(forcedRestore,false);assert.equal(record.requests.length-beforeRequests,1);assert.equal(value.provider,'brave');assert.equal(value.status,row.status===200?'ok':'error');assert(record.requests.at(-1).syntheticKeyMatches);if(row.status===200)assert.equal(value.results[0].title,'Clock fixture result');
  if(expected==='head'||row.offsetMs===0){assert(value.latencyMs>=100&&value.latencyMs<1000,'Elapsed duration invalid '+value.latencyMs);}else if(row.offsetMs>0){assert(value.latencyMs>60000);}else{assert(value.latencyMs<0);}stage(row.name);
 }
 record.configReadsUnchanged=hash(fs.readFileSync(configPath))===record.configBeforeReadsSha256;assert(record.configReadsUnchanged);record.clock=fs.readFileSync(clockLog,'utf8').trim().split('\n').map(JSON.parse);record.result='PASS';record.observed=expected==='base'?'RED_WALL_STEP_SEARCH_LATENCY':'GREEN_ELAPSED_SEARCH_LATENCY';
}catch(error){record.result='HOLD';record.error=error.stack??String(error);console.error(record.error);process.exitCode=1;}
finally{
 fs.writeFileSync(offset,'0');if(client)await bounded(client.stopAndWait(),5000,'Client cleanup').catch(e=>record.cleanup.clientError=String(e));if(gateway&&gateway.exitCode===null)gateway.kill('SIGTERM');if(gatewayClosed){try{record.cleanup.gateway=await bounded(gatewayClosed,25000,'Gateway cleanup');record.cleanup.forced=false;}catch{gateway.kill('SIGKILL');record.cleanup.gateway=await bounded(gatewayClosed,5000,'Forced cleanup');record.cleanup.forced=true;}}
 peer.closeAllConnections();await new Promise(resolve=>peer.close(resolve));record.cleanup.peerClosed=!peer.listening;record.cleanup.offsetRestored=fs.readFileSync(offset,'utf8')==='0';record.cleanup.portClosed=await new Promise(resolve=>{const s=net.connect({host:'127.0.0.1',port:19485});s.once('error',()=>resolve(true));s.once('connect',()=>{s.destroy();resolve(false);});});record.elapsedMs=performance.now()-started;
 if(record.result==='PASS'&&(record.cleanup.forced||record.cleanup.gateway?.code!==0||record.cleanup.clientError||!record.cleanup.portClosed||!record.cleanup.peerClosed)){record.result='HOLD';record.error='Cleanup failure';process.exitCode=1;}save();console.log(JSON.stringify({result:record.result,observed:record.observed,cleanup:record.cleanup}));
}

@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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS labels Oct 29, 2026
@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 measures search-provider test latency with the existing monotonic clock.

Example: The wall clock moves backward 60 seconds during a successful Brave provider test.

  • Before: The supplied base Gateway returns latencyMs: -59829.
  • After: The supplied head Gateway returns latencyMs: 160.9270370000013 with the same search results.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused contract repair with inspectable shipped-entry-point proof, meaningful regression coverage, and no actionable correctness or security finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied Linux/Node built-Gateway runs exercise webSearch.test through the official GatewayClient, shipped Brave adapter, and native HTTP fixture on the exact base and head. Actual RPC and HTTP traces show correct head durations during forward/backward clock steps, preserved success and 403-error payloads, one request per case, and unchanged configuration bytes; only Date.now and the external response are controlled.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Settings Search can report negative or clock-inflated provider-test latency after a host clock adjustment.
Reason: The change restores the existing elapsed-time contract without adding settings, changing defaults, or introducing another owner.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a concrete latency-reporting bug still present on current main, with convincing Gateway proof and no actionable findings.

Priority: P2
Reviewed head: 9114c452faa50a811e0d33ff7a5a1684dbc92e29

Before merge

None.

Findings

None.

Agent review details

How this fits together

Settings Search calls the Gateway's webSearch.test handler, which invokes the configured provider and returns normalized results or an error with elapsed latency.

flowchart LR
  A[Settings Search] --> B[Gateway webSearch.test]
  B --> C[Shared monotonic clock]
  B --> D[Search runtime]
  D --> E[Configured provider]
  E --> B
  B --> F[Results and elapsed latency]
Loading

Technical review

Best possible solution:

Merge the focused monotonic-clock change once the existing CI gate passes.

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

Current-main source exposes the failure directly, and the contributor supplies paired built-Gateway reproductions with injected Date.now steps; this review ran no target code.

Is this the best way to solve the issue?

The patch is the smallest complete repair: reuse the existing clock owner for the private start and both completion paths while preserving provider execution and response semantics.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Search-provider test duration keeps the original intent (f7dae76: Provide a real configured-provider test with results, latency, and actionable errors in Settings Search.)
  • Gateway search ownership keeps the original intent (f16e8bc: Consolidate single-consumer search helpers into their existing Gateway owner while preserving public behavior and security checks.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit f7dae76 adds src/gateway/server-methods/web-search.ts:171 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f7dae76bee98; files: src/gateway/server-methods/web-search.ts)

PR surface

Source +1, Tests +26, Other +1. Total +28 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 4 3 +1
Tests 1 26 0 +26
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 3 31 3 +28

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Clock adjustments can produce incorrect provider-test diagnostics, with limited impact and no demonstrated search-delivery failure.
  • 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.

Reviewed October 29, 2026, 12:31 PM ET / 16:31 UTC.

@Alix-007

Copy link
Copy Markdown
Contributor Author

Thanks @clawsweeper for the review and checking the paired Gateway evidence.

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

gateway Gateway runtime 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. 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