Skip to content

fix: fence Session Observer catalog requests - #137243

Merged
shakkernerd merged 4 commits into
mainfrom
fix/session-observer-request-generation
Sep 3, 2026
Merged

shakkernerd merged 4 commits into
mainfrom
fix/session-observer-request-generation

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Refs #137103
Follow-up to #137171.

What Problem This Solves

A Session Observer catalog request could become current again after the selected
agent cycled A -> B -> A. If the first A request completed after the newer A
request, its stale result could overwrite the current picker options.

Root Cause

The completion fence checked the current Gateway client and selected agent, but
those identities are reusable. It did not verify that the completing promise
was still the page's active catalog request.

Fix

Bind success and failure settlement to the current request promise in addition
to the existing Gateway, client, and agent checks. Older generations can no
longer update or reset the picker after a newer request starts.

Regression Coverage

The Config-page owner test uses the real shared catalog store. It keeps the
first Main request pending, completes Writer, invalidates the client catalog as
config.changed and chat.metadata.changed do, starts a distinct newer Main
request, then resolves the original Main request last. The test fails without
the request fence because the stale result replaces Current Main, and passes
with the promise-identity check.

Verification

  • The complete Config-page suite passed 53/53.
  • Exact-head Testbox passed lint, the Session Observer browser recovery, all 31
    Session Observer tests, and the 223-test focused UI suite.
  • The predicate-removal mutation reproduced the stale overwrite before the
    fence.
  • The real Gateway proof preserved unrelated config, selected the recovered
    utility model, and completed Session Observer model work.
  • Independent Workloop review and autoreview are clean.
  • Exact-head ClawSweeper review is Platinum with no correctness finding. Its
    production-growth item is resolved by the owner-local promise identity fence;
    no net-neutral form preserves the explicit generation check.
  • Initial CI failures were isolated to unrelated current-main defects in
    agent-exec timeout coverage and node command-state classification. Both were
    reproduced on current main and repaired by merged PR ci: remove redundant contract runs and costly test work #137220.

Visual Evidence

PR #137171 retains the visible picker recovery screenshots and recording. A new
A -> B -> A recording is omitted here because the Settings route coalesces the
held Main request until cache invalidation, and the browser harness cannot drive
that invalidation plus a third generation without mutating private request
state. The real-store owner test is the closest deterministic proof of this
settlement ordering.

@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XS maintainer Maintainer-authored PR labels Sep 3, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 3, 2026, 8:16 AM ET / 12:16 UTC.

ClawSweeper review

What this changes

The PR prevents an older Session Observer model-catalog request from replacing picker options after the selected agent cycles away and back.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open. Current main still permits the same-client A → B → A completion race, while this focused page-owned fence prevents the stale result from changing the Session Observer picker; the member-authored, maintainer-labeled PR remains for human review.

Priority: P2
Reviewed head: a0b05f5ab52d5aa9db7ef99669e08497c9ca27f5

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow owner-local repair with a credible real-store regression test; no correctness or security finding was identified.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored PR is exempt from the external-contributor proof gate. Its body describes real-Gateway and Testbox runs, but the supplied review context contains no directly inspectable artifact for the new ordering case; that is not a contributor-action blocker here.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored PR is exempt from the external-contributor proof gate. Its body describes real-Gateway and Testbox runs, but the supplied review context contains no directly inspectable artifact for the new ordering case; that is not a contributor-action blocker here.
Evidence reviewed 5 items Current-main defect: Current main's completion predicate checks connection, gateway, client, and selected agent only; after A → B → A those reusable identities let the first A completion update the picker again.
Introduced owner-boundary repair: The introduced predicate additionally requires the settling promise to remain the page's active request, covering both success and failure settlement without changing Gateway or cache behavior.
Regression coverage exercises the production boundary: The changed test uses the real catalog store, invalidates its public client cache, starts a newer Main request, resolves it before the original Main request, and asserts that the newer models remain visible after the stale completion.
Findings None None.
Security None None.

How this fits together

The Control UI Settings page requests configured models for the selected agent and uses them in the Session Observer picker. Gateway catalog results pass through the shared cache, then the Config page decides whether a completed request may update its current picker state.

flowchart LR
  A[Selected agent] --> B[Settings Config page]
  B --> C[Configured model request]
  C --> D[Gateway catalog]
  D --> E[Shared catalog cache]
  E --> F[Active-request fence]
  F --> G[Session Observer picker]
Loading

Before merge

  • Resolve merge risk (P1) - Production code is net +2 lines; the generation check must remain page-local because moving it into the shared catalog cache would conflate cache freshness with ownership of visible picker state.
Agent review details

Security

None.

PR surface

Source +2, Tests +22. Total +24 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 1 +2
Tests 1 35 13 +22
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 38 14 +24

Review metrics

Metric Value Why it matters
Production versus regression coverage production +2, tests +22 The small production increase is the explicit page-owned request-generation invariant; the test growth covers the previously untested cache-invalidation ordering.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the promise-identity generation fence in the Config page and retain the real-store ordering regression test beside the existing replacement-client coverage.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the promise-identity generation fence in the Config page and retain the real-store ordering regression test beside the existing replacement-client coverage.

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

Yes — source-reproducible. Deferring the first Main response, selecting Writer, invalidating the public catalog cache, selecting Main again, and resolving the old response last reaches the current-main overwrite predicate.

Is this the best way to solve the issue?

Yes. The Config page owns picker state, while the shared catalog store only owns cache freshness; promise identity is the narrow generation boundary that distinguishes a retired same-client request from the current one.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs a limited but user-visible Settings picker race without evidence of broader availability, security, or data impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is exempt from the external-contributor proof gate. Its body describes real-Gateway and Testbox runs, but the supplied review context contains no directly inspectable artifact for the new ordering case; that is not a contributor-action blocker here.

Evidence

What I checked:

  • Current-main defect: Current main's completion predicate checks connection, gateway, client, and selected agent only; after A → B → A those reusable identities let the first A completion update the picker again. (ui/src/pages/config/config-page.ts:806, e0dad1fc1333)
  • Introduced owner-boundary repair: The introduced predicate additionally requires the settling promise to remain the page's active request, covering both success and failure settlement without changing Gateway or cache behavior. (ui/src/pages/config/config-page.ts:810, a0b05f5ab52d)
  • Regression coverage exercises the production boundary: The changed test uses the real catalog store, invalidates its public client cache, starts a newer Main request, resolves it before the original Main request, and asserts that the newer models remain visible after the stale completion. (ui/src/pages/config/config-page.test.ts:703, a0b05f5ab52d)
  • Shared-cache fence is a separate invariant: The catalog store already fences cache writes with its in-flight identity; that cannot prevent an obsolete page subscriber from settling into page-owned picker state, so the new page-local fence is not duplicate cache policy. (ui/src/lib/model-catalog-store.ts:92, a0b05f5ab52d)
  • Related recovery work is already on main but does not supersede this PR: Merged fix: recover Session Observer models after catalog failure #137171 is contained by local main, but current main still has the unfenced predicate above; it addressed failed catalog recovery rather than this repeated-selection settlement race. (bf5c6d750c5a)

Likely related people:

  • shakkernerd: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Erick Kinnee: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

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

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

Workflow

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

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-03T10:39:29.082Z sha 9ea33e0 :: blocked before merge. :: [P2] Exercise the cache invalidation that permits the second A request
  • reviewed 2026-09-03T10:54:05.448Z sha bcd94ba :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added 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 rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 3, 2026
@shakkernerd shakkernerd self-assigned this Sep 3, 2026
@shakkernerd
shakkernerd force-pushed the fix/session-observer-request-generation branch from bcd94ba to a0b05f5 Compare September 3, 2026 12:09
@shakkernerd
shakkernerd merged commit 6b1d811 into main Sep 3, 2026
136 checks passed
@shakkernerd
shakkernerd deleted the fix/session-observer-request-generation branch September 3, 2026 12:23
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: Session Observer model choices now keep the newest catalog result through cache invalidation and repeated agent selection.

vincentkoc added a commit that referenced this pull request Sep 3, 2026
…36761-session-mode-local-20260903

* commit '58187248c8cafd7b8cfbba3de8d001762fb08b48':
  improve(testing): add watchOS Gateway upgrade survivor (#137203)
  improve(ui): structure Devices rows with an actions menu and a facts panel (#137084)
  test(cli): reuse canonical pairing call guard (#137210)
  fix(sessions): prevent gateway stalls during large session cleanup (#126035)
  fix(qa): resolve Slack runtime dependency (#137283)
  fix: fence Session Observer catalog requests (#137243)
  fix(memory): make watcher pressure guidance actionable (#137181)
  test(entry): type the respawn exit mock directly (#137258)
  fix(release): install first-hop fixtures through the candidate registry (#137286)

# Conflicts:
#	scripts/e2e/lib/upgrade-survivor/assertions.mjs
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
Prevents stale Session Observer catalog requests from overwriting newer picker results after cache invalidation and repeated agent selection.

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

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. 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.

1 participant