docs: record the pet window fixes and correct the N-11 root cause
The queue recorded N-11's cause as "the rebuild path never called show()". That was a real code defect and it is fixed, but it was not this symptom — the pet still did not appear after it. The live log showed the rebuild path failing outright before the reveal step, so the record now states that and names the fix that actually worked. The two root causes I proposed and retracted are kept as their own row, since "tried and disproved" is worth more to the next reader than a clean record. Also formats the queue with prettier, which reflows three tables. One hunk of that reflow was reverted by hand: a continuation line began with "+" meaning "and", and prettier normalised it into a nested list item, turning half a sentence into a bullet. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
这个提交存在于:
父节点
4f73c0819d
当前提交
3e03a4e8b6
共有 2 个文件被更改,包括 131 次插入 和 126 次删除
|
|
@ -56,6 +56,10 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
||||||
removed them from the tab order, so the focus rule that reveals them could never fire.
|
removed them from the tab order, so the focus rule that reveals them could never fire.
|
||||||
- A failure to open the desktop pet's context menu is now reported instead of silently doing
|
- A failure to open the desktop pet's context menu is now reported instead of silently doing
|
||||||
nothing.
|
nothing.
|
||||||
|
- The desktop pet appears when its display mode is set to floating. Switching modes closed the pet
|
||||||
|
by destroying its window, which forced every later open through a rebuild path that failed
|
||||||
|
outright; the pet window is now hidden and re-shown instead.
|
||||||
|
- The desktop pet no longer sits inside an opaque dark card when rendered inside the application.
|
||||||
- One unreachable connection no longer freezes the whole application. The reachability probe now
|
- One unreachable connection no longer freezes the whole application. The reachability probe now
|
||||||
runs outside the runtime lock, so a slot that is connecting cannot block status, sending,
|
runs outside the runtime lock, so a slot that is connecting cannot block status, sending,
|
||||||
cancelling or disconnecting on the other slot, and the attempt itself can be interrupted.
|
cancelling or disconnecting on the other slot, and the attempt itself can be interrupted.
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,12 @@
|
||||||
|
|
||||||
## 执行状态(2026-07-26 更新)
|
## 执行状态(2026-07-26 更新)
|
||||||
|
|
||||||
| 批次 | 状态 | 说明 |
|
| 批次 | 状态 | 说明 |
|
||||||
|---|---|---|
|
| --------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| R1 发布阻断批 | **已完成,门槛已验证** | 9 项全部实现。2026-07-26 首次跑完整门槛,发现 2 处编译/lint 失败并修复(详见下方「R1 门槛验证结果」),补写 F-05 缺失的单测。现全绿。 |
|
| R1 发布阻断批 | **已完成,门槛已验证** | 9 项全部实现。2026-07-26 首次跑完整门槛,发现 2 处编译/lint 失败并修复(详见下方「R1 门槛验证结果」),补写 F-05 缺失的单测。现全绿。 |
|
||||||
| R2 传输层批 | **已完成,门槛已验证** | F-10 – F-13 全部实现,新增 9 条 Rust 测试(`astrbot-desktop` 单元测试 67 → 76)。顺带并入 F-56(P3-4,取消不再置 Disconnected)。全绿。 |
|
| R2 传输层批 | **已完成,门槛已验证** | F-10 – F-13 全部实现,新增 9 条 Rust 测试(`astrbot-desktop` 单元测试 67 → 76)。顺带并入 F-56(P3-4,取消不再置 Disconnected)。全绿。 |
|
||||||
| R3 隔离与状态正确性批 | **已完成,门槛已验证** | F-14 – F-19 全部实现,新增 11 条 Rust 测试(`astrbot-desktop` 单元测试 76 → 87)与 5 条前端测试(19 → 24,含新建的 `ChatPanel.test.tsx`)。全绿。详见下方「R3 实现记录」。 |
|
| R3 隔离与状态正确性批 | **已完成,门槛已验证** | F-14 – F-19 全部实现,新增 11 条 Rust 测试(`astrbot-desktop` 单元测试 76 → 87)与 5 条前端测试(19 → 24,含新建的 `ChatPanel.test.tsx`)。全绿。详见下方「R3 实现记录」。 |
|
||||||
| R4 – R8 | 未开始 | 下一批为 R4 或 R5,两者与 R3 无依赖,可并行分派。 |
|
| R4 – R8 | 未开始 | 下一批为 R4 或 R5,两者与 R3 无依赖,可并行分派。 |
|
||||||
|
|
||||||
> 计数订正(2026-07-27 实测):本表此前记为「67 → 73(+6)」,与
|
> 计数订正(2026-07-27 实测):本表此前记为「67 → 73(+6)」,与
|
||||||
> `r1-r2-status-2026-07-26.md` 的「67 → 76(+9)」冲突。实跑 `cargo test --workspace` 的结果是
|
> `r1-r2-status-2026-07-26.md` 的「67 → 76(+9)」冲突。实跑 `cargo test --workspace` 的结果是
|
||||||
|
|
@ -62,8 +62,8 @@
|
||||||
- 移除流式总超时后,单条响应失去唯一边界(`read_timeout` 只测两次读之间的间隔,不能替代)。
|
- 移除流式总超时后,单条响应失去唯一边界(`read_timeout` 只测两次读之间的间隔,不能替代)。
|
||||||
已加 64MiB 单响应上限,同时约束 `mapper.accumulated`。
|
已加 64MiB 单响应上限,同时约束 `mapper.accumulated`。
|
||||||
- `send_slot_message` 的 `client.take()` 独占窗口原被 120s 总超时封顶,F-10 后变成与回复等长——
|
- `send_slot_message` 的 `client.take()` 独占窗口原被 120s 总超时封顶,F-10 后变成与回复等长——
|
||||||
期间 sessions / capabilities / upload / download / switch 五个命令全部误报未连接。已改 `clone()`
|
期间 sessions / capabilities / upload / download / switch 五个命令全部误报未连接。已改为
|
||||||
+ 以 `message_cancellation` 串行化发送(即 **F-49**,因 R2 使其显性化而从 R7 提前)。
|
`clone()` 并以 `message_cancellation` 串行化发送(即 **F-49**,因 R2 使其显性化而从 R7 提前)。
|
||||||
- `SseLineBuffer` 逐行从头 `drain` 是平方复杂度(hyper 单个 item 可达数百 KiB)。已改游标。
|
- `SseLineBuffer` 逐行从头 `drain` 是平方复杂度(hyper 单个 item 可达数百 KiB)。已改游标。
|
||||||
|
|
||||||
**R2 未覆盖、仍开放**:P1-2 描述中的「发送先入库 user 行」属 F-18(R3),本批未动。
|
**R2 未覆盖、仍开放**:P1-2 描述中的「发送先入库 user 行」属 F-18(R3),本批未动。
|
||||||
|
|
@ -160,59 +160,59 @@
|
||||||
|
|
||||||
其余批次之间可并行分派给不同分支。
|
其余批次之间可并行分派给不同分支。
|
||||||
|
|
||||||
* * *
|
---
|
||||||
|
|
||||||
## R1 · 发布阻断批
|
## R1 · 发布阻断批
|
||||||
|
|
||||||
**目标**:恢复真实 AstrBot 聊天闭环与桌宠功能。9 项全部是小改动(多数一行到一函数),建议 1–2 天内合并,合并后重新走一遍 Q9 门槛。
|
**目标**:恢复真实 AstrBot 聊天闭环与桌宠功能。9 项全部是小改动(多数一行到一函数),建议 1–2 天内合并,合并后重新走一遍 Q9 门槛。
|
||||||
|
|
||||||
| ID | 来源 | 位置 | 动作 | 验证 |
|
| ID | 来源 | 位置 | 动作 | 验证 |
|
||||||
| --- | --- | --- | --- | --- |
|
| -------- | ----- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| **F-01** | P0-1 | `crates/desktop-protocol/src/astrbot.rs:453-455`;`src-tauri/src/networking/astrbot_client.rs:440` | **推荐方案 A**:`AstrBotStreamMapper::new(server_instance_id, stream_id)` 增加流级种子(调用方传 `Uuid::new_v4()`),`event_id` 改为 `astrbot-{sid}-{stream}-{seq}`。保留同流内去重语义,事件 ID 全局唯一。(方案 B:sequence 提到 client 级 `AtomicU64` —— 会让协议 crate 依赖 client 生命周期,不推荐;方案 C:astrbot 路径取消去重 —— 最省事但丢掉同流重复防护) | 新增单测:同一 `AstrBotClient` 连续两次 `send_chat_stream`,第二条流的 delta 与 completed 全部到达 sender。真机:同一连接连发 3 条,每条回复完整显示 |
|
| **F-01** | P0-1 | `crates/desktop-protocol/src/astrbot.rs:453-455`;`src-tauri/src/networking/astrbot_client.rs:440` | **推荐方案 A**:`AstrBotStreamMapper::new(server_instance_id, stream_id)` 增加流级种子(调用方传 `Uuid::new_v4()`),`event_id` 改为 `astrbot-{sid}-{stream}-{seq}`。保留同流内去重语义,事件 ID 全局唯一。(方案 B:sequence 提到 client 级 `AtomicU64` —— 会让协议 crate 依赖 client 生命周期,不推荐;方案 C:astrbot 路径取消去重 —— 最省事但丢掉同流重复防护) | 新增单测:同一 `AstrBotClient` 连续两次 `send_chat_stream`,第二条流的 delta 与 completed 全部到达 sender。真机:同一连接连发 3 条,每条回复完整显示 |
|
||||||
| **F-02** | P1-12 | `src/features/pet/types.ts:47` | 正则 `\\.` → `\.` | `expect(petPackManifestSchema.parse(内置 manifest.json))` 通过 |
|
| **F-02** | P1-12 | `src/features/pet/types.ts:47` | 正则 `\\.` → `\.` | `expect(petPackManifestSchema.parse(内置 manifest.json))` 通过 |
|
||||||
| **F-03** | P1-13 | `src-tauri/capabilities/default.json:5` | `windows` 数组加 `"desktop-pet"` | 桌宠窗口能收到 `connection-runtime-event`;拖动与右键菜单生效 |
|
| **F-03** | P1-13 | `src-tauri/capabilities/default.json:5` | `windows` 数组加 `"desktop-pet"` | 桌宠窗口能收到 `connection-runtime-event`;拖动与右键菜单生效 |
|
||||||
| **F-04** | P1-14 | `src-tauri/tauri.conf.json` → `app.security.csp` | `img-src` 追加 `blob:` | **release 构建**下发送带图消息,图片正常渲染(dev 不注入 CSP,必须用 release 验) |
|
| **F-04** | P1-14 | `src-tauri/tauri.conf.json` → `app.security.csp` | `img-src` 追加 `blob:` | **release 构建**下发送带图消息,图片正常渲染(dev 不注入 CSP,必须用 release 验) |
|
||||||
| **F-05** | P1-15 | `src/features/chat/MessageContent.tsx:66-72` | `new URL(href, base)` 解析后仅放行 `http/https`(可选 `mailto`),非法协议降级为纯文本;`rel` 补 `noopener` | 单测:`[x](javascript:alert(1))` 渲染为文本而非 `<a>` |
|
| **F-05** | P1-15 | `src/features/chat/MessageContent.tsx:66-72` | `new URL(href, base)` 解析后仅放行 `http/https`(可选 `mailto`),非法协议降级为纯文本;`rel` 补 `noopener` | 单测:`[x](javascript:alert(1))` 渲染为文本而非 `<a>` |
|
||||||
| **F-06** | P1-7a | `src/features/chat/types.ts:35,36,63,64,156` | 五处 `.optional()` → `.nullish()`(`sessionId`/`messageId`/`displayName`/`updatedAt`/`name`) | 契约测试:用 Rust `serde_json` 真实输出(含 `null`)回放,`boundRuntimeEventSchema` / `remoteChatSessionSchema` / `astrbotModelOptionSchema` 全部通过 |
|
| **F-06** | P1-7a | `src/features/chat/types.ts:35,36,63,64,156` | 五处 `.optional()` → `.nullish()`(`sessionId`/`messageId`/`displayName`/`updatedAt`/`name`) | 契约测试:用 Rust `serde_json` 真实输出(含 `null`)回放,`boundRuntimeEventSchema` / `remoteChatSessionSchema` / `astrbotModelOptionSchema` 全部通过 |
|
||||||
| **F-07** | P1-7b | `crates/desktop-protocol/src/astrbot.rs:84-91` | `AstrBotModelOption` 补 `#[serde(rename_all = "camelCase")]`(该类型不入库,无迁移风险) | 前端 `isDefault` 不再恒 undefined;模型下拉默认项正确 |
|
| **F-07** | P1-7b | `crates/desktop-protocol/src/astrbot.rs:84-91` | `AstrBotModelOption` 补 `#[serde(rename_all = "camelCase")]`(该类型不入库,无迁移风险) | 前端 `isDefault` 不再恒 undefined;模型下拉默认项正确 |
|
||||||
| **F-08** | P1-16 | 新建 `src/lib/errorMessage.ts`;接入 `ChatPanel.tsx:423` 等 6 处、`SettingsPages.tsx:119` | 抽出共享 `errorMessage()`,识别 `{code,message}` 形状(复用 `ProfileManager.tsx:689-702` 的既有实现) | 断开连接后发送,错误条显示 Rust 的 `message` 而非 `[object Object]` |
|
| **F-08** | P1-16 | 新建 `src/lib/errorMessage.ts`;接入 `ChatPanel.tsx:423` 等 6 处、`SettingsPages.tsx:119` | 抽出共享 `errorMessage()`,识别 `{code,message}` 形状(复用 `ProfileManager.tsx:689-702` 的既有实现) | 断开连接后发送,错误条显示 Rust 的 `message` 而非 `[object Object]` |
|
||||||
| **F-09** | P1-17 | `DesktopPetView.tsx:92,173,191,198`;`App.tsx:451,554` | 恢复中文原文("精灵图加载失败"/"无法获取 Canvas 上下文"/"桌宠"/"加载中…");`&#x...;` 实体改明文 | CI 加 `grep -nP '\?{3,}'` 与非 ASCII 实体扫描 |
|
| **F-09** | P1-17 | `DesktopPetView.tsx:92,173,191,198`;`App.tsx:451,554` | 恢复中文原文("精灵图加载失败"/"无法获取 Canvas 上下文"/"桌宠"/"加载中…");`&#x...;` 实体改明文 | CI 加 `grep -nP '\?{3,}'` 与非 ASCII 实体扫描 |
|
||||||
|
|
||||||
**批次验收**:`cargo test`(+3 条新测试)、Vitest、typecheck、lint、release 构建、真机连发 3 条消息 + 桌宠事件联动 + 附件图渲染。
|
**批次验收**:`cargo test`(+3 条新测试)、Vitest、typecheck、lint、release 构建、真机连发 3 条消息 + 桌宠事件联动 + 附件图渲染。
|
||||||
|
|
||||||
**建议提交**:`fix(astrbot): scope stream event ids per request` / `fix(pet): correct manifest image pattern` / `fix(tauri): grant desktop-pet capability` / `fix(tauri): allow blob images in production csp` / `fix(chat): restrict markdown link protocols` / `fix(chat): accept null in runtime event contracts` / `fix(protocol): serialize model options in camelCase` / `refactor(ui): share ipc error formatting` / `fix(ui): restore corrupted localized strings`
|
**建议提交**:`fix(astrbot): scope stream event ids per request` / `fix(pet): correct manifest image pattern` / `fix(tauri): grant desktop-pet capability` / `fix(tauri): allow blob images in production csp` / `fix(chat): restrict markdown link protocols` / `fix(chat): accept null in runtime event contracts` / `fix(protocol): serialize model options in camelCase` / `refactor(ui): share ipc error formatting` / `fix(ui): restore corrupted localized strings`
|
||||||
|
|
||||||
* * *
|
---
|
||||||
|
|
||||||
## R2 · 传输层批(串行,同一分支)
|
## R2 · 传输层批(串行,同一分支)
|
||||||
|
|
||||||
**目标**:让长连接与长回复真正可用。四项都在 `astrbot_client.rs` / `gateway_client.rs` 的流循环,必须串行。
|
**目标**:让长连接与长回复真正可用。四项都在 `astrbot_client.rs` / `gateway_client.rs` 的流循环,必须串行。
|
||||||
|
|
||||||
| ID | 来源 | 位置 | 动作 | 验证 |
|
| ID | 来源 | 位置 | 动作 | 验证 |
|
||||||
| --- | --- | --- | --- | --- |
|
| -------- | ---- | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
||||||
| **F-10** | P1-1 | `gateway_client.rs:100-101`;`astrbot_client.rs:147-148` | 拆分两个 reqwest Client:REST 保留总时限,流式端点**不设** `.timeout()`,改用 `connect_timeout` + 心跳看门狗 / `read_timeout` 做空闲检测 | desktop SSE 连续保持 \>5 分钟不断;AstrBot 生成 \>120s 的长回复完整到达 |
|
| **F-10** | P1-1 | `gateway_client.rs:100-101`;`astrbot_client.rs:147-148` | 拆分两个 reqwest Client:REST 保留总时限,流式端点**不设** `.timeout()`,改用 `connect_timeout` + 心跳看门狗 / `read_timeout` 做空闲检测 | desktop SSE 连续保持 \>5 分钟不断;AstrBot 生成 \>120s 的长回复完整到达 |
|
||||||
| **F-11** | P1-3 | `astrbot_client.rs:462-463` | `buffer` 改 `Vec<u8>`,按 `\n` 在**字节层**分行,逐行 `String::from_utf8`(保留不完整尾字节到下一 chunk) | 单测:把一条中文 SSE 帧在 UTF-8 字符中间切成两个 chunk 喂入,输出无 `U+FFFD` |
|
| **F-11** | P1-3 | `astrbot_client.rs:462-463` | `buffer` 改 `Vec<u8>`,按 `\n` 在**字节层**分行,逐行 `String::from_utf8`(保留不完整尾字节到下一 chunk) | 单测:把一条中文 SSE 帧在 UTF-8 字符中间切成两个 chunk 喂入,输出无 `U+FFFD` |
|
||||||
| **F-12** | P1-2 | `runtime.rs:647-653`、`:723-731` | `should_retry_astrbot` 收窄:仅"连接建立失败"可重试;一旦收到响应头/首字节即不再自动重发,改返回可手动重试的错误码 | 单测:mock 在响应体中途断流 → 不产生第二次 POST |
|
| **F-12** | P1-2 | `runtime.rs:647-653`、`:723-731` | `should_retry_astrbot` 收窄:仅"连接建立失败"可重试;一旦收到响应头/首字节即不再自动重发,改返回可手动重试的错误码 | 单测:mock 在响应体中途断流 → 不产生第二次 POST |
|
||||||
| **F-13** | P2-2 | `astrbot_client.rs:456-459` 及 `next?` 错误路径 | 取消与错误两条 return 路径统一调 `mapper.finish_stream()`(`FinishReason::Cancelled` / `Error`)并 dispatch | 停止生成后重启应用,该消息不再显示为"生成中";DB 无 `streaming=1` 残留 |
|
| **F-13** | P2-2 | `astrbot_client.rs:456-459` 及 `next?` 错误路径 | 取消与错误两条 return 路径统一调 `mapper.finish_stream()`(`FinishReason::Cancelled` / `Error`)并 dispatch | 停止生成后重启应用,该消息不再显示为"生成中";DB 无 `streaming=1` 残留 |
|
||||||
|
|
||||||
**批次验收**:新增 3 条单测;真机断网/恢复、长回复、中途停止三场景。
|
**批次验收**:新增 3 条单测;真机断网/恢复、长回复、中途停止三场景。
|
||||||
|
|
||||||
**建议提交**:`fix(net): stop total timeouts from killing streams` / `fix(astrbot): decode sse bytes on line boundaries` / `fix(astrbot): do not resend messages after response start` / `fix(astrbot): finalize streams on cancel and error`
|
**建议提交**:`fix(net): stop total timeouts from killing streams` / `fix(astrbot): decode sse bytes on line boundaries` / `fix(astrbot): do not resend messages after response start` / `fix(astrbot): finalize streams on cancel and error`
|
||||||
|
|
||||||
* * *
|
---
|
||||||
|
|
||||||
## R3 · 隔离与状态正确性批
|
## R3 · 隔离与状态正确性批
|
||||||
|
|
||||||
| ID | 来源 | 位置 | 动作 | 验证 |
|
| ID | 来源 | 位置 | 动作 | 验证 |
|
||||||
| --- | --- | --- | --- | --- |
|
| -------- | ----- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- |
|
||||||
| **F-14** | P1-4 | `runtime.rs:197-325` | 探测移出锁:先置 `Connecting` 快照并 `drop(guard)`,`health()`/`probe()` 在锁外执行,按 generation 回写;激活伊始即安装 `connection_cancellation` 并在 probe 内 `select` | 一个槽连接不可达地址期间,另一槽的 `status()`/发送/断开全部正常;激活中可被 disconnect 打断 |
|
| **F-14** | P1-4 | `runtime.rs:197-325` | 探测移出锁:先置 `Connecting` 快照并 `drop(guard)`,`health()`/`probe()` 在锁外执行,按 generation 回写;激活伊始即安装 `connection_cancellation` 并在 probe 内 `select` | 一个槽连接不可达地址期间,另一槽的 `status()`/发送/断开全部正常;激活中可被 disconnect 打断 |
|
||||||
| **F-15** | P1-10 | `ChatPanel.tsx:144-155`;`App.tsx:391-399`;`DesktopPetView.tsx:46-82`;`src/test/setup.ts` | 三处改 `let active=true; listen().then(fn => active ? unlisten=fn : fn()); return () => {active=false; unlisten?.()}`;测试 mock 改为延迟 resolve 并断言注销次数 | StrictMode 下 delta 不再翻倍;新测试断言 unmount 后注销被调用 |
|
| **F-15** | P1-10 | `ChatPanel.tsx:144-155`;`App.tsx:391-399`;`DesktopPetView.tsx:46-82`;`src/test/setup.ts` | 三处改 `let active=true; listen().then(fn => active ? unlisten=fn : fn()); return () => {active=false; unlisten?.()}`;测试 mock 改为延迟 resolve 并断言注销次数 | StrictMode 下 delta 不再翻倍;新测试断言 unmount 后注销被调用 |
|
||||||
| **F-16** | P1-11 | `ChatPanel.tsx:80-82,384-412` | `pendingAttachments`、`draft`、`error` 改 `Record<ChatSlot, …>` | 陪伴槽上传附件 → 切运维 → 发送,附件不跟随;运维错误横幅不出现在陪伴槽 |
|
| **F-16** | P1-11 | `ChatPanel.tsx:80-82,384-412` | `pendingAttachments`、`draft`、`error` 改 `Record<ChatSlot, …>` | 陪伴槽上传附件 → 切运维 → 发送,附件不跟随;运维错误横幅不出现在陪伴槽 |
|
||||||
| **F-17** | P2-1 | `runtime.rs:453-477` | `switch_slot_session` 首锁捕获 `generation`,二次锁写入前比较,不一致返回 cancelled | 单测:切换会话期间 deactivate,旧 session 不写入新代快照 |
|
| **F-17** | P2-1 | `runtime.rs:453-477` | `switch_slot_session` 首锁捕获 `generation`,二次锁写入前比较,不一致返回 cancelled | 单测:切换会话期间 deactivate,旧 session 不写入新代快照 |
|
||||||
| **F-18** | P2-3 | `commands.rs:632-656` | 校验通过且确认 client 存在后再 `upsert_chat_message`;失败路径按 message_id 回删或标记 error | 未连接状态下发送,历史里不留 user 行 |
|
| **F-18** | P2-3 | `commands.rs:632-656` | 校验通过且确认 client 存在后再 `upsert_chat_message`;失败路径按 message_id 回删或标记 error | 未连接状态下发送,历史里不留 user 行 |
|
||||||
| **F-19** | P2-4 | `commands.rs:412-461` | `probe_connection_slot` 激活前校验 `connection_slots` 分配,拒绝同一 profile 占用两个运行时槽;operations 切换守卫覆盖 probe/disconnect | 同一 profile 依次 probe 双槽 → 第二次被 `profileAlreadyAssigned` 拒绝 |
|
| **F-19** | P2-4 | `commands.rs:412-461` | `probe_connection_slot` 激活前校验 `connection_slots` 分配,拒绝同一 profile 占用两个运行时槽;operations 切换守卫覆盖 probe/disconnect | 同一 profile 依次 probe 双槽 → 第二次被 `profileAlreadyAssigned` 拒绝 |
|
||||||
|
|
||||||
* * *
|
---
|
||||||
|
|
||||||
## R3.5 · 真机反馈批(2026-07-27 追加)
|
## R3.5 · 真机反馈批(2026-07-27 追加)
|
||||||
|
|
||||||
|
|
@ -221,12 +221,12 @@
|
||||||
|
|
||||||
### 已完成
|
### 已完成
|
||||||
|
|
||||||
| ID | 位置 | 根因 | 状态 |
|
| ID | 位置 | 根因 | 状态 |
|
||||||
| --- | --- | --- | --- |
|
| -------- | ------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
|
||||||
| **N-1** | `styles.css:2183/2456/2655/2735/3134`;`ChatPanel.tsx:822,834,846` | `.message-action-label`(`clip-rect` 屏幕阅读器类)**定义了却从未被任何组件使用**,组件用的是裸 `<span>`;同时按钮被 5 处重复定义中的 3 处当作胶囊按钮,与最终块冲突。文字塞进 2rem 方框后竖排折行 | 已修 |
|
| **N-1** | `styles.css:2183/2456/2655/2735/3134`;`ChatPanel.tsx:822,834,846` | `.message-action-label`(`clip-rect` 屏幕阅读器类)**定义了却从未被任何组件使用**,组件用的是裸 `<span>`;同时按钮被 5 处重复定义中的 3 处当作胶囊按钮,与最终块冲突。文字塞进 2rem 方框后竖排折行 | 已修 |
|
||||||
| **N-2** | `styles.css:509` + `:3106` | `.chat-message-row{align-items:flex-end}` 把头像对齐到 `.chat-message-content` 底边,而该盒子因操作条占位比气泡高一行 → 头像掉到气泡下方 | 已修 |
|
| **N-2** | `styles.css:509` + `:3106` | `.chat-message-row{align-items:flex-end}` 把头像对齐到 `.chat-message-content` 底边,而该盒子因操作条占位比气泡高一行 → 头像掉到气泡下方 | 已修 |
|
||||||
| **F-40** | `styles.css:3113` | 顺带关闭:`visibility:hidden` 把按钮移出 tab 序,`:focus-within` 永远无法触发。改为仅 `opacity` | 已修(原属 R6) |
|
| **F-40** | `styles.css:3113` | 顺带关闭:`visibility:hidden` 把按钮移出 tab 序,`:focus-within` 永远无法触发。改为仅 `opacity` | 已修(原属 R6) |
|
||||||
| **N-3** | `DesktopPetView.tsx:222-225` | 右键处理是裸 `void invoke(...)`,**无 `.catch`**,Rust 侧任何失败都不可见,与「原生菜单赢了」无法区分 | 已让错误可见;根因待定 |
|
| **N-3** | `DesktopPetView.tsx:222-225` | 右键处理是裸 `void invoke(...)`,**无 `.catch`**,Rust 侧任何失败都不可见,与「原生菜单赢了」无法区分 | 已让错误可见;根因待定 |
|
||||||
|
|
||||||
**验证**:在真实样式表下用浏览器实测——头像与气泡顶部差 0px,按钮 34×34 / `border-width: 0px`,
|
**验证**:在真实样式表下用浏览器实测——头像与气泡顶部差 0px,按钮 34×34 / `border-width: 0px`,
|
||||||
标签盒 1×1(已裁剪),聚焦后操作条 opacity 由 0 变 1。
|
标签盒 1×1(已裁剪),聚焦后操作条 opacity 由 0 变 1。
|
||||||
|
|
@ -252,10 +252,10 @@ F-33 / N-6 / N-7 全部**无法验证**,需先让服务端真的发出图片
|
||||||
|
|
||||||
AstrBot 在一次回复中**交错**投递两类 `plain` 帧:
|
AstrBot 在一次回复中**交错**投递两类 `plain` 帧:
|
||||||
|
|
||||||
| 类型 | 语义 | 实测 |
|
| 类型 | 语义 | 实测 |
|
||||||
| --- | --- | --- |
|
| ------------------ | ------------------------------------ | ------------------------------------------------------------- |
|
||||||
| `streaming: true` | 逐字增量,累计等于 `complete` 的内容 | 第2轮 173 字 = complete 173;第3轮 209 = 209;第4轮 142 = 142 |
|
| `streaming: true` | 逐字增量,累计等于 `complete` 的内容 | 第2轮 173 字 = complete 173;第3轮 209 = 209;第4轮 142 = 142 |
|
||||||
| `streaming: false` | **整段已完成的消息** | 第2轮 5 段共 915 字;第3轮 2 段共 469 字;第4轮 1 段 133 字 |
|
| `streaming: false` | **整段已完成的消息** | 第2轮 5 段共 915 字;第3轮 2 段共 469 字;第4轮 1 段 133 字 |
|
||||||
|
|
||||||
实测帧序(第2轮):`[增量×14] → 整段217 → 整段192 → [增量×23] → 整段201 → 整段192 →
|
实测帧序(第2轮):`[增量×14] → 整段217 → 整段192 → [增量×23] → 整段201 → 整段192 →
|
||||||
[增量×94] → 整段113 → complete(173)`。
|
[增量×94] → 整段113 → complete(173)`。
|
||||||
|
|
@ -276,18 +276,19 @@ AstrBot 在一次回复中**交错**投递两类 `plain` 帧:
|
||||||
|
|
||||||
### 新增项
|
### 新增项
|
||||||
|
|
||||||
| ID | 问题 | 位置 | 状态 |
|
| ID | 问题 | 位置 | 状态 |
|
||||||
| --- | --- | --- | --- |
|
| -------- | -------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------- |
|
||||||
| **N-9** | 分段消息被拼接进流式消息,并被 `complete` 替换丢弃 | `astrbot.rs:379`(`map_plain`)、`astrbot.rs:405`(`map_complete`) | 真因已定位,待重复性探针结果后实施 |
|
| **N-9** | 分段消息被拼接进流式消息,并被 `complete` 替换丢弃 | `astrbot.rs:379`(`map_plain`)、`astrbot.rs:405`(`map_complete`) | 真因已定位,待重复性探针结果后实施 |
|
||||||
| **F-44** | 发送后不滚动到底部,流式生成发生在视口外 | `ChatPanel.tsx` 全文件无 scroll 代码 | 已归档于 R6,用户 2026-07-27 反馈确认 |
|
| **F-44** | 发送后不滚动到底部,流式生成发生在视口外 | `ChatPanel.tsx` 全文件无 scroll 代码 | 已归档于 R6,用户 2026-07-27 反馈确认 |
|
||||||
| **N-8** | 消息进入列表无过渡动画,生硬出现 | `ChatPanel.tsx` 消息列表渲染 | 新记录,用户要求类 TG 的淡入过渡 |
|
| **N-8** | 消息进入列表无过渡动画,生硬出现 | `ChatPanel.tsx` 消息列表渲染 | 新记录,用户要求类 TG 的淡入过渡 |
|
||||||
|
|
||||||
### 桌宠两项(2026-07-27 真机反馈)
|
### 桌宠两项(2026-07-27 真机反馈,均已闭环)
|
||||||
|
|
||||||
| ID | 问题 | 根因 | 状态 |
|
| ID | 问题 | 根因 | 状态 |
|
||||||
| --- | --- | --- | --- |
|
| -------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| **N-10** | 应用内桌宠周边是不透明深色卡片 | `styles.css:1621` 的 `.app-pet-overlay .pet-window-embedded` 画了 92%/88% 不透明渐变 + 边框 + 投影。基类 `.pet-window` 本是 `transparent`,但该规则特异度更高(0,2,0)。**这是同一样式表第四次因重复/覆盖定义产生真实故障** | 已修 |
|
| **N-10** | 应用内桌宠周边是不透明深色卡片 | `styles.css:1621` 的 `.app-pet-overlay .pet-window-embedded` 画了 92%/88% 不透明渐变 + 边框 + 投影。基类 `.pet-window` 本是 `transparent`,但该规则特异度更高(0,2,0)。**这是同一样式表第四次因重复/覆盖定义产生真实故障** | 已修 |
|
||||||
| **N-11** | 切到「桌面悬浮」模式桌宠直接消失 | `close_pet_window`(`lib.rs:394`)用 `destroy()` 而非隐藏;应用启动时默认 `app-ui` 模式会立刻销毁配置创建的窗口。此后 `open_pet_window` 必走 `WebviewWindowBuilder::from_config` 重建分支,而配置声明 `"visible": false` —— **窗口建出来了但从未 `show()`**。已存在窗口的分支有 `.show()` 与定位,重建分支两者皆无 | 已修(抽出 `reveal_pet_window` 供两条路径共用) |
|
| **N-11** | 切到「桌面悬浮」模式桌宠直接消失 | `close_pet_window` 用 `destroy()` 而非隐藏。应用启动时默认 `app-ui` 模式会立刻销毁配置创建的窗口(真机日志:启动时 `close_pet_window invoked window_existed=true` 出现两次,React StrictMode 双挂载),此后 `open_pet_window` 必走 `WebviewWindowBuilder::from_config` 重建分支,而**该分支整体失败**——日志显示 `open_pet_window invoked window_existed=false` 之后既无 `pet window revealed` 也无失败行,即在配置查找 / `from_config` / `build()` 三处裸 `?` 之一返回 Err 且无日志。改为 `hide()` 后每次打开都走「窗口已存在」这条已验证可用的分支 | 已修(`4f73c08`)。真机确认:`window_existed=true` → `pet window revealed monitors=2 monitor_work_area=3840x2088+0+0 position=3554,1742 size=270x330 visible=true`,右下角 16px 安全边距正确 |
|
||||||
|
| — | _N-11 排查中提出并被推翻的两条根因_ | ①「重建分支没调 `show()`」——是真实代码缺陷(配置声明 `"visible": false`),已修,但**不是本症状的原因**:修完桌宠依旧不出现。②「`DesktopPetView` 缺 Suspense 边界」——**变异测试直接推翻**,React 19 容忍无边界的 lazy 组件。教训:在拿到日志前不应给根因结论,这一条上我连错两次 | 已记录 |
|
||||||
|
|
||||||
## 功能空缺盘点(2026-07-27)
|
## 功能空缺盘点(2026-07-27)
|
||||||
|
|
||||||
|
|
@ -295,11 +296,11 @@ AstrBot 在一次回复中**交错**投递两类 `plain` 帧:
|
||||||
(`AGENTS.md:9-14`,版本节点 `v0.3.0-alpha.1`),架构文档 §14 有设计边界。实际成色如下,
|
(`AGENTS.md:9-14`,版本节点 `v0.3.0-alpha.1`),架构文档 §14 有设计边界。实际成色如下,
|
||||||
均为**逐条 grep 验证**,非文档声称:
|
均为**逐条 grep 验证**,非文档声称:
|
||||||
|
|
||||||
| 能力 | 实际状态 |
|
| 能力 | 实际状态 |
|
||||||
| --- | --- |
|
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| **语音聊天** | `ChatPanel.tsx:647` 用浏览器 Web Speech API。**WebView2 不提供 `SpeechRecognition`**,故语音输入在应用内大概率恒不可用;朗读(`speechSynthesis`)可用。而架构 §14.1 定的是「按键录音 → 上传音频 → 服务端 STT → 文本回复 → 可选 TTS」,**方向与现实现不一致**。麦克风绑定聚焦实例、双面板目标显示与快捷键切换:**均未实现** |
|
| **语音聊天** | `ChatPanel.tsx:647` 用浏览器 Web Speech API。**WebView2 不提供 `SpeechRecognition`**,故语音输入在应用内大概率恒不可用;朗读(`speechSynthesis`)可用。而架构 §14.1 定的是「按键录音 → 上传音频 → 服务端 STT → 文本回复 → 可选 TTS」,**方向与现实现不一致**。麦克风绑定聚焦实例、双面板目标显示与快捷键切换:**均未实现** |
|
||||||
| **窗口感知** | Rust 侧已完成:`foreground_window.rs`(191行)、`uia.rs`(339行)、`capture.rs`(363行)。但**只有 `inspect_foreground_window` 与 `inspect_process` 注册为命令**,`uia` 与 `capture` 无任何出口。前端仅 `SettingsPages.tsx:136` 的诊断按钮手动调用,**没有任何通路把结果送给陪伴实例** |
|
| **窗口感知** | Rust 侧已完成:`foreground_window.rs`(191行)、`uia.rs`(339行)、`capture.rs`(363行)。但**只有 `inspect_foreground_window` 与 `inspect_process` 注册为命令**,`uia` 与 `capture` 无任何出口。前端仅 `SettingsPages.tsx:136` 的诊断按钮手动调用,**没有任何通路把结果送给陪伴实例** |
|
||||||
| **游戏陪伴** | 仅有 `pet-game-mode-toggle` 事件与 `gameMode` 状态,**只改窗口偏好**,不截图、不读窗口、不产生事件。架构 §14.2 的隔离规则(运维槽位不得自动接收游戏截图/窗口状态/事件)目前无从违反,因为没有数据流 |
|
| **游戏陪伴** | 仅有 `pet-game-mode-toggle` 事件与 `gameMode` 状态,**只改窗口偏好**,不截图、不读窗口、不产生事件。架构 §14.2 的隔离规则(运维槽位不得自动接收游戏截图/窗口状态/事件)目前无从违反,因为没有数据流 |
|
||||||
|
|
||||||
**实施前必须先定的三处硬约束**:
|
**实施前必须先定的三处硬约束**:
|
||||||
|
|
||||||
|
|
@ -319,83 +320,83 @@ AstrBot 在一次回复中**交错**投递两类 `plain` 帧:
|
||||||
|
|
||||||
已加 `trace_frame_shape()`(`astrbot_client.rs`,`RUST_LOG=astrbot_desktop=debug` 开启,只记结构不记内容)。
|
已加 `trace_frame_shape()`(`astrbot_client.rs`,`RUST_LOG=astrbot_desktop=debug` 开启,只记结构不记内容)。
|
||||||
|
|
||||||
| ID | 问题 | 候选根因 | 判据 |
|
| ID | 问题 | 候选根因 | 判据 |
|
||||||
| --- | --- | --- | --- |
|
| ------- | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
|
||||||
| **N-4** | 生成中概率出现两个回复气泡,结束后恢复成一个 | **候选 A = F-34(P2-13)**:`ChatPanel.tsx:976` 与 `commands.rs:412` 同用 `messageId \|\| eventId` 回退,`event_id` 每事件唯一,任一 delta 缺 `message_id` 即自成一条消息。**候选 B**:`ChatPanel.tsx:74-75` 的 `historySessionId` 回退到 `storedSessions[0]`,会加载**另一个会话**的历史并合并 | 日志中 `plain` 帧的 `has_message_id` 是否恒为 true |
|
| **N-4** | 生成中概率出现两个回复气泡,结束后恢复成一个 | **候选 A = F-34(P2-13)**:`ChatPanel.tsx:976` 与 `commands.rs:412` 同用 `messageId \|\| eventId` 回退,`event_id` 每事件唯一,任一 delta 缺 `message_id` 即自成一条消息。**候选 B**:`ChatPanel.tsx:74-75` 的 `historySessionId` 回退到 `storedSessions[0]`,会加载**另一个会话**的历史并合并 | 日志中 `plain` 帧的 `has_message_id` 是否恒为 true |
|
||||||
| **N-5** | 「恢复成一个」不是自愈 | `activeMessages`(`ChatPanel.tsx:116`)按 sessionId 过滤,只是**遮住**孤儿气泡;React state 与 SQLite 中它仍在 | 需随 N-4 一并清理 |
|
| **N-5** | 「恢复成一个」不是自愈 | `activeMessages`(`ChatPanel.tsx:116`)按 sessionId 过滤,只是**遮住**孤儿气泡;React state 与 SQLite 中它仍在 | 需随 N-4 一并清理 |
|
||||||
| **N-6** | 插件发的图片不显示 | `map_media()`(`astrbot.rs:339`)只记 `pending_media` 不产出事件,必须等后续 `attachment_saved` 配对;**若插件的 image 帧自带 id/URL 且无该后续帧,图片被静默丢弃**。另:非图片媒体全丢(F-33)、`pending_media` 单槽位(F-33)、id 字符集限 `[A-Za-z0-9._-]` 挡掉 URL 形态 | 日志中 image 帧的 `data_keys`,以及其后是否出现 `attachment_saved` |
|
| **N-6** | 插件发的图片不显示 | `map_media()`(`astrbot.rs:339`)只记 `pending_media` 不产出事件,必须等后续 `attachment_saved` 配对;**若插件的 image 帧自带 id/URL 且无该后续帧,图片被静默丢弃**。另:非图片媒体全丢(F-33)、`pending_media` 单槽位(F-33)、id 字符集限 `[A-Za-z0-9._-]` 挡掉 URL 形态 | 日志中 image 帧的 `data_keys`,以及其后是否出现 `attachment_saved` |
|
||||||
| **N-7** | 图片即便拿到也可能被 CSP 拦 | `tauri.conf.json:45` 的 `img-src 'self' asset: http://asset.localhost data: blob:` 不含任意 http 源 | 若插件走 URL,**倾向代理下载转 blob**,不放宽 `img-src`——放宽等于让渲染层直连任意外部主机 |
|
| **N-7** | 图片即便拿到也可能被 CSP 拦 | `tauri.conf.json:45` 的 `img-src 'self' asset: http://asset.localhost data: blob:` 不含任意 http 源 | 若插件走 URL,**倾向代理下载转 blob**,不放宽 `img-src`——放宽等于让渲染层直连任意外部主机 |
|
||||||
|
|
||||||
* * *
|
---
|
||||||
|
|
||||||
## R4 · 数据与凭据安全批
|
## R4 · 数据与凭据安全批
|
||||||
|
|
||||||
| ID | 来源 | 位置 | 动作 | 验证 |
|
| ID | 来源 | 位置 | 动作 | 验证 |
|
||||||
| --- | --- | --- | --- | --- |
|
| -------- | ----- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| **F-20** | P1-6 | `database/mod.rs:319-320` | 改 `SELECT * FROM (… ORDER BY updated_at DESC LIMIT ?) ORDER BY updated_at ASC`;补 `before`/`after` 游标参数 | 单测:插入 250 条,加载返回最新 100 条 |
|
| **F-20** | P1-6 | `database/mod.rs:319-320` | 改 `SELECT * FROM (… ORDER BY updated_at DESC LIMIT ?) ORDER BY updated_at ASC`;补 `before`/`after` 游标参数 | 单测:插入 250 条,加载返回最新 100 条 |
|
||||||
| **F-21** | P1-18 | `diagnostics/redaction.rs:91` | `key_value_regex` 候选加入裸 `token`、`auth[_-]?token`、`id[_-]?token`、`session[_-]?token`;新增 JWT 形态正则 `eyJ[\w-]+\.[\w-]+\.[\w-]+` | 新测试**不使用 known_secrets**:`token=eyJ…`、`?token=…`、YAML `token: eyJ…` 均须被脱敏(现有测试用 canary 掩盖了缺口,需一并重写) |
|
| **F-21** | P1-18 | `diagnostics/redaction.rs:91` | `key_value_regex` 候选加入裸 `token`、`auth[_-]?token`、`id[_-]?token`、`session[_-]?token`;新增 JWT 形态正则 `eyJ[\w-]+\.[\w-]+\.[\w-]+` | 新测试**不使用 known_secrets**:`token=eyJ…`、`?token=…`、YAML `token: eyJ…` 均须被脱敏(现有测试用 canary 掩盖了缺口,需一并重写) |
|
||||||
| **F-22** | P2-11 | `diagnostics/config.rs:213,232,259` | YAML/INI/.env 增加按 key 的行级结构化脱敏(对齐 JSON/TOML 的 `is_sensitive_key` 路径) | `.env` 内 `AUTH_TOKEN=…` 经诊断返回时为 `[REDACTED]` |
|
| **F-22** | P2-11 | `diagnostics/config.rs:213,232,259` | YAML/INI/.env 增加按 key 的行级结构化脱敏(对齐 JSON/TOML 的 `is_sensitive_key` 路径) | `.env` 内 `AUTH_TOKEN=…` 经诊断返回时为 `[REDACTED]` |
|
||||||
| **F-23** | P2-9 | `profiles.rs:213-218` | 删除 profile 前读取 `credential_reference` 并 `store.delete`;可选:启动时孤儿凭据对账 | 删除 profile 后 Credential Manager 中对应条目消失 |
|
| **F-23** | P2-9 | `profiles.rs:213-218` | 删除 profile 前读取 `credential_reference` 并 `store.delete`;可选:启动时孤儿凭据对账 | 删除 profile 后 Credential Manager 中对应条目消失 |
|
||||||
| **F-24** | P2-10 | `auth.rs:13-20`;`credentials/mod.rs:11-20` | 两个请求结构体手写 `Debug`(敏感字段输出 `[REDACTED]`)或改 `secrecy::SecretString` | 单测断言 `format!("{:?}", req)` 不含明文(对齐 `SecretCredential` 既有测试) |
|
| **F-24** | P2-10 | `auth.rs:13-20`;`credentials/mod.rs:11-20` | 两个请求结构体手写 `Debug`(敏感字段输出 `[REDACTED]`)或改 `secrecy::SecretString` | 单测断言 `format!("{:?}", req)` 不含明文(对齐 `SecretCredential` 既有测试) |
|
||||||
| **F-25** | P2-12 | `database/mod.rs:524,556` 及相关读写 | 统一 `account_id` 键模型:两表都含并全部读写带上,或彻底移除该列 —— 二选一,写进 ADR | 迁移测试 + 隔离测试 |
|
| **F-25** | P2-12 | `database/mod.rs:524,556` 及相关读写 | 统一 `account_id` 键模型:两表都含并全部读写带上,或彻底移除该列 —— 二选一,写进 ADR | 迁移测试 + 隔离测试 |
|
||||||
|
|
||||||
* * *
|
---
|
||||||
|
|
||||||
## R5 · 协议健壮与契约治理批
|
## R5 · 协议健壮与契约治理批
|
||||||
|
|
||||||
| ID | 来源 | 位置 | 动作 | 验证 |
|
| ID | 来源 | 位置 | 动作 | 验证 |
|
||||||
| --- | --- | --- | --- | --- |
|
| -------- | ----- | -------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
||||||
| **F-26** | P1-5 | `gateway_client.rs:179-184,282-284` | `UnsupportedEventType` / `InvalidPayload` 降级为事件级跳过(记日志、推进 `last_event_id`),仅版本/身份不匹配保持终态 | 单测:mock 推未知事件类型 → 槽位保持 Connected,后续事件正常 |
|
| **F-26** | P1-5 | `gateway_client.rs:179-184,282-284` | `UnsupportedEventType` / `InvalidPayload` 降级为事件级跳过(记日志、推进 `last_event_id`),仅版本/身份不匹配保持终态 | 单测:mock 推未知事件类型 → 槽位保持 Connected,后续事件正常 |
|
||||||
| **F-27** | P2-15 | `envelope.rs:171` 及各 payload | 信封与只读 payload 移除 `deny_unknown_fields`(`ToolProposal`/`ToolResult` **保留**);或解析失败跳过并推进游标 | 单测:信封带附加字段仍能解析;不再出现重放死循环 |
|
| **F-27** | P2-15 | `envelope.rs:171` 及各 payload | 信封与只读 payload 移除 `deny_unknown_fields`(`ToolProposal`/`ToolResult` **保留**);或解析失败跳过并推进游标 | 单测:信封带附加字段仍能解析;不再出现重放死循环 |
|
||||||
| **F-28** | P1-8 | `docs/protocol/v1/schemas/`;`tests/protocol_contract.rs` | 重跑 `export_schemas --write`;新增测试比对 `generated_schemas()` 与磁盘文件 | `cargo test` 即可发现漂移;`connection-profile.schema.json` 含 `remoteDisplayName` |
|
| **F-28** | P1-8 | `docs/protocol/v1/schemas/`;`tests/protocol_contract.rs` | 重跑 `export_schemas --write`;新增测试比对 `generated_schemas()` 与磁盘文件 | `cargo test` 即可发现漂移;`connection-profile.schema.json` 含 `remoteDisplayName` |
|
||||||
| **F-29** | P2-16 | `astrbot.rs:17-43`;`src/features/chat/types.ts:13`;`ChatPanel.tsx:240`;README | `TransportKind` 加 `#[serde(rename = "astrbot-openapi")]` 统一两套拼写,前端 enum 与文档同步(**跨端原子改动,一次落地**;DB 值不变,无迁移) | 全库 grep 无 `astr-bot-open-api` 残留 |
|
| **F-29** | P2-16 | `astrbot.rs:17-43`;`src/features/chat/types.ts:13`;`ChatPanel.tsx:240`;README | `TransportKind` 加 `#[serde(rename = "astrbot-openapi")]` 统一两套拼写,前端 enum 与文档同步(**跨端原子改动,一次落地**;DB 值不变,无迁移) | 全库 grep 无 `astr-bot-open-api` 残留 |
|
||||||
| **F-30** | P2-5 | `astrbot_client.rs:128-133,431-438` | 删除恒 false 的身份自比较,或改为探测可观测特征后再比对;文档明示 AstrBot 身份为 URL 派生 | 代码无死分支;`docs/decisions/` 记录该限制 |
|
| **F-30** | P2-5 | `astrbot_client.rs:128-133,431-438` | 删除恒 false 的身份自比较,或改为探测可观测特征后再比对;文档明示 AstrBot 身份为 URL 派生 | 代码无死分支;`docs/decisions/` 记录该限制 |
|
||||||
| **F-31** | P2-19 | `mock-gateway/src/routes.rs:196-206`、`state.rs:161-173`、`config.rs:29-31` | `Lagged` 改 `break`(迫使走重连重放);cursor 未命中先发 gap 事件;`server_instance_id` 掺端口 | soak 增加 sequence 单调无缺口断言 |
|
| **F-31** | P2-19 | `mock-gateway/src/routes.rs:196-206`、`state.rs:161-173`、`config.rs:29-31` | `Lagged` 改 `break`(迫使走重连重放);cursor 未命中先发 gap 事件;`server_instance_id` 掺端口 | soak 增加 sequence 单调无缺口断言 |
|
||||||
| **F-32** | P2-17 | `astrbot.rs:381-444` | complete 后记录 per-message 完成标记,同 id 的后续 plain/complete 需显式重新开窗或忽略 | 单测覆盖"重复 complete"与"complete 后迟到 plain" |
|
| **F-32** | P2-17 | `astrbot.rs:381-444` | complete 后记录 per-message 完成标记,同 id 的后续 plain/complete 需显式重新开窗或忽略 | 单测覆盖"重复 complete"与"complete 后迟到 plain" |
|
||||||
| **F-33** | P2-18 | `astrbot.rs:336-353` | 非图片媒体输出通用占位标记;`pending_media` 改 FIFO 队列 | 单测:`record` + `attachment_saved` 产出可见标记;双图交错不丢 |
|
| **F-33** | P2-18 | `astrbot.rs:336-353` | 非图片媒体输出通用占位标记;`pending_media` 改 FIFO 队列 | 单测:`record` + `attachment_saved` 产出可见标记;双图交错不丢 |
|
||||||
| **F-34** | P2-13 | `commands.rs:341`;`ChatPanel.tsx:916-917` | mapper 为无 `message_id` 的流合成稳定流内 id(如 `synthetic-{stream}`),前后端同步取消 event_id 回退 | 单测:省略 message_id 的多帧流合并为一条消息 |
|
| **F-34** | P2-13 | `commands.rs:341`;`ChatPanel.tsx:916-917` | mapper 为无 `message_id` 的流合成稳定流内 id(如 `synthetic-{stream}`),前后端同步取消 event_id 回退 | 单测:省略 message_id 的多帧流合并为一条消息 |
|
||||||
| **F-70** | P2-6 | `astrbot_client.rs:383-388` | `download_attachment` 先查 `Content-Length`,改流式累读并在超过 16MiB 时立即中断,不再整体读入内存后才校验 | 单测:mock 返回超限 body,客户端在读满前返回超限错误且内存占用有界 |
|
| **F-70** | P2-6 | `astrbot_client.rs:383-388` | `download_attachment` 先查 `Content-Length`,改流式累读并在超过 16MiB 时立即中断,不再整体读入内存后才校验 | 单测:mock 返回超限 body,客户端在读满前返回超限错误且内存占用有界 |
|
||||||
| **F-71** | P2-7 | `gateway_client.rs:121-126` | `health()` 与 SSE 一致附带 bearer | 单测:mock 对无 bearer 的 health 返回 401,激活仍成功即失败 |
|
| **F-71** | P2-7 | `gateway_client.rs:121-126` | `health()` 与 SSE 一致附带 bearer | 单测:mock 对无 bearer 的 health 返回 401,激活仍成功即失败 |
|
||||||
| **F-72** | P2-8 | `gateway_client.rs:237-238` | 仅在「连接存活超阈值且收到过事件」时重置退避,避免服务端接受即优雅关流时进入约 10 次/秒热重连 | 单测:mock 接受连接后立即关闭,断言重连间隔单调增长 |
|
| **F-72** | P2-8 | `gateway_client.rs:237-238` | 仅在「连接存活超阈值且收到过事件」时重置退避,避免服务端接受即优雅关流时进入约 10 次/秒热重连 | 单测:mock 接受连接后立即关闭,断言重连间隔单调增长 |
|
||||||
| **F-73** | P2-29 | `astrbot_client.rs:554-565` | JWT `exp` 判定改 `exp <= now + 30s`;不可解析的 token 打 debug 日志 | 单测:`exp` 落在 30 秒内的 token 被判为过期 |
|
| **F-73** | P2-29 | `astrbot_client.rs:554-565` | JWT `exp` 判定改 `exp <= now + 30s`;不可解析的 token 打 debug 日志 | 单测:`exp` 落在 30 秒内的 token 被判为过期 |
|
||||||
|
|
||||||
上列四项系 2026-07-27 补编。它们与 F-26、F-30 同处 `gateway_client.rs` / `astrbot_client.rs`,按本队列
|
上列四项系 2026-07-27 补编。它们与 F-26、F-30 同处 `gateway_client.rs` / `astrbot_client.rs`,按本队列
|
||||||
「同文件相邻改动合并进同一批」的编排原则归入 R5;放入 R4 会让两个可并行分支争夺同一文件。
|
「同文件相邻改动合并进同一批」的编排原则归入 R5;放入 R4 会让两个可并行分支争夺同一文件。
|
||||||
R5 因此由 9 项增至 13 项,与 R3、R4 仍无依赖关系。
|
R5 因此由 9 项增至 13 项,与 R3、R4 仍无依赖关系。
|
||||||
|
|
||||||
* * *
|
---
|
||||||
|
|
||||||
## R6 · 体验、无障碍与产品红线批
|
## R6 · 体验、无障碍与产品红线批
|
||||||
|
|
||||||
| ID | 来源 | 位置 | 动作 |
|
| ID | 来源 | 位置 | 动作 |
|
||||||
| --- | --- | --- | --- |
|
| -------- | ----- | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| **F-35** | P2-30 | `DesktopPetView.tsx:139-148`;`tauri.conf.json` | **产品红线**:`alwaysOnTop` 默认改 `false`(隔离基线要求气泡/桌宠不默认置顶);embedded 模式跳过偏好写入;非 embedded 先读既有偏好再增量提交 |
|
| **F-35** | P2-30 | `DesktopPetView.tsx:139-148`;`tauri.conf.json` | **产品红线**:`alwaysOnTop` 默认改 `false`(隔离基线要求气泡/桌宠不默认置顶);embedded 模式跳过偏好写入;非 embedded 先读既有偏好再增量提交 |
|
||||||
| **F-36** | P2-20 | `ChatPanel.tsx:73-74,181-187,264-293` | mark-read 完成后再重取会话列表;仅存在真实 `activeSessionId` 时标已读;非选中槽位监听事件递增未读 |
|
| **F-36** | P2-20 | `ChatPanel.tsx:73-74,181-187,264-293` | mark-read 完成后再重取会话列表;仅存在真实 `activeSessionId` 时标已读;非选中槽位监听事件递增未读 |
|
||||||
| **F-37** | P2-21 | `ChatPanel.tsx:468-475` | `retryMessage` 增加 `sessionId === activeSessionId` 过滤;`messageOverride` 与 draft 回退解耦 |
|
| **F-37** | P2-21 | `ChatPanel.tsx:468-475` | `retryMessage` 增加 `sessionId === activeSessionId` 过滤;`messageOverride` 与 draft 回退解耦 |
|
||||||
| **F-38** | P2-22 | `ChatPanel.tsx:435-457` | 按 `code === "cancelled"` 区分取消与真错误;停止时保留已收内容为正常消息,不标 error、不弹横幅 |
|
| **F-38** | P2-22 | `ChatPanel.tsx:435-457` | 按 `code === "cancelled"` 区分取消与真错误;停止时保留已收内容为正常消息,不标 error、不弹横幅 |
|
||||||
| **F-39** | P2-23 | `ChatPanel.tsx:920-925`;`chat/types.ts` | `ChatMessage` 补 `profileId`/`serverInstanceId` 并纳入所有 find/filter/去重键(对齐四元组规范) |
|
| **F-39** | P2-23 | `ChatPanel.tsx:920-925`;`chat/types.ts` | `ChatMessage` 补 `profileId`/`serverInstanceId` 并纳入所有 find/filter/去重键(对齐四元组规范) |
|
||||||
| **F-40** | P2-24 | `styles.css:3116-3139` | 去掉 `visibility:hidden`,仅用 opacity + pointer-events,解开键盘 focus-within 死锁 |
|
| **F-40** | P2-24 | `styles.css:3116-3139` | 去掉 `visibility:hidden`,仅用 opacity + pointer-events,解开键盘 focus-within 死锁 |
|
||||||
| **F-41** | P2-25 | `ChatPanel.tsx:607-620,711-717` | 箭头切换时 `focus()` 目标 tab;两个 panel id 常驻或动态 `aria-controls`;`aria-busy` 与 `aria-live` 分离 |
|
| **F-41** | P2-25 | `ChatPanel.tsx:607-620,711-717` | 箭头切换时 `focus()` 目标 tab;两个 panel id 常驻或动态 `aria-controls`;`aria-busy` 与 `aria-live` 分离 |
|
||||||
| **F-42** | P2-26 | `CredentialEnrollmentCard.tsx:34-80` | `finally` 中清空 secret/password/totp;两处 `invoke` 返回值补 zod schema |
|
| **F-42** | P2-26 | `CredentialEnrollmentCard.tsx:34-80` | `finally` 中清空 secret/password/totp;两处 `invoke` 返回值补 zod schema |
|
||||||
| **F-43** | P2-27 | `ChatPanel.tsx:343-354` | 首次 refresh 失败也建立退避轮询;snapshot schema strict 失败给可见告警而非静默离线 |
|
| **F-43** | P2-27 | `ChatPanel.tsx:343-354` | 首次 refresh 失败也建立退避轮询;snapshot schema strict 失败给可见告警而非静默离线 |
|
||||||
| **F-44** | P2-28 | `ChatPanel.tsx` | 消息列表底部锚点 +"接近底部才跟随";unmount 调 `recognition.stop()` / `speechSynthesis.cancel()`;朗读前 Markdown 转纯文本 |
|
| **F-44** | P2-28 | `ChatPanel.tsx` | 消息列表底部锚点 +"接近底部才跟随";unmount 调 `recognition.stop()` / `speechSynthesis.cancel()`;朗读前 Markdown 转纯文本 |
|
||||||
|
|
||||||
* * *
|
---
|
||||||
|
|
||||||
## R7 · 性能与工程化批
|
## R7 · 性能与工程化批
|
||||||
|
|
||||||
| ID | 来源 | 动作 | 预期收益 |
|
| ID | 来源 | 动作 | 预期收益 |
|
||||||
| --- | --- | --- | --- |
|
| -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
|
||||||
| **F-45** | 优化 §2 | `DesktopPetView.tsx:10` 去掉 `?inline` 改普通资源引用,manifest 与 import 同时切到已有的 WebP | lazy chunk 从 \~5.2MB 降到 \~0.6MB |
|
| **F-45** | 优化 §2 | `DesktopPetView.tsx:10` 去掉 `?inline` 改普通资源引用,manifest 与 import 同时切到已有的 WebP | lazy chunk 从 \~5.2MB 降到 \~0.6MB |
|
||||||
| **F-46** | 优化 §1 | `activeMessages` memo 依赖改标量 `activeSessionId`;`MessageContent` 套 `React.memo`;`applyRuntimeEvents` 只克隆命中项;`messages` 按会话修剪 | 消除 500ms 全表重渲染与重复 Markdown 解析 |
|
| **F-46** | 优化 §1 | `activeMessages` memo 依赖改标量 `activeSessionId`;`MessageContent` 套 `React.memo`;`applyRuntimeEvents` 只克隆命中项;`messages` 按会话修剪 | 消除 500ms 全表重渲染与重复 Markdown 解析 |
|
||||||
| **F-47** | 优化 §3 | 附件上传/下载改 Tauri 2 raw body / `tauri::ipc::Response` 二进制通道;Rust 侧去掉 `bytes.clone()` | 16MiB 附件不再膨胀成 1670 万元素数组 |
|
| **F-47** | 优化 §3 | 附件上传/下载改 Tauri 2 raw body / `tauri::ipc::Response` 二进制通道;Rust 侧去掉 `bytes.clone()` | 16MiB 附件不再膨胀成 1670 万元素数组 |
|
||||||
| **F-48** | P2-14 | 事件通道改"每槽独立 mpsc + 唯一持久化点 + 广播 emit",移除 `drain_connection_runtime_events` | 消除双消费者抢事件与跨槽背压 |
|
| **F-48** | P2-14 | 事件通道改"每槽独立 mpsc + 唯一持久化点 + 广播 emit",移除 `drain_connection_runtime_events` | 消除双消费者抢事件与跨槽背压 |
|
||||||
| **F-49** | 优化 §2 | `send_slot_message` 的 `client.take()` 改 `clone()`,以 `message_cancellation` 存在性串行化发送 | 长流期间 sessions/capabilities/upload 不再误报"未连接" |
|
| **F-49** | 优化 §2 | `send_slot_message` 的 `client.take()` 改 `clone()`,以 `message_cancellation` 存在性串行化发送 | 长流期间 sessions/capabilities/upload 不再误报"未连接" |
|
||||||
| **F-50** | 优化 §5 | `styles.css` 以 `--ui-*` 为唯一 token 源合并,删除 OS 亮色媒体查询块与幽灵 token,引入 stylelint | 减约 40% 死样式;修复暗色下链接对比度 |
|
| **F-50** | 优化 §5 | `styles.css` 以 `--ui-*` 为唯一 token 源合并,删除 OS 亮色媒体查询块与幽灵 token,引入 stylelint | 减约 40% 死样式;修复暗色下链接对比度 |
|
||||||
| **F-51** | P2-31 | `tauri.conf.json` 的 `beforeDevCommand`/`beforeBuildCommand` 改 `pnpm run`;engines 与 `@types/node` 对齐;文档 React 版本更正为 19 | 消除双包管理器混跑 |
|
| **F-51** | P2-31 | `tauri.conf.json` 的 `beforeDevCommand`/`beforeBuildCommand` 改 `pnpm run`;engines 与 `@types/node` 对齐;文档 React 版本更正为 19 | 消除双包管理器混跑 |
|
||||||
| **F-52** | P3-17 | tsconfig 补 `noUnusedLocals`/`noUncheckedIndexedAccess`;eslint 接 jsx-a11y、重开 `set-state-in-effect`;vitest 加 coverage;关掉无谓的 `usePolling` | 编译期即可暴露索引假设类缺陷 |
|
| **F-52** | P3-17 | tsconfig 补 `noUnusedLocals`/`noUncheckedIndexedAccess`;eslint 接 jsx-a11y、重开 `set-state-in-effect`;vitest 加 coverage;关掉无谓的 `usePolling` | 编译期即可暴露索引假设类缺陷 |
|
||||||
|
|
||||||
* * *
|
---
|
||||||
|
|
||||||
## R8 · 剩余 P3 与外部依赖
|
## R8 · 剩余 P3 与外部依赖
|
||||||
|
|
||||||
|
|
@ -416,19 +417,19 @@ R5 因此由 9 项增至 13 项,与 R3、R4 仍无依赖关系。
|
||||||
- **工具提案六道闸门**:未开始实现属阶段合理;**在闸门落地前不得放开任何工具执行入口**,`connection_policy_status` 应如实上报 guard 未激活。
|
- **工具提案六道闸门**:未开始实现属阶段合理;**在闸门落地前不得放开任何工具执行入口**,`connection_policy_status` 应如实上报 guard 未激活。
|
||||||
- **签名更新、双服务器 soak**:维持现状,不在本地伪造。
|
- **签名更新、双服务器 soak**:维持现状,不在本地伪造。
|
||||||
|
|
||||||
* * *
|
---
|
||||||
|
|
||||||
## 附录 · 批次依赖图与建议分支
|
## 附录 · 批次依赖图与建议分支
|
||||||
|
|
||||||
| 批次 | 依赖 | 建议分支 | 可并行 |
|
| 批次 | 依赖 | 建议分支 | 可并行 |
|
||||||
| --- | --- | --- | --- |
|
| ---- | ---------- | --------------------------------- | ------------------------------- |
|
||||||
| R1 | 无 | `fix/p02-release-blockers` | 内部 9 项可并行(除 F-06→F-08) |
|
| R1 | 无 | `fix/p02-release-blockers` | 内部 9 项可并行(除 F-06→F-08) |
|
||||||
| R2 | R1 的 F-01 | `fix/astrbot-stream-transport` | 内部串行 |
|
| R2 | R1 的 F-01 | `fix/astrbot-stream-transport` | 内部串行 |
|
||||||
| R3 | R1 的 F-06 | `fix/slot-isolation-and-state` | Rust 项与前端项可分两人 |
|
| R3 | R1 的 F-06 | `fix/slot-isolation-and-state` | Rust 项与前端项可分两人 |
|
||||||
| R4 | 无 | `fix/data-and-secret-boundaries` | 与 R2/R3 并行 |
|
| R4 | 无 | `fix/data-and-secret-boundaries` | 与 R2/R3 并行 |
|
||||||
| R5 | 无 | `fix/protocol-contract-hardening` | 与 R2/R3/R4 并行 |
|
| R5 | 无 | `fix/protocol-contract-hardening` | 与 R2/R3/R4 并行 |
|
||||||
| R6 | R3 | `fix/chat-ux-and-a11y` | — |
|
| R6 | R3 | `fix/chat-ux-and-a11y` | — |
|
||||||
| R7 | R6 | `perf/frontend-and-ipc` | — |
|
| R7 | R6 | `perf/frontend-and-ipc` | — |
|
||||||
| R8 | — | 随批携带 | — |
|
| R8 | — | 随批携带 | — |
|
||||||
|
|
||||||
按 `AGENTS.md` §11,每批合并前须走完:fmt → lint → typecheck → clippy(-D warnings) → 单元测试 → 适用集成测试 → 生产构建 → 更新 `docs/progress.md` 与 `CHANGELOG.md`。R1 与 R2 合并后建议同时刷新 `docs/q9-local-acceptance.md` 的验证记录。
|
按 `AGENTS.md` §11,每批合并前须走完:fmt → lint → typecheck → clippy(-D warnings) → 单元测试 → 适用集成测试 → 生产构建 → 更新 `docs/progress.md` 与 `CHANGELOG.md`。R1 与 R2 合并后建议同时刷新 `docs/q9-local-acceptance.md` 的验证记录。
|
||||||
|
|
|
||||||
正在加载…
添加表格
在新工单中引用