Skip to content

fix: preserve unread reminder for open sessions - #129386

Merged
roboclaw-bot merged 13 commits into
mainfrom
openclaw/mark-as-read-not-working
Aug 26, 2026
Merged

roboclaw-bot merged 13 commits into
mainfrom
openclaw/mark-as-read-not-working

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #129373

What Problem This Solves

Fixes an issue where users choosing Mark as unread on the currently open session would see the unread reminder disappear immediately. The active chat pane treated the resulting unread snapshot as newly viewed activity and sent unread: false, canceling the user action.

Why This Change Was Made

The Gateway now projects its existing durable markedUnreadAt fact. Clients that advertise support for the unread acknowledgement contract send the marker observed at activation with automatic unread: false acknowledgements. A newer marker makes that acknowledgement a successful no-op instead of erasing newer user intent.

Client activation guards distinguish an already-open pane from a genuine later activation, including retained web panes and native navigation. Running state remains orthogonal: streaming and completion can create activity unread state but do not themselves clear a manual marker.

Mixed-version policy preserves the shipped protocol: a bare legacy unread: false still clears unread state, including an explicit marker. This keeps Mark as read working on older clients. Durable protection across several simultaneously connected clients therefore requires each active client to support the advertised acknowledgement contract.

User Impact

On updated clients, Mark as unread remains visible while the current chat stays open, through run updates and completion, and clears on a genuine later activation or Mark as read. Older clients retain their existing read behavior; in a mixed fleet, an older active client can still clear the reminder until it updates.

Evidence

  • Pre-fix mocked-Gateway browser reproduction: run_d4d597152b25 failed because the active row did not retain its unread indicator.
  • Browser behavior proof: run_3be9c9de9f10 — inspected 1280×900 before/marked/running/completed/reopened screenshots and a 3.64-second WebM of the complete interaction.
  • Earlier complete browser/Gateway proof: run_6bc33fda3fdd — 209 Gateway/protocol/UI/browser tests passed.
  • Rebased focused proof on fc0787b014b:
    • 181 protocol/Gateway/UI unread tests passed.
    • All 20 selected-agent fixture cases from the previously red full shard passed.
    • The exact 199-file gateway-methods shard passed 3,686/3,687 tests locally; its sole failure was the linked-worktree environment reporting a synthetic plain workspace as a Git checkout. Clean exact-head CI is authoritative for that environment-only case.
  • Protocol registry, generated Swift drift, and protocol-since guards passed.
  • Full-branch P1 autoreview: clean; no accepted/actionable P0/P1 findings after applying the shipped mixed-version contract.
  • Judged LOC: production +413/-134; tests/support +780/-39; generated protocol +8; docs +3/-3. Positive production growth is the cross-client activation/acknowledgement contract across Gateway, web, Android, iOS, and macOS. The repair removes a duplicate iOS acknowledgement owner and the unshipped explicit-read protocol experiment.

Before — active session is read:

Active session before marking unread

Marked — unread indicator remains on the already-open session:

Active session marked unread

Running and completed — the manual reminder remains through lifecycle updates:

Manual unread reminder while the run is active

Manual unread reminder after run completion

Reopened — a genuine later activation clears the reminder:

Unread reminder cleared after reopening

Full interaction video:

manual-unread-running.webm

Exact-head CI is running on fc0787b014b. Local Android and Apple execution remain unavailable on this Linux host; exact-head CI is the authoritative native proof before landing.

AI-assisted: yes. The change was traced from the supplied recording through client activation, Gateway persistence, protocol projection, mixed-version behavior, and running-session races; the final diff and proof were reviewed before publication.

@clawsweeper

clawsweeper Bot commented Aug 25, 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: android App: android app: ios App: ios app: macos App: macos app: web-ui App: web-ui gateway Gateway runtime size: L maintainer Maintainer-authored PR labels Aug 25, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review August 25, 2026 14:45
@roboclaw-bot
roboclaw-bot force-pushed the openclaw/mark-as-read-not-working branch from 20d3fd8 to ec51007 Compare August 25, 2026 14:50
@roboclaw-bot
roboclaw-bot force-pushed the openclaw/mark-as-read-not-working branch 2 times, most recently from 3f79799 to 9ca68a2 Compare August 25, 2026 15:18
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. 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 Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 3:39 AM ET / 07:39 UTC.

ClawSweeper review

What this changes

Adds marker-bound automatic read acknowledgements across the Gateway, Control UI, Android, iOS, and macOS so a manual unread reminder persists while a session remains open.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No blocking patch defect found. The Gateway-owned conditional acknowledgement fixes the stale active-pane read while preserving legacy explicit-read behavior; the protected PR still needs acceptance of its documented mixed-client boundary and exact-head validation.

Priority: P1
Reviewed head: 04330d502b3db1f39a74a559257b5492014c03fd
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The owner-boundary repair and cross-client coverage are coherent, with merge readiness dependent on exact-head validation and acceptance of the documented transition.
Proof confidence 🌊 off-meta tidepool Not applicable: This protected maintainer/bot PR is exempt from the external-contributor proof gate; its body nevertheless includes Control UI media and focused regression coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This protected maintainer/bot PR is exempt from the external-contributor proof gate; its body nevertheless includes Control UI media and focused regression coverage.
Evidence reviewed 6 items Current-main failure path: The current-main chat pane sends a bare unread:false acknowledgement whenever an active row is unread, with no marker expectation; current-main session patching clears markedUnreadAt for every unread:false request.
Authoritative repair: The PR admits marker expectations only for standalone automatic reads and compares them inside the Gateway session mutation owner; a stale acknowledgement returns the current entry without erasing the newer marker.
Client caller and visible-flow coverage: The Control UI supplies expectedMarkedUnreadAt on its automatic read; the focused browser test verifies a manual marker survives running and completed updates, then is acknowledged only after reopening.
Findings None None.
Security None None.

How this fits together

Gateway session rows expose derived unread state and a durable manual marker to active clients. Clients acknowledge later activation through a session update, and the Gateway decides whether that acknowledgement still matches operator intent.

flowchart LR
  A[Session row or event] --> B[Active chat client]
  B --> C[Activation read guard]
  C --> D[Conditional session update]
  D --> E[Gateway session owner]
  E --> F[Durable unread marker]
  F --> G[Updated session row]
Loading

Decision needed

Question Recommendation
Should this repair ship with the documented mixed-client transition in which a legacy active client may still explicitly clear a newer manual unread marker? Accept the transition: Ship the conditional acknowledgement contract after exact-head validation while retaining legacy explicit-read compatibility.

Why: The patch intentionally retains legacy bare-read semantics instead of breaking older clients, so the residual upgrade behavior is a product compatibility choice.

Before merge

  • Resolve merge risk (P1) - During a staggered upgrade, an older active client can still send a legacy bare read and clear a newer manual reminder; that documented compatibility boundary needs maintainer acceptance.
  • Resolve merge risk (P1) - The repair adds cross-client session coordination at the Gateway/protocol boundary; exact-head validation is still incomplete.
Agent review details

Security

None.

PR surface

Source +200, Tests +527, Docs +2, Other +326. Total +1055 across 72 files.

View PR surface stats
Area Files Added Removed Net
Source 25 255 55 +200
Tests 16 565 38 +527
Docs 3 4 2 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 28 430 104 +326
Total 72 1254 199 +1055

Review metrics

Metric Value Why it matters
Production and test delta production +413/-134; tests/support +780/-39; generated +8; docs +3/-3 The cross-client contract is substantial but corresponds to the Gateway-authoritative coordination required to protect reminders across supported clients.
Protocol surface 1 capability added; 2 optional session fields added Older clients remain interoperable while newer clients can opt into marker-bound acknowledgements.

Stored data model

Persistent data-model change detected: serialized state: packages/gateway-protocol/src/schema/sessions-patch.test.ts, serialized state: packages/gateway-protocol/src/schema/sessions-patch.ts, serialized state: packages/gateway-protocol/src/schema/sessions-row.ts, serialized state: src/gateway/server-methods/session-unread-ack.ts, serialized state: src/gateway/server-methods/sessions-patch-engine.ts, serialized state: src/gateway/session-event-payload.ts, and 16 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Accept the documented transition (recommended)
    Merge after exact-head validation if maintainers accept that legacy clients retain their established explicit-read behavior during a staggered upgrade.
  2. Strengthen mixed-client protection
    Require a protocol design that prevents a legacy active client from clearing a marker set after activation before merge.
  3. Pause for migration policy
    Defer the PR if the residual mixed-client reminder loss is not acceptable for the supported upgrade window.

Technical review

Best possible solution:

Accept the documented legacy-client transition only after exact-head validation confirms the Gateway and supported clients preserve marker-bound acknowledgements.

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

Yes. Current main’s active chat sends a bare unread:false acknowledgement after observing an unread row, while the durable marker is not projected to distinguish a later manual mark; focused regression scenarios cover that path.

Is this the best way to solve the issue?

Yes. Comparing the acknowledgement at the Gateway’s authoritative session write owner is safer than suppressing client reads, which would not protect multi-client races.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • remove proof: 🎥 video: Current real behavior proof evidence kind is not_applicable.

Label justifications:

  • P1: The PR repairs a deterministic silent loss of unread reminders in the active-session workflow.
  • merge-risk: 🚨 compatibility: The documented rollout deliberately retains legacy bare-read behavior, leaving a mixed-client transition boundary.
  • merge-risk: 🚨 session-state: The change alters durable unread-marker acknowledgement and projection across clients.
  • 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: This protected maintainer/bot PR is exempt from the external-contributor proof gate; its body nevertheless includes Control UI media and focused regression coverage.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Recent session-mutation and patch-engine history covers the authoritative Gateway write boundary used by this change. (role: recent Gateway/session mutation owner; confidence: high; commits: 28ee832da463, 2d33a15e3e96; files: src/gateway/server-methods/sessions-patch-engine.ts, src/gateway/sessions-patch.ts)
  • zw-xysk: Earlier current-main blame associates this contributor with the existing unread-clearing path, though the broader history trail is mixed. (role: recent contributor to existing unread patch behavior; confidence: medium; commits: 4e4d59547630; files: src/gateway/sessions-patch.ts)

Rank-up moves

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

  • Finish exact-head validation.
  • Record maintainer acceptance of the mixed-client transition.

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 (12 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-25T23:48:15.776Z sha fc0787b :: needs changes before merge. :: [P1] Remove the Control UI legacy-Gateway fallback
  • reviewed 2026-08-26T01:26:31.133Z sha 0cfe00c :: needs maintainer review before merge. :: none
  • reviewed 2026-08-26T02:55:36.248Z sha 7ff7ac813a08f7246d9140f0c9a51c5075a9c20d :: needs maintainer review before merge. :: none
  • reviewed 2026-08-26T04:01:14.792Z sha 2b18b6dd1b0dacccc472cd1555c06b13c914d551 :: found issues before merge. :: [P2] Remove the unrelated Voyage batch rewrite
  • reviewed 2026-08-26T04:54:34.126Z sha d56b5851dfebc0c7dd8d8291e7fc24ae013e1027 :: found issues before merge. :: [P2] Correct the staggered-upgrade documentation
  • reviewed 2026-08-26T05:34:02.945Z sha a9747b50134a449b3716fea459354b45e89831e8 :: needs changes before merge. :: [P2] Correct the legacy-client unread semantics | [P2] Restore the responsive widget authoring rule
  • reviewed 2026-08-26T06:26:56.714Z sha 872b9a5f2a52cc1c1eb6535ea85d11501cd78262 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-26T06:47:10.491Z sha 0d9e268 :: needs maintainer review 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 Aug 25, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Addressed the P1 mixed-version finding on exact head f85f01fa1174.

  • Added closed readIntent: "explicit" semantics for deliberate Mark as read actions.
  • Bare legacy unread: false now preserves an existing manual marker while still clearing activity-only unread state.
  • Automatic acknowledgements remain CAS-bound with expectedMarkedUnreadAt.
  • Updated web, Android, iOS, and macOS explicit-read producers; removed the duplicate unguarded iOS acknowledgement owner.
  • Added mixed-version, explicit-read, batch, capability-gating, and client request tests.
  • 176 focused protocol/Gateway/UI tests pass; fresh autoreview is clean (0.99). Exact-head CI is attached and running.

The deliberate policy tradeoff is documented: an old client cannot distinguish automatic acknowledgement from explicit read, so against a newer Gateway both preserve a manual marker; update that client to explicitly clear the marker.

@clawsweeper re-review

@roboclaw-bot
roboclaw-bot force-pushed the openclaw/mark-as-read-not-working branch 3 times, most recently from 519cfa1 to 5fdaed6 Compare August 25, 2026 21:23
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Aug 25, 2026
@roboclaw-bot
roboclaw-bot force-pushed the openclaw/mark-as-read-not-working branch 2 times, most recently from 8d1871b to 872b9a5 Compare August 26, 2026 06:19
@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 Aug 26, 2026
@roboclaw-bot
roboclaw-bot force-pushed the openclaw/mark-as-read-not-working branch from 872b9a5 to 0d9e268 Compare August 26, 2026 06:40
@clawsweeper clawsweeper Bot added the proof: 🎥 video Contributor real behavior proof includes video or recording evidence. label Aug 26, 2026
@clawsweeper clawsweeper Bot removed the proof: 🎥 video Contributor real behavior proof includes video or recording evidence. label Aug 26, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Land-ready evidence for exact head 04330d502b3db1f39a74a559257b5492014c03fd:

  • Root cause/owner: an active pane could unconditionally acknowledge unread state after a newer manual marker. The Gateway session mutation owner now compare-and-sets automatic acknowledgements against markedUnreadAt.
  • Behavior: the manual reminder survives active-pane refresh, running/completion updates, and failed history hydration; it clears after a later successful activation. Control UI, Android, iOS, and macOS use the same marker-bound contract.
  • ClawSweeper: no patch findings on exact head. Maintainer accepts the documented staged-upgrade boundary that a legacy active client retains bare-read behavior until upgraded.
  • Exact-head CI: run 32943160055 attempt 2 passed, including iOS/macOS/Android, Control UI E2E, real-Gateway E2E, bundle, lint, type, and screenshot lanes.
  • Focused local proof: 447 protocol/Gateway/UI/infra assertions; 16 targeted Control UI E2E assertions; 21 hydration/read-marker UI tests; SSH tunnel suite repeated 5 times (60 assertions).
  • Visual proof: five inspected screenshots and the full interaction video remain attached in the PR body.
  • Known proof gaps: none.

Repo-native review artifacts validate with READY FOR /prepare-pr and zero findings.

@roboclaw-bot
roboclaw-bot merged commit 44d60a2 into main Aug 26, 2026
361 of 363 checks passed
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

@roboclaw-bot
roboclaw-bot deleted the openclaw/mark-as-read-not-working branch August 26, 2026 12:04
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
* fix: preserve manual unread markers in open sessions

* fix: distinguish explicit session reads

* fix(ui): gate unread contract on gateway capability

* perf(ui): keep server capabilities out of startup bundle

* test(gateway): keep agent fixtures roster-consistent

* fix(sessions): preserve legacy read compatibility

* test(gateway): type agent fixture configs

* fix(ui): remove unread gateway fallback

Co-authored-by: Tak Hoffman <[email protected]>

* test(infra): avoid fixed SSH tunnel port

* fix(ui): acknowledge unread after history commit

* docs: clarify unread upgrade boundary

* test(ui): drive mobile session menu by tap

* fix(ios): remove stale read reconciliation call

---------

Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: ios App: ios app: macos App: macos app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime 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. P1 High-priority user-facing bug, regression, or broken workflow. 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.

Mark as unread is immediately cleared for the open session

1 participant