feat(sessions): unread indicator for scheduled-run deliveries#572
Merged
Conversation
A scheduled (unattended) run delivers a session the user wasn't watching.
Surface it: the sidebar shows an unread dot until they open it.
- sessions/metadata.py: set_session_unread / mark_session_read — a targeted
single-attribute UpdateExpression on the row's current SK (GSI-resolved),
concurrent-safe with the title/activity writes; preview-session guarded;
best-effort (never raises).
- harness/runner.py: mark the delivered session unread only on a *completed*
run with trigger == "schedule" — attended "Run now" and failed/consent-
blocked runs never set the dot (the user is present / there's nothing to
read).
- app_api POST /sessions/{id}/read: clears the durable flag when the user
opens the session; idempotent, ownership-enforced via the GSI lookup.
- SPA: durable server-persisted unread on SessionMetadata (survives reload,
reaches other devices) ORed with ChatStateService's ephemeral in-tab
unread for interactive background completions; session-list renders the dot.
Backend 108 + frontend 25 tests pass.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Surfaces scheduled-run results the user hasn't seen — the sidebar shows an unread dot on a session a scheduled (unattended) run delivered, until they open it. Natural UX follow-on to the scheduled-runs engine.
Behavior
set_session_unread/mark_session_read(sessions/metadata.py): a targeted single-attributeUpdateExpressionon the row's current SK (GSI-resolved), concurrent-safe with the title/activity writes, preview-session-guarded, best-effort.run_agent_headlessmarks the session unread only on acompletedrun withtrigger == "schedule"— attended "Run now" and failed/consent-blocked runs never set the dot.POST /sessions/{id}/readclears the durable flag when the user opens the session (idempotent, ownership-enforced via the GSI lookup, 204).unreadonSessionMetadata(survives reload, reaches other devices) ORed withChatStateService's ephemeral in-tab unread for interactive background completions;session-listrenders the dot.Verification
test_harness_runner,test_sessions,test_sessions_metadata).session-list,chat-state.service) viang test.Depends on the
is_preview_sessionleaf from #567 (merged).🤖 Generated with Claude Code