Skip to content

refactor(ui): observe device policy read readiness - #180285

Merged
steipete merged 13 commits into
mainfrom
solid2/w-s2-device-policy-readiness
Oct 22, 2026
Merged

steipete merged 13 commits into
mainfrom
solid2/w-s2-device-policy-readiness

Conversation

@steipete

@steipete steipete commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Whole-scope AST census at 5b4f83ce8611 → final head b47ccdaaf5a. These count syntax candidates and API use, not unresolved defects. Promise-returning memo callbacks are described separately below because the AST async-keyword count does not identify them.

Family Physical LOC 1 Handlers 2 Cleanup/settled 3 Async-keyword memos/Loading/Errored 4 Action/optimistic/store 5 Imports/lazy 6 Structured/store/projection 7 Factory 8 Context/use 9 Reveal 10 Root/owner/run
solid 7935 → 7935 3 4/19 0/3/1 2/1/1 3/2 0/1/0 0 0/1 0 1/1/1
config 4962 → 4962 0 0/3 0/0/0 0/0/0 0/0 1/1/0 0 0/0 0 0/0/0
menus 8513 → 8513 0 1/13 1/5/3 2/3/0 3/1 0/2/0 1 0/0 0 0/0/0
rest 20210 → 20210 4 15/21 2/10/7 3/3/0 6/1 2/2/0 0 2/2 0 0/0/1
pagesA 28038 → 28038 3 3/39 21/42/41 22/30/1 6/0 1/3/1 0 0/0 0 0/0/0
pagesB 44686 → 44686 1 4/49 2/43/31 13/13/4 22/4 2/7/2 0 1/4 1 0/0/0
pagesC 57115 → 57292 4 13/68 4/45/36 → 4/46/37 20/29/0 43/4 9/14/0 0 0/0 0 0/0/0
app 31650 → 31650 2 3/11 0/9/8 0/0/0 68/7 0/2/0 0 1/2 0 0/0/0
lib 54669 → 54669 0 5/5 0/2/2 1/1/0 15/1 1/2/0 0 1/0 0 2/0/2
plugins 4024 → 4024 0 3/12 0/4/4 1/1/0 13/1 1/2/0 0 0/1 0 2/2/3
api 2104 → 2104 0 0/0 0/0/0 0/0/0 2/0 0/0/0 0 0/0 0 0/0/0
total 263906 → 264083 17 51/240 30/163/133 → 30/164/134 64/81/6 181/21 17/36/3 1 5/10 1 5/3/7

The unchanged families retain the campaign’s separately recorded semantic exceptions and assignments. This PR changes only the Devices family and the directly coupled HTML publication proof.

Problem and change

Devices policy controls need to follow the readiness of their existing Gateway and runtime-config requests. Two page-lifetime async memos now observe admitted receipts under independent Loading/Errored regions. They retain connection, epoch and target identity and send no extra RPC. Inventory remains independently usable. A failed initial config read presents retry; a failed warm reload preserves the editable last-good bindings and unsaved draft.

Main now contains the coupled HTML publication pointer fix, which contributes no diff here. Main’s sharing-test refresh barrier repair (#180498) is retained in full; the three added assertion messages are the only remaining chat change. To keep the page below its 700-line gate, the existing rotation-outcome flow now lives in the Device dialogs owner. It still awaits the authoritative result and reveals a delivered token after a connection reset; its old exported helper is now private.

A reviewed reconnect failure is fixed: readiness now uses the same connection-owned binding-form accessor as rendering. Previously the stale snapshot check could replace a retained unsaved draft with initial-load retry UI after reconnect. The shared accessor preserves existing permission and Gateway/client custody and retains the existing mutation refresh-target memo. The reload/reconnect regression fails on the prior head and passes after repair. The separate suggestion to explicitly reset Errored was not adopted: the existing cold-read retry test confirms native Solid 2 error recovery.

Touched-file checklist Before → after / retained contract
1 Native handler bindings 0 unresolved → 0; retry dispatch reads live props
2 Component lifecycle onCleanup 0→0; paired onSettled 1→1
3 Async reads 2 policy/config readiness families become 2 receipt observers; Loading 0→1 and Errored 0→1 wrapper, each used for both regions; latest 1→2; isPending 0→1
4 Mutations Existing policy and inventory action/optimistic/affects/refresh owners unchanged
5 Code splitting Devices lazy route boundary unchanged; no new startup imports
6 Structured state Existing 2 array snapshot seeds retained; no collection copies added. New signal records a request receipt, not editable owner data
7 JSX Handwritten component factories 0→0
8 Context Redundant provider wrappers 0→0
9 Sibling loading Reveal 0→0: inventory, policy and shared config have independent admission and retry lifetimes
10 Owner APIs Root/getOwner/runWithOwner 0/0/0→0/0/0

Presence, system information and environment samples remain deliberately silent background reads. Plain owners retain synchronous admission, policy drafts, authorization and write settlement. The existing save actions provide temporary feedback; this PR adds only readiness consumption. pr-simplify retained the two scoped receipt observers because replacing owner admission with a new read would duplicate RPCs.

Proof

Check Result
Frozen install Passed; pinned Solid rc.16 retained
UI tsrs Passed; final lint and page-size gate passed
Device unit tests 51 distinct cases passed across the prior and final heads on the pinned Bun runtime with one worker: 44 page/lifecycle/readiness, 4 policy-save and 3 dialog cases. After extraction, the 6 affected rotation cases were rerun and passed
Formatting All changed files passed; the extraction’s 3 files were checked after formatting
Scoped lint Passed, including the page-size gate
Independent P0–P2 autoreview Fresh final merged candidate scoped-clean; prior implementation and extraction reviews also clean
Production Knip Exact base and final head exit 1 for the same 2 unused heartbeat files; complete logs are byte-identical, with no UI findings or new ignores
Exact-base/head production builds Both passed with identical fixed build metadata
Strict performance Both passed with zero violations and zero warnings; paired measurements below
Full CI ci:full; final corrected head b47ccdaaf5a passed run 39767107404, attempt 1, with all 69 jobs completed successfully or skipped. Earlier runs belong to superseded heads
Sharing regression All 6 cases passed after retaining main’s barrier fix; assertion messages preserved
Reconnect regression New parameterized case failed before repair (missing Node combobox), then all 44 Device page cases passed, including existing cold-read retry. Final restoration of the required mutation refresh target also passed all 44
Visual proof Four previously inspected synthetic captures reused; integration has no presentation change

The earlier HTML local replay reached a 300-second setup watchdog before browser launch and remains inconclusive. Run 39756934355 subsequently passed all UI E2E and real-Gateway shards but failed chat-session-sharing-mobile.test.tsx > keeps sharing busy through refresh and retires it for a same-key successor. The six-case file passed on both its exact base and head, so no inherited-failure claim was made. Diagnostic head 04f847 then passed full CI 39760197525. Main’s independent refresh-barrier fix (#180498) is now merged intact; the focused six-case test and UI tsrs pass on merged head 5c03b734f06, and final corrected-head full CI 39767107404 passed. The old auto request was confirmed cancelled before head replacement.

A late exact-head typecheck caught a remaining reference after the attempted projection-memo cleanup on c9e16ade972. That head is superseded. The final head restores the original affects/refresh memo and uses a typed form-helper parameter; exact source typecheck, lint/page-size gate, all 44 page cases, and independent review pass.

Gzip measurement Exact base 5b4f83ce8611 Head b47ccdaaf5a Delta
Startup JS 316,499 B 316,947 B +448 B
Startup CSS 40,894 B / 1 request 40,894 B / 1 request unchanged
Chat boot JS 1,439,592 B 1,440,002 B +410 B
New Session boot JS 1,016,388 B 1,016,791 B +403 B

Both builds and strict performance checks passed with zero violations and warnings. All measured surfaces stay below their current caps (startup 325,081 B, Chat 1,500,000 B, New Session 1,035,000 B); the original Devices lazy boundary and request counts are preserved. Both builds use identical fixed timestamp, build ID, branch and revision metadata.

Production physical LOC across the five changed production files: 1,285 → 1,462 (+177). Nonblank LOC: 1,234 → 1,406 (+172). The increase contains two scope-aware receipt observers and one shared readiness wrapper. Net PR diff: 11 files, +360/−58; no dependency, CSS, route, tag or selector change.

Before: node policy read held

After: node policy read held

Before: node policy ready

After: node policy ready

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 22, 2026
@clawsweeper

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 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-22T10:50:16.371500Z c9e16ad New commits
ℹ️ 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.

@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. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR presents Devices policy and configuration reads through scoped Solid loading and error boundaries.

Example: The policy read for Studio Mac remains pending.

  • Before: Existing loading flags disable the policy controls while inventory stays visible.
  • After: A scoped Solid readiness boundary preserves that presentation and retires observations when the connection changes.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful owner-directed work with visible browser evidence, but a confirmed recovery regression blocks merge.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected browser screenshots show the shipped Devices page with synthetic Studio Mac policy reads held and resolved on the reviewed head; existing browser CI separately exercises the configuration recovery path and exposes the listed regression.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Policy and binding sections need independent readiness without blocking the device inventory.
Reason: The maintainer-authored direction follows the repository's Solid migration guidance and retains Gateway/configuration ownership.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⛔ Needs changes before merge - 3 items remain

Keep open for a focused repair: the owner-directed readiness refactor fits the existing architecture, but introduces a confirmed recovery regression.

Priority: P2
Reviewed head: 93aad1f30664e21f94471ff0149c62272ccdc9ea

Before merge

  • Keep the binding editor available after a failed reload (P2) - When an administrator changes the binding from disk-node to new-node, encounters a save conflict, and Reload's config.get fails, this unconditional rejection reaches PolicyRead's Errored boundary and replaces the entire Bindings editor with an alert. RuntimeConfig still retains the draft, but the user can no longer inspect or edit it until another read succeeds. This reverses the recovery contract established in fix(ui): prevent lost or blocked device binding edits #149721. Exact-head checks-ui-e2e (2/9) fails at settings-reload-devices-draft.e2e.test.ts:73 on precisely this scenario. Preserve the retained editor on refresh failure, show the error alongside it, and keep the existing failed-reload browser assertions.
  • Complete next step - Resolve GitHub's reported merge conflict with main while preserving the separate inventory and policy changes.
  • Explain or restore the original intent of Binding refresh failure and draft retention - fix(ui): prevent lost or blocked device binding edits #149721: Binding controls pause during reload, resume afterward, and retain the draft when the read fails.

Findings

  • [P2] Keep the binding editor available after a failed reload — ui/src/pages/devices/devices-policy-reads.ts:77-79

Provenance

Agent review details

How this fits together

The Devices page consumes Gateway policy requests and shared RuntimeConfig receipts, then renders inventory, approval controls, and node-binding editors.

flowchart TD
  A[Gateway connection] --> B[Existing policy loaders]
  A --> C[RuntimeConfig owner]
  B --> D[Scoped readiness observers]
  C --> D
  D --> E[Policy and binding boundaries]
  A --> F[Device inventory]
Loading

Technical review

Best possible solution:

Keep the existing binding draft and editor available after refresh failure while displaying the error and retry through RuntimeConfig.

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

Source tracing establishes the introduced failure path, and exact-head browser CI fails at the matching retained-editor assertion; no target code was executed during this review.

Is this the best way to solve the issue?

Receipt-based readiness preserves the existing request owners, but refresh errors must not replace an editor whose valid draft the configuration owner intentionally retains.

Full review comments:

  • [P2] Keep the binding editor available after a failed reload — ui/src/pages/devices/devices-policy-reads.ts:77-79
    When an administrator changes the binding from disk-node to new-node, encounters a save conflict, and Reload's config.get fails, this unconditional rejection reaches PolicyRead's Errored boundary and replaces the entire Bindings editor with an alert. RuntimeConfig still retains the draft, but the user can no longer inspect or edit it until another read succeeds. This reverses the recovery contract established in fix(ui): prevent lost or blocked device binding edits #149721. Exact-head checks-ui-e2e (2/9) fails at settings-reload-devices-draft.e2e.test.ts:73 on precisely this scenario. Preserve the retained editor on refresh failure, show the error alongside it, and keep the existing failed-reload browser assertions.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Page-local state and request ownership keeps the original intent (3dc6e49: Move presentation into Solid while preserving synchronous request admission, mutation authority, and target identity.)
  • Same-client reconnect retention keeps the original intent (67c35e9: Retain drafts and loaded data across transport interruptions while retiring old-generation results.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test:ui:e2e ui/src/e2e/settings-reload-devices-draft.e2e.test.ts
  • pnpm test ui/src/pages/devices/devices-page.test.tsx --maxWorkers=1
  • pnpm tsgo:ui
  • git diff --check
  • Inspect browser output showing the retained binding draft after a failed reload and recovery after a successful retry.

What I checked:

Likely related people:

  • Tommy Joseph: Raw commit 24b93de adds ui/src/pages/devices/devices-page.ts:477 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 24b93dea01ea; files: ui/src/pages/devices/devices-page.ts)

PR surface

Source +161, Tests +61. Total +222 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 167 6 +161
Tests 2 68 7 +61
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 235 13 +222

Labels

Label changes:

  • add P2: The pending refactor introduces a bounded Settings recovery regression with an existing focused browser test.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: The pending refactor introduces a bounded Settings recovery regression with an existing focused browser test.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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 22, 2026, 12:38 AM ET / 04:38 UTC.

@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: 985112c594

ℹ️ 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".

if (
!result.ok &&
currentConfigRead(current.state) === read &&
!currentConfigObject(current.state)

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 Preserve the retained draft across reconnect failures

When a same-client reconnect invalidates the config connection, currentConfigObject(current.state) returns null because the snapshot is marked stale, even though viewProps deliberately continues displaying the connection-owned config.configForm. If the reconnect's config.get then fails, this condition throws and replaces that retained binding draft with the initial-load error UI; clicking its Retry button calls discardDraft({ reloadOnly: true }), which can discard the unsaved draft once the retry succeeds. Distinguish a genuinely empty initial load from a stale-but-retained editable form before rejecting the readiness promise.

Useful? React with 👍 / 👎.

@steipete steipete Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in c9e16ad. Readiness and rendering now share the existing binding-form accessor, including the read-permission and Gateway/client custody checks. The new failed-reconnect variant failed on the previous head with a missing Node combobox; all 44 Device page tests pass after the fix, preserving the element, draft value, editability and dirty state. Final head b47ccda also retains the original config mutation refresh-target memo; its exact typecheck, lint and all 44 page tests pass.

@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: 21b40429c9

ℹ️ 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".

fallback={(error) => (
<div class="callout danger" role="alert">
{String(error())}
<button class="btn" onClick={() => props.onRetry()}>

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.

P2 Badge Reset the policy error boundary after retry

When the initial config.get read fails, clicking Retry invokes the owner reload but leaves this Errored boundary in its failed state because the provided reset callback is ignored. Even if the replacement read succeeds, the bindings section can remain replaced by the error callout until the page is remounted; admit the retry and reset the boundary so it can consume the new read.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The existing page-level test surfaces the shared config read failure and retries through its owner verifies this path and passes on the final head: it clicks Retry, completes the successor owner read, and observes the error disappear. Solid 2 automatically heals this boundary when the async derivation becomes healthy, so no explicit reset is needed. I retained the owner retry and the behavioral assertion.

@steipete
steipete enabled auto-merge (squash) October 22, 2026 09:44
@steipete
steipete disabled auto-merge October 22, 2026 10:02
@steipete
steipete merged commit 2deffd0 into main Oct 22, 2026
107 of 110 checks passed
@steipete
steipete deleted the solid2/w-s2-device-policy-readiness branch October 22, 2026 11:20
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with prior CI and scoped validation.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
* refactor(ui): observe device policy read readiness

* fix(ui): retain device bindings after failed warm reloads

* test(ui): use supported exact role-name matching

* test(ui): wait for compact identity menu readiness

* style(ui): format device binding readiness assertion

* test(ui): wait for HTML preview pointer routing

* test(ui): identify session sharing transition failures

* fix(ui): retain device binding drafts after reconnect failures

* fix(ui): preserve the device config mutation refresh target
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 ci:full Keep ordinary native-locale CI selection on the next PR run. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant