Repository navigation
fix: show unread activity on never-opened sessions - #128986
Conversation
Use creation time as the initial unread baseline for modern session rows while leaving legacy rows unchanged. Co-authored-by: Tak Hoffman <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 12:22 AM ET / 04:22 UTC. ClawSweeper reviewWhat this changesThis PR makes a never-opened session show unread activity when its durable creation time predates recorded activity, while retaining legacy behavior for rows without creation provenance. Merge readinessNo blocking code findings. This is still-needed, focused Gateway repair; it remains open because it is an active maintainer-labeled PR, not because it is superseded or already on current main. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe Gateway converts persisted session metadata into session-list rows and live event payloads consumed by the Control UI and other clients. Read markers and activity timestamps become the unread indicator rendered by those clients. flowchart LR
A[Session creation] --> B[Persisted session row]
C[Agent activity] --> B
B --> D[Gateway unread projection]
E[Read or unread action] --> D
D --> F[Session list and events]
F --> G[Control UI and clients]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +3, Tests +10. Total +13 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the unread rule in the canonical Gateway row projection and land it with the recorded legacy-row and upgrade behavior intact. Do we have a high-confidence way to reproduce the issue? Yes, from source: a row with createdAt 10 and lastActivityAt 11 was previously projected read and is now projected unread; the PR also supplies isolated Gateway and Chromium before/after evidence. Is this the best way to solve the issue? Yes. The Gateway row projection is the single source for both session lists and live payloads, so a client-side inference path would duplicate read-state policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 935c555c98d6. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Maintainer decision: accept the documented upgrade behavior. Existing modern sessions with durable ClawSweeper rank-up move: satisfied. This PR is ready for review, the owner decision above resolves the session-state merge risk, and exact-head validation is green. Land-ready proof for
Known proof gaps: none for this bounded deterministic Gateway projection change. |
|
Merged via squash.
|
Use creation time as the initial unread baseline for modern session rows while leaving legacy rows unchanged. Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
Related: #100739
What Problem This Solves
Fixes an issue where users could see every session as read even when a never-opened session had received new activity. Modern sessions without a
lastReadAttimestamp were projected as read, so the Control UI sidebar and other clients never received an unread state for their first background activity.Why This Change Was Made
The Gateway now uses the session's immutable creation timestamp as the initial unread baseline until an actual read timestamp exists. Rows that predate durable creation provenance keep the upgrade-safe legacy behavior, so old installs do not light up historical sessions.
This repairs the unread invariant at the canonical session-row projection used by list responses and live events. It does not add client-side inference or a second read-state path.
User Impact
Never-opened modern sessions now show an unread indicator after new activity and remain unread until the user opens or explicitly marks them read. Existing legacy rows without creation provenance remain unchanged.
Evidence
sessions.list, and Chromium showed theBackground researchrow without an unread dot under the pre-fix projection.Before
After
Post-fix recording
read-unread-after.webm
OPENCLAW_READ_UNREAD_PROOF_STATE=before node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/read-unread-status-proof.capture.e2e.test.ts— passed (temporary capture-only test removed before commit).OPENCLAW_READ_UNREAD_PROOF_STATE=after node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/read-unread-status-proof.capture.e2e.test.ts— passed (temporary capture-only test removed before commit).node scripts/run-vitest.mjs --configLoader runner src/gateway/session-utils.test.ts -t "derives unread state"— passed after rebase; 7 table-driven cases cover modern first activity, explicit unread, read/activity ordering, and legacy rows.node scripts/check-changed.mjs -- src/gateway/session-utils-core.ts src/gateway/session-utils.test.ts— passed..agents/skills/autoreview/scripts/autoreview --mode uncommitted --stream-engine-output— clean; no accepted/actionable findings, correctness 0.99.Production LOC: +6/-3 (net +3) | Tests: +10/-0. The production growth is the creation-baseline owner fix plus the compatibility invariant comment; no fallback path or persistence change was added.
Regression provenance: the original unread contract was introduced by @steipete in #100814 and intentionally treated sessions without any read timestamp as read for upgrade safety. Durable
createdAtprovenance now lets modern rows distinguish “new session, never read” from legacy unknown state. The hidden retained-pane bug fixed in #123247 was separate.AI-assisted by Roboclaw; behavior, code, tests, and visual proof were reviewed before publication.