Repository navigation
fix(ui): stop retrying rejected unread patches - #149359
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 15, 2026, 10:15 PM ET / September 16, 2026, 02:15 UTC (Revision 6). ClawSweeper reviewWhat this changesThe Control UI skips automatic read acknowledgements for viewers and stops retrying permanent Gateway rejections, with updated tests and documentation. Merge readiness⛔ Blocked before merge - 2 items remain This fix remains necessary on current main, and the earlier browser-test finding is resolved. No blocking code defect was found, but the visible unread-badge change still requires the repository’s before/after screenshot evidence. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI consumes Gateway session updates and acknowledges unread activity when a conversation is opened. Its unread guard controls repeat requests, while the session capability publishes errors and reconciles sidebar badges. flowchart TD
A[Gateway session updates] --> B[Active chat pane]
B --> C{Viewer or restricted access?}
C -->|Yes| D[Keep unread badge]
C -->|No| E[Unread episode guard]
E --> F[Gateway read acknowledgement]
F -->|Permanent rejection| G[Publish error and retain latch]
F -->|Temporary failure| E
F -->|Success| H[Reconcile read state]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +9, Tests +86, Docs 0. Total +95 across 6 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the bounded rejection latch and documented viewer policy, with visible proof of badge retention and authorized read recovery before landing. Do we have a high-confidence way to reproduce the issue? Yes, from source: a rejected automatic read patch on current main clears the latch, allowing the next active-session update to retry. The PR reports regression-first failures; this review did not execute tests. Is this the best way to solve the issue? Yes, within the explicitly documented viewer tradeoff: the change extends the existing guard and error owner without adding server permissions, storage, or competing mutation paths. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 589268ffdbac. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
901a661 to
b477e7d
Compare
eef07b0 to
0185ccd
Compare
Skip automatic read acknowledgements for session viewers. Keep permanent Gateway rejections latched for the current unread episode while preserving transient retries and the existing session capability error path.
Expect shared viewers to keep unread state across session updates while their composer remains enabled. Retain automatic acknowledgement coverage for shared members.
0185ccd to
749812b
Compare
|
Merged via squash.
|
* fix(ui): stop retrying rejected unread patches Skip automatic read acknowledgements for session viewers. Keep permanent Gateway rejections latched for the current unread episode while preserving transient retries and the existing session capability error path. * test(ui): cover shared viewer read acknowledgements Expect shared viewers to keep unread state across session updates while their composer remains enabled. Retain automatic acknowledgement coverage for shared members.
What Problem This Solves
Fixes repeated rejected read acknowledgements while a Control UI viewer watches a shared session. On team.openclaw.ai on September 15, one hour contained 3,077
sessions.patchcalls, 3,021 rejected withINVALID_REQUEST/session is shared for this connection; 2,943 came from one Control UI connection (about one every 1.2 seconds), adding request-handler work to a saturated Gateway main thread.User Impact
Opening a session as a viewer no longer sends an automatic read patch. Other permanent read-patch rejections appear once per unread episode instead of triggering another request on every active-session snapshot. Temporary failures and unsent requests remain retryable.
No visual change; screenshots are intentionally omitted for this behavior-only work order. No server semantics, sharing permissions, configuration, or storage changes.
Why This Change Was Made
The Gateway composes this rejection in
authorizeSessionSharingTarget: shared viewers are denied when their operator role caps participation at viewing or suggesting. The general method-access check does not include that session policy. Chat already receives caller-specificsharingRole, so its automatic read path skips viewers without changing the composer participation tracker.SessionUnreadPatchGuardnow retains its episode latch for the gateway client's canonicalINVALID_REQUEST,FORBIDDEN, andAPPROVAL_NOT_FOUNDcodes. Session-not-found responses already useINVALID_REQUEST; there is no genericNOT_FOUNDin this protocol. The existing session capability remains the error publisher. Confirmed read/new-activity episodes and navigation reset the existing guard; manual unread reminders keep their existing behavior.Tradeoff: ordinary Chat rows omit the full role cap. Uncapped shared viewers can be writable on the server, but also skip automatic acknowledgements. Authorized explicit read actions remain available. The more precise
activitySummary.canEnsurepermission is only projected for Activity requests; this change does not add summary work to Chat roster reads.Evidence
Regression-first proof, with production files unchanged: 8 failed, 28 passed. Shared viewer cases sent a patch instead of zero; permanent rejection cases expected one request but received two; the guard retried the same rejected episode.
After the fix: 52 passed across 4 files, including permanent rejection/error-publication cases,
UNAVAILABLE, client timeouts, null/unsent results, shared viewers, owner/member/admin acknowledgements, optimistic rollback, manual reminders, and retained-pane activation.Key regressions:
handles INVALID_REQUEST read failures across active snapshots,does not mutate unread state with shared viewer participation, andlatches a INVALID_REQUEST rejection until a new unread episode or activation. The request/error test uses the real session capability and a synthetic Gateway client.The browser participation regression also passes all 7 cases. It now checks that shared viewers keep their unread marker across session updates without disabling their composer, while shared members still acknowledge reads:
Validation status: 52 unit/integration tests, 7 browser E2E cases, and all 92 native wrapper tests passed on the rebased tree. Changed-file checks and
git diff --checkpassed; fresh independent Codex review is clean through P2. Current head:749812bf3389bb1ca10ae1fe7a0e1eb8da034a60, rebased onto main including the unrelated validation fixes in #149349, #149423, and #149477. Exact-head CI is pending.Docs: updated Sessions and sidebar automatic-read behavior. Known gaps: no production Gateway was changed or used for validation; this PR does not claim a measured post-deployment CPU reduction. The coordinator owns landing.