Repository navigation
fix: show unread marker when a visible session completes - #155690
Conversation
Co-authored-by: hxy91819 <[email protected]>
Worked on by: - @hxy91819 Co-authored-by: hxy91819 <[email protected]> OpenClaw-Publication: e5256717-72f2-4407-a461-f446a7d19ff2
|
🦞👀 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: needs maintainer review before merge. Reviewed September 23, 2026, 11:18 AM ET / 15:18 UTC (Revision 3). ClawSweeper reviewWhat this changesThe 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 Review scores
Verification
How this fits togetherThe 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]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +21, Tests +46. Total +67 across 6 files. View PR surface stats
Review metricsNone. Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…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]>
* 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]>
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.
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
unreadin the samesessions.changedsnapshot. 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.origin/main; the stable patch ID is unchanged, and the focused 75-test suite passed again afterward.Visual proof
Both screenshots use the same completed-session fixture after its last read; only the Gateway completion projection differs.
Before
After
View the OpenClaw team session