Skip to content

fix(macos): clear stale settings when switching gateways - #137502

Merged
steipete merged 4 commits into
mainfrom
codex/mac-gateway-settings-ownership
Sep 4, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/mac-gateway-settings-ownership

Conversation

@steipete

@steipete steipete commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #137089. Skill-trust cache ownership is reviewed separately in #137563.

Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers can help update the branch when needed.

What Problem This Solves

Switching the Mac app’s Primary Gateway could leave the previous Gateway’s settings, status, errors, or drafts on screen. Retained controls could then send a Cron edit, configuration save, or skill action to the replacement Gateway. An unavailable replacement could leave stale information visible indefinitely. Cold Config loads and retries also had cancellation and duplicate-request paths that hid errors or left the pane unfinished.

Why This Change Was Made

The connection owns selection retirement, including selections that never complete a handshake. Panes bind displayed data, drafts, and asynchronous work to that source. Reads require their physical connection; durable edits retain their configured Gateway across socket reconnects. Configuration documents carry their origin and version hash through saving, so a denied Gateway request cannot authorize a local-file fallback.

Shared ownership now covers Cron editors/transcripts, Channels/Config, Skills/ClawHub, health, instances, nodes, and usage. The source owns shared configuration reads and connection acquisition, so cancellation of one SwiftUI caller cannot discard another caller’s result. Config has one selected-section loading task. A failed section remains actionable through Retry; root completion cannot silently retry it.

Cold connection errors remain attached to the selected revision while Refresh/Reload runs. Pending acquisition is visible, successful source adoption retires the error, and late work cannot overwrite a replacement source. Cron separately displays loading, failure, and a successful empty result. An endpoint-owned formatter removes credentials from diagnostics while preserving authenticated navigation. Acknowledged ClawHub installs retain their result and audit warning if later confirmation or search fails.

Obsolete usage loaders, duplicated skill request paths, redundant loading state, unused schema-force handling, and the duplicate selected-section request are removed. Configuration options, storage schemas, dependencies, and Gateway protocol are unchanged.

Evidence

Signed native builds were exercised against independent Gateways A and B through actual Primary selection, Settings, retained editors, and Dashboard navigation. A→offline B immediately removed A’s data; a retained A Cron editor rejected Save before any B write. Restarting B recovered its own Config, Skills, and Cron fixtures. Same-Gateway reconnect preserved valid drafts. Actual native B→A→B promotion retained the Config Port section and automatically displayed 32292→32291→32292, without Reload between switches; leaving/reopening Config and explicit Reload also completed.

A synthetic ClawHub Review → Verify/install flow proved that acknowledged success and its audit warning survive reconnect and later search failure, while a successful empty search clears only the read error. No software was downloaded or executed in that fixture. Live Cron failure retained Refresh, and Dashboard diagnostics omitted the token fragment; focused tests additionally cover URL username/password components.

The reviewed Settings correction 920cc2b823465b5272fbb0ceefe34a3b0a044f75 passed the full native suite and is included in combined signed-live candidate 2fae6c9b27e5bca1492e12395b43de79e45ac69d. The final signed AFTER run passed in one app process: cold Config shows pending; an unavailable B retains its connection error during automatic acquisition and actual Channels Refresh; restoring B recovers automatically. Actual Set as Primary confirmations then update the retained Config Port B→A→B (32292→32291→32292), followed by a successful Reload and Channels/Config revisit. The initial and final B profile hashes match. The unchanged signed baseline visibly lost its Channels error after Refresh and showed unavailable Config without a pending indicator. Controlled native tests also reproduced duplicate selected-section lookup and cancellation of joined acquisition before the fixes.

The final combined native candidate passed 2,082 Swift Testing tests across 218 suites, four XCTest cases, and both named AppState isolation tests. The full suite ran at width one; all 81 source hashes were unchanged before/after. Forty-seven focused owner/sibling tests cover cold/open/retry, retained section, cancellation, selected-revision replacement, push adoption, and late completion. Final three-pass independent review is scoped-clean with zero P0–P2 findings. Strict Swift lint/format, docs formatting, and diff checks passed; the canonical native source inventory remains verified. The early offline Config Reload coordinate missed the button, so that capture proves automatic retry only; held native regressions cover cold Reload. The later recovered-B Reload was an actual UI action. Exact current-head required CI passed: scheduled run 33825471857, attempt 2, completed with 88 successful jobs and 13 skips; both Swift phases, the recovered lint shard, and the aggregate passed.

CI investigation produced separate repairs: #137639 isolates unrelated provider-auth warmup from the authenticated MCP replacement proof; #137671 repairs Browser cleanup latency and tab-registration ownership; #137620 recorded the dated release-discovery fixture defect, subsequently fixed on main in #137633; #137620 is closed as superseded after all 30 current-main owner tests passed. No production timeout, test assertion, or CI gate is weakened.

Current head caf69a689179db8fb3db5b5fc39b8450d80cf891 incorporates main’s audit-timeout handling (#137716) and fixture repair (#137633). All 69 non-generated changed files are byte-identical to the reviewed/signed candidate, and the eight changed native-inventory entries are identical relative to the new base. The full hosted Swift release and test phases also passed for 920cc2b8; refreshed-head required CI is green.

Review and Size

The current ClawSweeper cold-retry finding is addressed at the acquisition owner with held-attempt regressions. Its requested signed AFTER verification is complete; exact-head required CI is complete. The shared lease boundary preserves the distinction between changing Gateway and reconnecting to the same Gateway. Production growth represents that previously absent ownership across long-lived panes and edits; removed duplicate paths offset part of it. Judged delta: production 43 files, +2,569/−1,231 (net +1,338); tests/preview support 21 files, +5,134/−552 (net +4,582); docs five files, +57/−1; generated native inventory +8/−3. CronSettings+Testing.swift is counted as preview support. The final cold retry correction adds 55 net production lines to represent shared acquisition ownership and pending state.

Native Before and After

A retained A editor previously attempted its update on B; it now rejects the changed Gateway before issuing the write.

Before: retained A Cron edit sent to B

After: source-bound editor rejects the stale action

Cron failure retains Refresh

Dashboard failure address omits credentials

Primary B and retained Config Port agree

Acknowledged ClawHub install and audit warning survive later search failure

Before: Refresh clears the unavailable Gateway error

After: Refresh retains the error and shows pending acquisition

Final signed build: retained Config follows Primary A

Final signed build: Primary B restored, Reload and reopening completed

Recorded Follow-ups

The audit also identified iOS ClawHub confirmation misclassifying an acknowledged install, and regular prerequisite-install warning arrays not fully projected in the native result. Their reproduction and acceptance notes are retained separately; neither is part of this Gateway-settings repair.

Expanded manual CI also exposed separate follow-ups: NodeForegroundServiceTest.stopDuringRuntimeConstructionRetiresBackgroundStartup observes status/request callbacks before asynchronous teardown is joined; Chromium bootstrap times out during its MCP handshake before obtaining a controlled tab; a built SQLite fixture starts its mock provider on the same port selected for its Gateway. These observations are recorded separately, without treating them as Mac source regressions. The required scheduled PR run passed on its unchanged head. Its setup failure occurred before lint and passed on retry; the remaining Swift jobs were retried only after fresh verification that they were unassigned and no work was executing.

Observed follow-up: native Settings did not visibly rise above an already-open Dashboard during one signed VM interaction. Source inspection found no elevated Dashboard level; the captures do not prove Settings action admission, so the cause remains unconfirmed and no speculative focus fix is included.

@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 docs Improvements or additions to documentation app: macos App: macos size: XL maintainer Maintainer-authored PR labels Sep 3, 2026
@steipete
steipete marked this pull request as ready for review September 3, 2026 19:03
@steipete steipete self-assigned this Sep 3, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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. 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, 10:02 PM ET / September 4, 2026, 02:02 UTC.

ClawSweeper review

What this changes

This PR makes the macOS app discard or reject settings, cached views, and actions tied to a gateway after the selected gateway is replaced, while retaining valid same-route reconnect behavior.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep open: the source-backed gateway-ownership repair appears correct, but the exact-head aggregate CI gate remains failed or incomplete and must be resolved before merge.

Priority: P2
Reviewed head: caf69a689179db8fb3db5b5fc39b8450d80cf891

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The repair has strong focused ownership coverage and a coherent boundary, with final merge confidence held back by incomplete exact-head aggregate CI.
Proof confidence 🦞 diamond lobster (5/6) Not applicable: This maintainer-authored PR is not blocked on external contributor proof; its supplied native evidence is supplemental to the source and focused-test review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is not blocked on external contributor proof; its supplied native evidence is supplemental to the source and focused-test review.
Evidence reviewed 5 items Connection ownership boundary: GatewayConnection binds a server, socket, and revision into a lease; replacement adoption retires the prior configured connection before shutdown, and stale-route checks distinguish retired routes from valid same-route reconnects.
Store cleanup and stale-save protection: Channels, configuration, jobs, and skills retain source-bound state and reject or clean up work whose lease no longer owns the selected Gateway; ConfigStore rejects stale sources rather than locally falling back after cancellation or authorization failures.
Regression coverage: Focused macOS IPC tests cover source replacement, retained selected sections, stale mutation rejection, and suppression of late reads after a Gateway replacement.
Findings None None.
Security None None.

How this fits together

The macOS app selects a Gateway connection and uses it to load configuration, channels, jobs, and skills. Those stores now bind work and cached state to the selected connection so late results or retained actions cannot affect a replacement Gateway.

flowchart LR
  A[Gateway selection] --> B[Connection lease]
  B --> C[Settings and feature stores]
  C --> D{Lease still current?}
  D -->|Yes| E[Load or save Gateway state]
  D -->|No| F[Clear stale state and reject action]
  E --> G[macOS settings and views]
Loading

Before merge

  • Resolve merge risk (P1) - Switching a primary Gateway intentionally clears source-bound drafts and cached panes; exact-head validation must confirm that only stale state is removed and valid same-route reconnect state remains usable.
  • Resolve merge risk (P1) - The supplied exact-head aggregate CI gate is failed or incomplete, leaving merge readiness unproven despite the focused source and test coverage.
  • Complete next step (P2) - Resolve or explain the failed exact-head aggregate gate and wait for remaining exact-head checks before merge.
Agent review details

Security

None.

PR surface

Docs +56, Other +5925. Total +5981 across 70 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 5 57 1 +56
Config 0 0 0 0
Generated 0 0 0 0
Other 65 7711 1786 +5925
Total 70 7768 1787 +5981

Review metrics

Metric Value Why it matters
Production versus test delta production +2,569/-1,231 (net +1,338); tests/preview support +5,134/-552 (net +4,582); docs +57/-1 The substantial production growth implements a cross-store ownership boundary, so exact-head validation is material before merge.

Root-cause cluster

Relationship: canonical
Canonical: #137502
Summary: This is the canonical macOS Gateway-settings ownership repair; related work covers adjacent security, browser, and CI concerns.

Members:

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

Merge-risk options

Maintainer options:

  1. Complete exact-head validation (recommended)
    Resolve or explain the failed aggregate gate and obtain the remaining exact-head results before merging this state-ownership change.
  2. Pause for CI diagnosis
    Pause the PR if the aggregate failure cannot be attributed and cleared without weakening the gateway-replacement coverage.

Technical review

Best possible solution:

Merge only after exact-head CI is green and confirms the documented rule: gateway replacement clears only state and actions owned by the retired connection.

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

Yes—focused macOS IPC scenarios define the Gateway replacement and late-result paths, although this read-only review did not execute them.

Is this the best way to solve the issue?

Yes—the lease/source ownership model repairs stale state at the connection and store owners, rather than compensating in individual views.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded macOS correctness repair with user-visible stale-state impact but no demonstrated outage or security bypass.
  • merge-risk: 🚨 compatibility: Existing macOS users can observe changed retention behavior when switching their selected Gateway.
  • merge-risk: 🚨 session-state: The patch changes when cached panes, drafts, and retained actions are invalidated across Gateway replacement.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is not blocked on external contributor proof; its supplied native evidence is supplemental to the source and focused-test review.

Evidence

What I checked:

Likely related people:

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

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Resolve or explain the failed exact-head aggregate gate and wait for the remaining exact-head checks.

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 (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-03T21:14:19.058Z sha ae880d5 :: blocked before merge. :: none
  • reviewed 2026-09-03T21:24:06.326Z sha ae880d5 :: blocked before merge. :: none
  • reviewed 2026-09-03T22:14:08.045Z sha ae880d5 :: blocked before merge. :: none
  • reviewed 2026-09-03T22:41:19.754Z sha 6d83d1b :: blocked before merge. :: none
  • reviewed 2026-09-03T23:09:38.884Z sha 6d83d1b :: blocked before merge. :: [P1] Retain the cold-failure error during a same-Gateway retry
  • reviewed 2026-09-04T00:21:52.500Z sha 920cc2b :: blocked before merge. :: none
  • reviewed 2026-09-04T01:20:01.244Z sha 920cc2b :: blocked before merge. :: none
  • reviewed 2026-09-04T01:36:47.311Z sha caf69a6 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added 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. and removed 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. labels Sep 3, 2026
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The final head adds two defects found through the signed app: Cron loading/failure was presented as an empty result, and Dashboard diagnostics retained credential-bearing URL parts. Both have failing-before/passing-after owner regressions, and the final correction review completed three independent passes with no accepted findings. The combined native suite passed 2,077 tests across 218 suites plus both named-profile tests; formatting, lint, inventory generation/verification, and docs checks pass. Signed correction AFTER checks and exact-head CI are in progress before landing.

@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@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
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The current head is 6d83d1bed50a76c37200675b11dd7f61ce1d49ab. Signed AFTER proof for the Cron loading/error and credential-safe Dashboard corrections is complete and attached in the PR body, including recovery on Gateway B.

A later native CI run exposed caller cancellation in shared Config reads. The owner repair removes 16 production lines; an unchanged deterministic regression fails nine assertions before the fix and passes after it. The complete original-order native run passes 2,078 tests, four XCTest cases, and both named AppState tests. Focused owner/sibling checks and independent review pass. New exact-head CI and the updated signed Config check remain in progress.

@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 3, 2026
@clawsweeper clawsweeper Bot removed the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Sep 3, 2026
@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 proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 4, 2026
Retire selected Gateway state before a replacement handshake, and carry
source ownership through status panes, config documents, Cron drafts and
skill actions. Same-Gateway reconnects retain valid durable intent; a
replacement cannot inherit it. Keep Config lookup failures actionable and
show independent ClawHub install acknowledgements and read failures.

Regression proof covers unavailable replacements, retained and reopened
panes, stale async work, cold Config acquisition, and source-scoped edits.
The final candidate passes 2,073 native tests plus the named isolation
suite, pinned lint/format gates, and independent correction review.

Follow-up to #137089. Release-note context: Mac Gateway switching now
clears stale settings/status immediately and prevents retained controls
from acting on another Gateway.
Show Cron loading, errors, and confirmed empty results from the store owner.
Use one credential-safe endpoint formatter for Dashboard errors and logs.
Regenerate the native text inventory and preserve localized empty results.

Validation: failing-before/passing-after owner regressions, combined native
2077 tests plus named-profile checks, lint/format/docs, and independent review.
Own shared config and schema reads in ChannelsStore so Source-driven SwiftUI task replacement cannot cancel the read used by other callers. Preserve queued Reload and dirty-draft semantics while removing unused schema reload state. Regression proof covers cancellation before dispatch, joining callers, and source retirement; full native validation passes 2078 tests.
@steipete
steipete force-pushed the codex/mac-gateway-settings-ownership branch from 920cc2b to caf69a6 Compare September 4, 2026 01:21
@steipete
steipete merged commit 6df202a into main Sep 4, 2026
431 of 445 checks passed
@steipete
steipete deleted the codex/mac-gateway-settings-ownership branch September 4, 2026 02:14
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
…7502)

* fix(macos): keep settings and edits on their selected gateway

Retire selected Gateway state before a replacement handshake, and carry
source ownership through status panes, config documents, Cron drafts and
skill actions. Same-Gateway reconnects retain valid durable intent; a
replacement cannot inherit it. Keep Config lookup failures actionable and
show independent ClawHub install acknowledgements and read failures.

Regression proof covers unavailable replacements, retained and reopened
panes, stale async work, cold Config acquisition, and source-scoped edits.
The final candidate passes 2,073 native tests plus the named isolation
suite, pinned lint/format gates, and independent correction review.

Follow-up to openclaw#137089. Release-note context: Mac Gateway switching now
clears stale settings/status immediately and prevents retained controls
from acting on another Gateway.

* fix(macos): distinguish gateway loading failures and redact diagnostics

Show Cron loading, errors, and confirmed empty results from the store owner.
Use one credential-safe endpoint formatter for Dashboard errors and logs.
Regenerate the native text inventory and preserve localized empty results.

Validation: failing-before/passing-after owner regressions, combined native
2077 tests plus named-profile checks, lint/format/docs, and independent review.

* fix(macos): keep config reads alive across view cancellation

Own shared config and schema reads in ChannelsStore so Source-driven SwiftUI task replacement cannot cancel the read used by other callers. Preserve queued Reload and dirty-draft semantics while removing unused schema reload state. Regression proof covers cancellation before dispatch, joining callers, and source retirement; full native validation passes 2078 tests.

* fix(macos): preserve cold gateway retry ownership
steipete added a commit that referenced this pull request Oct 13, 2026
* refactor(apple): simplify old shared and macOS bookkeeping

Replace redundant generations with existing cancellation or actual owner
identity, consolidate parallel fallback/policy paths, and remove test-only
forwarding layers. Preserve authority, FIFO, durable state, resource bounds,
public protocol/config shapes, signing, permissions, and visible rendering.

Reuse canonical session-key normalization for Voice Wake delivery selection:
opaque Signal group IDs remain case-sensitive and main aliases are not added.
Use canonical IP-literal policy for discovery labels and remote CLI validation.

Best-effort tradeoffs accepted

- Palette generation (#159350): synthetic direct completions bypassed the sole cancellation-owning caller; unsupported future callers can show stale results until the next search. Current cancellation/request/agent checks remain.
- Link preview generation (#160710): synthetic URL replacement without caller cancellation is outside the SwiftUI task lifecycle; a late cosmetic result can remain until the next refresh. Network/SSRF checks and bounded caches remain.
- Sidebar preview generation (#147197): same-request overlapping cache reads can finish out of order; no linked human failure report, and a later refresh replaces the cosmetic projection. Owner/request checks remain.
- Source-preview producer revision (#148906): duplicate of exact task cancellation, with no human failure report. Consumer revision and authenticated resource authority remain.
- Mermaid generations (#135470/#135746): feature stress fixtures, no linked human race report. Exact subscriber cancellation and job/WebView identity retain the same admission; no extra failure accepted.
- Camera JPEG UUID (#107879): duplicates exact task cancellation; #107804 was a human feature request, not a generation-specific incident. Captured session/agent/route and attachment admission remain.
- Discovery generation (#145435): speculative queued callbacks, no linked human incident. A stopped browser may publish one late discovery projection; next discovery/refresh repairs it. Connection authority remains separate.
- FSEvents generation (#145453): synthetic stop/restart fixtures, no linked human incident. An old callback after restart may cause one extra refresh; serial lifecycle ownership and pending-work cancellation remain.
- Menu generations (#139688): feature-local late-result fixtures, no linked human incident. Exact task cancellation replaces duplicate tokens; drain-before-disconnect and real consumer/window authority remain.
- Cron generation (#131466/#137502): #138209 cut every load over to one cancel-and-drain chain. No direct concurrent load caller remains; cancellation and physical source leases stay checked after awaits.
- WebChat visibility acknowledgement/retry (#113634/#137089): synthetic timeout/reconnect interleavings, no linked human incident. A timed-out visibility update is best effort until the next transition/reconnect; FIFO and live socket leases remain.
- WebChat cleanup UUID (#113634/#137089): retain one bounded completed Task handle per live connection instead of matching cleanup tokens. Completion releases captures; replacement/retirement removes the handle.
- Child-exit polling (#145437): synthetic missed-notification coverage, no linked human report. A lost OS exit notification may wait for the existing deadline; final non-reaping liveness/status checks and cleanup remain.
- Realtime iterator borrowing trap (#156772): every real consumer awaits its own iterator sequentially. Unsupported concurrent next calls no longer get a custom custody protocol; bounded stream/cancellation/socket checks remain.
- Receipt projection admission (#161745): both real callers already match receipt and row identity immediately before synchronous projection. Those effect checks remain; no unsupported internal caller is defended twice.
- Recap attribution heuristics (#112188/#113084): synthetic guard matrix, no linked human race report. Missing initial rows or very late unrelated completion may supply a cosmetic footer; per-session freshness, failed-turn handling and settled results remain.
- PortGuardian per-write schema scans (#110527): synthetic live-handle version advance, no linked human incident. Concurrent external schema upgrades are best effort until reopen; initial admission, migration locks, receipts, transactions and durability remain.
- Unread queue counter (#110019): actual Task equality replaces the duplicate integer token. Exact-tail reclamation, bounded bookkeeping, FIFO and route authority remain unchanged.

Review dispositions: the claimed Task compilation failure is disproved by the
selected SDK's Equatable conformance and native builds. Repeated receipt
identity admission is unnecessary at its internal projector because both real
callers retain it immediately before projection. Per-write schema revalidation
was declined under the explicit best-effort policy above.

Proof and scope

Net production reduction: 369 lines (148 added, 517 deleted), excluding tests.
Fresh seven-day census permits all substantive production edits; the only
recent caller change is the unavoidable one-line fallback-to-parse rename.

Shared Swift build passed. Final focused shared tests passed 396 cases in six
suites (6.683s execution), Watch decoder tests passed five cases (0.003s), and
isolated whole-owner native tests passed 16 cases. macOS SwiftPM compiled all
products and the test bundle. Final macOS and iOS/Watch xcodebuild builds passed
(89.60s and 120.87s wall), without signing changes or app launches.

Canonical Apple lint/format checks passed; the initial iOS format failure in
WatchCommands was ours and corrected, with no gate weakened. Lint-suppression
tests passed 3/3 (14.09s wall). Earlier runtime cycles and Madge each reported 0;
the TypeScript graph is unchanged. Native localization stayed at 4476 entries.
The 45 original packaging/elevation timeout cases passed one focused retry
(94.79s wall), with no assertion/budget change and no claim of a diagnosed fix.

Known gaps: seven issues remained in the earlier ChatStreamReplayTests
narration=false package cases; causality/current-main attribution is unproven.
App-hosted macOS tests were not executed on the operator desktop. No hosted CI
or PR was started: the explicit BELOW-500 rule requires a branch-only handoff.

* refactor(ui): consolidate old UI owners and validation

Share route decoding, attachment retention, gallery preparation, transient
identity encoding, override copying, and extension classification. Remove
duplicate admission/schema mirrors and obsolete supported-browser fallbacks.
Both Lit and Solid paths remain; no rendering change is intended. No config,
protocol, persisted shape, dependency, or public SDK change.

Best-effort tradeoffs accepted

- Malformed internal native requests (#140988): all callers are typed and
  native hosts validate at the effect; their error replaces the renderer mirror.
- Worker replacement during an identity query (#140484): added for synthetic
  autoreview interleavings, not a human incident. Return false; normal worker
  announcements and foreground recovery observe the next active worker.
- Native readiness changing between synchronous checks (#140484/#109719):
  rely on queued events. A broken native event can require another worker event
  or reload; camera readiness retains its existing five-second error deadline.
- Overlapping application-root health reporters (#152638): startup mounts one
  root. Unsupported overlapping roots are last-publication-wins; the actual
  reported health/status feature and native trusted-document checks remain.
- Polling after stop (#139704): its sole owner retires eligibility first.
  Scheduling now uses that owner admission, not a separate read-only generation.
- Resetting an observer without retiring its connection (#116887): no production
  caller does this. Canonical connection epochs remain the sole retirement owner;
  unsupported direct live-scope reset no longer fences an old response separately.
- Upload policy changing during local reads (#158567): decoded/hash work can
  finish. Draft publication and every upload request retain live policy checks.
- Missing supported browser primitives (#105240/#151388/#100024/#102745):
  unsupported runtimes error instead of code-point initials, skipped input yield,
  wall-clock timing, or approximate microtask paint. The human progress-card fix
  in #151386 keeps its browser yield and durable FIFO handoff unchanged.
- URL APIs disappearing after URL creation (#100024/#149330): supported browsers
  keep paired APIs. An unsupported replaced global can throw during cleanup;
  undefined URLs, creation fallback, cancellation and release ordering remain.
- Malformed internal MCP calls bypassing AppBridge (#161747): may throw. The SDK
  still rejects malformed wire blocks before dispatch, proved over real in-memory
  App/AppBridge transport. UI content, authority, confirmation and custody policy
  remain. The introducing PR cites no human incident for the second mirror.

Production: +176/-394, net -218 lines across 21 eligible old files. Tests: +30.
Focused owner/sibling tests, targeted types/lint/format, lint-suppression and
independent P0-P2 review pass. Import edges are unchanged; runtime/Madge cycle
proof remains zero. Whole-tree Knip timed out at existing limits; heavy gallery
renderer runs did not reach assertions, while its owning controller suite passed.

* refactor(ui): remove obsolete Fetch capability branch

The supported Control UI browser floor includes Fetch. Start attachment
metadata reads directly rather than leaving an unsupported runtime in a
permanent checking state.

Best-effort tradeoffs accepted

- Missing global Fetch: the guard originated in #64104, whose feature report
  cites no human missing-Fetch incident. An unsupported runtime that replaces
  Fetch now reaches the existing rejected-request/unavailable path. Metadata
  validation, auth/tickets, allow POST, cancellation, resource admission,
  expiry and bounded retry remain unchanged. No intended rendering change.

Unchanged lifecycle baseline: 21/21, 25.09 s. Final lifecycle and attachment
siblings: 50/50, 14.77 s. UI types, typed lint, formatting and lint-suppression
checks pass. This cut removes five production lines including formatter
reflow, bringing the lane to 223 net production lines removed.
Fresh independent P0-P2 review is scoped-clean with no actionable findings.

* fix(ui): use global frame scheduling APIs

Preserve double-frame paint timing and cancellation without requiring a Window object in renderer-free hosts that supply the standard global APIs. The existing access suite reproduces seven unhandled errors before this fix and passes on main; all 130 affected cases plus 262 timing/state/send sibling cases now pass without test changes.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…#170823)

* refactor(apple): simplify old shared and macOS bookkeeping

Replace redundant generations with existing cancellation or actual owner
identity, consolidate parallel fallback/policy paths, and remove test-only
forwarding layers. Preserve authority, FIFO, durable state, resource bounds,
public protocol/config shapes, signing, permissions, and visible rendering.

Reuse canonical session-key normalization for Voice Wake delivery selection:
opaque Signal group IDs remain case-sensitive and main aliases are not added.
Use canonical IP-literal policy for discovery labels and remote CLI validation.

Best-effort tradeoffs accepted

- Palette generation (openclaw#159350): synthetic direct completions bypassed the sole cancellation-owning caller; unsupported future callers can show stale results until the next search. Current cancellation/request/agent checks remain.
- Link preview generation (openclaw#160710): synthetic URL replacement without caller cancellation is outside the SwiftUI task lifecycle; a late cosmetic result can remain until the next refresh. Network/SSRF checks and bounded caches remain.
- Sidebar preview generation (openclaw#147197): same-request overlapping cache reads can finish out of order; no linked human failure report, and a later refresh replaces the cosmetic projection. Owner/request checks remain.
- Source-preview producer revision (openclaw#148906): duplicate of exact task cancellation, with no human failure report. Consumer revision and authenticated resource authority remain.
- Mermaid generations (openclaw#135470/openclaw#135746): feature stress fixtures, no linked human race report. Exact subscriber cancellation and job/WebView identity retain the same admission; no extra failure accepted.
- Camera JPEG UUID (openclaw#107879): duplicates exact task cancellation; openclaw#107804 was a human feature request, not a generation-specific incident. Captured session/agent/route and attachment admission remain.
- Discovery generation (openclaw#145435): speculative queued callbacks, no linked human incident. A stopped browser may publish one late discovery projection; next discovery/refresh repairs it. Connection authority remains separate.
- FSEvents generation (openclaw#145453): synthetic stop/restart fixtures, no linked human incident. An old callback after restart may cause one extra refresh; serial lifecycle ownership and pending-work cancellation remain.
- Menu generations (openclaw#139688): feature-local late-result fixtures, no linked human incident. Exact task cancellation replaces duplicate tokens; drain-before-disconnect and real consumer/window authority remain.
- Cron generation (openclaw#131466/openclaw#137502): openclaw#138209 cut every load over to one cancel-and-drain chain. No direct concurrent load caller remains; cancellation and physical source leases stay checked after awaits.
- WebChat visibility acknowledgement/retry (openclaw#113634/openclaw#137089): synthetic timeout/reconnect interleavings, no linked human incident. A timed-out visibility update is best effort until the next transition/reconnect; FIFO and live socket leases remain.
- WebChat cleanup UUID (openclaw#113634/openclaw#137089): retain one bounded completed Task handle per live connection instead of matching cleanup tokens. Completion releases captures; replacement/retirement removes the handle.
- Child-exit polling (openclaw#145437): synthetic missed-notification coverage, no linked human report. A lost OS exit notification may wait for the existing deadline; final non-reaping liveness/status checks and cleanup remain.
- Realtime iterator borrowing trap (openclaw#156772): every real consumer awaits its own iterator sequentially. Unsupported concurrent next calls no longer get a custom custody protocol; bounded stream/cancellation/socket checks remain.
- Receipt projection admission (openclaw#161745): both real callers already match receipt and row identity immediately before synchronous projection. Those effect checks remain; no unsupported internal caller is defended twice.
- Recap attribution heuristics (openclaw#112188/openclaw#113084): synthetic guard matrix, no linked human race report. Missing initial rows or very late unrelated completion may supply a cosmetic footer; per-session freshness, failed-turn handling and settled results remain.
- PortGuardian per-write schema scans (openclaw#110527): synthetic live-handle version advance, no linked human incident. Concurrent external schema upgrades are best effort until reopen; initial admission, migration locks, receipts, transactions and durability remain.
- Unread queue counter (openclaw#110019): actual Task equality replaces the duplicate integer token. Exact-tail reclamation, bounded bookkeeping, FIFO and route authority remain unchanged.

Review dispositions: the claimed Task compilation failure is disproved by the
selected SDK's Equatable conformance and native builds. Repeated receipt
identity admission is unnecessary at its internal projector because both real
callers retain it immediately before projection. Per-write schema revalidation
was declined under the explicit best-effort policy above.

Proof and scope

Net production reduction: 369 lines (148 added, 517 deleted), excluding tests.
Fresh seven-day census permits all substantive production edits; the only
recent caller change is the unavoidable one-line fallback-to-parse rename.

Shared Swift build passed. Final focused shared tests passed 396 cases in six
suites (6.683s execution), Watch decoder tests passed five cases (0.003s), and
isolated whole-owner native tests passed 16 cases. macOS SwiftPM compiled all
products and the test bundle. Final macOS and iOS/Watch xcodebuild builds passed
(89.60s and 120.87s wall), without signing changes or app launches.

Canonical Apple lint/format checks passed; the initial iOS format failure in
WatchCommands was ours and corrected, with no gate weakened. Lint-suppression
tests passed 3/3 (14.09s wall). Earlier runtime cycles and Madge each reported 0;
the TypeScript graph is unchanged. Native localization stayed at 4476 entries.
The 45 original packaging/elevation timeout cases passed one focused retry
(94.79s wall), with no assertion/budget change and no claim of a diagnosed fix.

Known gaps: seven issues remained in the earlier ChatStreamReplayTests
narration=false package cases; causality/current-main attribution is unproven.
App-hosted macOS tests were not executed on the operator desktop. No hosted CI
or PR was started: the explicit BELOW-500 rule requires a branch-only handoff.

* refactor(ui): consolidate old UI owners and validation

Share route decoding, attachment retention, gallery preparation, transient
identity encoding, override copying, and extension classification. Remove
duplicate admission/schema mirrors and obsolete supported-browser fallbacks.
Both Lit and Solid paths remain; no rendering change is intended. No config,
protocol, persisted shape, dependency, or public SDK change.

Best-effort tradeoffs accepted

- Malformed internal native requests (openclaw#140988): all callers are typed and
  native hosts validate at the effect; their error replaces the renderer mirror.
- Worker replacement during an identity query (openclaw#140484): added for synthetic
  autoreview interleavings, not a human incident. Return false; normal worker
  announcements and foreground recovery observe the next active worker.
- Native readiness changing between synchronous checks (openclaw#140484/openclaw#109719):
  rely on queued events. A broken native event can require another worker event
  or reload; camera readiness retains its existing five-second error deadline.
- Overlapping application-root health reporters (openclaw#152638): startup mounts one
  root. Unsupported overlapping roots are last-publication-wins; the actual
  reported health/status feature and native trusted-document checks remain.
- Polling after stop (openclaw#139704): its sole owner retires eligibility first.
  Scheduling now uses that owner admission, not a separate read-only generation.
- Resetting an observer without retiring its connection (openclaw#116887): no production
  caller does this. Canonical connection epochs remain the sole retirement owner;
  unsupported direct live-scope reset no longer fences an old response separately.
- Upload policy changing during local reads (openclaw#158567): decoded/hash work can
  finish. Draft publication and every upload request retain live policy checks.
- Missing supported browser primitives (openclaw#105240/openclaw#151388/openclaw#100024/openclaw#102745):
  unsupported runtimes error instead of code-point initials, skipped input yield,
  wall-clock timing, or approximate microtask paint. The human progress-card fix
  in openclaw#151386 keeps its browser yield and durable FIFO handoff unchanged.
- URL APIs disappearing after URL creation (openclaw#100024/openclaw#149330): supported browsers
  keep paired APIs. An unsupported replaced global can throw during cleanup;
  undefined URLs, creation fallback, cancellation and release ordering remain.
- Malformed internal MCP calls bypassing AppBridge (openclaw#161747): may throw. The SDK
  still rejects malformed wire blocks before dispatch, proved over real in-memory
  App/AppBridge transport. UI content, authority, confirmation and custody policy
  remain. The introducing PR cites no human incident for the second mirror.

Production: +176/-394, net -218 lines across 21 eligible old files. Tests: +30.
Focused owner/sibling tests, targeted types/lint/format, lint-suppression and
independent P0-P2 review pass. Import edges are unchanged; runtime/Madge cycle
proof remains zero. Whole-tree Knip timed out at existing limits; heavy gallery
renderer runs did not reach assertions, while its owning controller suite passed.

* refactor(ui): remove obsolete Fetch capability branch

The supported Control UI browser floor includes Fetch. Start attachment
metadata reads directly rather than leaving an unsupported runtime in a
permanent checking state.

Best-effort tradeoffs accepted

- Missing global Fetch: the guard originated in openclaw#64104, whose feature report
  cites no human missing-Fetch incident. An unsupported runtime that replaces
  Fetch now reaches the existing rejected-request/unavailable path. Metadata
  validation, auth/tickets, allow POST, cancellation, resource admission,
  expiry and bounded retry remain unchanged. No intended rendering change.

Unchanged lifecycle baseline: 21/21, 25.09 s. Final lifecycle and attachment
siblings: 50/50, 14.77 s. UI types, typed lint, formatting and lint-suppression
checks pass. This cut removes five production lines including formatter
reflow, bringing the lane to 223 net production lines removed.
Fresh independent P0-P2 review is scoped-clean with no actionable findings.

* fix(ui): use global frame scheduling APIs

Preserve double-frame paint timing and cancellation without requiring a Window object in renderer-free hosts that supply the standard global APIs. The existing access suite reproduces seven unhandled errors before this fix and passes on main; all 130 affected cases plus 262 timing/state/send sibling cases now pass without test changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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