Skip to content

fix: show unread marker when a visible session completes - #155690

Merged
roboclaw-bot merged 2 commits into
mainfrom
openclaw/session-status-and-red-point-mark
Sep 23, 2026
Merged

roboclaw-bot merged 2 commits into
mainfrom
openclaw/session-status-and-red-point-mark

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Contributor

Reported and scoped by Mason.

Worked on by

Work sessions

What Problem This Solves

Fixes: a visible session could reach a terminal state without showing an unread marker when it completed after the user had last read it.

User Impact

User impact: completed visible sessions now show the unread red dot immediately, while heartbeat and hidden/internal runs remain quiet.

Why This Change Was Made

The lifecycle persistence path now retains the run visibility metadata, advances session activity for accepted visible terminal events, and derives unread in the same sessions.changed snapshot. This keeps status, durable activity, and the client notification consistent without forcing hidden work or heartbeats to appear unread.

Evidence

  • pnpm test src/gateway/session-lifecycle-state.test.ts src/gateway/session-lifecycle-persistence-owner.test.ts src/gateway/session-event-payload.test.ts --maxWorkers=1 --reporter=dot: 3 files and 75 tests passed in 10.75 seconds wall time.
  • The full changed-file gate passed before the patch-identical rebase, covering formatting, line caps, dependency/config/plugin boundaries, production and test typechecks, dead-code analysis, lint, database checks, import cycles, and the pairing-account guard.
  • Rebased cleanly onto current origin/main; the stable patch ID is unchanged, and the focused 75-test suite passed again afterward.
  • Fresh AutoReview reported no P0-P2 findings.

Visual proof

Both screenshots use the same completed-session fixture after its last read; only the Gateway completion projection differs.

Before

Before — completed session without an unread marker

After

After — completed session with the unread red dot


View the OpenClaw team session

roboclaw-bot and others added 2 commits September 22, 2026 11:10
Worked on by:
- @hxy91819

Co-authored-by: hxy91819 <[email protected]>
OpenClaw-Publication: e5256717-72f2-4407-a461-f446a7d19ff2
@clawsweeper

clawsweeper Bot commented Sep 22, 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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Sep 22, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review September 22, 2026 11:14
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Sep 22, 2026
@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 23, 2026, 11:18 AM ET / 15:18 UTC (Revision 3).

ClawSweeper review

What this changes

The Gateway records visible, non-heartbeat session completion as activity and updates the unread marker in session notifications.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: current main lacks the lifecycle completion update, and no blocking patch defect was found. The new screenshots address the previous visual-proof follow-up.

Priority: P2
Reviewed head: 3f4294929b8e046db88877577a29ca9dec1ec895

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with relevant regression coverage and inspected visual evidence, with no blocking defect identified.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The bot-authored PR is exempt from the external-contributor runtime gate. Inspected before/after fixture screenshots demonstrate the changed unread marker and address the prior visual follow-up; they do not claim a live Gateway persistence round trip. Existing timestamp storage and read semantics remain unchanged.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The bot-authored PR is exempt from the external-contributor runtime gate. Inspected before/after fixture screenshots demonstrate the changed unread marker and address the prior visual follow-up; they do not claim a live Gateway persistence round trip. Existing timestamp storage and read semantics remain unchanged.
Evidence reviewed 11 items Pinned patch ownership: Reviewed the merge-base-to-head patch. Its changes are confined to lifecycle activity, event metadata preservation, snapshot unread derivation, and their tests; daemon changes in endpoint drift are not this PR's work.
Completion policy: Accepted terminal events advance activity monotonically only when explicitly visible, non-heartbeat, and not interrupted for restart. Existing stale-session and recovery checks remain in place.
Production event path: Agent events carry private, non-enumerable visibility and heartbeat metadata. The persistence owner now explicitly retains those values; runtime subscriptions prepare the terminal write before chat presentation, and successful persistence precedes session snapshot publication.
Findings None None.
Security None None.

How this fits together

The Gateway receives agent lifecycle events, persists session status and activity, and publishes session snapshots. The Control UI uses those snapshots to display unread markers.

flowchart LR
  A[Agent lifecycle event] --> B[Current session checks]
  B --> C{Visible terminal run?}
  C -->|Non-heartbeat| D[Advance session activity]
  C -->|Hidden or heartbeat| E[Preserve activity]
  D --> F[Derive unread status]
  E --> F
  F --> G[Publish session snapshot]
  G --> H[Control UI unread marker]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +21, Tests +46. Total +67 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 23 2 +21
Tests 3 48 2 +46
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 71 4 +67

Review metrics

None.

Technical review

Best possible solution:

Keep completion activity and unread projection consistent through the existing Gateway lifecycle owner and shared unread calculation.

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

Yes, from source: a visible terminal event after lastReadAt can leave lastActivityAt unchanged on current main, so the shared unread calculation stays false. No runtime reproduction was executed in this review.

Is this the best way to solve the issue?

Yes. Preserving private event metadata and reusing the existing lifecycle and unread owners is a narrow repair that preserves heartbeat, hidden-run, and recovery exclusions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 645f1bc4ef49.

Labels

Label changes:

  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The bot-authored PR is exempt from the external-contributor runtime gate. Inspected before/after fixture screenshots demonstrate the changed unread marker and address the prior visual follow-up; they do not claim a live Gateway persistence round trip. Existing timestamp storage and read semantics remain unchanged.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: Repairs a missing completion indicator with limited impact on session-list usability.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 bot-authored PR is exempt from the external-contributor runtime gate. Inspected before/after fixture screenshots demonstrate the changed unread marker and address the prior visual follow-up; they do not claim a live Gateway persistence round trip. Existing timestamp storage and read semantics remain unchanged.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The bot-authored PR is exempt from the external-contributor runtime gate. Inspected before/after fixture screenshots demonstrate the changed unread marker and address the prior visual follow-up; they do not claim a live Gateway persistence round trip. Existing timestamp storage and read semantics remain unchanged.

Evidence

What I checked:

  • Pinned patch ownership: Reviewed the merge-base-to-head patch. Its changes are confined to lifecycle activity, event metadata preservation, snapshot unread derivation, and their tests; daemon changes in endpoint drift are not this PR's work. (3f4294929b8e)
  • Completion policy: Accepted terminal events advance activity monotonically only when explicitly visible, non-heartbeat, and not interrupted for restart. Existing stale-session and recovery checks remain in place. (src/gateway/session-lifecycle-state.ts:225, 3f4294929b8e)
  • Production event path: Agent events carry private, non-enumerable visibility and heartbeat metadata. The persistence owner now explicitly retains those values; runtime subscriptions prepare the terminal write before chat presentation, and successful persistence precedes session snapshot publication. (src/gateway/session-lifecycle-persistence-owner.ts:87, 3f4294929b8e)
  • Existing state contract: lastActivityAt already means the latest completed agent run, and existing row tests establish activity-after-read unread behavior, manual unread preservation, and legacy-row handling. This patch uses the existing field and shared derivation without changing schema, stored representation, or read acknowledgements. (src/config/sessions/types.ts:328, 3f4294929b8e)
  • Still absent on main: The fetched main implementation updates terminal status and timing but does not advance lastActivityAt in the lifecycle snapshot. Its persistence owner and event snapshot also lack this PR's changes. (src/gateway/session-lifecycle-state.ts:214, 645f1bc4ef49)
  • Latest-release comparison: The lifecycle source retrieved at v2026.9.5 likewise lacks the completion activity update; no shipped implementation of this patch was established. (src/gateway/session-lifecycle-state.ts, ec9c1a13db89)

Likely related people:

  • Peter Steinberger: Raw commit 1ad9fe2 adds src/shared/session-unread.ts:15 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1ad9fe2a759d; files: src/shared/session-unread.ts)
  • chelsealong: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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 (2 earlier review cycles)
  • reviewed 2026-09-22T11:52:57.577Z sha 3f42949 :: needs changes before merge. :: none
  • reviewed September 22, 2026, 8:24 AM ET / 12:24 UTC (Revision 2) sha unknown :: needs changes before merge. :: none

@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Sep 23, 2026
@roboclaw-bot
roboclaw-bot merged commit 359a8a3 into main Sep 23, 2026
284 of 285 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/session-status-and-red-point-mark branch September 23, 2026 15:21
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

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

* fix(sessions): show unread marker after completion

Co-authored-by: hxy91819 <[email protected]>

* fix: show unread marker when a visible session completes

Worked on by:
- @hxy91819

Co-authored-by: hxy91819 <[email protected]>
OpenClaw-Publication: e5256717-72f2-4407-a461-f446a7d19ff2

---------

Co-authored-by: hxy91819 <[email protected]>
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
hartra344 added a commit to hartra344/pincer that referenced this pull request Sep 29, 2026
* Mark a reply unread when it lands in a chat nobody is viewing (#426)

Released Gateways (before openclaw/openclaw#155690) only turn a chat unread when
the user sends, and since #374 Pincer reads the chat on screen as the user sends,
so replies never showed as unread. On a chat final, wait a short grace and, if
no viewer (main window, split pane, chat window) shows the chat, it isn't unread
already and nobody read it after the reply, patch unread=true once per run.

Co-authored-by: Copilot App <[email protected]>

* Drop a pending reply mark when the chat is viewed within the grace (#426)

Co-authored-by: Copilot App <[email protected]>

---------

Co-authored-by: hartra344 <[email protected]>
Co-authored-by: Copilot App <[email protected]>
wangmiao0668000666 added a commit to wangmiao0668000666/openclaw that referenced this pull request Oct 11, 2026
openclaw#155690 advances lastActivityAt only for terminal writes that carry
controlUiVisible, so a Control-UI chat send that a restart-safe admission
terminalizes after a Gateway restart is persisted terminal with no activity
advance and the session list never shows the unread marker, even though the
reply never reached the user.

terminalizeRestartSafeChatAdmission synthesizes its own terminal event, and that
admission only exists for the browser Control UI (restartRecoverySourceIngress is
hardcoded "control-ui" and eligibility is isBrowserOperatorUiClient), so the
event now stamps controlUiVisible: true.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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