Repository navigation
feat: 会话未读状态与系统通知 - #1645
Merged
Merged
feat: 会话未读状态与系统通知#1645
Conversation
Refs MEMOH-146
Refs MEMOH-146
Refs MEMOH-146
Refs MEMOH-146
Refs MEMOH-146
Refs MEMOH-146
Refs MEMOH-146
A chat tab that is no longer shown is kept alive with the props it had when it was last rendered, so it still looked visible and active and marked new replies read the moment they arrived. Track activation in useSessionViewing so every cached pane stops reading. Refs MEMOH-146
The inbox becomes one raised card aligned to the sidebar title and dot columns, with a mail-style row (title and elapsed time, then bot and state). Rows and the card reveal and collapse on the house spring, and one AttentionDot component now owns the unread mark everywhere: a spring pop and a single halo when attention arrives, yellow when the agent waits on the user, and a cutout on the bot switcher avatar. Refs MEMOH-146
main took 0169 for dropping compaction settings. Refs MEMOH-146
Expanding the needs-you list replayed the arrival highlight and dot pop on rows that were already there, because the motion ran on mount. Arrival motion now keys off the unread store's isFresh (a live attention within the last two seconds), so expanding, reloading or switching bots stays still. Rows and the card use the slide-in + highlight motion picked in the design lab: height, fade and a short drop on one ease-out curve, a staggered burst, a one-shot kind tint, a dot pop and a count bump, all collapsing to instant under prefers-reduced-motion. Refs MEMOH-146
Rows revealed by "Show all" used the live-arrival entrance (340ms plus an 80ms stagger per row), so expanding four rows took about 600ms while collapsing took 240ms. Revealed rows now open together at the collapse duration; the slower staggered entrance stays for live arrivals. Refs MEMOH-146
Read and unread are now two sides of one per-user state: session_reads
keeps a forward-only read_at and a forward-only marked_unread_at, and the
later one wins, so concurrent tabs and devices converge. A session the user
marks unread keeps its own attention kind and time; one that never needed
attention shows as "marked".
PUT /users/me/read-state replaces the per-bot mark-read endpoint and takes
a batch of {session_id, unread, through} changes, so marking one session,
reading everything, and undoing it all use one call. Only sessions the
caller created and that can carry unread state are touched. Marking unread
publishes session_unread, never session_attention, so it never notifies.
On the web, a session marked unread while it is on screen is left alone
until it is opened again; new attention on screen is still read at once.
Refs MEMOH-146
… unread The card header now folds the list like the Folders and Recents section headers (whole row toggles, chevron on hover or focus, remembered per device). A trailing × reads every unread session behind a confirm bubble, and the toast it raises offers an undo that marks the same sessions unread again, restoring their kind and time. Session rows gain "Mark as unread" / "Mark as read" in both the context menu and the hover menu, shown only on sessions that can carry unread state (canHoldUnread mirrors the server rule). leaveRow now drops its held end state once Vue hides the element, so a list folded with v-show does not stay at zero height when reopened. Refs MEMOH-146
The multi-select bar sat above the Needs you card, as if the card's rows were part of the selection. It now heads the Folders and Recents group it acts on, sticky inside that group in the shared scrollport, with even 8px gaps to the card and the Folders header. Refs MEMOH-146
LittleSound
force-pushed
the
feat/memoh-146-session-unread-notifications
branch
from
October 29, 2026 13:13
9aebf00 to
3031542
Compare
main now refuses echo.NewHTTPError bad requests that carry text, since the boundary never sends that text to the user. A read that omits through answers request.field_required for the through field instead. Refs MEMOH-146
LittleSound
marked this pull request as ready for review
October 29, 2026 13:37
Red was spent on every unread reply, so a real failure did not stand out. Dots, arrival tints and counts now follow one ladder: red for a failed run, yellow while the agent waits on the user, the scheme's brand for a plain reply or a manual mark. The needs-you count and the bot switcher speak for their most urgent unread, through BadgeCount's new warning and brand tones. Refs MEMOH-146
chen-ran
approved these changes
Nov 1, 2026
2 of 6 tasks
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.
Author
Type
Summary
Agent 跑完长任务、运行失败或者等待工具审批时,如果用户当时不在看这个会话,现在什么提示都没有。没接 IM 渠道的网页端和桌面端用户,根本不知道 bot 已经做完了。
这个 PR 给“用户自己在网页 / 桌面端发起的会话”加上未读状态和系统通知,并且用户可以手动把会话标为已读或未读。
后端
0171_session_attention:bot_sessions增加attention_at/attention_kind;新表session_reads按用户记录read_at(已读游标)和marked_unread_at(手动标未读的时间),两个时间都只会向前推进,以较晚的那个为准。0001_init快照同步更新。completed记为reply,failed/lost记为failed;进入waiting_decision时记为needs_input。用户主动中止(aborted)和重复上报的终态都不写。写入不会改动updated_at。GET /users/me/unread:跨 bot 的未读汇总。PUT /users/me/read-state:批量设置已读或未读,请求体是{items: [{session_id, unread, through?}]}。已读和未读是同一个状态的两面;标已读时through必填,缺少时返回request.field_required(field: through);只读到这个时间为止,避免把之后新到的提醒一并读掉。GET /users/me/attention/events:事件有session_attention、session_unread(手动标未读,不弹通知)、session_read,每一帧都重新检查 bot 访问权限。unread/attention_kind/attention_at。网页端
(n)。--brand,跟着配色方案变)。每一行的点、到达时的底色闪动都按这一行的种类上色;「需要你」卡片的计数、bot 切换器头像上的点、切换器菜单里每个 bot 的计数,都取其中最急的那种颜色(红 > 黄 > 主题色)。卡片计数也把折叠起来没显示的行算进去,所以第 6 条是失败时,计数同样会变红。计数用的是BadgeCount新增的warning/brand色调,来自配套的 feat: BadgeCount 增加 warning 与 brand 色调 ui#41。AttentionDot组件:新提醒到达时弹一下、外圈扩散一次光晕。桌面端
sessionId + attentionAt去重,会校验 IPC 参数;点击通知时打开窗口并跳到对应会话。app.setBadgeCount在 Dock 上显示未读总数。桌面端默认开启通知。Related Issues
packages/ui现指向正式仓库的合并提交2a40d38f36818b27b2400a3a81aa64e5765dbb62,包含BadgeCount的warning/brand色调及 UI fix: correct store import path case #42 的 ErrorIcon 依赖修复。94f715054b41ce5f0736219b0b94f44c7aa029a9,保留主线外部 runtime Registry / Session Manager 接口和路由异步防竞态检查。迁移编号调整为尚未占用的0171;主线已发布的0170_history_checkpoints未修改。仍保留的行为与验证边界
Validation
2026-11-02 合入 main / UI #41 后的验证(
42f3bcd30)codex/pr1645-continue。通过项目scripts/dev-compose.sh启动隔离的memoh-pr1645-qa开发栈,Webhttp://127.0.0.1:30082,Server30080。确认源码挂载指向本轮 worktree,Server / Channel / PostgreSQL / pgvector / Connect-It 健康,数据库版本171、dirty=false。mise run sqlc-generate、mise run sdk-generate、Web typecheck 通过。MISE_SHELLCHECK_VERSION=0.11.0明确选定已安装的 shellcheck,未跳过钩子)。mise run lint通过:UI contract、ESLint、Go lint 均无错误;保留现有告警。./internal/chat/... ./internal/handlers/... ./internal/agent/application/... ./internal/agent/runtime/session/... ./cmd/...。171、dirty=false。completed且持久化attention_kind=reply,SSE 驱动未读数 3 → 4;点击提醒打开回复正文,未读数 4 → 3。颜色样本通过隔离测试库准备,不代表真实失败/审批触发已在本轮重测。此次未调用真实模型服务,也未验证操作系统通知横幅。以下为此前提交的验证记录,环境与提交不同:
自动检查(基于 origin/main
bbedfb5f5)go test跑了./internal/chat/...、./internal/handlers/、./internal/agent/application/、./internal/agent/runtime/session/、./cmd/...,全部通过。go test -tags=integration ./internal/chat/attention/通过,覆盖资格判断、updated_at不变、时间戳只向前推进、未读规则、手动标未读和读掉手动未读。scripts/check-ui-contract.mjs)通过。ui-icon-contract、chat-user-input-form、panel-preview、useMediaGallery、desktop 的server-connection和docker/server-entrypoint。本 PR 没有改动这些文件,报错是localStorage is not defined、mock 缺少导出这类和本机环境有关的问题。9ca58892b上 CI 的 Test、Lint、迁移、桌面端构建等全部通过。TestBadRequestsCarryNoUserText发现 read-state 接口在缺少through时用了带文字的echo.NewHTTPError。已改成apperror.FieldRequired("through"),handler 测试同步更新;重启 server 后用真实接口确认返回 400request.field_required,界面上标记未读 / 已读照常工作。TestTerminalWSPongsDoNotCountAsActivity(终端 WebSocket),和本 PR 无关,本机重跑通过。实际页面验证(Agent 自测,不算 Human QA)
http://127.0.0.1:25100,模型用 deepseek-flash,bot 有 Nyanko、Gamer、[memoh-193] bot a / b。(1),通知只弹一次。date。卡片显示黄色的“等待你确认”,切换器上也是黄点,并发出通知;点“允许”后运行完成,因为当时正在看,没有重复提醒。Notification换成了一个记录器,确认通知只调用一次,标题和正文都正确。electron-vite dev连到测试环境,通过调试端口检查:没有验证的
Notifications are not allowed for this application),既不弹授权框,也不出现在「系统设置 → 通知」里。主进程确实发出了通知,但横幅显示需要用正式签名的版本做人工 QA。Screenshots / Recordings
2026-11-02 当前集成版本(Agent 捕获,用户已复核本轮页面)

此前提交的历史截图
以下 1–20 来自此前运行的开发环境(Agent 自测);1–7 的卡片样式较早,8–20 是合入本轮 main 前的版本。当前提交请以上方六张截图为准。
date命令。Human QA