Skip to content

fix: keep runtime catalog, relay and Feishu windows on elapsed time - #192469

Merged
obviyus merged 10 commits into
mainfrom
fix-runtime-cache-clock-sweep
Nov 4, 2026
Merged

obviyus merged 10 commits into
mainfrom
fix-runtime-cache-clock-sweep

Conversation

@obviyus

@obviyus obviyus commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Host wall-clock corrections can prematurely expire process-local caches and relay references, or postpone their elapsed-time backstops. This sweep combines #192122, #192422 and #192308, preserving all original contributor commits from @wangmiao0668000666 through cherry-picks.

Changes

Use performance.now() at the existing extension owners for:

  • Anthropic CLI session scan, partial-discovery and Desktop overlay refresh deadlines.
  • Browser extension-relay captured-operation lifetime.
  • Feishu bot-info probe caching and streaming-start failure backoff.

No TTL values, model-facing text, persisted/native timestamps, SDK contracts, authentication, update, approval or voice-activation policy change. Excludes #192296, #192293 and #192144.

Remove both proposed test allocations and fold regressions into existing boundary scenarios: assembled catalog caching with a missing Desktop transcript and forward/backward corrections; an authenticated relay's real captured reference plus existing connection isolation/cleanup; and failed Feishu probe reuse. Keep partial-scan retry, watcher invalidation, Desktop backstop and streaming recovery coverage. Production net0; tests net−1. No new production abstraction or SDK exports. Documentation is intentionally unchanged: existing duration contracts are restored, not altered.

Evidence

Normally built Gateway in secretless Linux Node24.22.1 Docker, task-only profiles/config/state/ports. Only the Gateway process's Date.now is stepped; performance and real timers are untouched. This is a process-local wall-clock step, never a system clock change.

Member / shipped entry Main twice Candidate twice Controls
#192122 sessions.catalog.list, task-owned native-format Claude transcript store +61min step causes an extra filesystem tree scan (readdir4→5) before elapsed expiry no extra scan (4→4) no-step4→4; same real transcript returned; read-only filesystem observation, no fake reader/watch
#192422 built Gateway, real Chromium/unpacked extension, authenticated owner protocol capture +6min step retires the valid captured reference immediately same captured tab remains resolvable no-step resolves on both; a fresh real capture becomes stale after301 real seconds on both; real DOM remains readable
#192308 channels.status probe and signed Feishu inbound webhook → real agent dispatch → Lark TLS transport probe1→2 after +11min; natural HTTP400 streaming create retries prematurely after +2min (1→2) probe remains1; streaming create remains suppressed at1 no-step reuse on both; after61 real seconds streaming retries again (main3, candidate2); all4 turns deliver complete static fallback prose

Run IDs:

  • Catalog main catalog-base-1-n1p63e, catalog-base-2-Sm4TpT; candidate catalog-candidate-1-A7jq56, catalog-candidate-2-2toxpJ.
  • Relay main relay-base-1-9zb3y5, relay-base-2-Ac1ROM; candidate relay-candidate-1-aj7yhd, relay-candidate-2-zqDYyj.
  • Feishu main stream-base-1-GO9v4x, stream-base-2-axD629; candidate stream-candidate-1-wSzUmn, stream-candidate-2-z4chwP.

The Feishu fixture returns real HTTP400 for /open-apis/cardkit/v1/cards; the SDK and streaming owner are unmodified. Signed webhooks, real OpenClaw agent turns against a local Responses fixture, recorded outbound static-card content and subsequent successful retry prove the actual reply-dispatch boundary. Synthetic managed API-key profile only; no live tenant/provider credentials or live-delivery claim. Catalog proof uses the actual Gateway RPC and native-format store, not an exported catalog-helper replay. Relay proof loads the actual unpacked extension in Chromium and captures its real advertised tab, not a synthesized bridge acceptance.

Focused checks: 137/137 pass across five touched test files (3 browser,93 Feishu,41 Anthropic). Formatting and lint pass on11 changed files. Identical consolidated regressions against baseline fail at the intended boundaries: catalog hard-scan backstop, relay resolve after wall step, and3 failed-probe cache cases. Baseline 1ca0669dbe3982369463b921397027f3727f51fd; production bytes tested match this candidate (subsequent edits only consolidate tests). Raw JSON, HTTP/DOM/IO observations and sanitized logs are retained; public receipt follows below.

Risk and rollback

Two-way door: reverting restores the former in-process timing; no schema/state migration. Blast radius is Claude catalog scan freshness, extension captured-operation expiry, and Feishu probe/streaming retry timing. Stored epochs, typing-age timestamps, connection authority, scopes, cancellation and cleanup remain unchanged.

wangmiao0668000666 and others added 9 commits November 4, 2026 06:55
The Anthropic session catalog keys its hard-scan, desktop-overlay, and
CLI-scan deadlines with Date.now(), so a wall-clock correction (NTP step
or manual change) can stretch or shorten the five-minute tree backstop,
letting stale sessions linger or forcing needless rescans.  Use
performance.now() for all elapsed-time TTLs, matching the established
clock-sweep shape (#191606) already applied to sibling extensions.

Co-Authored-By: nebulacoder-v8.0 <[email protected]>
readDesktopOverlay now keys its sixty-second refresh backstop on
performance.now(), so the Desktop overlay test's clock mock must follow;
the Date.now() mock no longer advances the deadline.

Co-Authored-By: nebulacoder-v8.0 <[email protected]>
A host wall-clock correction could retire a captured extension-relay
operation whose 5-minute elapsed window was still open. Measure the
relay capture deadline and its check against performance.now(), the
same monotonic clock as the cleanup timer.

Co-Authored-By: nebulacoder-v8.0 <[email protected]>
The streaming-start failure backoff window is monotonic (performance.now);
the old Date.now spy no longer advances it. Point the spy at performance.now
and add a test-lines allocation for the new probe clock-step coverage.

Co-Authored-By: nebulacoder-v8.0 <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@obviyus

obviyus commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

Built shipped-entry proof for #192122, #192422 and #192308, with all contributor commits retained:

  • Claude catalog: real Gateway sessions.catalog.list reads the task-owned native Claude transcript. Main twice adds a readdir after a +61min process-local wall step (4→5); candidate twice stays4. No-step control4→4 on all runs. Read-only IO observation, no fake catalog reader/watch or native-Mac claim.
  • Browser relay: real Chromium with the actual unpacked extension is manually paired to the built Gateway; real tab appears through browser.request and is captured over the authenticated owner protocol. Main twice resolves the reference before the step and loses it immediately after +6min; candidate twice retains it. Fresh captures then expire after301 actual seconds on both refs; DOM readback stays Real attached page. No captureFor/bridge spy or synthesized tab acceptance.
  • Feishu: channels.status probe1→2 after +11min on main, stays1 on candidate. Signed webhook reaches a real agent turn against a local Responses endpoint, then real Lark TLS transport receives HTTP400 on streaming card creation. Main prematurely retries after +2min (count1→2); candidate holds at1. No-step control stays1. After61 real seconds both retry (main total3, candidate2), and all4 turns deliver the full static fallback prose captured in actual im/v1/messages payloads. Synthetic credentials only; no live provider or Feishu claim.

All clock steps change only Gateway Date.now, not performance/timers or the OS clock. Baseline1ca0669dbe3982369463b921397027f3727f51fd. Exact production owner bytes are unchanged since the runtime matrix; later consolidation touches tests only. Focused suites137/137 pass, formatting/lint11files pass; committed counterfactual regressions fail on main at all3 owners. Both allocations removed; production net0, tests net−1. No auth/update/approval/voice-activation or clock-policy member included.

Durable local evidence: /Users/obviyus/Developer/.agents/handoffs/openclaw-bugloop/proofs/runtime-cache-clock-sweep-2026-11-04/workboard/ . Scripts catalog.mts, browser.mts, feishu.mts, clock.mjs, run-{catalog,browser,feishu}.sh; per-run result.json/IO/HTTP/DOM receipts and sanitized gateway.log in observed-{catalog,browser,feishu}. Authoritative run IDs are enumerated in the PR body. Chromium profile caches were removed from copied evidence; build/dependency artifacts remain solely in the task container. No merge performed.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 4, 2026
@clawsweeper

clawsweeper Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR measures Anthropic catalog freshness, browser relay capture lifetime, and Feishu cache and retry windows with monotonic time.

Example: The Gateway wall clock advances six minutes immediately after capturing a browser tab reference.

  • Before: Resolving the reference returns null before its five-minute elapsed lifetime ends.
  • After: The reference remains resolvable until its elapsed lifetime ends or its connection or target becomes invalid.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-consistent repair with concrete shipped-entry results and useful consolidated regressions; current-head CI is still pending.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Supplied built-Gateway results exercise catalog RPC filesystem scans, actual Chromium extension captures, and signed Feishu webhook dispatch over real TLS transport under process-local wall-clock steps, with elapsed expiry and retry controls; referenced local raw receipts were not independently inspected.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Host clock corrections can invalidate usable browser references, trigger unnecessary catalog and health requests, or postpone refresh and streaming retries.
Reason: This maintainer-authored repair restores existing duration contracts without adding policy, configuration, or public API surface.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR fixes clock-step failures still present on main, with no introduced correctness defect found.

Priority: P2
Reviewed head: 5a7b40b7aaf8dba303a14e646edc6cebaae8f655

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway catalog requests, authenticated browser operations, and Feishu status and reply flows reach plugin-owned caches and deadlines that determine refresh, reference validity, and retry timing.

flowchart TD
  A[Gateway requests] --> B[Anthropic catalog]
  A --> C[Browser relay owner]
  A --> D[Feishu probe and replies]
  E[Monotonic elapsed time] --> B
  E --> C
  E --> D
  B --> F[Session catalog results]
  C --> G[Current tab operations]
  D --> H[Status and delivered replies]
Loading

Technical review

Best possible solution:

Keep the paired monotonic deadline substitutions in the existing owners and land through the existing CI gate.

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

Current-main deadline arithmetic directly explains premature expiry after a forward clock step and delayed refresh after rollback; supplied runtime comparisons corroborate it, but this review executed no target code.

Is this the best way to solve the issue?

The patch is the smallest complete repair: each affected producer and consumer shares monotonic time, while TTL values, persisted epochs, cache keys, and authorization owners stay intact.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit ebca214 adds extensions/browser/src/browser/extension-relay/owner-server.ts:56 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ebca214d87b6; files: extensions/browser/src/browser/extension-relay/owner-server.ts)
  • Vincent Koc: Raw commit 4df0e10 adds extensions/feishu/src/reply-dispatcher.ts:35 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4df0e106239d; files: extensions/feishu/src/reply-dispatcher.ts)
  • Glucksberg: Raw commit 60ef923 adds extensions/feishu/src/probe.ts:8 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 60ef92305154; files: extensions/feishu/src/probe.ts)

PR surface

Source 0, Tests -1. Total -1 across 11 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 13 13 0
Tests 5 26 27 -1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 39 40 -1

Root-cause cluster

Relationship: canonical
Canonical: #192469
Summary: This PR consolidates three narrower clock-window repairs and preserves their contributor commits.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.

Label justifications:

  • P2: Host clock corrections can disrupt catalog freshness, browser operation references, and Feishu retry timing, with limited blast radius and existing recovery paths.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • 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-11-04T02:09:06.410Z sha b7f8fcd :: needs maintainer review before merge. :: none

Reviewed November 3, 2026, 9:22 PM ET / November 4, 2026, 02:22 UTC (Revision 2).

@obviyus

obviyus commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@obviyus

obviyus commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

CI attribution for run41758195050: check-test-types had an OWN optional-array-index error at session-catalog.test.ts:1289 from the consolidation. Fixed by checking the typed spy collection with some(), not assuming spies[2] exists. Exact failing extension-test type graph now passes (2.4s), the focused catalog regression passes, and formatting passes. Production bytes and runtime proof are unchanged; tests stay net−1. Repair push5a7b40b7aaf8 follows, with after-push/re-review.

The other red, checks-node-compact-small-2 (https://github.com/openclaw/openclaw/actions/runs/41758195050/job/126339727863), is inherited: relay-coexistence.integration.test.ts:348, both configured profile port/name drift cases expect oldProfile.isTransportAvailable() to reject, but it resolves false. Replayed BOTH existing cases in secretless Docker on the actual hosted merge b1040354539a5411328734fa225d312d51bf91c7 and its frozen main parent991fb33476973a8f0bd2b7a4180b0a8469baffa0: identical2fail/10skipped on both, same false-versus-rejection payload and line348. No product or fixture edits, no hosted rerun. This sweep only changes owner capture expiry; these failures happen at profile availability with no captured reference, and the same case fails without the sweep.

Durable receipt: workboard/coexistence-{main,head}.log, repair-types.log, repair-regression.log, and repair-and-attribute.sh under /Users/obviyus/Developer/.agents/handoffs/openclaw-bugloop/proofs/runtime-cache-clock-sweep-2026-11-04/ . Pueue13819. Cancelled0. Own type red repaired; inherited relay contract mismatch left for maintainer disposition.

@clawsweeper

clawsweeper Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the clawsweeper:intake:bug Preliminary submission classification; full source review pending. label Nov 4, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 4, 2026
@obviyus

obviyus commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

Final exact-head state: 5a7b40b7aaf8dba303a14e646edc6cebaae8f655, after-push completed, fresh review4/6. Own check-test-types regression is now GREEN in hosted CI. The only remaining nonaggregate red is checks-node-compact-small-2: https://github.com/openclaw/openclaw/actions/runs/41759736939/job/126344994380 . Its annotations are the same two port/name-drift false-versus-rejection cases at relay-coexistence.integration.test.ts:348, covered by the paired actual-CI-merge/frozen-main receipt #192469 (comment) . No new cases, no reruns. Cancelled0. The repaired catalog assertion also remains red on baseline (false instead of true) and green on candidate; workboard/repair-negative.log captures the final assertion. Production/runtime proof unchanged. CI gate remains FAILURE pending maintainer disposition; no merge performed.

@obviyus

obviyus commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

Maintainer override: the only red is checks-node-compact-small-2, where two relay profile port/name-drift cases at relay-coexistence.integration.test.ts:348 resolve false. They fail the same way on the actual CI merge and its frozen main parent, and also on #191578 with that PR's changes reverted. This sweep doesn't cause them. Receipt: #192469 (comment)

@obviyus
obviyus merged commit 34ccfee into main Nov 4, 2026
102 of 105 checks passed
@obviyus
obviyus deleted the fix-runtime-cache-clock-sweep branch November 4, 2026 02:29
@obviyus

obviyus commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in 34ccfee. These caches and retries now follow elapsed time across clock changes. Thanks @wangmiao0668000666.

@wangmiao0668000666

Copy link
Copy Markdown
Contributor

Thanks for sweeping #192122, #192422 and #192308 into this consolidation and landing them in 34ccfee — the shipped-entry proofs you ran cleared the gate we were stuck on for the catalog TTLs, and keeping the contributor commits retained is much appreciated.

Understood on the exclusions: #192296, #192293 and #192144 stay independent and continue as their own PRs. Thanks again for the quick resolution!

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 4, 2026
…penclaw#192469)

fix: measure three more cache and retry deadlines with the monotonic clock

Three more deadlines used the wall clock: the Claude catalog filesystem scan cache, a browser extension cache with a 5-minute expiry, and Feishu streaming fallback retry. After the clock moved, they expired early or too late. They now use the monotonic clock. Behavior without a clock change is unchanged.

This sweep includes openclaw#192122, openclaw#192422 and openclaw#192308, with the contributors' commits kept for credit.

Evidence: built shipped entry points, stepping only the process wall clock (no system clock change). Each member was wrong on main twice and right with this change twice, with no-step controls: real Claude catalog filesystem scans; real Chromium with an unpacked extension and a 301-second real expiry; and a signed Feishu webhook with real agent dispatch and a natural streaming HTTP 400 fallback with a 61-second real retry. Details: openclaw#192469 (comment).

Thanks @wangmiao0668000666.

Co-authored-by: wangmiao0668000666 <wangmiao0668000666>
Co-authored-by: nebulacoder-v8.0 <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 14, 2026
…191585)

Feishu core delivers attachment blocks even when text block streaming is disabled. Admit captioned media to the existing caption and native attachment delivery path instead of returning before either send.

The 89 additional regression-test lines exercise the real dispatcher queue, caption sender and image uploader through a mocked Feishu SDK client in preview modes off and partial, without an injected final reply or production test seams.

Co-authored-by: forrystudio <[email protected]>
(cherry picked from commit 569ca48)

Release adaptation: inline the existing public-SDK runtime fixture because
reply-dispatcher.test-support.ts is absent on this release baseline. Keep
real dispatcher, caption sender, media classifier and uploader coverage.

Companion audit: later #192469 (monotonic retry window) and #192482
(preview tail deduplication) do not affect captioned non-streaming admission;
not applicable to this fix. #197656 removes obsolete allocation records;
retain the allocation for this release's existing ratchet. No PR-number
follow-ups found through 7bccde6. Existing dispatcher producers, senders
and reply-runtime exports are present-equivalent; no storage changes.

Proof: git diff --check passed. Focused Vitest/typecheck/lint unavailable:
this isolated worktree has no node_modules; no dependencies were installed.

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
(cherry picked from commit 52e15d4e681397a7b596b5252688376a9979897d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu extensions: anthropic extensions: browser P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants