Skip to content

fix(ui): recover session observers after failures and reconnects - #116887

Merged
steipete merged 1 commit into
mainfrom
codex/qa200-session-observer
Jul 31, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa200-session-observer

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

A failed broad sessions.subscribe permanently disabled Control UI session updates while successful list hydration erased the only visible error. Independent targeted message observers can still deliver session changes and terminal updates during that outage, and both reconciliation paths also erased the active broad-observer error. Even when observation eventually recovered, events lost during the outage were never reconciled.

Why This Change Was Made

  • Give the broad Gateway session observer one canonical, connection-scoped owner for pending, acknowledged, failed, and retrying work.
  • Require the actual Gateway contract's affirmative subscribed: true; reject false, omitted, and null acknowledgments.
  • Reuse the existing bounded retry policy while retiring stale requests and timers across same-client reconnects, connection replacement, disposal, and reentrant teardown.
  • Track observer-versus-operation error ownership explicitly so successful hydration, targeted session changes, terminal reconciliation, newer operation failures, and identical error messages cannot silently erase the wrong diagnostic.
  • Force one canonical filtered session-list catch-up after the observer recovers, closing the unreplayed-event gap without a second steady-state refresh path.

User Impact

Connected operators see accurate session freshness and an actionable observer outage instead of a silently stale Control UI. Once the broad observer recovers, missing sessions and terminal changes reconcile automatically. No Gateway protocol, authentication, public configuration, plugin ownership, or persistent-state contract changes.

Evidence

  • Current Gateway response and targeted-message subscriber contracts directly inspected in src/gateway/server-methods/sessions-subscriptions.ts and src/gateway/server-session-events.ts.
  • Final amended candidate: fd47466ca57c58cae837c85ba3278df4ed83b422 on codex/qa200-session-observer.
  • Focused final exact-content owner suites: 45 tests passed. Both newly added targeted-reconciliation regressions failed on the prior exact candidate and pass after the canonical fix.
  • Previous full focused owner, caller, and direct Gateway dependency validation: 105 tests passed; only the two owner paths and their targeted regressions changed afterward.
  • Fake-timer and boundary regressions cover affirmative/false/empty/null subscription acknowledgments, retryable rejection, list hydration, targeted session updates, run-terminal updates, same-client reconnect, stale acknowledgment retirement, reentrant disposal, operation-error ownership, equal-message collisions, and recovery catch-up.
  • Final exact-commit structured Codex autoreview: CLEAN (confidence 0.93); TruffleHog, targeted oxlint, oxfmt, git diff --check, and isolated-worktree guards clean.

Distinct Root Causes

  1. Broad session observation could fail permanently while hydration and targeted reconciliation hid the outage.
  2. Recovering observation did not reconcile session events missed while the broad observer was inactive.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels Jul 31, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jul 31, 2026
@clawsweeper

clawsweeper Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 31, 2026, 12:00 PM ET / 16:00 UTC.

ClawSweeper review

What this changes

The PR gives the Control UI's Gateway session observer retry and reconnect ownership, preserves observer errors, and refreshes the filtered session list after the observer recovers.

Merge readiness

⛔ Blocked until real behavior proof is added - 5 items remain

Keep this PR open for explicit maintainer handling: the maintainer label prevents automated cleanup, and the current head still lacks inspectable after-fix real-behavior proof. Repository inspection could not run because the read-only shell failed before executing any command (bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted), so this review does not claim source, history, or test verification beyond the supplied PR context.

Priority: P1
Reviewed head: 268a54b590471f836ed010c2923cd4f10a1f98c4
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The proposed implementation has focused test signal, but absent inspectable real-behavior evidence keeps it below merge-ready confidence.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The PR reports mock/fake-timer suites but supplies no inspectable current-head after-fix Control UI or Gateway runtime artifact; add a redacted terminal trace, runtime logs, or recording that directly shows failure and recovery. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR reports mock/fake-timer suites but supplies no inspectable current-head after-fix Control UI or Gateway runtime artifact; add a redacted terminal trace, runtime logs, or recording that directly shows failure and recovery. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 3 items Repository-inspection blocker: The required read-only policy, source, history, and test inspection could not begin because the shell sandbox failed before the command executed; no local source or git-history claim is made in this review.
PR-supplied proof status: The supplied PR body reports focused fake-timer and mock-Gateway tests, while the latest completed ClawSweeper review explicitly says there is no inspectable after-fix Control UI or Gateway runtime evidence for the reviewed head; the supplied context shows no later proof artifact or proof link.
Changed behavior surface: The supplied changed-file list confines the implementation to Control UI session state, a new session subscription owner, and mock-Gateway/E2E helpers; it does not show dependency, workflow, credential, or package-resolution changes.
Findings None None.
Security None None.

How this fits together

The Control UI receives Gateway connection snapshots and session events, then maintains the session list and terminal state shown to an operator. This PR changes the broad session-event subscription boundary so failures and reconnects can recover before updated state reaches the UI.

flowchart LR
  A[Gateway connection snapshot] --> B[Control UI session capability]
  B --> C[Broad session observer]
  C --> D[Retry and reconnect handling]
  D --> E[Filtered session-list catch-up]
  E --> F[Operator session view]
  G[Targeted session and terminal events] --> B
Loading

Decision needed

Question Recommendation
After current-head runtime proof and required checks are available, should maintainers accept this session-state recovery behavior for the protected Control UI path? Require runtime proof first: Request redacted current-head Control UI or Gateway evidence showing an observer failure, retry, recovery, and catch-up before making the merge decision.

Why: The patch deliberately changes session observer lifecycle and visible diagnostic ownership, while the maintainer label requires explicit human handling and the supplied evidence is limited to reported mock/test results.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR reports mock/fake-timer suites but supplies no inspectable current-head after-fix Control UI or Gateway runtime artifact; add a redacted terminal trace, runtime logs, or recording that directly shows failure and recovery. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - Merging changes to observer recovery, diagnostic ownership, and catch-up reconciliation without inspectable current-head runtime evidence could leave the Control UI stale or surface the wrong session error after a reconnect.
  • Resolve merge risk (P1) - The branch is behind main and multiple required checks were still running in the supplied context, so the exact merge result and final validation state need a refresh before approval.
  • Complete next step (P2) - The protected label, missing real-behavior proof, in-progress checks, and unavailable local inspection prevent a safe automated repair or merge recommendation.
Agent review details

Security

None.

PR surface

Source +147, Tests +561. Total +708 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 206 59 +147
Tests 3 573 12 +561
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 779 71 +708

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: ui/src/lib/sessions/connection-hydration.test.ts, serialized state: ui/src/lib/sessions/index.test.ts, serialized state: ui/src/lib/sessions/index.ts, serialized state: ui/src/lib/sessions/session-event-subscription.ts, serialized state: ui/src/test-helpers/control-ui-e2e.mock-gateway.test.ts, unknown-data-model-change: ui/src/lib/sessions/connection-hydration.test.ts, and 3 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Add current-head recovery proof (recommended)
    Capture redacted browser, terminal, or Gateway logs showing the observer fails, retries, acknowledges subscribed: true, and reconciles the session list after recovery.
  2. Accept the session-state risk
    A maintainer may merge on the reported mock and focused-test evidence alone if they explicitly accept the absence of an inspectable runtime recovery trace.
  3. Pause pending a narrower reproduction
    Pause this PR if the team cannot provide a reproducible observer outage that distinguishes the proposed owner from the existing lifecycle path.

Technical review

Best possible solution:

Keep one connection-scoped observer owner only if a current-head Control UI or Gateway run visibly demonstrates failure, retry, recovery, and the resulting filtered-list catch-up, then refresh review against the merge result after required checks complete.

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

Unclear: the supplied PR describes a concrete mock-Gateway and fake-timer path, but the repository shell failed before current-main source, tests, and an actual runtime path could be inspected or reproduced.

Is this the best way to solve the issue?

Unclear: the connection-scoped subscription owner is a plausible bounded solution, but the required comparison with current session lifecycle code, Gateway contracts, sibling behavior, and current-main history could not be completed after the shell infrastructure failure.

AGENTS.md: unclear because the file could not be read completely.

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

Labels

Label changes:

  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🧂 unranked krab, so this older rating label is no longer current.

Label justifications:

  • P1: A failed broad observer can leave connected operators with stale session and terminal information until recovery is correctly reconciled.
  • merge-risk: 🚨 session-state: The patch changes subscription lifecycle, error ownership, retry timing, and catch-up behavior for the Control UI session state.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR reports mock/fake-timer suites but supplies no inspectable current-head after-fix Control UI or Gateway runtime artifact; add a redacted terminal trace, runtime logs, or recording that directly shows failure and recovery. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Repository-inspection blocker: The required read-only policy, source, history, and test inspection could not begin because the shell sandbox failed before the command executed; no local source or git-history claim is made in this review.
  • PR-supplied proof status: The supplied PR body reports focused fake-timer and mock-Gateway tests, while the latest completed ClawSweeper review explicitly says there is no inspectable after-fix Control UI or Gateway runtime evidence for the reviewed head; the supplied context shows no later proof artifact or proof link. (268a54b59047)
  • Changed behavior surface: The supplied changed-file list confines the implementation to Control UI session state, a new session subscription owner, and mock-Gateway/E2E helpers; it does not show dependency, workflow, credential, or package-resolution changes. (ui/src/lib/sessions/session-event-subscription.ts:1, 268a54b59047)

Likely related people:

  • steipete: The supplied PR metadata attributes the current session-observer implementation commit to this contributor; current-main feature history could not be inspected because the repository shell failed before running read-only git commands. (role: recent area contributor; confidence: low; commits: 268a54b59047; files: ui/src/lib/sessions/index.ts, ui/src/lib/sessions/session-event-subscription.ts)

Rank-up moves

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

  • Add redacted current-head runtime evidence for observer failure, retry, recovery, and session-list catch-up.
  • Refresh review after the branch is rebased or the actual merge result and required checks are available.

Rating scale

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

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

Workflow

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

History

Review history (2 earlier review cycles)
  • reviewed 2026-07-31T14:48:46.638Z sha fd47466ca57c58cae837c85ba3278df4ed83b422 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-31T15:09:46.539Z sha 132995df31769ec260698888556dbbf34b19ebb9 :: needs real behavior proof before merge. :: none

@steipete
steipete force-pushed the codex/qa200-session-observer branch from fd47466 to 132995d Compare July 31, 2026 15:04
@steipete
steipete force-pushed the codex/qa200-session-observer branch from 132995d to 268a54b Compare July 31, 2026 15:56
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 31, 2026
@steipete
steipete merged commit dd2062b into main Jul 31, 2026
101 of 103 checks passed
@steipete
steipete deleted the codex/qa200-session-observer branch July 31, 2026 16:20
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Jul 31, 2026
* origin/main: (42 commits)
  fix(auto-reply): avoid false overload attribution on stalled replies (#116959)
  fix(auth-profiles): scope model_not_found cooldown to the failing model (#116768)
  fix(agents): expose embedded preparation latency (#116936)
  fix(macos): preserve localized setup fallback
  fix: repair canonical session keys with doctor (#116703)
  fix(gateway): preserve plugin-only session change events (#116948)
  fix(media): recognize AIFF attachments across audio workflows (#116907)
  fix(openai): recover missing terminal response output (#116910)
  fix(telegram): preserve outbound media metadata and rejected photos (#116886)
  fix(agents): preserve bounded truthful subagent outcomes (#116932)
  improve(setup): clarify local provider actions
  fix(cron): preserve scheduler truth across edits and delivery (#116923)
  fix(openai): finalize Chat tool calls from authoritative terminals (#116922)
  fix(ui): recover session observers across reconnects (#116887)
  fix(qa): verify requested scenarios and reject silent character runs (#116912)
  fix: agent turns survive unavailable optional web credentials (#112522)
  fix(sessions): preserve transcript and child ownership (#116897)
  fix(ui): preserve chat stream ownership and accessible rendering (#116929)
  fix(media): preserve display metadata and attachment formats (#116928)
  fix(together): preserve immediate video outcomes and image references (#116913)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
* origin/main: (42 commits)
  fix(auto-reply): avoid false overload attribution on stalled replies (openclaw#116959)
  fix(auth-profiles): scope model_not_found cooldown to the failing model (openclaw#116768)
  fix(agents): expose embedded preparation latency (openclaw#116936)
  fix(macos): preserve localized setup fallback
  fix: repair canonical session keys with doctor (openclaw#116703)
  fix(gateway): preserve plugin-only session change events (openclaw#116948)
  fix(media): recognize AIFF attachments across audio workflows (openclaw#116907)
  fix(openai): recover missing terminal response output (openclaw#116910)
  fix(telegram): preserve outbound media metadata and rejected photos (openclaw#116886)
  fix(agents): preserve bounded truthful subagent outcomes (openclaw#116932)
  improve(setup): clarify local provider actions
  fix(cron): preserve scheduler truth across edits and delivery (openclaw#116923)
  fix(openai): finalize Chat tool calls from authoritative terminals (openclaw#116922)
  fix(ui): recover session observers across reconnects (openclaw#116887)
  fix(qa): verify requested scenarios and reject silent character runs (openclaw#116912)
  fix: agent turns survive unavailable optional web credentials (openclaw#112522)
  fix(sessions): preserve transcript and child ownership (openclaw#116897)
  fix(ui): preserve chat stream ownership and accessible rendering (openclaw#116929)
  fix(media): preserve display metadata and attachment formats (openclaw#116928)
  fix(together): preserve immediate video outcomes and image references (openclaw#116913)
  ...
steipete added a commit that referenced this pull request Oct 13, 2026
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.
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: web-ui App: web-ui maintainer Maintainer-authored PR merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant