Skip to content

fix: ZER-669 P1 遗留修复:详情冷启动补历史 / 来源链接语义 / 状态展示映射 - #35

Closed
ZeroPointSix wants to merge 8 commits into
mainfrom
zer-669-p1-legacy-fixes
Closed

fix: ZER-669 P1 遗留修复:详情冷启动补历史 / 来源链接语义 / 状态展示映射#35
ZeroPointSix wants to merge 8 commits into
mainfrom
zer-669-p1-legacy-fixes

Conversation

@ZeroPointSix

Copy link
Copy Markdown
Owner

关联 Issue

Linear: ZER-669 [W2] P1 遗留修复:详情冷启动补历史 / 来源链接语义 / 状态展示映射(父任务 ZER-404,关联 ZER-414)

改动内容

1. 详情冷启动补历史(SSE replay)

  • crates/openab-gateway/src/session_admin.rs:SSE 端点 /api/v1/sessions/events 在请求未携带 Last-Event-ID 时(冷启动/刷新/深链直达)改为 subscribe_after(Some(0)),从头重放事件总线中保留的历史;重构 replay_events_sse 使回放与续传共用一条路径。
  • crates/openab-gateway/tests/admin_api_integration.rs:新增 sse_cold_start_without_last_event_id_replays_retained_history 集成测试。
  • web/src/hooks/useSessionStream.ts:改用内存游标去重(不再用 sessionStorage 恢复游标),保证详情页始终只有一条 SSE 连接且冷启动可收全量历史。
  • web/src/lib/session.ts:新增 visibleTimelineItems,过滤初始种子占位项,避免与回放历史重复展示。

2. 来源链接语义(permalink)

  • crates/openab-core/src/session_snapshot.rsSessionSource 新增 permalink: Option<String>#[serde(default, skip_serializing_if)])+ set_source_permalink
  • crates/openab-core/src/acp/profile_pool.rs:新增 SessionPool::record_session_source_permalink(幂等,值未变不写盘)。
  • crates/openab-core/src/slack.rsslack_ts_permalink_fragment / slack_thread_permalink 构造 Slack 线程深链(app.slack.com/client/{team}/{channel}/p{ts}?thread_ts=…),在 handle_message 分发前回填;含单测。
  • crates/openab-core/src/discord.rsdiscord_channel_permalink(guild 频道 /channels/{guild}/{channel},DM 用 /@me/),在 Handler::message 中回填;含单测。
  • web/src/pages/SessionDetailPage.tsxpermalink 存在时主按钮变为「回到 Slack/Discord」,另有「复制会话链接」;「打开来源」不再指向 Plus Web 自身。
  • web/src/types.tsSessionSource.permalink?: string

3. 状态展示映射集中化

  • 新增 web/src/lib/sessionStatus.tsxSESSION_STATUS_DISPLAY / sessionStatusDisplay / SESSION_STATUS_FILTER_OPTIONS / SESSION_STATUS_VALUE_ENUM(后端 starting/idle/running/suspended/error/exited → 启动中/空闲/运行中/等待/失败/完成),前端仅此一处维护。
  • StatusTag.tsx / SessionTable.tsx / OverviewPage.tsx 统一改用该映射;lib/format.ts 移除旧 statusLabels,新增 sourcePlatformLabel

测试

在 VPS 测试机(kuoya-sgp-001, 4C8G, cargo 1.97.1 / node 20 / pnpm 10.14)实测:

  • cargo test -p openab-core --lib745 passed, 0 failed(含本次新增 permalink 单测)
  • web:pnpm install --frozen-lockfile && pnpm lint && pnpm test27 passed (6 files),tsc 类型检查通过
  • cargo test -p openab-gateway --test admin_api_integration:VPS 上链接器两次 Bus error(rust-lld 环境问题,非代码问题),请 CI 复跑确认

验收对照

  • 从 Slack 深链冷启动打开会话,能看到完整历史事件
  • 详情页仍只有一条 SSE 连接
  • SessionSource.permalink 已落库,Slack/Discord 适配器回填并可反向跳回线程
  • 「打开来源」不再指向 Plus Web 自身
  • 状态展示映射表在前端集中一处维护

@linear-code

linear-code Bot commented Aug 12, 2026

Copy link
Copy Markdown

ZER-669

ZeroPointSix added a commit that referenced this pull request Aug 13, 2026
Resolve the diverged #36 and #37 integration trees by retaining the current #39 tree, which contains the complete #30-#35 integration plus #38. The second parent preserves the exact #36/#41 head for ancestry and auditability without reintroducing its incomplete duplicate workbench implementation.
@ZeroPointSix

Copy link
Copy Markdown
Owner Author

已由 #46 的干净 ZER-404 W1–W5 只读工作台整合替代。#46 从最新 main 按依赖顺序重建,保留本 PR 的有效能力并补齐跨包冲突、活动流接线、恢复链与最新回归修复;原分支保留供历史追溯。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant