Skip to content

fix(ui): keep session branch PR cache windows on elapsed time - #191576

Merged
obviyus merged 6 commits into
openclaw:mainfrom
wangmiao0668000666:fix/control-ui-session-prs-elapsed
Nov 3, 2026
Merged

obviyus merged 6 commits into
openclaw:mainfrom
wangmiao0668000666:fix/control-ui-session-prs-elapsed

Conversation

@wangmiao0668000666

@wangmiao0668000666 wangmiao0668000666 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The session branch-PR cache used wall-clock epochs for its90-second success TTL and failure/quota backoffs. A forward wall-clock correction expired fresh branch snapshots early, making extra GitHub requests; a backward correction could retain stale snapshots too long. This is the remaining branch-cache member after #191606.

Changes

  • Preserve wangmiao0668000666's two original commits and use the existing core monotonicDeadlineAfter/monotonicNow owner at all five deadline write/comparison sites.
  • Keep durations, branch/session/credential identity, cancellation, forced-refresh ordering, GitHub transport and persisted timestamps unchanged.
  • Fold the clock regression into existing list-failure/retry coverage, and advance the retention fixture's elapsed clock alongside its Date step. Tests net0; production+1; docs+1. No allocation or baseline changes.

Evidence

Built Gateway in secretless Node24.22.1 Docker, real Git checkout/branch/commit/remote, real WebSocket subscription RPC, and recorded local GitHub HTTP responses: main twice prematurely refetches revision2 after a process-local forward Date.now step; candidate twice retains revision1 through the original90-second TTL. Ordinary no-step reuse controls pass. Performance and actual timers are untouched; no system clock was changed.

The consolidated backward-clock regression fails on pre-fix main and passes on candidate. Both touched suites pass 11/11; targeted formatting and lint pass. Full before/after payloads, HTTP counts, isolation paths and run identifiers are in the proof comment below. No live GitHub or provider credentials required. No visual change or browser screenshot claim.

Risk and rollback

Two-way door: reverting restores the former in-process cache timing; no schema or persisted state migration. Blast radius is session branch-PR freshness and GitHub request/backoff timing; other cache owners and UI rendering are unchanged.

Detailed built-Gateway proof: #191576 (comment)

@clawsweeper

clawsweeper Bot commented Nov 3, 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 Nov 3, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR measures session branch-PR cache freshness and retry windows with the existing monotonic clock.

Example: A branch snapshot has a 90-second TTL, and Date.now advances 61 minutes before the normal poll at 60 elapsed seconds.

  • Before: The Gateway prematurely fetches revision2, producing a second GitHub list request.
  • After: The Gateway retains revision1 with one list request until the original elapsed-time deadline.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A minimal repair with shipped-entry-point before/after proof, a consolidated backward-clock regression, and no actionable findings; pending CI remains a landing gate.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The linked proof comment exercises the changed branch-cache owner through the built Gateway’s registered subscription in secretless Node Docker, using native Git and recorded HTTP responses; repeated baseline/candidate comparisons show premature expiry removed, and the exercised code matches the reviewed head.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Host clock corrections can trigger unnecessary PR requests or keep stale session PR snapshots beyond their intended lifetime.
Reason: The patch restores existing elapsed-duration expectations without changing defaults, adding options, or expanding the feature.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a current cache-timing defect with a focused change and sufficient Gateway proof; no actionable defects remain, and exact-head CI is pending.

Priority: P2
Reviewed head: a08d644d61fe1efc4358658fe1e4953bda17c452

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Gateway resolves a session’s GitHub checkout, caches branch PR observations, and supplies snapshots to Control UI subscriptions and publication readers.

flowchart LR
  A[Control UI subscription] --> B[Gateway subscription owner]
  B --> C[Session checkout resolution]
  C --> D[Branch PR cache]
  E[Monotonic clock] --> D
  D --> F[GitHub HTTP client]
  D --> G[PR snapshot events]
Loading

Technical review

Best possible solution:

Land the existing focused monotonic-clock repair once the exact-head CI gate passes.

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

Current-main source compares wall-clock deadlines directly, and the supplied built-Gateway comparison demonstrates premature expiry after a forward clock step; this read-only review ran no target code.

Is this the best way to solve the issue?

The patch is the smallest complete fix: all branch-cache deadlines use the existing process-local clock owner, without changing cache policy or adding state.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Branch-cache expiry and forced refresh keeps the original intent (2d54be3: The original session PR feature cached GitHub observations and preserved chips during quota exhaustion; the later sidebar repair added coalesced forced refreshes that retain quota backoff.)
  • Display enrichment failure and quota deadlines keeps the original intent (e8d136f: Publication readers needed list facts without waiting for optional display metadata, while display readers retained stale fallback and retry windows.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit c715d89 adds src/gateway/control-ui-session-prs.ts:601 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c715d89de81e; files: src/gateway/control-ui-session-prs.ts)

PR surface

Source +1, Tests 0, Docs +1. Total +2 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 6 5 +1
Tests 2 3 3 0
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 10 8 +2

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Clock corrections can produce premature GitHub requests or prolonged stale PR snapshots, with limited impact on session PR display and retry timing.
  • 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 (2 earlier review cycles)
  • reviewed 2026-11-03T01:28:36.304Z sha d4150ac86a5996fb63f3af264c9e902f1baa658c :: needs real behavior proof before merge. :: [P2] Advance the retention fixture's monotonic clock during backoff
  • reviewed 2026-11-03T17:00:06.284Z sha f4b1e47 :: needs maintainer review before merge. :: none

Reviewed November 3, 2026, 12:40 PM ET / 17:40 UTC (Revision 3).

wangmiao0668000666 and others added 2 commits November 3, 2026 10:41
The in-process branch PR cache anchors its TTL on Date.now(); a wall-clock
correction (NTP step, manual change, suspend/resume) extends or shortens the
window. Anchor on performance.now() so the module-local cache ages by elapsed
time. Compare and write in the same clock domain; no entry leaves the process.
… fixture

The retention fixture's 61s wall-clock step only moved Date, so the branch
cache's performance.now() deadlines never aged; the final poll then advanced
elapsedMs by only 240,001ms, leaving the 5-minute rate-limit backoff unexpired
(104 fetches instead of the expected 205). Advance the elapsed-time clock with
the wall clock while keeping the backoff alive.

Co-Authored-By: nebulacoder-v8.0 <[email protected]>
@wangmiao0668000666
wangmiao0668000666 force-pushed the fix/control-ui-session-prs-elapsed branch from cb6f6ca to f4b1e47 Compare November 3, 2026 02:42
@wangmiao0668000666

Copy link
Copy Markdown
Contributor Author

@obviyus — thanks for sweeping #191575 and #191577 into #191606. This PR (#191576) is the remaining same-shape cache window (session branch-PR cache in control-ui-session-prs.ts) that #191606 intentionally excluded, and current main still keeps all five Date.now() reads there.

Status now:

  • Rebased onto latest main (f4b1e4729d2), CI fully green including checks-node-changed-compact-large-13.
  • Fixed the retention-fixture P2 (the 61s wall-clock step now also advances the mocked performance.now() elapsed clock, so the 5-minute rate-limit backoff stays alive) — this was the exact-head CI failure.
  • RED/GREEN verified remotely: the production Date.now() → performance.now() swap fails the new elapsed-time case on the old clock and passes on this head.

It exercises the same elapsed-time shape as #190894/#190997/#191606. Happy to add the shipped Gateway proof if you'd prefer to land it here rather than fold it into another sweep.

@wangmiao0668000666

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 3, 2026
@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb cli CLI command changes scripts Repository scripts commands Command implementations docker Docker and sandbox tooling agents Agent runtime and tooling channel: feishu Channel integration: feishu channel: twitch Channel integration: twitch channel: irc extensions: acpx extensions: duckduckgo channel: qa-channel Channel integration: qa-channel extensions: qa-lab extensions: memory-wiki extensions: tokenjuice Changes to the bundled tokenjuice extension plugin: bonjour Plugin integration: bonjour plugin: google-meet plugin: azure-speech Azure Speech plugin extensions: diagnostics-prometheus plugin: migrate-hermes channel: synology-chat plugin: migrate-claude plugin: zoom Zoom plugin labels Nov 3, 2026
@obviyus

obviyus commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Exact-head refresh: after-push required reconciling GitHub diff/base drift, so current main was merged without conflicts and the final head is a08d644d61fe1efc4358658fe1e4953bda17c452. after-push now succeeds with4files and requested re-review. Rebuilt this exact head and repeated the real-Git/built-Gateway subscription proof twice: candidate3 branch-candidate-3-BBs3Pe, candidate4 branch-candidate-4-gYzfVZ, both PASS with revision1 and one list request after the process-local Date.now step, retaining the original TTL. No-step controls also pass. Logs/result payloads under workboard/observed-exact and candidate-{3,4}.log in the existing191576 proof root; Pueue13738. No further product edits, baseline changes or hosted reruns.

@obviyus

obviyus commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Landed in c5828d0. Thanks @wangmiao0668000666. The branch pull-request cache now expires by elapsed time.

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

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation 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