Skip to content

fix(ui): recover viewer presence after a lost acknowledgment - #156255

Merged
vincentkoc merged 2 commits into
mainfrom
fix/control-ui-t3a-viewer-ack-20260922
Sep 23, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
fix/control-ui-t3a-viewer-ack-20260922

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes: viewer presence can remain stuck when a declaration acknowledgment is lost even though the chat connection is healthy.

User Impact

Viewer declarations recover without reconnecting a healthy chat socket. Closing the last pane still clears its presence before the declaration listeners detach.

Why This Change Was Made

Use the existing 30-second request deadline and retry owner for this idempotent declaration. Superseded declarations release their local pending request, while unchanged declarations remain coalesced and late replies cannot confirm newer state.

Production LOC: +17/-4 (net +13) | Tests: +266/-48 (net +218). The added owner state retires superseded local waiters through the existing pending-request contract. This changes one production owner. It does not change global request deadlines, reconnect policy, pull-request subscriptions, or the server protocol.

Evidence

  • Original owner regression: five intended failures with seven existing cases passing.
  • Fixed owner, retry, and real pending-request boundary: 18/18 passing, including final-clear recovery, stale replies, supersession, listener cleanup, and same-set coalescing.
  • Routed Chromium regression: the original code sends only one declaration; the fix sends one retry after the operation deadline and existing retry delay, with one socket and one connection handshake throughout. A delayed retired reply does not trigger further work.
  • All 14 selected static stages passed for the original three-file change. Hosted CI then exposed six obsolete two-argument assertions in one connected caller test. The caller now checks every exact session key set plus the standard timeout and AbortSignal.
  • The complete 40-test caller suite and all eight applicable recovery stages passed on the final four-file snapshot; the original three hashes and their owner/browser evidence remain unchanged. Independent final source/export qualification and fresh four-file automated review passed with no findings. New exact-head hosted/native gates remain pending.
  • Measured proof cost: 18 focused tests across two native Vitest lanes (4.32s + 8.47s), plus one routed Chromium case (34.56s including its browser harness). No real timeout sleep: the regression advances virtual time. Hosted CI cost will be recorded when its exact-head run completes.

The browser proof uses the real Control UI and a synthetic Gateway that withholds the acknowledgment while continuing normal ticks. It is not deployed or external-Gateway verification. No rendered appearance changes.

@vincentkoc vincentkoc self-assigned this Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vincentkoc
vincentkoc marked this pull request as ready for review September 23, 2026 06:06
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 23, 2026, 3:28 AM ET / 07:28 UTC (Revision 2).

ClawSweeper review

What this changes

Adds a deadline and cancellation to Control UI viewer-presence declarations so lost acknowledgments can retry without reconnecting the chat socket.

Merge readiness

✅ Ready for maintainer review

The fix remains useful, and the previous caller-test finding is resolved. No blocking correctness or security findings remain in the reviewed patch.

Priority: P2
Reviewed head: 6af97d36904ebd5fc7d5f054120d63bfd51b72e4

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with relevant regression coverage and the previous finding resolved.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from external-contributor proof requirements. Its reported Chromium run exercises the real chat route and presence owner against a synthetic Gateway, showing retry without reconnect; this is boundary coverage, not deployed-Gateway verification. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from external-contributor proof requirements. Its reported Chromium run exercises the real chat route and presence owner against a synthetic Gateway, showing retry without reconnect; this is boundary coverage, not deployed-Gateway verification. No stored-data contract changes.
Evidence reviewed 7 items Introduced change and review identity: Reviewed the pinned merge-base-to-head delta. Production changes are confined to the viewer-presence owner; the other changes cover owner, browser, and chat-caller regressions. Base-only navigation changes were excluded.
Still necessary on main and latest release: Inspected the presence owner at pinned main and v2026.9.5. Both send declarations without request options, leaving a lost acknowledgment pending while unchanged signatures remain coalesced. Browser transport construction supplies no default request deadline.
Cancellation and retry contract: The existing pending-request owner removes timed-out or aborted requests, clears their timers and listeners, and ignores responses for retired IDs. The presence store advances its generation before supersession and retains the existing acknowledgment fence and retry scheduler. Server declarations synchronously replace the connection's set, making retries idempotent.
Findings None None.
Security None None.

How this fits together

Chat panes declare which sessions the user is viewing through a shared Control UI presence store. The store sends the current session set to the Gateway and clears it when the last pane closes.

flowchart LR
  A[Visible chat panes] --> B[Shared presence store]
  B --> C[Bounded Gateway request]
  C --> D[Gateway viewer set]
  C --> E{Acknowledgment received}
  E -->|Yes| F[Confirm current declaration]
  E -->|Deadline expires| G[Existing retry scheduler]
  G --> B
  F -->|Final empty set| H[Detach listeners]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +13, Tests +218. Total +231 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 17 4 +13
Tests 3 266 48 +218
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 283 52 +231

Review metrics

None.

Technical review

Best possible solution:

Keep declaration recovery in the existing presence owner, using bounded requests while preserving coalescing, stale-result rejection, and acknowledged final clearing.

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

Yes, from source: withholding a viewer declaration acknowledgment while healthy ticks continue leaves main's request pending indefinitely. The focused browser regression models this trigger, but this review did not execute it.

Is this the best way to solve the issue?

Yes. Applying the existing deadline and cancellation contract at the declaration owner is narrower than changing global deadlines or reconnecting a healthy socket.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: Repairs a bounded viewer-presence recovery failure without changing chat transport or global request policy.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from external-contributor proof requirements. Its reported Chromium run exercises the real chat route and presence owner against a synthetic Gateway, showing retry without reconnect; this is boundary coverage, not deployed-Gateway verification. No stored-data contract changes.

Label justifications:

  • P2: Repairs a bounded viewer-presence recovery failure without changing chat transport or global request policy.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from external-contributor proof requirements. Its reported Chromium run exercises the real chat route and presence owner against a synthetic Gateway, showing retry without reconnect; this is boundary coverage, not deployed-Gateway verification. No stored-data contract changes.

Evidence

What I checked:

  • Introduced change and review identity: Reviewed the pinned merge-base-to-head delta. Production changes are confined to the viewer-presence owner; the other changes cover owner, browser, and chat-caller regressions. Base-only navigation changes were excluded. (ui/src/lib/session-viewer-presence.ts:115, 6af97d36904e)
  • Still necessary on main and latest release: Inspected the presence owner at pinned main and v2026.9.5. Both send declarations without request options, leaving a lost acknowledgment pending while unchanged signatures remain coalesced. Browser transport construction supplies no default request deadline. (ui/src/lib/session-viewer-presence.ts:118, 3ab93b4ea598)
  • Cancellation and retry contract: The existing pending-request owner removes timed-out or aborted requests, clears their timers and listeners, and ignores responses for retired IDs. The presence store advances its generation before supersession and retains the existing acknowledgment fence and retry scheduler. Server declarations synchronously replace the connection's set, making retries idempotent. (packages/gateway-client/src/pending-request.ts:104, 6af97d36904e)
  • Previous finding resolved: The latest commit changes only the chat-page test. All six assertions preserve their exact session-key expectations and now check the standard timeout and AbortSignal; the captured PR body reports the complete 40-test caller suite passing. (ui/src/pages/chat/chat-page.test.ts:701, 6af97d36904e)
  • Scoped browser and owner coverage: The browser regression enters the real chat route, withholds the first declaration response, advances virtual time while ticks continue, and checks one retry with one socket and handshake. It then releases the retired response and checks that no further declaration occurs. Owner tests cover final-clear recovery, supersession, coalescing, and cleanup. The captured body reports passing runs; this review did not execute tests or independently observe a deployed Gateway. (ui/src/e2e/session-viewer-presence.e2e.test.ts:15, 6af97d36904e)
  • Area history and prior lifecycle contract: Current-main path history identifies Peter Steinberger's presence and lifecycle work. GitHub verifies refactor(ui): share gateway set synchronization lifecycle #140811 as merged at this commit; its contract preserves retries for failed final clears and waits for the current acknowledgment before detaching. The raw commit parent and GitHub patch were inspected after local follow/blame encountered unavailable historical objects. (ui/src/lib/session-viewer-presence.ts:48, 78231b8261e6)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

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

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

Workflow

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

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-23T06:12:45.238Z sha 86055a1 :: needs changes before merge. :: [P2] Update the chat-page assertions for request options

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 23, 2026
@vincentkoc
vincentkoc merged commit 4ca402e into main Sep 23, 2026
121 checks passed
@vincentkoc
vincentkoc deleted the fix/control-ui-t3a-viewer-ack-20260922 branch September 23, 2026 07:52
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 24, 2026
…w#156255)

* fix(ui): recover stalled viewer presence acknowledgments

* test(ui): verify bounded viewer declarations at chat caller
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
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 P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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