Skip to content

refactor(ui): reuse presentation lifetime owners - #177437

Merged
steipete merged 1 commit into
mainfrom
deslop/z34-8-ui-lifetimes-20261015
Oct 19, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/z34-8-ui-lifetimes-20261015

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The Control UI duplicates timer, artwork, FileReader, request-version and reconnect ownership already provided by shared helpers or the parent lifetime.

What Changed

Use the existing presence lifecycle, artwork renderer and Blob reader; keep only config-read request versions; create Logbook once per parent-owned connection. Remove presentation-only chronology and redundant provider refresh scheduling while retaining actual connection/agent/day scope, network cancellation, native authority, config-write admission and FIFO settlement.

This is the UI area split from the plugin/core owner-plumbing family spanning more than 120 paths. The campaign's area-split exception applies; no padding to meet a deletion floor. Current pre-format measurement: 102 net production lines removed across 11 production owners, 17 changed source/test paths. Phase E standalone session memory, all supporting machinery and tests are untouched. No CSS, tag, DOM, user-facing text, public SDK, configuration, protocol, dependency or persisted shape change intended.

Best-effort tradeoffs accepted

The remaining cuts intend no behavior compromise. Schema loading has synchronous one-request admission plus retained connection epoch, so its second version dimension is redundant (#122117 extraction); config read/write invalidation stays. Activity uses the existing nearest-deadline/hidden-clear/visible-catchup owner (#168756/#168788). Background uploads use the existing reader with identical image-read errors (#173811). Plugin visitor artwork uses the existing renderer with the same image class, empty alt, pending/error fallback and retired-result behavior (#168760/#169243/#171576).

Evidence

The current-base focused selection covered 25 owner/consumer files (21 UI unit files plus four focused browser-unit files, not E2E): 389 passed and one ordinary Agents catalog-publication assertion failed. That proposed three-line cut and all associated test changes were withdrawn. The complete retained Agents suite then passed 31 tests (30.6 seconds wall). Existing inputs and passing proof for the other owners are unchanged.

Typed lint caught the newly added presence case growing an already-over-limit Activity test file. Only that new case moved to a small dedicated file using existing real Gateway/session/context helpers, preserving every assertion; the original Activity test file is now base-identical. The new presence file and original Activity suite pass 36 tests (20.1 seconds wall; new case 40 ms). No limit, assertion or suppression was weakened.

Targeted UI production and changed-test types pass (7.6 and 8.2 seconds). Focused typed lint passes (61.5 seconds; existing style/reactivity warnings remain), formatting passes, the Solid controller guard passes with no baseline growth, runtime cycles are zero and Madge cycles are zero. Author simplification and complete diff inspection are complete. A fresh independent review with the complete determining owners and moved-test helper context finished scoped-clean through P2 (confidence 0.90).

The suppression audit is 13 pass / one inherited failure: the unchanged src/gateway/session-row-scope.ts|unicorn/no-new-array|1 row introduced by #177285. This exact signature is open in the coordinator index and occurs in completed scheduled main runs 39270035500 and 39261680942; the newest six completed scheduled runs were checked. The source and audit test are base-identical, and this UI diff adds no suppression. No allowlist or baseline was changed. Exact-head hosted CI remains the broad gate; this is not an all-green CI claim. Changed-check dry-run classified all 17 current paths; broad local check-changed/build/E2E were not run under the campaign budget.

New boundary tests cover actual presence expiry/visibility/disposal and retained visitor success/error/replacement/retirement. Existing cross-connection/day, native setting errors, config write/reconnect and Logbook ordering assertions remain. Removed tests only pinned the explicitly removed same-scope metadata perfection paths. No longer timeouts, retries, skips, suppressions or baseline expansion. Local proof is isolated/nice10/single-worker; exact-head PR CI supplies broad proof. No visual appearance change intended, so no visual redesign evidence is claimed.

@clawsweeper

clawsweeper Bot commented Oct 19, 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.

@steipete
steipete marked this pull request as ready for review October 19, 2026 15:38
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T15:42:11.561188Z 4314276 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 43142768fb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 262 to 266
const isCurrent = () =>
this.context.isConnected &&
this.context.available &&
client === this.context.client &&
requestId === this.availabilityRequestId &&
environmentId === this.availabilityTarget;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore latest-request admission for desktop availability

When two node.runnerInventory.changed events for the current node arrive before the first environments.status call resolves, the newer reply can update the lock state and then the older reply still passes every check here and overwrites it. This can leave the desktop viewer showing stale availability—and potentially the wrong sign-in/control state—until another inventory event occurs, so retain a per-request generation check before publishing the snapshot.

AGENTS.md reference: ui/AGENTS.md:L14-L18

Useful? React with 👍 / 👎.

Comment on lines 121 to 123
if (reason === "publication" && (this.active || this.catalogLoading)) {
this.publicationPending = true;
// Catalog changes during an existing read are best effort until the next refresh.
return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Queue publications that arrive during provider loads

When chat.metadata.changed arrives while the initial auth/catalog read is active, subscribeModelCatalogChanges reaches this branch after invalidating the shared facts, but the event is discarded and the already-running pre-publication response can still be published. A normal login or provider update can therefore leave the Models page showing Checking or old authentication metadata indefinitely until a manual refresh; preserve one trailing publication refresh after the active read settles.

AGENTS.md reference: ui/AGENTS.md:L14-L18

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR reuses shared presentation helpers and parent connection lifetimes while removing redundant request counters and refresh scheduling.

Example: An openai catalog publication arrives while the Models page is loading authentication.

  • Before: The loader queues a follow-up read and automatically adopts the published catalog.
  • After: The publication is best effort during the active read; Checking or older metadata can remain until ordinary or manual refresh.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source-consistent, with meaningful owner-level coverage; assessed behavioral evidence remains in-process rather than current-head shipped-entry-point proof.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; supplied tests exercise owners in process, while the inspected historical Mac settings and onboarding screenshots do not demonstrate this head's changed lifecycles.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes
Reason: The maintainer chose consolidation and documented the limited freshness compromises; inspection confirms helper reuse and removal of duplicate lifecycle ownership without new configuration or public contracts.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored refactor consolidates existing UI owners, and source review found no actionable defect outside the explicitly accepted behavior changes.

Priority: P3
Reviewed head: 43142768fb408fe08114a7c4389b3cfc198d9289

Before merge

None.

Findings

None.

Agent review details

How this fits together

Control UI presentation owners consume Gateway snapshots, events, native callbacks, and browser timers, then publish scoped state to Solid views.

flowchart TD
  Gateway[Gateway snapshots and events] --> Owners[Scoped domain owners]
  Native[Native settings callbacks] --> Owners
  Parent[Plugin page connection lifetime] --> Logbook[Logbook model]
  Helpers[Shared presentation helpers] --> Views[Solid views]
  Owners --> Views
  Logbook --> Views
Loading

Technical review

Best possible solution:

Use the existing shared helpers and parent connection owner while retaining actual scope, cancellation, config-write ordering, and the recorded best-effort tradeoffs.

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

This is a refactor rather than a reported bug; source and existing regressions establish the changed ordering cases, but no runtime reproduction was performed.

Is this the best way to solve the issue?

The change uses owners already present, removes the replaced paths, and retains meaningful lifecycle tests; the reduced freshness guarantees are explicitly accepted by the maintainer.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Desktop availability request chronology changes intended behavior with a stated reason (cc0d3ca: Keep native desktop availability current across lock, disconnect, and refresh activity.)
  • Model-provider trailing publication refresh changes intended behavior with a stated reason (19752be: Adopt completed catalog publication after an active authentication read rather than remain on Checking.)
  • Config request versions keeps the original intent (5c81ed5: Separate runtime config state, Gateway operations, and write coordination while preserving read retirement and write ordering.)
  • Activity presence presentation lifetime keeps the original intent (e33b7f6: Preserve presence expiry and page behavior during the Solid migration.)
  • Logbook connection and polling lifetime keeps the original intent (10c95d1: Move polling and request retirement into a scoped model; the later parent keyed boundary now supplies connection replacement.)
  • Native hosting completion notices changes intended behavior with a stated reason (74828ac: Preserve native settings behavior and completion notices during the Solid port.)
  • Visitor artwork rendering keeps the original intent (c2d584a: Preserve visitor identity, rendering, and retired-result behavior during the Solid migration.)
  • Background image reading keeps the original intent (1b1283f: Keep background selection and upload behavior within the Settings owner lifetime.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source -102, Tests +135. Total +33 across 17 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 11 44 146 -102
Tests 6 231 96 +135
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 275 242 +33

Review metrics

Metric Value Why it matters
Production versus test changes Production +44/-146; tests +231/-96 Production removes 102 lines; test growth primarily covers presence expiry, visibility and disposal, plus visitor artwork loading, failure, replacement, and retirement.

Labels

Label changes:

  • add P3: This is an owner-approved lifecycle cleanup with recoverable presentation tradeoffs and no identified urgent user-facing defect.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is an owner-approved lifecycle cleanup with recoverable presentation tradeoffs and no identified urgent user-facing defect.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 19, 2026, 11:55 AM ET / 15:55 UTC.

@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head gate investigation for 43142768fb408fe08114a7c4389b3cfc198d9289:

Evidence Observed result
CI run 39279577142, attempt 1 Completed successfully
Actions openclaw/ci-gate, job 118163414014 Success; the complete 56-job attempt has exactly one gate job
All exact-head check runs No failed test/check leaf; the older cancelled PR-context run is superseded
Security publisher 39285453102, job 118170083076 Successful workflow execution, but published a CI-only combined failure: “CI must complete successfully; review updates automatically”
Independent dependency and security-sensitive statuses Both successful, no approval request

The original publisher's ciState function from its trusted checkout d0e8fc8a103b2c37e98809ee46370748bb965155, evaluated read-only against the current public PR/run/job metadata, returns success. This diagnostic publishes no status and changes no gate. The historical publication discrepancy remains unresolved; it is not being called passing security/combined proof or a failing product test.

No CI rerun, dispatch, branch update, test weakening, status override or gate bypass was performed for this investigation. Ordinary native landing remains subject to its live gate checks.

@steipete

Copy link
Copy Markdown
Contributor Author

Coordinator landing evidence for exact head 43142768fb408fe08114a7c4389b3cfc198d9289:

  • CI run 39279577142 (pull_request, head 4314276) completed success.
  • Security Review run 39279577479 (head 4314276) completed success.
  • The red openclaw/ci-gate status (16:27:10Z) links run 39285453102, a workflow_run Security Review for a different head (d0e8fc8a103b), so the gate was published from another commit's run. No failing check exists for this head.

Merging with the exact-head SHA guard (squash). This works around a misfiring gate publisher; it does not bypass any failing check.

@steipete
steipete merged commit b6666b7 into main Oct 19, 2026
144 of 146 checks passed
@steipete
steipete deleted the deslop/z34-8-ui-lifetimes-20261015 branch October 19, 2026 18:29
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L 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