🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
📝 docs(skills): UX audit (L1) worked examples for 5 chat surfaces (#16637)
Arvin Xu1dd5077ff431
diff --git a/.agents/skills/ux-audit/SKILL.md b/.agents/skills/ux-audit/SKILL.mdindex 1cfcf84998c..c58b05cdbb9 100644--- a/.agents/skills/ux-audit/SKILL.md+++ b/.agents/skills/ux-audit/SKILL.md@@ -1,7 +1,6 @@---name: ux-auditdescription: 'Audit a page / surface against the Designing Interfaces pattern language + the ux skill checklists, then land findings. Three layers — static (code), visual (screenshots), dynamic (automated user journey + perf). Use to run a repeatable, standards-based UX review of one screen.'-disable-model-invocation: trueargument-hint: '<page-or-surface> [--l1 | --l2 | --l3]'---@@ -177,8 +176,8 @@ open-redirect guard, a smart default: these are the **good cases**. Name them, creports no good cases can only ever sharpen the ❌ side of the checklists.- **They protect.** "Don't regress this" is a finding. The next refactor needs to knowwhich behaviors are load-bearing — the **Strengths worth preserving** block in- [`example/tasks.md`](references/example/tasks.md) (the loading/not-found state machine,- comment-draft-preserved-on-failure, the run-all preview → confirm flow) and the **✅ 亮点**+ [`example/task-detail.md`](references/example/task-detail.md) (the loading/not-found state+ machine, comment-draft-preserved-on-failure, the run-all preview → confirm flow) and the **✅ 亮点**rows in [`example/home.md`](references/example/home.md) (empty-send → day's-hint fallback,drawer-not-navigate surface contract) are exactly that list.- **They calibrate severity.** A gap reads differently against a surface that is otherwise@@ -186,8 +185,8 @@ open-redirect guard, a smart default: these are the **good cases**. Name them, c> ❌ The drift this prevents: an audit whose "Patterns in use" ✅ rows are one-word ticks> ("persistent", "strong", "textbook") while every gap gets a paragraph — the good cases-> demoted to checkboxes. [`example/tasks.md`](references/example/tasks.md) is the model to-> match: each standout pattern carries its `file:line` and a **✅ 亮点** call-out, so the+> demoted to checkboxes. [`example/task-detail.md`](references/example/task-detail.md) is the model+> to match: each standout pattern carries its `file:line` and a **✅ 亮点** call-out, so the> strengths are as legible as the gaps.## Severity rubric (shared)diff --git a/.agents/skills/ux-audit/references/example/channel.md b/.agents/skills/ux-audit/references/example/channel.mdnew file mode 100644index 00000000000..0a0341340d2--- /dev/null+++ b/.agents/skills/ux-audit/references/example/channel.md@@ -0,0 +1,217 @@+# Worked example — Channel (bot/messenger 接入) audit++A real run of this skill against the per-agent channel-connect surface+(`/agent/:aid/channel` → `src/routes/(main)/agent/channel`), 2026-07-02 (LOBE-11216, under the+Chat / 会话 UX-Audit parent LOBE-11145). Use it as a **template for the output shape**, not as+current-state truth (the code moves; re-verify before citing).++Surface = a **master-detail settings console** for connecting one agent to messaging+platforms (Telegram / Discord / Slack / Feishu / LINE / WeChat / QQ / iMessage …). **Chrome**+\= `NavHeader`. **Left** (`list.tsx`, 260px) = a platform list with per-platform runtime+status dots, a `MessengerPromo` card, a docs link, and an overflow menu (export / import /+delete-all). **Right** = either `detail/` (a schema-driven credential + settings form →+Header status toggle, Body form, Footer save/test/delete + webhook URL) or `ComingSoon` for+not-yet-available platforms. Connecting is a **save → auto-connect → poll runtime status**+flow; WeChat uses a QR-scan modal instead of a token form.++**Layers run:** L1 (static / code) ✅ — everything below. L2 (visual) / L3 (dynamic) ⏳ not+yet run — see §5. Verdicts about the render (which of the Footer's two primary buttons+actually dominates, whether the coming-soon-only degrade reads as "broken") are L1 inferences,+pending L2.++**Surface class & its norms (benchmark first).** This is an **integration / connect-an-app+console** — reference class: Slack app-directory connect, Zapier/Make connections, the+Vercel/GitHub integrations pages, Twilio senders. Class norms an L1 read should check+present/missing: per-connection **live status** (connected / failed / starting) ✅; a+**save → connecting → connected/failed** state machine ✅; **test connection** ✅; **secret+fields masked** ✅; a failed **list fetch** distinguished from "nothing connected" ✗; **typed+secrets protected** across navigation ✗; **secret export** treated as sensitive ⚠️; a+**coming-soon / request-integration** affordance that isn't a dead-end ⚠️. The defining risk+of this class is that a connection's **credentials and live status** are both load-bearing and+both fail-prone — the surface must never make "failed to load" look like "not connected / lost+your config".++## 1 — Patterns in use++| Pattern (family) | Where | Rating | Note |+| ------------------------------------------------ | ------------------------------------------------------------------------------------------------- | ------ | ------------------------------------------------------------------------- |+| Two-Panel / Master-Detail (layout) | list `aside` + detail `main` (`list.tsx:258`, `detail/index.tsx:500`) | ✅ | canonical settings shape |+| List with status (data) | platform rows + per-status color/title dots (`list.tsx:207-296`) | ✅ | live runtime status surfaced per row |+| Form Builder / schema form (edit) | `Body` renders credential + settings from `platformDef.schema` (`Body.tsx:380-517`) | ✅ | password fields masked, conditional `visibleWhen`, object-list allowlists |+| Save → in-progress → done (act) | `handleSave` → saving(locked) → auto-connect → poll (`detail/index.tsx:299-374`) | ✅ | textbook state machine (highlight §2) |+| Optimistic toggle (act) | enable Switch: `pendingEnabled` + `toggleLoading`, rollback on catch (`detail/index.tsx:452-471`) | ✅ | optimistic + rollback + toast |+| Live status polling (data) | queued/starting → poll 2s (`detail/index.tsx:183-191`); WeChat QR poll (`QrCodeAuth.tsx:51-90`) | ✅ | QR has terminal `expired` + Refresh (highlight §2) |+| Capability guardrail (feedback) | `userIdMissing` Alert + auto-expand settings to the field (`Footer.tsx:203`, `Body.tsx:404-411`) | ✅ | proactive + routes to the fix |+| Result / Alert feedback (act) | save / connect / test `Alert`s (`Footer.tsx:166-201`) | ✅ | each async result has a distinct alert |+| Confirm destructive (act) | delete-one + delete-all `confirmModal` (`detail/index.tsx:436`, `list.tsx:164`) | ⚠️ | confirmed, but delete-all is wide-blast w/ no type-to-confirm (gap ⑤) |+| Cross-surface promo (grow) | `MessengerPromo` → `/settings/messenger` (`MessengerPromo.tsx:75`) | ✅ | versioned-dismiss, links onward |+| Failure + Retry on the **list** fetch (feedback) | — | — | **absent** — both list fetches read only `{data,isLoading}` (gap ①) |+| Draft safety on the credential form (edit) | — | — | **absent** — in-memory antd form, reset on switch (gap ②) |+| Empty / dead-end (coming-soon) | `ComingSoon` icon+title+desc | ⚠️ | no CTA — dead-ends (gap ⑧) |++**Read:** the **detail** half of this surface is genuinely mature — the save/connect/poll+machine, the optimistic toggle, the QR terminal-error, and the userId guardrail are all+best-in-class and are the "don't regress" core. The weakness clusters at the **seams**: the+**list fetch has no failure path** (gap ①, the one 🔴), the **credential form loses typed+secrets** on a master-detail switch (gap ②), and **secret export/import** is handled casually+(gap ③).++## 2 — Strengths / good cases (don't regress)++- **✅ 亮点 — The detail save→connect→poll state machine (→ ✅ for ux Act §3.1).**+ `handleSave` (`detail/index.tsx:299-374`): `validateFields → setSaving(locked) →+create/updateBotProvider → post-save side-effect hook → success Alert (auto-clears 3s) →+auto-`connectCurrentBot` → poll runtime status`; every async handler+ (`connectCurrentBot`, `handleToggleEnable`, `handleDelete`, `handleTestConnection`,+ `handleRefreshStatus`) has a `try/catch` that surfaces the error as a typed `Alert` or a+ toast, and each locks its own control (`saving` / `connecting` / `testing` / `toggleLoading`+ / `refreshingStatus`). This is the confirm→in-progress(locked)→done/error shape in full — the+ reference the list-side bulk paths (gap ③) should copy.+- **✅ 亮点 — Optimistic enable-toggle with rollback (→ reinforces ux Act "optimistic surfaces+ failure").** The Header Switch sets `pendingEnabled` + `toggleLoading`, writes, and on+ `catch` **reverts `pendingEnabled` and toasts** (`detail/index.tsx:452-471`) — never a silent+ optimistic rollback.+- **✅ 亮点 — WeChat QR is a correct polling flow with a terminal error + Retry (→ ✅ for ux+ Feedback §4.2).** `startQrFlow` polls scan status every 2s and handles all three terminals:+ `confirmed` → authenticate + close, `expired` → **stop polling + warning Alert + a Refresh+ button that restarts the flow** (`QrCodeAuth.tsx:60-90,120-127`). A polling loop that can+ actually _end in failure and offer a way out_ — exactly Feedback §4.2 on the live-status path.+ (Nit: it uses antd `Spin` — gap ⑦.)+- **✅ 亮点 — `userIdMissing` is a proactive guardrail that also routes to the fix.** When a+ saved bot lacks the operator User ID (needed for push-back), the Footer raises an info Alert+ (`Footer.tsx:203-211`) **and** `Body` auto-expands the collapsed Settings group to that field+ on mount (`Body.tsx:404-411,481`). A reminder that also puts the user on the field — capability+ guardrail done well (Feedback §4.3 shape).+- **✅ good — Per-status list dots with color + title** (`list.tsx:207-296`): connected /+ failed / queued / starting / dormant / disconnected each map to a distinct color and a+ hover title — the live state is legible at the list level, not just in the detail.+- **✅ good — MessengerPromo** (`MessengerPromo.tsx`): a dismissible cross-surface card whose+ dismiss id is **versioned** (`messenger-promo-v1`) so a copy change re-surfaces it, and it+ links onward to `/settings/messenger` — closed-loop discovery.++## 3 — Experience gaps (ranked)++**① A failed list fetch renders a coming-soon-only catalog / "no channels" with no error —+ux Read §1.1 / Feedback §4.2** 🔴 `useFetchPlatformDefinitions` and `useFetchBotProviders`+both return a full `SWRResponse` (with `.error`) but the page destructures only+`{ data, isLoading }` (`index.tsx:37-42`), and **both fetches set `fallbackData: []`**+(`store/agent/slices/bot/action.ts:122,130`). So on failure `error` is set-but-unread and+`data` falls back to `[]`:++- A failed **platform-definitions** fetch → `platforms = []` → `allPlatforms` = just the+ frontend-only `COMING_SOON_PLATFORMS` (`index.tsx:62-68`) → `!isLoading &&+allPlatforms.length > 0` is **true** → the surface renders a **coming-soon-only** list, with+ every real and connected platform gone, no reason, no retry.+- A failed **providers** fetch → `providers = []` → connected channels lose their status dots+ and `currentConfig`, so a configured WeChat/Slack bot reads as **never connected**; clicking+ it shows the blank "connect" form, inviting a **duplicate** re-entry of credentials.++The merged static fallback makes this worse than the usual `data ?? [] → <Empty>`: even a+`length === 0 → empty` guard wouldn't fire, because the coming-soon entries keep+`length > 0` — the failure hides behind a **plausible partial catalog**. Remedy: read `error`+from both hooks; render a failed state (reason + retry via `mutate`) before assembling+`allPlatforms`; don't let `fallbackData: []` stand in for a resolved-empty.++**② The credential form silently discards unsaved secrets on a platform switch — ux Edit+§2.1** 🟠 The detail form is an in-memory antd `Form` (`detail/index.tsx:77`); switching the+active platform in the master list runs `form.resetFields()` (`detail/index.tsx:245-251`) with+**no dirty-guard**, and nothing persists the draft. So pasting a bot token + app secret and+then clicking another platform (or navigating away, or reloading) **wipes the entered+credentials with no warning** — and these are exactly the high-effort, easy-to-lose values+(tokens copied from a third-party console) the draft-safety rule exists to protect. It's the+master-detail form of §2.1's "switching items away from a dirty editor never silently+discards", against an in-memory store. Remedy: warn on switch/exit when the form is dirty (or+back the draft to storage keyed by `agentId+platform`), matching the chat composer's per-context+draft model.++**③ Channel config export/import handles plaintext secrets casually + partial-import on+failure — ux Act (secret handling / partial failure)** 🟠 "Export config" writes **every+provider's `credentials`** (bot tokens, signing secrets) to a plaintext JSON download+`lobehub-channels-<agentId>.json` (`list.tsx:98-102`) with **no warning** the file contains+cleartext secrets and no re-mask — a store of secrets that were entered as masked+`FormPassword` fields is re-revealed in bulk to a file. And "Import config" loops+`createBotProvider` (+ optional `connectBot`) over the file (`list.tsx:127-159`); a mid-loop+throw shows a generic `importFailed` toast **after** some providers were already created —+partial import, no report of what landed or how to finish. Remedy: warn that the export+contains secrets (or encrypt/redact it); make import report per-item success/failure rather+than a single generic catch.++**④ The Footer has two primary buttons (delete + save) — ux Act (one primary button)** 🟡 The+action bar renders **Delete** as `type="primary"` + `danger` (`Footer.tsx:131-139`) alongside+**Save** as `type="primary"` (`Footer.tsx:154-162`) — two visually dominant primary controls on+one surface, so the destructive action competes with the affirmative one for the eye. Save is+the surface's single primary; delete should be a secondary / text-danger button. (Actual visual+dominance is an **L2** confirm.) Remedy: demote delete to non-primary danger.++**⑤ "Delete all channels" is a wide-blast action with only a text confirm — ux Act+(unrecoverable action)** 🟡 `handleDeleteAll` (`list.tsx:161-178`) deletes **every** channel on+the agent behind a `confirmModal` with a danger button + description — but no **explicit+gesture** (type-to-confirm / checkbox). Wiping all bot connections is unrecoverable and+wide-blast; the count-less text confirm is one misclick from destroying every integration.+(It's tucked in an overflow menu, which lowers accident odds but doesn't change the blast+radius.) Remedy: require a type-to-confirm gesture for the all-channels wipe.++**⑥ The detail defaults to the first platform, not a connected one — ux Read §1.6** 🟡+`effectiveActiveId = activeProviderId || allPlatforms[0]?.id` (`index.tsx:71`) lands on+whatever platform is first in the list, ignoring which platforms the agent has actually+**connected**. A user with only WeChat connected opens on (say) Telegram's blank form instead+of their live WeChat channel — the landing doesn't reflect the data state. Remedy: default to+the first **connected** provider when one exists, else the first platform.++**⑦ WeChat QR modal uses antd `Spin` + antd primitives — ux Feedback §4.1** 🟡 `QrCodeAuth`+loads the QR with `<Spin size="large"/>` and builds the whole modal from antd+`Button`/`Alert`/`QRCode`/`Typography` (`QrCodeAuth.tsx:5,114`), against §4.1's "no antd `Spin`;+use `NeuralNetworkLoading` / project loaders". The flow's logic is right (gap-free polling) —+only the loading visual is off-system. Remedy: swap `Spin` for a project loader.++**⑧ ComingSoon detail dead-ends — ux Read §1.1 (empty as a real page) / Grow §5.3** 🟡+`ComingSoon` renders an icon + title + description with **no next action** — no "notify me when+this ships", no "request / vote", no link to a roadmap or the channels docs+(`ComingSoon.tsx:68-83`). A placeholder that leads nowhere; the class norm (a+request-integration affordance) is absent. Remedy: add a notify/vote CTA or a docs/roadmap link.++## 4 — Skill feedback (回灌)++- **New generalizable gap → landed in `ux` Read §1.1 (mandatory close).** Every existing §1.1+ ❌ was either `data ?? [] → <Empty>` (list) or `?? {…:0}` (metrics). This surface reveals a+ **third mask: a list assembled from a fetched set _merged with a static/frontend set_**+ (`[...fetched, ...COMING_SOON]`). A failed fetch here doesn't even read as empty — the static+ entries keep `length > 0`, so both a `length === 0 → Empty` guard **and** an error-unread call+ site render a **plausible partial catalog**, hiding the entire fetched half. Landed by+ extending Read §1.1 (new paragraph + ❌ **Channel** example + a checklist line) and mirroring+ one line into the SKILL Quick review, citing `channel/index.tsx:37-42,62-68` ++ `bot/action.ts:122,130`.+- **New generalizable gap → landed in `ux` Edit §2.1.** §2.1's examples are all a **single**+ editor (the chat composer). This surface adds the **master-detail** shape: a shared form+ instance `resetFields()` on the active-item change silently discards unsaved input — and the+ input is **secrets** pasted from a third-party console (highest-effort, least-recreatable).+ Landed as a sharpened §2.1 ❌ (master-detail shared-form reset) + a Quick-review touch, with+ **Channel** as the ❌, citing `channel/detail/index.tsx:77,245-251`.+- **Validated existing rules** (good ❌ instances to cite): Read §1.1 (gap ①), Read §1.6 (gap+ ⑥, first-tab default), Act one-primary-button (gap ④), Act unrecoverable-action (gap ⑤,+ delete-all no type-to-confirm), Feedback §4.1 (gap ⑦, antd `Spin`), Act secret-handling (gap+ ③, plaintext export).+- **Good cases worth citing as ✅:** the save→connect→poll machine (§2) and the WeChat QR+ terminal-error+Refresh (§2) are strong ✅ examples for Act §3.1 and Feedback §4.2+ respectively; the `userIdMissing` guardrail-that-routes-to-the-field is a nice Feedback §4.3+ shape. Noted as ✅ examples; the rules already state the principle, so not grafted into the+ prose beyond a citation.++## 5 — Pending: L2 visual + L3 dynamic++L1-only; verdicts a later pass should confirm or quantify:++- **L2 (visual)** — does the coming-soon-only degrade (gap ①) actually read as a broken/empty+ surface? Which of the Footer's two primary buttons (gap ④) visually dominates? Does the+ 260px list truncate long platform names / status dots; dark/light on the status colors; the+ QR modal's `Spin` vs the rest of the product's loaders (gap ⑦).+- **L3 (dynamic)** —+ - Force the platform-definitions fetch offline to **confirm gap ① live** — that the surface+ settles on coming-soon-only with no error, and force the providers fetch to fail to confirm+ connected channels vanish.+ - Type credentials, switch platform, and confirm the field wipes with no warning (**gap ②**).+ - Drive the full save → connect → poll happy path and a forced connect failure to confirm the+ machine's error Alerts render (protect §2).+ - Walk the WeChat QR to `expired` to confirm the Refresh restart, and to `confirmed` to+ confirm auth+close.+ - Export a config and confirm the JSON carries plaintext secrets (**gap ③**).diff --git a/.agents/skills/ux-audit/references/example/chat.md b/.agents/skills/ux-audit/references/example/chat.mdnew file mode 100644index 00000000000..358962179c3--- /dev/null+++ b/.agents/skills/ux-audit/references/example/chat.md@@ -0,0 +1,211 @@+# Worked example — Chat(会话主界面,默认无选中 topic 态)surface audit++对 agent chat 默认态(无选中 topic 的新会话)做 **L1 静态审计**。+Linear: LOBE-11221(隶属 LOBE-11145)。2026-07-02。++**Layers run:** L1 (static /code) ✅ — 以下全部。L2 (visual) / L3 (dynamic) ⏳ 未跑。+关于渲染的结论(send error 后 editor 是否可恢复、skeleton 是否永久化)是 L1 推理,待 L2/L3 确认。++Surface = 消息流(load → empty/welcome → list)+ 输入区域(`MainChatInput` → `ChatInput`)+ chrome。+本 audit 聚焦**默认态**(新会话 / 无 topic),与 \[1] topic 共享 element。++## 1 — Patterns in use++| Pattern (family) | Where | Rating | Note |+| --------------------------------- | ---------------------------------------------------------------------------------------------------------- | ------ | ---------------------------------------------------------- |+| Center Stage (layout) | `ConversationArea.tsx:106-135`: ChatList 主导,composer 固定在 footer | ✅ | textbook |+| Visual Framework (layout) | `agent/index.tsx:12-25`: Flexbox 100% height/width + `ChatHydration` + `TelemetryNotification` | ✅ | consistent chrome |+| Skeleton loading (feedback) | `ChatList/index.tsx:174` — `!messagesInit && !isNewConversation` → `SkeletonList` | ⚠️ | **no terminal failure path** — see gap ① |+| Empty-state as onboarding | `ChatList/index.tsx:178`: `AgentHome` (agent info + opening questions) 当 `displayMessageIds.length === 0` | ✅ | real page with CTA;但 welcome 无 loading state — gap ④ |+| Draft safety (input / edit) | `useChatInputDraft` → `draftStorage.ts`: localStorage, **per-context key**, debounce 500ms, LRU 50 | ✅ | **亮点** — 见 §2 |+| Same-page error (feedback) | send error → closable `Alert` (`ChatInput/index.tsx:392-400`) | ✅ | 不 silent — 但 editor 已 cleared,draft 已 removed — gap ② |+| Prominent "Done" Button (action) | Send button + mode selector + model switch (`MainChatInput/index.tsx:34-38`) | ✅ | primary action 明确 |+| Autocompletion (input) | `@`-mention, slash menu, local-folder mention (desktop) (`Conversation/index.tsx:26-38`) | ✅ | rich input affordances |+| Progress / Cancelability (action) | streaming 时 Stop button (`ChatInput/index.tsx:376-377`, `onStop=stopGenerating`) | ✅ | generation-class cancel norm met |+| Capability guardrail (feedback) | `AgentConfigError` above composer (`MainChatInput/index.tsx:46`) | ✅ | reactive config warning |+| Capability guardrail (feedback) | `InputCompletionErrorAlert` — model completion 不可用时 `ChatInput/index.tsx:77-99` | ✅ | soft warning + settings link |+| Update Indicator (data) | `RefreshingHint` when SWR isValidating (`ChatList/index.tsx:155-156`) | ✅ | non-destructive refresh indicator |+| Virtualized list (data) | `VirtualizedList` over `displayMessageIds` (`ChatList/index.tsx:196-201`) | ✅ | scales to long conversations |+| Overview + Detail (data) | message → Portal / WorkingSidebar | ✅ | preserves surface contract (panel) |++## 2 — Strengths / good cases(don't regress)++- **✅ 亮点 — Durable, per-context composer draft。** Composer 对每个 topic 的输入做 localStorage 持久化,+ **按 context key**(agent+topic+thread)做 scope。每次击键 debounce 保存(500ms),mount 时 restore 到空 editor,+ unmount 时 flush pending save,send 后 remove draft(`draftStorage.ts`、`useChatInputDraft.ts`、`ChatInput/store/action.ts:85`)。+ Storage 上限 50 条 LRU eviction(`draftStorage.ts:108-126`)。reload /crash/ 切 topic **不会丢失输入**,+ 且 draft 不跨 topic 泄漏。这是 Edit §2.1 ❌ 的反面 —— **已经是 Edit §2.1 ✅ 示例**。++- **✅ 亮点 — Send failure is surfaced, not silent。** 失败的 send 在 composer 上方渲染 closable `Alert`+ 携带 `sendMessageError` 信息(`ChatInput/index.tsx:392-400`)。不像 Pages sidebar 只有 `console.error`,+ 用户明确知道发送失败了。++- **✅ 亮点 — Streaming is abortable。** 生成中的 Stop 按钮连到 `stopGenerating`+ (`ChatInput:376-377`),满足 generation-class "Cancel while it runs" norm(Act §3.1)。++- **✅ 亮点 — Deep-linking two-way sync。** `ChatHydration` 做 URL ↔ store 双向同步:+ `useLayoutEffect` 把 `:topicId` / `?thread=` 注入 store,`subscribe` 把 store 变化写回 URL+ 用 `replace` history(`ChatHydration/index.tsx:32-85`)。++- **✅ 亮点 — Auto-reconnect to running Gateway operation。** `useGatewayReconnect` 在 topic load+ 时检测并重连运行中的 operation(`ConversationArea.tsx:84-88`)。用户刷新页面不丢失进行中的 agent run。++- **✅ 亮点 — Stream-safe message refresh。** `useFetchMessages` 在读 stream 时 gated:+ `isAgentRuntimeRunning` → skip onData write,避免 SWR refetch 覆盖内存中 stream 内容+ (`data/action.ts:226-235`)。++- **✅ Send error cleared on next successful send。** `conversationLifecycle.ts` 在每次 sendMessage+ 启动时 `inputSendErrorMsg: undefined`,不和 stale error 混合。++## 3 — Experience gaps(ranked)++---++### ① 🔴 Message stream 无 terminal failure path — fetch error → permanent skeleton — Feedback §4.2 / Read §1.1++**文件**: `src/features/Conversation/ChatList/index.tsx:174`++ChatList 用 `messagesInit` 做 loading gate:++```tsx+if (!messagesInit && !isNewConversation) {+ return <SkeletonList />;+}+```++`messagesInit` 是 **success-only / data-presence-disguised init flag**:++- `useFetchMessages` 只注册了 `onData`,**没有 `onError`**(`data/action.ts:211-266`)+- `messagesInit: true` **只在 onData 中设置**(`data/action.ts:258`),或由 `StoreUpdater`+ 从 `hasInitMessages` 初始化(`StoreUpdater.tsx:72`)+- fetch 失败时 `messagesInit` 永远为 false → `SkeletonList` 永久渲染,**无 Retry**++`hasInitMessages` 从 ChatStore 的 `dbMessagesMap[chatKey]` 来(`ConversationArea.tsx:52`)。+如果该 topic 有 cached messages(上次访问过的),`messagesInit` 起始即为 true,skeleton 不出现,+问题仅发生在**无缓存 topic** 的首次 fetch 失败。++**SWR `error` property 完全未被消费** — `messagesSWR` 只读了 `.isValidating`。++**影响**: 切到一个有消息的 topic 后断网 → 永久 skeleton,唯一的恢复方式是 navigate away + reload。+这属于 Feedback §4.2 描述的经典模式:"init flag set only on success → permanent skeleton on error"。++**修复建议**: ChatList 或 ConversationArea 消费 `messagesSWR.error`,在非空时渲染 Error/Retry 态+带 Reload 按钮(调用 `messagesSWR.mutate()`)。++---++### ② 🔴 Send 先清 editor + 删 draft,再异步 send — send 失败时 editor 为空且 draft 被删除 — Edit §2.1++**文件**:++- `src/features/Conversation/ChatInput/index.tsx:342-343` — `clearContent()` 先于 `await sendMessage()`+- `src/features/ChatInput/store/action.ts:85` — `removeDraft(draftKey)` 在 store 层同样先于实际发送完成++时序:++1. `handleSend` 捕获 markdown/json → 立即 `clearContent()` → 编辑器为空+2. 同时 `handleSendButton`(store 层)在 `onSend` 回调后立即 `addInputHistory` + `removeDraft(draftKey)`+3. `await sendMessage(...)` 异步执行+4. 如果 ChatStore 的 sendMessage 在创建 user message 之前抛异常 → editor 为空 + draft 已删除 + 无 user message++虽然 ChatStore 的 `sendMessage` 在 `conversationLifecycle.ts` 中有自己的 try-catch 设置+`inputSendErrorMsg`,但 send error 的 alert(`ChatInput:392-400`)只提供了 **close** 按钮 —+没有 "retry with same content" 的路径。用户必须重新输入。++**对比**: `inputHistoryStorage` 在 `handleSendButton` 中**同步**写入(send 之后,但在 store action 内部),+所以如果 ChatStore catch 了 error 但已经过了 `addInputHistory` 那行,则历史里有一份。但 draft 已经删除,+editor 为空,用户得手动从 history 找回。且 `addInputHistory` 依赖 `handleSendButton` 的成功路径 —+如果 `onSend` 里的 `clearContent` 和 `addInputHistory` 之间有 race(虽然目前同步),风险依然存在。++**修复建议**:++- draft removal 推迟到 send 确认成功(user message created)之后+- 或 send error 路径恢复 draft(`saveDraft(draftKey, capturedJson)`)+- 或在 send error alert 上提供 "retry" action(恢复 editor content 并重新 send)++---++### ③ 🟠 ChatInput 的 `sendMessageError` alert — closable 但无可操作用 Retry — Act §3.1++**文件**: `src/features/Conversation/ChatInput/index.tsx:392-400`++```tsx+<Alert+ closable+ title={t('input.errorMsg', { errorMsg: sendMessageErrorMsg })}+ type={'secondary'}+ onClose={clearSendMessageError}+/>+```++send error alert 只有一个 close 操作(dismiss the alert),没有 Retry/resend 操作。+这违反了 Act §3.1 的 terminal error 规则:error 状态应该带 escape hatch。+在这个 context 里,escape hatch = resend。++**修复建议**: alert 的 action 区域加一个 "Retry" button,调用恢复 editor content + 重新 send。++---++### ④ 🟡 AgentHome(welcome)无 loading state — agent config 异步加载时 welcome 显示 blank/partial++**文件**: `src/features/AgentHome/index.tsx`++AgentHome 渲染时依赖 agent config:++- `AgentInfo` 读取 `agentSelectors.currentAgentMeta` — agent name/avatar/description+- `OpeningQuestions` 读取 `agentSelectors.openingQuestions`++`ChatList/index.tsx:119-123` 在 mount 时调用 `useFetchAgentConfig(isLogin, context.agentId)` 确保+agent config 已加载,但这是 fire-and-forget SWR — 没有 loading/error 状态。+在 config 加载完成前,AgentInfo 可能显示空白(agent title 为空)、OpeningQuestions 为 `[]`。++这不算 critical(chat 的 welcome 本来就是一个 greeting page),但属于 Consistency 缺口:+new-conversation 的 welcome page 看起来像 loaded but empty,而不是 still-loading。++**修复建议**: AgentInfo 在 agent title 为空时渲染 skeleton avatar + title placeholder;+OpeningQuestions 列表渲染 skeleton chips。++---++### ⑤ 🟢 Discussion — 发送进行中的 editor 行为是 feature,不是 bug++当前设计允许用户在 streaming 期间继续编辑并 queue 消息(`disableQueue` 仅在 onboarding 等 surface 设为 true)。+Queue 通过 `QueueTray` 可见,这是一个 pattern 实现:**Deferred Choices (feedback)**。+这与 ChatGPT/Claude 的行为一致,是正确的设计选择。无需修改。++## 4 — 回灌 ux skill++### ✅ Draft safety (Edit §2.1) — 已有 ✅ 示例,不需新增++chat 的 `useChatInputDraft` + `draftStorage` 已经是 Edit §2.1 引用的 ✅ 示例(`edit.md:18-20`)。+无需回灌。++### Gap ① → Feedback §4.2 强化 ❌ 示例++**现有**: Feedback §4.2 的 ❌ 示例是 Agent profile (`agentConfigErrorMap` orphaned)。++**新增**: 在 Feedback §4.2 添加 chat ChatList 的 ❌ 示例:++> ❌ **Chat ChatList** (`src/features/Conversation/ChatList/index.tsx:174`) has zero error branch —+> `messagesInit` is a data-presence-disguised init flag set only inside SWR `onData` (`data/action.ts:258`),+> and the SWR `error` property is never consumed. A failed fetch on a topic with no cached messages+> renders a permanent `SkeletonList` with no Retry — Fix: consume `messagesSWR.error`, render a failed+> state with `messagesSWR.mutate()` as the Retry action.++### Gap ② → Edit §2.1 强化 ❌ 示例 — send 失败丢失 editor content++**新增**: 在 Edit §2.1 的 "Failed save keeps content for retry" checklist 下添加:++> ❌ **Chat ChatInput** (`src/features/Conversation/ChatInput/index.tsx:342, store/action.ts:85`)+> clears the editor (`clearContent()`) and removes the localStorage draft (`removeDraft(draftKey)`)+> **before** `await sendMessage()` completes — a send failure leaves the editor empty and the draft+> deleted, with no recovery path. The send-error alert shows only a close button, not a Retry that+> restores the captured content. Fix: defer draft removal to post-success, or on error restore the+> draft from the captured JSON + show a Retry action.++## 5 — Layers pending++- **L2 (visual)**: confirm skeleton renders correctly on real topic load; confirm AgentHome welcome+ renders as real page (not blank); verify send error alert visual hierarchy; dark mode.+- **L3 (dynamic)**: drive send failure + retry flow; force message fetch error via network throttle;+ measure CLS during topic switch; verify keyboard focus after send / stop.diff --git a/.agents/skills/ux-audit/references/example/doc.md b/.agents/skills/ux-audit/references/example/doc.mdnew file mode 100644index 00000000000..30d109ece2c--- /dev/null+++ b/.agents/skills/ux-audit/references/example/doc.md@@ -0,0 +1,187 @@+# Worked example — Agent Document View (助理文档视图) audit++A real run of this skill against the **standalone agent-document view**+(`/agent/:aid/docs/:docId` → `src/routes/(main)/agent/docs`), 2026-07 (LOBE-11214, under the+Chat UX Audit surface LOBE-11145). Use it as a **template for the output shape**, not as+current-state truth (the code moves; re-verify before citing). Surface = the nav header+(agent→doc breadcrumb + `AutoSaveHint` + Share + More menu) → the shared `PageEditor` canvas+(title / meta bar / lock banners / rich-text editor) → the right-panel documents/skills+explorer, plus an optional (lab-flagged) anchored `FloatingChatPanel`.++**Layers run:** L1 (static / code) ✅ — everything below. L2 (visual) / L3 (dynamic + CLS)+⏳ not yet run. Verdicts about the render are L1 inferences here, pending L2.++**Surface class & benchmark:** this is a **document editor embedded under an agent context**+(Notion page, Google Docs, Craft, Coda). Class norms checked up front: autosave with a visible+save-state (⚠️ — present but structurally can't show failure, gap ②), draft / crash recovery+(⚠️ — exists but scoped to the collaborative-lock-degraded window only, gap ⑥), collaborative+edit safety (✅ — `useDocumentLock` peek-on-open + read-only + CONFLICT handling, §2), version+history (✅ — `PageEditor/History`), full CRUD with confirm-on-delete + optimistic rollback (✅+— **standout**, §2), share / copy-link / export (✅), and a **failed-load state with retry**+(❌ — the biggest gap: the error UI is _built_ but ordering-dead, gap ①). The capabilities are+nearly all present — the weakness clusters entirely in **failure handling on load and save**.++## 1 — Patterns in use++| Pattern (family) | Where | Rating | Note |+| -------------------------------- | ------------------------------------------------------------------------------------------------ | ------ | --------------------------------------------------------------------- |+| Visual Framework (layout) | `NavHeader` + two-column `Layout` (editor + right panel) (`Layout/index.tsx:9`) | ✅ | consistent chrome |+| Breadcrumbs / Deep-linking | agent→doc breadcrumb; `/agent/:aid/docs/:docId` restores the surface (`Header/index.tsx:46`) | ✅ | agent label returns to chat |+| Center Stage (layout) | `PageEditor` rich-text canvas dominates (`PageEditor.tsx:273`) | ✅ | |+| Rich-text editor + toolbar | Lexical editor, slash / ask-copilot / block plugins (`EditorCanvas`) | ✅ | |+| Overview + Detail (data) | right-panel Documents/Skills explorer beside the open doc (`RightPanel/index.tsx:122`) | ✅ | auto-picks Skills tab when no plain docs |+| Full-lifecycle CRUD (act) | create / folder / rename / move / delete, optimistic + rollback (`useDocumentTreeOps.ts`) | ✅ | **亮点** — see §2 |+| Confirm destructive (act) | every delete site wraps `confirmModal` (`Header/useMenu.tsx:91`, `useDocumentTreeOps.ts:388`) | ✅ | **亮点** — see §2 |+| Collaborative lock (feedback) | `useDocumentLock` peek-on-open, read-only for others, re-hydrate on flip (`useDocumentLock.ts`) | ✅ | workspace pages only |+| Save-conflict handling (fb) | CONFLICT save → read-only + keep `isDirty` so content is copyable (`editor/action.ts:353`) | ✅ | **亮点** — the one failure they handle right (§2) |+| Managed-doc guard (input) | skill `SKILL.md` index: `metaReadOnly` locks title/emoji to avoid bundle desync (`index.tsx:80`) | ✅ | **亮点** — see §2 |+| Draft / crash recovery (edit) | `usePageDraft` → sessionStorage snapshot + restore-on-open confirm (`usePageDraft.ts`) | ⚠️ | **only while lock is degraded → no backup for personal docs** (gap ⑥) |+| Loading Skeleton (feedback) | `EditorSkeleton` while content resolves (`DocumentIdMode.tsx:20`) | ⚠️ | **data-presence gate → permanent on error/not-found** (gap ①) |+| Autosave (feedback) | `AutoSaveHint` saving→saved, debounced writes (`editor/action.ts:310`) | ⚠️ | **no `failed` state → silent save failure** (gap ②) |+| **Failure + Retry on load** (fb) | `EditorError` alert exists (`DocumentIdMode.tsx:29`) but ordered behind the loading gate | — abs. | **built but unreachable on first load; no retry** (gap ①) |+| Empty / Not-found state (read) | — | — abs. | deleted / bad `docId` → permanent skeleton (gap ①) |+| List data-states (read) | right-panel explorer: loading / empty / error all rendered (`AgentDocumentsGroup.tsx:369`) | ✅ | **亮点** — the list side does what the doc side doesn't (§2) |+| Cross-surface entry (growth) | breadcrumb → chat; explorer → other docs; copy-link; anchored chat topic (lab) | ✅ | doc↔chat loop closed |++**Read:** layout, CRUD, collaborative locking, managed-doc safety and the list-side data-states+are mature — genuinely strong. The weakness clusters entirely in **Feedback (load + save+failure)**: an error/not-found path that is _written but ordering-dead_, and an autosave that+structurally cannot report failure.++## 2 — Strengths / good cases (don't regress)++This surface is well-built where it counts; these are the ✅ half of the 回灌 loop and the+"don't regress" baseline for the next refactor:++- **✅ 亮点 — CRUD is optimistic with real rollback + failure toasts.** Create doc / create+ folder / rename / move / delete all apply an optimistic mutation, then **roll back to a+ snapshot and toast on failure** (`useDocumentTreeOps.ts` — create `:199,220`, folder+ `:152,161`, rename `:270,283`, move `:329,352`, delete `:430,459`). No silent rollback (the+ Act §3 trap). The model to copy for any tree/list CRUD.+- **✅ 亮点 — Every delete confirms.** The header More menu (`Header/useMenu.tsx:91-110`), the+ explorer tree (`useDocumentTreeOps.ts:388`), the web-list item and the skill row+ (`AgentDocumentsGroup.tsx:163,457`) each wrap `removeDocument` in `confirmModal` with a danger+ OK and an error toast. Consistent destructive-action discipline across four call sites.+- **✅ 亮点 — The one save-failure they DO model, they model well (lock CONFLICT).** On a+ collaborative CONFLICT the save path flips the editor read-only via `saveBlockedByLock` and+ **keeps `isDirty`** so the unsaved content stays on screen to copy out, rather than dropping+ the edit (`store/document/slices/editor/action.ts:353-364`), with a dedicated recovery path+ that clears the stale block (`clearSaveBlockedByLock`, `useDocumentLock.ts:152`). This is+ exactly the §4.4 "keep the edited value + name the reason" behavior — which makes gap ② sharper:+ the _generic_ network/500 failure gets none of this care (same `catch`, resets to `idle`).+- **✅ 亮点 — Managed-doc identity guard.** A skill's `SKILL.md` index is shown under the bundle+ title and its title/emoji are locked read-only (`metaReadOnly`, `AgentDocumentPage/index.tsx:80-92`),+ because a plain title save would overwrite the `SKILL.md` filename and desync the bundle. A+ thoughtful "don't let a generic editor corrupt a managed entity" guard.+- **✅ — Stale-response race guard on fetch.** `useFetchDocument`'s `onData` discards a response+ whose `documentId` is no longer the active one (`store/document/slices/document/action.ts:234-239`),+ so fast doc-switching can't hydrate the editor with a previous doc's content.+- **✅ — Draft restore is careful where it applies.** `usePageDraft` prompts once on open (not+ on every remount), enforces 24h staleness, and clears the snapshot when the lock recovers AND+ the doc is clean (`usePageDraft.ts:123-166`). Good hygiene — the limit is _scope_ (gap ⑥), not+ craft.+- **✅ — The right-panel explorer gets all four data-states right.** Loading+ (`NeuralNetworkLoading`), empty (`Empty` with icon + copy), and error (`Text type=danger`) are+ all rendered, and the documents tree keeps its toolbar reachable when empty+ (`AgentDocumentsGroup.tsx:369-383,532-537`; `DocumentExplorerTree.tsx` empty). This is the ✅+ contrast to the **doc body** on the same surface, which renders only loading + success (gap ①)+ → the audit's severity anchor: the gap is a local omission, not a surface-wide neglect.++## 3 — Experience gaps (ranked)++**① First-load fetch failure AND not-found both resolve to a permanent skeleton; the+`EditorError` alert is built but ordering-dead — ux §4.2 / Read §1.1** 🔴+`DocumentIdMode` renders `{error && <EditorError/>}` off the real SWR `error`+(`EditorCanvas/DocumentIdMode.tsx:223`) — but **after** `if (isLoading) return <EditorSkeleton/>`+(`:209`), where `isLoading = editorSelectors.isDocumentLoading(id) = !documents[id]`+(`store/document/slices/editor/selectors.ts:87`) — the **data-presence-disguised init flag** §4.2+warns about. `useFetchDocument` writes `documents[id]` only in its `onData`, and returns **`null`+(not a throw) on not-found**, dropped by an early return+(`store/document/slices/document/action.ts:219-222,228-260`). So on a first-load 500 the entry+never lands → `isLoading` stays `true` **forever** → the skeleton short-circuits and the+`EditorError` below it is **unreachable**; it can only paint on a later focus-revalidation failure+over already-loaded content. A **deleted / bad `docId`** hits the same wall → a **permanent+skeleton instead of a 404** (Read §1.1: failed / not-found / still-loading are conflated). No+retry exists on either path (SWR only auto-revalidates on focus, `action.ts:261`). Sharp because+the fix is nearly free — the error component already exists and already reads `error`. _Remedy:_+branch `error` and resolved-`null` **before** the loading gate → a failed state (reason + Reload+via `mutate`) and a real not-found; keep the skeleton only for `!error && no-data-yet`.++**② Autosave cannot represent failure — a failed content/title save reads as "saved" — ux §4.4+/ §4.2** 🟠 The document save-state enum is `'idle' | 'saving' | 'saved'` with **no `failed`**+(`store/document/slices/editor/initialState.ts:65`, mirrored in `AutoSaveHint.tsx:12`), and+`performSave`'s `catch` resets it to `'idle'` for every non-CONFLICT failure (network / 500),+logging only to console (`editor/action.ts:359-364`). So the `AutoSaveHint` in the header+(`Header/index.tsx:67`) shows "已保存最新 /saved" while the doc is still dirty and the write+failed — the type-level silent-write trap already documented for the page editor and agent+profile. `isDirty` stays true, so the debounced save _may_ retry on the next keystroke and the+`UnsavedChangesGuard` autosaves on navigation (`DocumentIdMode.tsx:110-127`) — a real backstop —+but a user who stops editing and stops navigating sits on lost-but-"saved" content indefinitely.+This is the **already-landed §4.4 rule** (it names `store/document/slices/editor/action.ts`+directly); this surface is a fresh confirmation, not a new gap. _Remedy:_ add `failed` to the+enum + an inline Retry that keeps the edited value; drive it from the `catch`.++**③ No retry affordance on any load error — even the reachable states are static — ux §4.2**+🟠 The `EditorError` alert (reachable only on revalidation failure, per gap ①) is a static+`<Alert type=error>` with no action (`DocumentIdMode.tsx:29-41`), and the explorer's error branch+is static `<Text type=danger>` (`AgentDocumentsGroup.tsx:377-383`). Both rely entirely on SWR+focus-revalidation; a user staring at either has no in-place way to re-run the fetch. _Remedy:_+give both a Reload button calling the SWR `mutate` (already available at both call sites).++**④ The header/title list fetch swallows its error — a failed list shows a placeholder title+silently — ux Read §1.1** 🟡 `useAgentDocumentItem` destructures only `{ data, mutate }` and+never reads `error` (`useAgentDocumentItem.ts:20`); a failed `listDocuments` leaves `item`+`undefined`, so the breadcrumb renders the placeholder title (`Header/index.tsx:61`) with no+signal that metadata failed to load. Milder than gap ① (the body fetch is the real content), but+it's the same failure-as-nothing coercion. _Remedy:_ surface a subtle failed-to-load affordance+on the title, or at least don't present a placeholder as if it were the real (empty) title.++**⑤ The anchored chat-topic failure silently hides the panel — ux §4.2** 🟡+`useDocumentChatTopic` returns `{ topicId, error, isLoading }` but callers gate render on+`topicId` truthiness only (`AgentDocumentPage/index.tsx:95`), and the hook logs errors to console+(`FloatingChatPanel/useDocumentChatTopic.ts:44-50`). If the topic lookup / create fails, the+FloatingChatPanel just doesn't appear — no error, no retry. Lower severity because the panel is+behind a lab flag (`enableAgentDocumentFloatingChatPanel`), but the silent-disappear pattern is+worth fixing before it graduates. _Remedy:_ on `error`, render a compact failed-to-load strip with+Retry instead of rendering nothing.++**⑥ Draft / crash recovery doesn't cover personal (non-workspace) agent docs — ux Edit §2.1**+🟡 `usePageDraft` only writes its sessionStorage snapshot while `lockHealth !== 'healthy'`+(`usePageDraft.ts:109-118`), and the lock is `enabled: workspacePage = documentId && canEdit &&+isWorkspacePage` (`useDocumentLock.ts:60,88`). For a personal / desktop-local agent doc the lock+never engages, so `lockHealth` stays at its `'healthy'` default (`PageEditor/store/initialState.ts:71`)+and **the snapshot never fires** — unsaved edits live in-memory only, protected solely by the+`beforeunload` autosave guard. A hard crash / kill / power-loss inside the autosave debounce+window (`EDITOR_DEBOUNCE_TIME` … `EDITOR_MAX_WAIT`) loses the last edits with no local recovery.+Narrower than a compose box (server autosave is the primary copy), but the draft safety net users+might assume is present is, for personal docs, absent. _Remedy:_ also snapshot on the normal dirty+path (not only during lock degradation), or document that the draft is lock-window-scoped.++## 4 — Skill feedback (回灌)++**New generalizable gap landed in `ux`:**++- **§4.2 — "error branch ordered _after_ a data-presence loading gate is unreachable on first+ load."** Existing §4.2 examples all cover the error path being _absent_ or _orphaned in the+ store_. This surface is a new, sharper shape: the error branch is **present in the same+ component and reads the real SWR `error`**, yet it sits below `if (isLoading) return <Skeleton/>`+ where `isLoading = !map[id]`, so a first-load failure (and a resolved-`null` not-found) can+ never reach it — it paints only on revalidation. Landed as a new paragraph + ❌ example (Agent+ document view) + checklist item in [feedback.md §4.2](../../ux/references/feedback.md), mirrored+ into the [Quick review](../../ux/SKILL.md) Feedback line. **→ landed as ux feedback §4.2 ❌.**++**Validated instances of existing rules (no new rule needed):**++- **§4.4 (autosave save-state has no `failed`)** — gap ②. The rule already names+ `store/document/slices/editor/action.ts`; this surface (same code, seen from the agent-doc+ header) is a fresh confirmation.+- **§4.2 (failed load offers Reload/Retry)** — gap ③. Static error alert + static list-error+ text, no retry — the already-documented "failed state must carry a Reload" line.+- **Read §1.1 (failure ≠ empty / not-found)** — gaps ①, ④. Not-found → permanent skeleton and a+ failed list-fetch → placeholder title are both the failure-as-nothing coercion §1.1 covers.++**Good cases worth preserving (see §2)** — the optimistic-CRUD-with-rollback, confirm-on-every-delete,+CONFLICT-save read-only handling, and managed-doc `metaReadOnly` guard are the "don't regress"+list for the next refactor. None extracted a _new_ ✅ rule this run (each re-illustrates an+already-complete rule — optimistic-rollback under Act §3, keep-the-value under §4.4), so per the+good-case 回灌 bar they're reported here but not force-landed as ✅ examples.diff --git a/.agents/skills/ux-audit/references/example/task-detail.md b/.agents/skills/ux-audit/references/example/task-detail.mdnew file mode 100644index 00000000000..1ee0d7a3b01--- /dev/null+++ b/.agents/skills/ux-audit/references/example/task-detail.md@@ -0,0 +1,180 @@+# Worked example — Task detail /run-monitor (任务详情) audit++A real run of this skill against the **single-task detail** — the cross-agent `/task/:taskId`+and its agent-scoped twin `/agent/:aid/task/:taskId`, 2026-07 (LOBE-11220). The detail doubles as+an **async agent-run monitor**: a live activity feed, subtasks, comments, artifacts, and+schedule / verify / model config. Use it as a template for the output shape, not as current-state+truth (the code moves; re-verify before citing).++> **Sibling of the tasks list.** This detail and the [tasks list](tasks.md) share one store and+> one feature package but are **different surfaces**, so one report each. The **cross-surface+> seam** (detail edits leaving the list row stale) is owned in [`tasks.md`](tasks.md) as gap L③;+> it's the detail's `updateTask` that causes it, cross-referenced here. The combined run's `ux`+> 回灌 is already landed (§4).++**Both route trees delegate to one component.** `agent/:aid/task/:taskId`+(`desktopRouter.config.tsx:130-136`) and `/task/:taskId` (`:650-663`, router `errorElement`+`resetPath="../tasks"` at `:661`) both render `TaskDetailPage`+(`routes/(main)/agent/task/[taskId]/index.tsx`, `routes/(main)/task/[taskId]/index.tsx`). One+detail surface, audited once.++**Surface class:** async-job / agent-run monitor + editable record — benchmark against Devin /+GitHub Actions run pages / cron dashboards (run · pause · **stop/abort** · retry · live log ·+schedule) **and** an editable issue detail (title · priority · assignee · autosave).+**Layers run:** L1 (static / code) ✅ — everything below. L2 / L3 ⏳ not yet run — see §5.++**Load-bearing files:** `features/AgentTasks/AgentTaskDetail/{TaskDetailPage,TaskDetailSections,+useActiveTaskDetail,TaskDetailRunPauseAction,TaskDetailHeaderActions,TaskActivities,TaskSubtasks,+TaskVerifyConfig,TaskInstruction,TaskArtifacts,TaskParentBar,CommentInput,TopicCard}`,+`shared/Breadcrumb.tsx`, `store/task/slices/{detail,lifecycle,config}/action.ts`,+`store/task/slices/detail/initialState.ts`, `store/task/selectors/detailSelectors.ts`,+`components/Editor/AutoSaveHint.tsx`.++## 1 — Patterns in use++| Pattern (family) | Where | Rating | Note |+| ----------------------------------- | ---------------------------------------------------------------------- | ------ | ---------------------------------------------------------- |+| Loading state machine (feedback) | compound gate (`useActiveTaskDetail.ts:63-78`) | ✅ | skeleton on "resolving", not `data===undefined` — **亮点** |+| Live activity feed (data) | `TaskActivities.tsx` + reactive 10 s poll (`detail/action.ts:300-315`) | ✅ | polls only in-flight; real empty — **亮点** |+| Not-found / 404 (data) | `TaskDetailPage.tsx:39-59` | ⚠️ | real screen, but **failed-load reads as 404** (gap D②) |+| Run / pause / stop / retry (act) | `TaskDetailRunPauseAction.tsx`, `TopicCard.tsx` | ⚠️ | works; **start/stop failures silent** (gap D①) |+| Cancel a running job (act) | header "Stop" = set `paused`; real abort only per-topic | ⚠️ | **no task-level abort; buried per-topic** (gap D④) |+| Autosave / editable-in-place (edit) | title, instruction, verify / model / schedule config | ⚠️ | **no `failed` state; config saves silent** (gap D③) |+| Run-all bulk flow (act) | `TaskSubtasks.tsx:204-255` | ✅ | preview → locked confirm → partial/kicked toast — **亮点** |+| Comment / feedback (edit) | `CommentInput.tsx`, `CommentCard.tsx` | ⚠️ | draft safe on failure ✅; **no failure toast** (gap D⑤) |+| Confirmation (act) | delete / brief / artifact / stop-topic / run-all | ✅⚠️ | broad; **task-level Stop unconfirmed** (gap D④) |+| Deep-link / breadcrumb (nav) | `shared/Breadcrumb.tsx`; copy-link | ✅ | present on both normal + not-found |+| Elapsed / countdown readout (fb) | topic elapsed / next-run countdown | ✅ | derived from **persisted** timestamps, not a local counter |+| Section empty states (data) | artifacts hide-on-zero (`TaskArtifacts.tsx:124`) | ⚠️ | whole section vanishes (gap D⑥, pending L2) |++**Read:** the **read/monitor spine is mature** — the loading/not-found gate machine, reactive+live polling, run-all preview, broad confirmations, persisted elapsed readouts. The weakness+clusters hard in **write feedback**: run/pause/create (D①), a transient fetch error masquerading+as deletion (D②), config autosave that structurally can't report failure (D③), no real run abort+(D④), silent comment failure (D⑤), and a few section-polish / i18n gaps (D⑥).++## 2 — Strengths / good cases (don't regress)++The read/monitor spine is the model half of this surface — these already landed as ✅ examples in+`ux` (the combined run), and are the "don't regress" list for the write-path refactor:++- **✅ 亮点 — Loading /not-found state machine (landed as ux Feedback §4.2 ✅).**+ `useActiveTaskDetail.ts` gates the skeleton on "resolving" (`isTaskResolving = !hasTaskDetail &&+!isNotFound`, `:63`), **not** on `data === undefined`, and the assignee-config gate keys off the+ fetch's **in-flight** flag (`agentConfigLoading`, `:72-73`), so an assignee that resolves to+ `null` (deleted / out-of-scope) **releases** the gate instead of deadlocking. Extracted the+ compound-gate sub-rule into §4.2. (The one soft spot: a transient _error_ still coerces to 404 —+ gap D②; the gate machine itself is the model.)+- **✅ 亮点 — Live polling without the `refreshInterval` trap (landed as ux Read §1.7 ✅).** the+ activity feed polls 10 s **only while** `hasInFlightActivity`, via a reactive-boolean `shouldPoll`+ feeding `refreshInterval` (`detail/action.ts:300-315`, `:48-57`) rather than a function-valued+ `refreshInterval` — dodging SWR's cold-start trap and stopping the moment the run goes idle.+- **✅ 亮点 — Run-all flow — the mutation model (landed as ux Act §3.1 ✅).**+ `TaskSubtasks.tsx:204-255` runs preview → **locked confirm** → `partialFailure` vs `kickedOff`+ toasts, with a real outer try/catch + error toast — so a bulk run tells the user exactly what+ happened even on partial success. The model every other mutation here should copy (most don't —+ gaps D①D⑤).+- **✅ 亮点 — Comment draft preserved on failure.** the comment editor is cleared **only after**+ `await` resolves (`CommentInput.tsx`), so a failed post keeps the typed draft rather than eating+ it — the draft-safety half is already right (the missing half is the failure toast — gap D⑤).+- **✅ 亮点 — Persisted elapsed /countdown readouts.** the running-topic elapsed+ (`TopicCard.tsx:45-59`) and the scheduled next-run countdown (`TaskDetailRunPauseAction.tsx:110-135`)+ both derive from **persisted** timestamps (`activity.time`, `heartbeat.lastAt`, the cron pattern),+ with a 1 s ticker only advancing the display — so a remount shows true elapsed, not a reset-to-0.+- **✅ — Broad confirmation coverage.** delete / brief / artifact / stop-topic / run-all are all+ confirm-gated; the gap is _consistency_ (the task-level Stop is the one sibling left unconfirmed —+ gap D④), not absence.++## 3 — Experience gaps (ranked)++**D① Run / Pause / Run-now failures are silent — Act §3.1 / Feedback §4.2** 🔴+`runTask` catches and only `console.error`s (`store/task/slices/lifecycle/action.ts:49-52`) — no+re-throw, no toast; its callers `handleRunOrPause` / `handleRunNow` use `try/finally` with **no+catch** (`TaskDetailRunPauseAction.tsx:59-67`, `:83-91`). Because `runTask` never rejects, a failed+run resolves normally, `finally` clears `isStarting`, and the next refresh reverts the optimistic+`status:'running'` — so the button **silently snaps back to "Run"** with no error. The pause path+(`updateTaskStatus(taskId,'paused')`) rethrows but the caller still has no catch, so a failed pause+is equally silent. The job-control twin of the optimistic-mutation rule: a run/pause/stop that only+logs its failure reads as a dead button. _Remedy:_ toast at the store-action boundary (copy the+run-all flow). **Filed as sub-issue.**++**D② Failed task-detail fetch masquerades as "Task not found" (404), no retry — Read §1.1** 🟠+`fetchTaskDetail` throws `Task not found` when `result.data` is falsy **and** lets any network / 500+rejection propagate the same way (`store/task/slices/detail/action.ts:124-129`);+`useActiveTaskDetail.ts:60` then sets `isNotFound = !!taskError && !hasTaskDetail`, and+`TaskDetailPage.tsx:39-59` renders a terminal `NotFound` whose only action is a "Back to tasks"+`Link` (`:51-53`). A transient failure (after SWR retries) therefore tells the user the task was+**deleted** and offers **no Reload** — deleted vs failed-to-load conflated (the comment at+`useActiveTaskDetail.ts:49-51` reasoned only about the missing case). _Remedy:_ distinguish a+thrown "not found" → 404 from a fetch rejection → reload state; read `error` before falling to+`NotFound`. (The rest of this machine is the §2 model.)++**D③ Config autosave fails silently; the save-state can't represent failure — Feedback §4.4** 🟠+`updateVerifyConfig`, `updateTaskModelConfig`, `updatePeriodicInterval`, `setAutomationMode`,+`updateSchedule` all catch-and-`console.error` (`store/task/slices/config/action.ts:121-132,+135-156,160-167,172-230,235-285`); the optimistic engine reverts the value with no toast.+Compounding it, `taskSaveStatus` is `'idle' | 'saving' | 'saved'` with **no `failed`**+(`slices/detail/initialState.ts:9`); on error it resets to `'idle'` (`detail/action.ts:284`,+`config/action.ts:153`, `lifecycle/action.ts:106`), and the header renders `AutoSaveHint` **only+while `saving`** (`TaskDetailPage.tsx:68`) — `AutoSaveHint` itself has no failed state+(`components/Editor/AutoSaveHint.tsx`). So a failed verify / schedule / model save looks identical+to a saved one. (`updateTask` — title/assignee — is the one exception that toasts,+`detail/action.ts:286-291`.) The same type-level trap as agent-profile and the page editor.+_Remedy:_ add `failed` to the enum + an inline retry keeping the edited value; drive it from the+config `catch`. **Filed as sub-issue.**++**D④ No true task-level abort; header "Stop" is unconfirmed and gives no feedback — Act §3.1 / §3.4** 🟠+The header "Stop" (`TaskDetailRunPauseAction.tsx:189-200`) calls `updateTaskStatus(taskId,'paused')`+— it flips the DB status to `paused` with **no confirm and no success toast**, and there is **no+task-level run abort**: the only real cancel is per-topic (`cancelTopic`, `lifecycle/action.ts:23-27`)+buried behind the activity feed's `TopicCard` "Stop Run" confirm (`TopicCard.tsx:74-89`). So to+actually abort an in-flight run the user must hunt the running topic card, while the prominent+"Stop" only pauses — and the per-topic stop confirms while the task-level one doesn't+(consistency-is-semantic). Absent cancel is a class-norm miss for a run-monitor (Devin / Actions all+abort a running job). Also `TaskDetailRunPauseAction.tsx:178` returns `null` on a terminal task, so+the run-control region reads empty with no "what now" (pending L2). _Remedy:_ wire a real+task-level abort into the in-progress state; confirm it consistently with the per-topic stop.+**Filed as sub-issue.**++**D⑤ Comment / instruction submit failures are silent — Act §3.1 / Feedback §4.4** 🟡+`addComment` has no catch and doesn't toast (`store/task/slices/detail/action.ts:76-89`);+`CommentInput` / `CommentCard.handleSave` await it in `try/finally` with no catch. The draft is safe+(editor cleared only after `await` — the §2 good case), but the failed post is an unhandled+rejection with no message. Instruction autosave is the D③ shape. _Remedy:_ toast the failure at the+action boundary; keep the (already-preserved) draft.++**D⑥ Section polish — artifacts hide-on-zero, parent-bar swallows error, hardcoded i18n — Read §1.1 / i18n** 🟡+`TaskArtifacts.tsx:124` returns `null` on zero artifacts — the whole section vanishes, so "no+artifacts yet" is indistinguishable from "feature missing"; `TaskParentBar.tsx:57-60` swallows a+parent-fetch error and silently shows `backlog`; and several strings bypass locale files+(`TopicCard.tsx:79-88` stop-run confirm, `detail/action.ts:287` "Failed to update task",+`TaskArtifacts.tsx:36` `'Untitled'`). _Remedy:_ render a labeled empty for artifacts; surface the+parent error; move literals to locales. **(confirm the section-vanish on render — L2.)**++_Cross-surface:_ the detail's `updateTask` leaving the **list row stale** (two un-normalized caches,+gated refresh — `detail/action.ts:295-297`) is owned as **gap L③ in [`tasks.md`](tasks.md)**.++## 4 — Skill feedback (回灌)++- **Already landed by the combined run (validated-existing here):** Feedback **§4.2** ✅ compound-gate+ sub-rule (the §2 loading machine); Read **§1.7** ✅ conditional-polling sub-rule (the §2 reactive+ poll); Act **§3.1** ✅ run-all + ❌ job-control (gap D①); Read **§1.1** ❌ error-as-not-found (gap+ D②); Feedback **§4.4** ❌ no-`failed` save-state (gap D③). All already cite this surface.+- **No new generalizable rule from this split run.** Gap D④ (no task-level abort; real cancel buried+ per-topic) is a fresh **instance** of the already-landed Act §3.1 cancel-class norm ("a+ long-running op offers Cancel while it runs, not delete-after"), not a missing distinction — so it's+ recorded as an ❌ example, not re-landed. D⑤/D⑥ are validated-existing (Act §3.1, Read §1.1, i18n).+- The 回灌 loop for this surface pair was closed by the combined run; this split verifies the rules+ still hold at current line numbers and re-homes the ❌ examples per surface.++## 5 — Pending: L2 visual + L3 dynamic++- **L2 (visual)** — whether a terminal-state task's detail (run-control `null`, gap D④) leaves an+ obvious next action; the artifacts total-hide (gap D⑥); how the not-found screen reads vs a real+ 404; narrow-width + dark-mode.+- **L3 (dynamic)** —+ - Force the detail fetch to 500 → **confirm gap D②** (shows "Task not found", no reload).+ - Force a run start / pause to fail → **confirm gap D①** (button snaps back, no toast).+ - Force a schedule / verify / model save to fail → **confirm gap D③** (value reverts silently, hint gone).+ - Try to abort a running task from the header → **confirm gap D④** (only pauses; real cancel is per-topic).+ - **Measure the activity-feed poll's effect on INP** while a run streams.diff --git a/.agents/skills/ux-audit/references/example/tasks.md b/.agents/skills/ux-audit/references/example/tasks.mdindex ca13b569a02..004d3c6196a 100644--- a/.agents/skills/ux-audit/references/example/tasks.md+++ b/.agents/skills/ux-audit/references/example/tasks.md@@ -1,253 +1,177 @@-# Worked example — Task Workspace (`/tasks` list + `/task/[id]` detail) audit--A real run of this skill against the **Task Workspace** (`@/features/AgentTasks`), 2026-07 —-an agent task board: a cross-agent list/kanban (`/tasks`) + a single-task detail that doubles-as an **async agent-run monitor** (`/task/[taskId]`) with a live activity feed, subtasks,-comments, artifacts, and schedule / verify config. Use it as a template for the output shape,-not as current-state truth (the code moves; re-verify before citing).--**One pair of surfaces, two entry points (not a duplicate).** The audit resolved the parent-issue's warning: the "Chat-side" tasks routes (`agent/:aid/tasks`, `agent/:aid/task/:taskId`,-`desktopRouter.config.tsx:121-136`) and the standalone workspace routes (`/tasks`,-`/task/:taskId`, `:637-669`) **delegate to the same components** — `AgentTasksPage` and-`TaskDetailPage` — parameterized by `agentId` / `showTaskAgentPanelToggle`-(`routes/(main)/tasks/index.tsx`, `.../agent/tasks/index.tsx`, `.../task/[taskId]/index.tsx`).-So this is **one** list surface + **one** detail surface, audited once.--**Surface class:** agent task board / issue tracker + async-job monitor — benchmark against-Linear / Asana (list · kanban · grouping · priority · assignee) **and** Devin / GitHub Actions-run pages / cron dashboards (run · pause · stop · retry · live log · schedule).+# Worked example — Tasks list /kanban (任务列表) audit++A real run of this skill against the **agent tasks list** — the cross-agent list/kanban board+(`/tasks`) and its agent-scoped twin (`/agent/:aid/tasks`), 2026-07 (LOBE-11219). Use it as a+template for the output shape, not as current-state truth (the code moves; re-verify before+citing).++> **One pair of surfaces, audited as two focused reports.** The tasks list and the single-task+> **detail** (`/task/:taskId`) share one store and one feature package but are **different+> surfaces** with different class norms, so they get one report each: this file (the list) and+> its sibling [`task-detail.md`](task-detail.md) (the detail / run-monitor). They were first+> audited together; the combined run's `ux` 回灌 is already landed (§4). The **cross-surface+> seam** between them (list `tasks` array vs detail `taskDetailMap`) is a real gap — owned here+> as **gap L③**, cross-referenced from the detail report.++**Both route trees delegate to one component.** The Chat-side `agent/:aid/tasks`+(`desktopRouter.config.tsx:121-128`) and the standalone `/tasks` (`:643`) both render+`AgentTasksPage` parameterized by `agentId` / all-agents (`routes/(main)/agent/tasks/index.tsx`,+`routes/(main)/tasks/index.tsx:3`). One list surface, audited once.++**Surface class:** agent task board / issue-tracker list — benchmark against Linear / Asana /+GitHub Issues (list · kanban · grouping · priority · assignee · **live status** · bulk ops).**Layers run:** L1 (static / code) ✅ — everything below. L2 (visual) / L3 (dynamic + CLS)-⏳ not yet run — see §5. Verdicts about the render are L1 inferences here, pending L2.+⏳ not yet run — see §5.**Load-bearing files:** `features/AgentTasks/AgentTaskList/{AgentTasksPage,TaskList,KanbanBoard,-KanbanColumn,EmptyState,CreateTaskInlineEntry}`, `AgentTaskDetail/{TaskDetailPage,-useActiveTaskDetail,TaskDetailRunPauseAction,TaskDetailHeaderActions,TaskActivities,TaskSubtasks,-TaskVerifyConfig,TaskInstruction,CommentInput,TopicCard}`, `CreateTaskModal/*`,-`store/task/slices/{list,detail,lifecycle,config}/action.ts`, `services/task.ts`,+KanbanColumn,EmptyState,CreateTaskInlineEntry}`, `features/AgentTasks/features/AgentTaskItem.tsx`,+`features/AgentTasks/hooks/useTaskItemContextMenu.tsx`, `CreateTaskModal/*`,+`store/task/slices/{list,detail,lifecycle}/action.ts`, `store/task/selectors/listSelectors.ts`,`apps/server/src/routers/lambda/task.ts`.## 1 — Patterns in use-| Pattern (family) | Where | Rating | Note |-| ------------------------------------- | --------------------------------------------------------------------------------------------- | ------ | ---------------------------------------------------------- |-| Overview + Detail (nav) | list rows → `taskDetailPath` (`AgentTaskItem.tsx:65`); detail sections | ✅ | click row opens detail |-| Deep-linking / breadcrumb (nav) | `shared/Breadcrumb.tsx`; copy-link (`HeaderActions.tsx:49`, `useTaskItemContextMenu.tsx:202`) | ✅ | workspace-aware absolute URL |-| List ⇄ Kanban toggle (nav) | `TasksGroupConfig.tsx:163`, persisted `setViewMode` | ✅ | view choice sticks |-| Grouping / sub-grouping / sort (data) | `TaskList.tsx:143-201`, `listViewOptions.ts` | ⚠️ | rich — but **client-side over ≤50 rows** (gap ⑤) |-| Empty-as-onboarding (growth) | `EmptyState.tsx` (greeting + inline create + templates) | ✅ | strong onboarding hero — highlight |-| Loading Skeleton (feedback) | list `TaskList.tsx:203`, kanban `KanbanColumn.tsx:253`, detail `useActiveTaskDetail` | ⚠️ | detail solid; **list can't fail** (gap ①) |-| **Failure + Retry (feedback)** | list fetch / detail fetch | — abs. | the surface's dominant gap (①②) |-| Live activity feed (data) | `TaskActivities.tsx` + 10s poll (`detail/action.ts:48`) | ✅ | reversed chronological, real empty |-| Not-found / 404 (data) | `TaskDetailPage.tsx:39-59` | ⚠️ | real screen, but **failed-load reads as 404** (gap ②) |-| Optimistic mutation (act) | kanban drag (`KanbanBoard.tsx:133`), status, delete | ⚠️ | some roll back + toast, most log-only (gaps ③④⑥⑦⑧) |-| Run / pause / stop control (act) | `TaskDetailRunPauseAction.tsx`, `TopicCard.tsx` | ⚠️ | works, but start/stop failures silent (gap ③) |-| Editable-in-place / autosave (edit) | title, instruction, comment, config | ⚠️ | debounced save, **no `failed` state** (gaps ④⑥) |-| Confirmation (act) | delete / brief / artifact / stop-topic / run-all | ✅⚠️ | broad; **task-level Stop unconfirmed** (gap ⑨) |-| Context menu (act) | `useTaskItemContextMenu.tsx` (status/priority/run/copy/delete) | ✅⚠️ | complete; menu run/status failures silent (gap ⑦) |-| Inline create + modal (act/edit) | `CreateTaskInlineEntry.tsx`, `CreateTaskModal/*` | ⚠️ | create failure silent (③); **draft not persisted** (gap ⑩) |--**Read:** the **read/monitor spine is mature** (detail state machine, live polling, activity-feed, confirmations). The weakness clusters hard in **Feedback** — every fetch that can hang has-no retry (①②), and **nearly every write swallows its failure** (create ③, run/pause ③, delete ④,-config/status autosave ④, comment/menu ⑦⑧): a catch that only `console.error`s, or a re-throw-into an uncaught handler, so the optimistic UI reverts with no word to the user. Plus a-**Read-at-scale** cap (⑤) — the list silently truncates at 50.+| Pattern (family) | Where | Rating | Note |+| ---------------------------------- | -------------------------------------------------------------------------- | ------ | ------------------------------------------------------ |+| Overview + Detail (nav) | row → `taskDetailPath` (`AgentTaskItem.tsx:65-72`) | ✅ | click row / subtask opens detail |+| Deep-linking / breadcrumb (nav) | copy-link builds absolute workspace URL (`useTaskItemContextMenu.tsx:142`) | ✅ | |+| List ⇄ Kanban toggle (nav) | `TasksGroupConfig.tsx`, persisted `viewMode` | ✅ | view choice sticks |+| Grouping / sub-group / sort (data) | `TaskList.tsx:135-201`, `listViewOptions` | ⚠️ | rich — but **client-side over a ≤50 cap** (gap L②) |+| Empty-as-onboarding (growth) | `EmptyState.tsx:36-99` (greeting + inline create + templates) | ✅ | strong first-run hero — **亮点** (§2) |+| Permission-gated actions (act) | create/edit gated on `usePermission` + tooltip reason | ✅ | `AgentTasksPage.tsx:60,125` — **亮点** (§2) |+| Hidden-completed footer (data) | "N completed hidden · show" (`TaskList.tsx:224-243`) | ✅ | reversible disclosure |+| Loading Skeleton (feedback) | list `TaskList.tsx:203-213`, kanban `KanbanBoard.tsx:203` | ⚠️ | gated `!isInit` → **permanent on error** (gap L①) |+| **Failure + Retry (feedback)** | list / group fetch | — abs. | the surface's dominant gap (L①) |+| Empty state variants (data) | generic `Empty` (`TaskList.tsx:216-222`) | ⚠️ | **no CTA, no no-match variant** (gap L⑥) |+| Live / status feed (data) | per-row `useFetchTaskDetail` polls in-flight rows only | ⚠️ | list-level status **not** refreshed; no indicator (L⑥) |+| Optimistic mutation (act) | kanban drag / context-menu status / inline create | ⚠️ | **most swallow failure** (gaps L③L④) |+| Lists at scale (data) | plain `.map`, no windowing (`TaskList.tsx:43-48`) | — abs. | no virtualization / pagination (gap L②) |+| Inline create + modal (act/edit) | `CreateTaskInlineEntry.tsx`, `CreateTaskModal/*` | ⚠️ | **draft not persisted** (gap L⑤) |++**Read:** navigation, view-toggle, first-run onboarding and permission-gating are mature. The+weakness clusters in **Feedback / Read-at-scale**: no error path (L①), no virtualization over a+silent 50-row cap (L②), a stale-across-surface list row (L③), several silent-failure write paths+(L④), an unprotected create draft (L⑤), and a quasi-live list that under-serves liveness while+its empty state dead-ends (L⑥).## 2 — Strengths / good cases (don't regress)-The read/monitor spine is mature — these are the ✅ half of the 回灌 loop and the "don't regress"-list for the next refactor (which is mostly write-path work, so it's easy to nick these). **Three-land as ✅ examples in the `ux` checklists** (see §4):--- **✅ 亮点 — Detail loading /not-found state machine (→ landed as ux Feedback §4.2 ✅).**- `useActiveTaskDetail.ts` gates the skeleton on "resolving", **not** on `data === undefined`, and- the assignee-config gate keys off the fetch's **in-flight** flag (`agentConfigLoading`, `:66-77`),- so an assignee that resolves to `null` (deleted / out-of-scope) **releases** the gate instead of- deadlocking — a task with no assignee still renders instead of spinning forever. Extracted a- latent **compound-gate** sub-rule into Feedback §4.2. (The one soft spot: a _transient fetch- error_ still coerces to "Task not found" — gap ②; the gate machine itself is the model.)-- **✅ 亮点 — Live polling without the `refreshInterval` trap (→ landed as ux Read §1.7 ✅).** the- activity feed polls 10s **only while** `hasInFlightActivity`, driven by a **reactive-boolean**- `shouldPoll` selector feeding `refreshInterval` (`detail/action.ts:300-315`) rather than a- function-valued `refreshInterval` — so it dodges SWR's cold-start trap (the function form never- schedules a first timer if its initial value is `0`) and stops the moment the run goes idle.- Extracted the "conditional polling starts from reactive state" sub-rule into Read §1.7.-- **✅ 亮点 — Run-all flow — the mutation model (→ landed as ux Act §3.1 ✅).** `TaskSubtasks.tsx:204-255`- runs preview → **locked confirm** → `partialFailure` vs `kickedOff` toasts, so a bulk run tells- the user exactly what happened even on partial success. This is cited as the **✅** for Act §3.1- and is the model every other mutation on this surface should copy (they mostly don't — gaps- ③⑦⑧).-- **✅ 亮点 — Comment draft preserved on failure.** the comment editor is cleared **only after**- `await` resolves, so a failed post keeps the typed draft in place rather than eating it — the- draft-safety half of the write path is already right (the missing half is the failure _toast_ —- gap ⑥).-- **✅ 亮点 — Broad confirmation coverage.** destructive / disruptive actions across the surface —- delete, brief, artifact, stop-topic, run-all — are gated behind confirms (Confirmation row, §1- table). The gap is _consistency_, not absence: the task-level Stop is the one sibling left- unconfirmed (gap ⑨).+The read/onboarding spine is strong — these are the ✅ half of the 回灌 loop and the "don't+regress" list for the (mostly write-path) next refactor:++- **✅ 亮点 — Empty-as-onboarding hero.** First-run empty isn't a blank slate: `EmptyState.tsx:36-99`+ renders a greeting, an inline create composer, and recommended task templates (with their own+ skeletons + refresh), gated on `isListEmpty` (`AgentTasksPage.tsx:64,146`). The empty state+ doubles as the primary entry point — the model an empty data list should follow.+- **✅ 亮点 — Permission-gated actions carry their reason.** Create / edit are gated on+ `usePermission('create_content')` with a tooltip `reason` wired consistently across the header+ `+`, the inline composer submit, the context menu, and run-all (`AgentTasksPage.tsx:60,125`,+ `CreateTaskInlineEntry.tsx:285`) — a disabled control that says _why_, not a dead one.+- **✅ 亮点 — Reactive per-row polling.** Each row's `useFetchTaskDetail` polls 10 s **only while**+ that task has in-flight activity (`store/task/slices/detail/action.ts:300-315`, reactive+ `shouldPoll` boolean → `refreshInterval`), dodging SWR's function-form cold-start trap. (Caveat:+ it refreshes the row's _detail_, not the list's own status field — see gap L⑥.)+- **✅ — Hidden-completed footer.** Completed tasks collapse behind a "N hidden · show" footer+ (`TaskList.tsx:224-243`) rather than padding the list — reversible progressive disclosure.## 3 — Experience gaps (ranked)-**① List / kanban fetch failure → permanent skeleton, no retry — Feedback §4.2** 🔴-`isTaskListInit` / `isTaskGroupListInit` flip to `true` **only** in the SWR `onSuccess`-callback (`store/task/slices/list/action.ts:146-155`, `:110-116`); there is **no `onError`**, and-the hook's `error` / `isLoading` are **discarded at the call site** (`AgentTasksPage.tsx:63` calls-`useFetchTaskList(...)` without assigning the return). `TaskList.tsx:203` / `KanbanBoard.tsx:203`-render the skeleton on `!isInit`. So when `taskService.list()` exhausts SWR's retries, `isInit`-stays `false` **forever** → skeleton spins with no error, no retry. The init-flag-gated-on-success-trap — identical to the Eval module's nine-fetch version.--**② Failed task-detail fetch masquerades as "Task not found" (404), no retry — Read §1.1** 🟠-`fetchTaskDetail` throws `Task not found` when `result.data` is falsy **and** propagates any-network / 500 rejection the same way (`detail/action.ts:124-129`); `useActiveTaskDetail.ts:60`-then sets `isNotFound = !!taskError && !hasTaskDetail`, and `TaskDetailPage.tsx:39-59` renders a-terminal `NotFound` whose only action is "Back to tasks". A transient fetch failure (after SWR-retries) therefore tells the user the task was **deleted** and offers **no Reload** — deleted vs-failed-to-load conflated. The code comment (`useActiveTaskDetail.ts:49-51`) reasoned only about-the missing case, not the errored one. (The rest of this machine is good — see Strengths.)--**③ Run / Pause / Run-now / Create failures are silent — Act §3.1 / Feedback §4.2** 🔴-`runTask` catches and only `console.error`s (`lifecycle/action.ts:49-52`) — no re-throw, no-toast; its callers `handleRunOrPause` / `handleRunNow` use `try/finally` with **no catch**-(`TaskDetailRunPauseAction.tsx:60-67`, `:84-91`). A failed run rolls the optimistic-`status: 'running'` back on refresh, so the button **silently snaps back to "Run"** with no-error. The **pause** path (`updateTaskStatus(taskId, 'paused')`) and **createTask**-(`detail/action.ts:150-174`, `try/finally` no catch; callers `CreateTaskInlineEntry.tsx:126`,-`CreateTaskContent.tsx:83` don't catch) are the same shape — an unhandled rejection, zero-feedback, on the surface's primary action. This is the **job-control** twin of the optimistic--mutation rule: a run/pause/stop/retry that only logs its failure reads as a dead button.--**④ Config & status autosave fail silently; the save-state can't represent failure — Feedback §4.4** 🟠-`updateVerifyConfig`, `updateTaskModelConfig`, `updatePeriodicInterval`, `setAutomationMode`,-`updateSchedule` all catch-and-`console.error` (`config/action.ts:121-132,151-167,224-229,279-284`),-as does `TaskVerifyConfig.doSave` (`:202-204`) and `TaskInstruction`'s debounced save-(`TaskInstruction.tsx:98-100`). The store's optimistic engine reverts the value on failure but-says nothing — a silent-write trap. Compounding it, `taskSaveStatus` is `saving | saved | idle`-with **no `failed`**: on error `updateTask` / `#transitionStatus` reset to `idle`-(`detail/action.ts:284`, `lifecycle/action.ts:106`), and the header renders `AutoSaveHint` only-while `saving` (`TaskDetailPage.tsx:68`) — the enum literally can't represent failure.-(`updateTask` itself does toast — `detail/action.ts:286` — the one exception.)--**⑤ List sort / group / filter run client-side over a 50-row cap; no load-more — Read §1.2** 🟠-The server caps the list at `limit` default **50**, max 100 (`apps/server/src/routers/lambda/-task.ts:99`), and the store's `fetchTaskList` passes **no** limit/offset, so exactly 50 rows load-while `tasksTotal` (`data.total`) can be larger. `TaskList.tsx:135-201` then filters, sorts, and-groups **entirely in-memory over those 50** — with **no pagination, no virtualization, no-load-more**. A user with 60 tasks sees 50, and any sort/group silently orders a partial set (the-paginated-sort-client-side trap). Each visible row _also_ fires its own-`useFetchTaskDetail(task.identifier)` (`AgentTaskItem.tsx:47`) → up to 50 detail requests per-list paint.--**⑥ Instruction / comment / feedback submit show no failure — Act §3.1 / Feedback §4.4** 🟡-`addComment` has no catch and doesn't toast (`detail/action.ts:76-89`); `CommentInput` /-`CommentCard.handleSave` / `FeedbackInput` await it in `try/finally` with no catch-(`CommentInput.tsx:57-65`, `CommentCard.tsx:97-104`). Draft is safe on the comment path (editor-cleared only after `await` resolves — good), but the failed post is an unhandled rejection with no-message. Instruction autosave is the §④ shape.--**⑦ Context-menu run / status changes are fire-and-forget — Act §3.1** 🟡-The context menu calls `void updateTaskStatus(...)` (`useTaskItemContextMenu.tsx:114`) and-`runTask` (which only logs); kanban drag reverts visually but shows no toast-(`KanbanBoard.tsx:139-141`). A failed status/run from the menu gives no feedback. (Status does-flip `taskSaveStatus`, but that's surfaced only on the detail page.)--**⑧ Delete-task failure is silent, and optimistic-before-confirm — Act §3.1** 🟡-`deleteTask` optimistically removes the row (`detail/action.ts:180`), then on failure rolls back-and **re-throws** with no toast (`:190-198`); the confirm modal's `onOk`-(`TaskDetailHeaderActions.tsx:38-41`) doesn't catch, so a failed delete rejects silently and the-navigate to `/tasks` is skipped — the detail page flickers out and back with no explanation.--**⑨ Task-level "Stop" is unconfirmed and gives no feedback — Act §3.1** 🟡-The header Stop (`TaskDetailRunPauseAction.tsx:189-200`) pauses the whole task with **no confirm-and no success toast**, while the per-topic "Stop Run" **is** confirmed (`TopicCard.tsx:77-89`).-Stopping an in-progress agent run is disruptive; the two sibling stop controls should confirm-consistently (consistency-is-semantic).--**⑩ Create draft not persisted — modal `maskClosable` / collapse loses typed content — Edit §2.1** 🟡-`CreateTaskContent` and `CreateTaskInlineEntry` hold draft in local `useState`+**L① List / kanban fetch failure → permanent skeleton, no retry — Feedback §4.2** 🔴+`isTaskListInit` / `isTaskGroupListInit` flip `true` **only** in the SWR `onSuccess`+(`store/task/slices/list/action.ts:146-155`, `:110-116`); there is **no `onError`** anywhere in+`src/store/task`, and the hook's `error` / `isLoading` are **discarded at the call site** —+`AgentTasksPage.tsx:62-63` calls `useFetchTaskList(...)` without assigning the return (kanban:+`KanbanBoard.tsx:89-90`). `TaskList.tsx:203` renders the skeleton on `!isInit`. So once+`taskService.list()` exhausts SWR's retries, `isInit` stays `false` **forever** → skeleton spins+with no error, no retry. And error is never checked before empty: `isListEmpty = isTaskListInit &&+tasks.length === 0` (`listSelectors.ts:41`) is `false` on failure, so the page falls through the+onboarding hero into the permanent skeleton — a failed load reads as neither empty nor error.+_Remedy:_ add `onError` → an error state + Reload; read the hook's `error` at the call site.++**L② List sort / group / filter run client-side over a 50-row cap; no virtualization — Read §1.2** 🟠+The server caps the list at `limit` default **50** (`apps/server/src/routers/lambda/task.ts`), and+`fetchTaskList` passes no limit/offset, so 50 rows load while `tasksTotal` can be larger.+`TaskList.tsx:135-201` then filters, sorts, and groups **entirely in-memory over those 50** — no+pagination, no load-more, no windowing (plain `.map`, `TaskList.tsx:43-48`; kanban maps all,+`KanbanColumn.tsx:260`). A user with 60 tasks sees 50, and any sort/group silently orders a partial+set (the paginated-sort-client-side trap). Each visible row _also_ mounts its own+`useFetchTaskDetail(task.identifier)` (`AgentTaskItem.tsx:48`) → up to 50 detail SWR subscriptions+per list paint. _Remedy:_ server-side sort/group/paginate (URL-driven keys), virtualize, batch the+per-row detail.++**L③ Detail edits don't propagate to the list — two un-normalized caches — Act §3.1 (cross-surface)** 🟠+The list reads a `tasks` array (`useFetchTaskList` `onSuccess`); the detail reads `taskDetailMap`.+`updateTask` patches only the map and refreshes the list **only** when assignee / parent changed+(`store/task/slices/detail/action.ts:295-297`). So editing a task's **title / priority / model /+instruction** from the detail leaves the **list row stale** — visible when list + detail are+mounted together (Chat portal) or on cached back-navigation (`revalidateOnFocus:false`). This is a+seam **between** this surface and [`task-detail.md`](task-detail.md); a per-surface read misses it+by construction (see the method note in §4). _Remedy:_ one normalized map, or invalidate the list+on every successful write, not a gated subset.++**L④ Context-menu / drag / create write failures are silent — Act §3.1** 🟡+The context menu fires `void updateTaskStatus(...)` (`useTaskItemContextMenu.tsx:114`, `:279`) —+`#transitionStatus` `console.error`s and rethrows (`lifecycle/action.ts:104-109`), but the `void`+drops it, so a failed status change silently reverts on the next refresh. Kanban `handleDragEnd`+awaits `updateTaskStatus` in `try { } catch { revert }` with an **empty catch**+(`KanbanBoard.tsx:137-141`) — reverts the card, no toast. `createTask` (`detail/action.ts:150-174`,+`try/finally` no catch) rejects up to `CreateTaskInlineEntry.handleSubmit` (`:107-155`), which+`await`s it with **no catch and no error toast** — a failed create leaves the composer unclear'd+with no word. All three should toast at the store-action boundary (the run-all flow and detail+`updateTask` already do — see §2 / task-detail.md).++**L⑤ Create draft not persisted — modal `maskClosable` discards typed content — Edit §2.1** 🟡+`CreateTaskContent` / `CreateTaskInlineEntry` hold the draft in local `useState`(`CreateTaskContent.tsx:51`, `CreateTaskInlineEntry.tsx:64`); the modal is `maskClosable: true`(`CreateTaskModal/index.tsx:11`), so a stray backdrop click discards everything typed with no-warning, and the minimize→inline handoff opens a fresh inline entry rather than carrying the-draft. (Twin of the home-composer in-memory-draft ❌ already in Edit §2.1.)--**⑪ Section polish — Read §1.1 / Act §3.2** 🟡-`TaskArtifacts.tsx:124` returns `null` on zero artifacts — the whole section vanishes, so "no-artifacts yet" is indistinguishable from "feature missing"; `TaskParentBar.tsx:57-60` swallows a-parent-fetch error and silently shows `backlog`; and `TaskDetailRunPauseAction.tsx:178` returns-`null` when a task is terminal (`completed`/`failed`/`canceled`) so the run-control region reads-empty with no "what now" — **confirm on the render (L2)**, don't conclude from the code.--**⑫ Hardcoded English `defaultValue` / raw literals — i18n** 🟡-Several user-facing strings bypass locale files: `TopicCard.tsx:79-88` (stop-run confirm),-`TopicChatDrawer/index.tsx:150,157,185` (copy-id labels), `detail/action.ts:287` ("Failed to-update task"), `TaskArtifacts.tsx:36` (`node.title || 'Untitled'`). They only show if a `zh-CN`-key is missing, but the `defaultValue` fallbacks flag keys that may be absent.--**⑬ Detail edits don't propagate to the list — two un-normalized caches — Act §3.1 (cross-surface)** 🟠-The list reads a `tasks` array (`useFetchTaskList` `onSuccess`); the detail reads `taskDetailMap`;-`updateTaskDetail` patches only the map (`detail/reducer.ts:74`). Sync is a full `refreshTaskList()`-(`list/action.ts:67`) mounted on _some_ paths (run / status / create / delete) but **gated** on-`updateTask` to fire only when assignee / parent changed (`detail/action.ts:295-297`). So editing a-task's **title / priority / model / instruction** from the detail leaves the list row **stale** —-visible when list + detail are mounted together (Chat portal) or on cached back-navigation-(`revalidateOnFocus:false`). Fix: one normalized map, or invalidate the list on every successful-write. **This is a seam _between_ the two surfaces — see the method note below.**--> ⚠️ **Method blind spot this run hit.** ⑬ was missed on the first pass because the audit was split-> into a per-surface list reader and a per-surface detail reader, each told to ignore the other — so-> the shared-store seam (list `tasks` vs detail `taskDetailMap`, stitched by a gated `refreshTaskList`)-> was owned by neither, and the ux-audit checklists have no cross-surface / cache-coherence item. When-> a surface pair edits + lists the **same entity**, add a reader that owns the seam (the shared store),-> or the split-by-surface fan-out will silently drop coherence bugs.+warning, and the minimize → inline handoff opens a fresh entry rather than carrying the draft.+(Twin of the home-composer in-memory-draft ❌ already in Edit §2.1.) _Remedy:_ back the draft to+localStorage keyed per agent, or warn on dirty close.++**L⑥ Quasi-live list under-serves liveness, and the empty state dead-ends — Read §1.7 / §1.1** 🟡+The list is a live surface (running tasks change status), but the row's top-level status tag reads+`toTaskStatus(task.status)` from the **non-polled list fetch** (`AgentTaskItem.tsx:62,101,166`);+the per-row detail poll refreshes subtasks/activities but never `refreshTaskList`, so a+running→completed transition can show a **stale top-level status** until a mutation or remount, and+there is **no Update Indicator / "N new" / manual refresh** anywhere. Separately, the generic+`Empty` (`TaskList.tsx:216-222`) is description + icon with **no CTA** and **no no-match variant**,+so a list filtered/grouped to zero rows (while `isListEmpty` is false) dead-ends with no+create/clear-filters affordance. _Remedy:_ refresh the list-level status on the same poll (or a+"N updated · refresh" pill), and give the zero-rows `Empty` a create / clear-filters CTA.+**(the visible staleness needs L3 to confirm — see §5.)**## 4 — Skill feedback (回灌)-- **Landed as strengthened `ux` items** from this audit:- - Act **§3.1** — the optimistic-mutation bullet is extended to **run / pause / stop / retry- job-control** actions, with a task-workspace ❌ (`runTask` console.error-only,- `lifecycle/action.ts:49-52` + uncaught `handleRunOrPause`) vs ✅ (`TaskSubtasks` run-all)- (gaps ③⑦). Mirrored into the Quick review.- - Read **§1.1** — new ❌ example: task detail coerces a transient fetch error into a permanent- "Task not found" via a fetcher that throws on both missing-and-errored + `isNotFound =-!!error` (`fetchTaskDetail`, `useActiveTaskDetail.ts:60`) (gap ②).- - Feedback **§4.2** — new ❌ example: task list `isTaskListInit` set only in `onSuccess` with- the hook's `error` discarded at the call site (gap ①).- - Feedback **§4.4** — new ❌ example: task config autosave (verify / schedule / model /- interval) catches-and-logs, and `taskSaveStatus` has no `failed` variant (gap ④).- - Act **§3.1** — new **cross-surface coherence** rule + ❌ example: list `tasks` array and detail- `taskDetailMap` are two un-normalized copies, and `updateTask` refreshes the list only for- assignee / parent, so a detail title/priority edit leaves the list row stale (gap ⑬). Mirrored- into the Quick review. Plus a method note (⚠️ under gap ⑬): split-by-surface fan-out needs a- reader that owns the shared-store seam, or it drops coherence bugs by construction.-- **Good cases landed as ✅ examples (the ✅ half of 回灌 — each sharpened a rule, not just decorated it):**- - Feedback **§4.2** — new **compound-gate** sub-rule + ✅: a gate waiting on a _secondary/dependent_- fetch must key off its **in-flight** flag and release on resolved-absent (`null`), never on the- dependency being present in a map. Extracted from `useActiveTaskDetail.ts:66-77` (the assignee-- config gate) — the current rule only covered a primary fetch's success-only init flag; this adds- the "absent dependency is a resolved state, not a pending one" distinction. Checklist line added.- - Read **§1.7** — new **conditional-polling** sub-rule + ✅: start polling from **reactive state**- (`shouldPoll` boolean → `refreshInterval`), not a function-form `refreshInterval` (which never- schedules a first timer if the initial value is `0`, so polling silently never starts). Extracted- from `detail/action.ts:300-315`. Checklist line added.- - Act **§3.1** — the **run-all** flow (`TaskSubtasks.tsx:204-255`) is cited as the ✅ for the- job-control rule (preview → locked confirm → `partialFailure` vs `kickedOff` toasts).-- **Validated existing rules** (good ❌ examples to cite): Read §1.2 sort/search over a- partial paginated page (gap ⑤); Edit §2.1 in-memory draft lost on close (gap ⑩); Act §3.2- terminal-state control visibility (gap ⑪, pending L2). Good ✅ instance already covered by an- existing rule (cited, not re-landed): comment-draft-preserved-on-failure (Edit §2.1).+- **Already landed by the combined run (validated-existing here):** Feedback **§4.2** ❌ (gap L①,+ the `isTaskListInit`-only-on-success + error-discarded-at-call-site permanent skeleton); Read+ **§1.2** ❌ (gap L②, sort/group over a partial paginated page); Act **§3.1** cross-surface+ coherence rule + ❌ (gap L③, list `tasks` vs detail `taskDetailMap`); Act **§3.1** job-control /+ optimistic ❌ (gap L④); Edit **§2.1** in-memory draft (gap L⑤). Read **§1.7** live-feed ❌ and+ Read **§1.1** empty-variant (gap L⑥). All already cite this surface.+- **No new generalizable rule from this split run.** The two fresh angles (list-level status+ staleness while rows poll individually; the generic `Empty` with no CTA / no no-match) are both+ **instances of already-complete rules** (Read §1.7 live feed owes an indicator + refresh; Read+ §1.1 empty owes a CTA and a no-match variant), not a missing distinction — so, per the good-case+ rule, nothing is landed; they're recorded as ❌ examples.+- **Noted, not landed (candidate):** _a list whose **rows** are individually live (each polls its+ own detail) but whose **list** fetch is static — the row summary goes stale while its detail+ refreshes_. Per-row polling ≠ list freshness. Promote to a Read §1.7 sub-rule if a second surface+ repeats it.++> ⚠️ **Method note (carried from the combined run).** The cross-surface seam L③ was missed on the+> first per-surface pass because a list-only reader and a detail-only reader each ignored the+> other, so the shared-store seam was owned by neither. When a surface pair edits + lists the+> **same entity**, one reader must own the seam (the shared store) — this split keeps L③ owned+> here and cross-referenced from the detail report, not dropped between them.## 5 — Pending: L2 visual + L3 dynamic-L1-only; a later pass should confirm / quantify:--- **L2 (visual)** — how the list skeleton reads vs the onboarding hero; whether a terminal-state- task's detail (run-control `null`, gap ⑪) leaves an obvious next action; kanban at many- columns; the artifacts total-hide (gap ⑪); narrow-width + dark-mode of the create modal.+- **L2 (visual)** — how the list skeleton reads vs the onboarding hero; the zero-rows `Empty`+ (gap L⑥); kanban at many columns; narrow-width + dark-mode of the create modal.- **L3 (dynamic)** —- - Force the list fetch offline → **confirm gap ① live** (permanent skeleton, no retry).- - Force the detail fetch to 500 → **confirm gap ②** (shows "Task not found", no reload).- - Force a run start / pause / create to fail → **confirm gap ③** (button snaps back, no toast).- - Force a schedule / verify save to fail → **confirm gap ④** (value reverts silently).- - Seed 60+ tasks → **confirm gap ⑤** (only 50 render, sort/group over the partial set).- - **Measure list CLS/LCP** across skeleton→content and the 50 per-row detail fetches (gap ⑤).+ - Force the list fetch offline → **confirm gap L① live** (permanent skeleton, no retry, no empty).+ - Seed 60+ tasks → **confirm gap L②** (only 50 render; sort/group over the partial set).+ - Edit a task's title/priority from the detail with the list mounted → **confirm gap L③** (stale row).+ - Let a running task complete while the list is open → **confirm gap L⑥** (stale status, no indicator).+ - Fail a context-menu status change / kanban drag / create → **confirm gap L④** (silent revert).+ - **Measure list CLS/LCP** across skeleton→content and the up-to-50 per-row detail fetches (gap L②).diff --git a/.agents/skills/ux-audit/references/example/topics.md b/.agents/skills/ux-audit/references/example/topics.mdnew file mode 100644index 00000000000..63b648270ae--- /dev/null+++ b/.agents/skills/ux-audit/references/example/topics.md@@ -0,0 +1,228 @@+# Worked example — Agent topics / 话题列表 (topic management) audit++A real run of this skill against the per-agent topic-management page+(`/agent/:aid/topics` → `src/features/AgentTopicManager`), 2026-07-02 (LOBE-11217, under the+Chat / 会话 UX-Audit parent LOBE-11145). Use it as a **template for the output shape**, not as+current-state truth (the code moves; re-verify before citing).++Surface = a scrolling management view over one agent's topics: **chrome** = `NavHeader` ++`AgentBreadcrumb` + a header **search box** (`Header.tsx`) → **① Toolbar** (status tabs with+count badges · trigger/project/time filter chips · card/list view toggle · sort · overflow+"archive stale") → **② BulkActionBar** (floating, appears on selection: favorite · archive ·+move · delete) → **③ the list** in card (`TopicGrid` → `TopicCard`) or list (`TopicListView`+→ `Row`) form, grouped by time/project, **infinite-scrolled** 30 rows/page → **④+MoveTopicsModal** (pick → confirm → moving → done). A topic row/card navigates to the chat+topic view.++**Layers run:** L1 (static / code) ✅ — everything below. L2 (visual) / L3 (dynamic + CLS)+⏳ not yet run — see §5. Verdicts about the render (does the false-empty actually read as+onboarding, how the floating bulk bar sits) are L1 inferences here, pending L2.++**Surface class & its norms (benchmark first).** This is a **list-management console** —+the reference class is Gmail / Linear / Notion database views / a file manager: a large+collection the user filters, sorts, multi-selects, and bulk-operates. Class norms an L1+code-read should check present/missing: server-backed **filter + sort + search over the whole+set** (not the loaded page) ⚠️ (search only); **select-all across the filtered set**, not just+the visible page ✗; **bulk action → confirm → progress → partial-failure report** ⚠️+(delete/move only); a real **empty vs no-match vs failed** split ⚠️ (no failed); **row → detail+/ open** ✅. The defining risk of this class is the **partial-page lie** — anything computed+client-side over the lazily-loaded rows (filter, sort, counts, bulk scope) silently+misrepresents the full set.++## 1 — Patterns in use++| Pattern (family) | Where | Rating | Note |+| ------------------------------------ | --------------------------------------------------------------------------------------- | ------ | ------------------------------------------------------------------------------- |+| Visual Framework (layout) | `NavHeader` + centered `maxWidth:1440` column (`index.tsx:201,213`) | ✅ | consistent chrome |+| Card Stack / Grid of Equals (layout) | `TopicGrid` auto-fill card grid (`TopicGrid.tsx:14`) + `TopicListView` table (`:264`) | ✅ | two view modes, toggle in Toolbar |+| Titled Sections (layout) | time/project group bars (`TopicListView.tsx:281`, `TopicGrid.tsx:54`) | ✅ | grouping is a composition move, not a filter |+| Dynamic Queries (data) | status tabs + trigger/project/time chips + sort (`Toolbar.tsx`) | ⚠️ | **all client-side over the loaded page** (gap ②) |+| Search / find (data) | header `Input` → `useSearchTopics` BM25 (`index.tsx:86`, `Header.tsx:27`) | ✅ | **server-side**, disables infinite-scroll in search mode (highlight) |+| Row → Detail (nav) | card/row `navigate(AGENT_CHAT_TOPIC_URL)` (`TopicCard.tsx:98`, `TopicListView.tsx:162`) | ✅ | closed loop back into chat (Grow §5.3) |+| Multi-select + Bulk (act) | checkbox select + floating `BulkActionBar`; ⌘/ctrl-click to select (`TopicCard.tsx:93`) | ⚠️ | select-all only in list view (gap ⑤); no locked/partial-failure (gaps ⑤⑦) |+| Wizard / state machine (act) | `MoveTopicsModal` pick→confirm→moving→done (`MoveTopicsModal/Content.tsx`) | ✅ | textbook — lock dismissal, catch→retry, go-to-target CTA (highlight §2) |+| Infinite scroll (data) | `IntersectionObserver` sentinel → `loadMoreAgentTopicsView` (`index.tsx:180`) | ⚠️ | page-fetch failure is silent (gap ④) |+| Empty-state variants (feedback) | filtered vs first-run split (`EmptyState.tsx:32`) | ⚠️ | two of three states — **no failed variant** (gap ①) |+| Failure + Retry (feedback) | — | — | **absent** — initial fetch reads only `isLoading` (gap ①), load-more silent (④) |++**Read:** layout, the two view modes, grouping, server-side search, and the move modal are+mature. The weakness clusters in the **data-query layer** (everything but search is a+client-side pass over a partial page — gap ②/③) and in **failure handling** (no error state+on either the initial load or the page loads — gaps ①/④).++## 2 — Strengths / good cases (don't regress)++- \*\*✅ 亮点 — `MoveTopicsModal` is a textbook async-action state machine (→ ✅ for ux Act §3.1+ - Feedback §4.2).\*\* `pick → confirm → moving → done` (`Content.tsx:59,124,171,185,195`):+ it **locks dismissal mid-flight** (`setCanDismissByClickOutside(false)`, `:110`), the+ `catch` **toasts and returns to `confirm`** so the move is retryable without losing the+ picked target (`:115-118`), `moving` uses `NeuralNetworkLoading` (not antd `Spin`), and+ `done` offers a **"go to target agent" primary CTA** (`:203-213`) — forward momentum + a+ closed loop. This is the confirm→in-progress(locked)→done/error shape the bulk bar (gap ⑤)+ lacks; it's the "don't regress" reference for every other mutating path on this surface.+- **✅ 亮点 — Move picker re-adds the virtual inbox agent (already landed as ux Read §1.4 ✅).**+ `targetAgents` prepends the inbox/default "LobeAI" agent that the sidebar list filters out+ (`Content.tsx:80-98`), so topics can be moved to it — a picker that lists every valid+ target, not "every target the sidebar happened to keep".+- **✅ 亮点 — Server-side BM25 search + infinite-scroll disabled in search mode.** Search+ routes to `useSearchTopics` → `searchTopics` over the whole set (`index.tsx:86`,+ `action.ts:779`), and the observer effect early-returns in search mode+ (`index.tsx:181,248`) so paging doesn't fight relevance order. This is the **one** read+ dimension done right — and exactly what makes gap ② (the other four dimensions,+ client-side) legible as the anomaly rather than the norm.+- **✅ 亮点 — Reset-on-agent-switch guards stale bulk targets.** The route reuses one+ component instance across `/agent/:aid` navigations, so `reset()` runs on `activeAgentId`+ change, not just unmount (`index.tsx:72-74` + comment). Without it a leftover `selectedIds`+ from agent A would make a bulk Delete/Archive on agent B **silently target another agent's+ topics** — a real data-safety guard.+- **✅ 亮点 — Dedicated SWR bucket for the management view.** The heavy `withDetails` fetch+ lives in its own `agentTopicsViewMap` bucket, not the sidebar's cheap one (`index.tsx:37-41`+ - comment), so the two responses can't clobber each other on whoever-lands-last.+- **✅ good — `preStatusPool` counts each tab "as if you switched with the same other+ filters".** The status count badges are derived from the pool with every filter _except_+ status applied (`index.tsx:99-126`), so switching tabs is predictable. Thoughtful+ composition — undermined only by the partial-page problem (gap ②), not by its own logic.++## 3 — Experience gaps (ranked)++**① A failed initial fetch renders as the first-run "no topics yet" onboarding — ux Read §1.1+/ Feedback §4.2** 🔴 `useFetchAgentTopicsView` returns a full `SWRResponse` (it has `.error`),+but the page destructures only `{ isLoading }` (`index.tsx:76`) — **`error` is never read**.+The view map is populated **only in the SWR `onData`** success path (`action.ts:570-621`), so+on any network / 500 / auth failure `agentTopicsViewMap[key]` stays undefined →+`allTopics = []` → `totalAfterFilter === 0` → the page renders+`<EmptyState hasFilters={false}>` = **"No topics yet — start a chat"** (`index.tsx:225-230`,+`EmptyState.tsx:35`). A failure masquerades as **onboarding**: no reason, no Reload, and it+invites the user to re-create conversations they already own. Remedy: read `error`; branch a+failed state (reason + `mutate` retry) **before** the empty branch — only show empty on+`!error && total === 0`.++**② Filters, sort, and the count badges all run client-side over the loaded page, not the+server — ux Read §1.2 / memory `feedback_paginated_list_sort_server_side`** 🟠 The list is+infinite-scrolled 30 rows/page (`index.tsx:32`, `action.ts:627`), but **every read dimension+except search** is computed client-side over `allTopics` (the loaded pages only):+`matchesStatus / matchesGroup / matchesTrigger / matchesTimeRange` + `sortTopics` + grouping+(`index.tsx:99-140`, `utils.ts:9-89`), and the per-status **count badges** (`index.tsx:115-126`+→ `Toolbar.tsx:427`). The management fetch sends the server only `agentId / current / pageSize+/ withDetails` (`action.ts:562-567`) — **no** status/trigger/time/sort. Consequences on any+agent with >30 topics not fully scrolled in:++- **Sort is a lie across pages** — sorting by title/created orders just the loaded rows;+ scrolling appends the next `updatedAt`-ordered page at the **end**, so the list visibly+ isn't sorted.+- **A filter can show a false "no match"** — filtering to `completed` / a rare trigger shows+ `EmptyState hasFilters` "no topics match" while matching topics sit on unfetched pages.+- **The tab count badges under-report** — "Completed 3" when 40 completed exist unloaded.++The kicker: the server **already supports** server-side status/trigger filtering — the+sidebar's `loadMoreTopics` passes `excludeStatuses` / `excludeTriggers` into the same+`getTopics` service (`action.ts:724-734`); the management view just omits them. Remedy: push+the active filter + sort into `getTopics` (cheapest), or lift the whole read-state to the URL++- fetch key per Read §1.2 (also buys deep-linking).++**③ "Archive stale >3mo" mutates only the loaded page and reports success even on partial+failure — ux Read §1.2 + Act §3.1** 🟠 The overflow "archive stale" scans+`topicSelectors.agentTopicsViewTopics` = **loaded topics only** (`Toolbar.tsx:349-355`, dup in+the unused `ToolbarActions.tsx:24-31`), so with 30 of 500 loaded it silently archives the+stale rows among 30 and **misses the rest** — a bulk op whose scope is the partial page (the+mutating twin of gap ②). And the loop `for (…) await updateTopicStatus(…)` has **no per-item+catch**; it then fires `message.success('archived N')` (`Toolbar.tsx:365-369`) even if a call+rejected mid-way — reporting a completion that didn't happen. Remedy: run the query for+"stale" server-side (or over the full set), wrap the loop to collect failures, and report+partial completion.++**④ A failed load-more page fails silently — no error, no retry, and the observer can+re-fire — ux Feedback §4.2** 🟠 `loadMoreAgentTopicsView`'s `catch` only resets+`isLoadingMore: false` — **no error state, no retry** (`action.ts:678-689`; identical in+`loadMoreTopics:765-776`). A failed page-N fetch makes the "Loading more…" row vanish+(`index.tsx:251`) and the list just **stops**, indistinguishable from end-of-list — while+`hasMore` is still `true`, so the `IntersectionObserver` (`index.tsx:185-193`) re-fires on any+scroll nudge, **silently retrying a failing endpoint** with zero feedback. Remedy: on a+page-fetch rejection set an error flag and render an inline "couldn't load more — Retry" row+at the tail, distinct from the genuine end.++**⑤ Batch favorite / archive are fire-and-forget: no locked state, no failure surface — ux+Act §3.1 / Feedback §4.2** 🟠 `handleBatchFavorite` / `handleBatchArchive` fan out+`Promise.all(...)` and call `exitSelectMode()` immediately, with **no in-progress lock and no+`catch`** (`BulkActionBar.tsx:56-68`). If a write fails the user gets no toast and the+selection is already gone; double-clicking re-fires. This is exactly the+confirm→**in-progress(locked)**→done/error shape the sibling `MoveTopicsModal` (§2) and the+`confirmModal`-driven batch **delete** (`:70-85`, whose async `onOk` locks the OK button) get+right — the two lighter bulk actions skip it. Remedy: lock the bar while the batch runs and+toast on failure, matching delete/move.++**⑥ The default (card) view is missing both per-item actions and select-all that the list+view has — ux Act (lifecycle completeness + bulk↔single parity) / Read §1.2** 🟡 The default+`viewMode` is `'card'` (`store.ts:52`), yet `TopicGrid` / `TopicCard` render **no per-item+dropdown** — rename, single-delete, favorite-toggle, and "open in new tab" all live only in+`TopicListView`'s `Row` via `useTopicItemDropdownMenu` (`TopicListView.tsx:148-153,231-233`).+So in the view the user lands on, a topic's own lifecycle is unreachable without switching to+list view. `TopicGrid` also has **no select-all** (only `TopicListView` renders the header+checkbox, `:267-273`), so bulk-select in card view means clicking every card. And even in list+view, `handleSelectAll` selects `allIds` = the **loaded** rows (`:249,255-262`), never "all N+matching across pages" (pairs with gap ②). Remedy: give the card view the same per-item menu ++select-all; when paginated, offer "select all N" the server resolves.++**⑦ Bulk delete aborts mid-loop on first failure with no partial-failure report — ux Act+(partial failure)** 🟡 Batch delete confirms (good — `confirmModal` with a danger button and+count, `BulkActionBar.tsx:70-84`) then loops `for (…) await removeTopic(id)` serially. A+mid-loop rejection **throws out of the loop**: the remaining selected topics stay,+`exitSelectMode()` never runs, and there's no toast — the user sees a partially-completed+delete with no report of what failed. (Deleting many topics is wide-blast; a count confirm is+acceptable, but silent partial completion isn't.) Remedy: collect per-item results and report+"deleted X, failed Y — retry".++**⑧ Minor — rename edit is discarded silently on click-outside — ux Edit §2.1** 🟡 Rename+(list-row menu only) opens the shared `RenameModal`, whose value is in-memory `useState` and+whose mask is `maskClosable` — a click outside discards the edit with no "discard changes?"+guard. A single-field title rename is low-stakes for durable draft persistence, but the+**silent** discard on an accidental outside-click is the real gap. Remedy: warn on dirty+dismiss (or disable `maskClosable` while dirty). Shared component, not topic-specific — noted,+not landed.++## 4 — Skill feedback (回灌)++- **New generalizable gap → landed in `ux` Read §1.2 (mandatory close).** §1.2 already said+ "search **and filter** must query the server", but every ❌/✅ example was about the **search+ box** alone. This surface reveals the sharper, **split-dimension** rule: getting search+ server-side is **not** the whole job — a facet **filter**, a **sort**, the **count badges**,+ and any **"act on the filtered set" bulk op** each _independently_ lie if held client-side+ over the loaded page (false-empty · mis-ordered-across-pages · under-counted · partial-scope+ mutation), even when search is correct. Landed by extending Read §1.2 (new paragraph + ❌+ **Agent topics** example + a checklist line) and mirroring one line into the SKILL Quick+ review, citing `AgentTopicManager/index.tsx:99-140` + `Toolbar.tsx:349`.+- **New generalizable gap → landed in `ux` Feedback §4.2.** All existing §4.2 examples were+ **initial-load** skeletons that hang; none covered the **load-more / infinite-scroll** page+ failure, which fails _differently_ — the first page looks healthy, the next-page `catch`+ silently drops the "loading more" row with `hasMore` still true, and an `IntersectionObserver`+ re-fires into a silent retry loop. Landed as a new §4.2 paragraph + checklist line + a+ Quick-review mirror, with **Agent topics** as the ❌ (both the initial-fetch masquerade of+ gap ① and the load-more silence of gap ④), citing `index.tsx:76` + `action.ts:678-689`.+- **Validated existing rules** (good ❌ instances to cite): Read §1.1 (gap ①, error-as-empty+ masquerade), Feedback §4.2 (gaps ①④, no retry), Act §3.1 (gap ⑤, bulk with no+ locked/error state; gap ⑦, no partial-failure report).+- **Good cases already landed / reinforced ✅:** Read §1.4 (the move picker's inbox re-add is+ already the §1.4 ✅); the `MoveTopicsModal` state machine (§2) reinforces Act §3.1's+ confirm→in-progress→done/error ✅ and is worth citing as the in-context counter-example to+ the fire-and-forget bulk bar.++## 5 — Pending: L2 visual + L3 dynamic++L1-only; verdicts a later pass should confirm or quantify on this surface:++- **L2 (visual)** — does the failed-fetch empty (gap ①) actually **read** as first-run+ onboarding (confirm the masquerade)? Where does the floating `BulkActionBar` sit relative to+ the last row / does it occlude content? Card vs list select-all asymmetry (gap ⑥) side by+ side; narrow-width wrap of the Toolbar chips (`Toolbar.tsx:421 wrap`); dark/light on the+ status dots + group bars.+- **L3 (dynamic)** —+ - Force the topics fetch offline to **confirm gap ① live** — that the page settles on the+ "start a chat" empty, not a skeleton or error.+ - On an agent with **>30 topics**, filter to a status whose matches are all on page 2+ to+ **confirm gap ②'s false-empty**, and sort by title then scroll to watch order break across+ the page boundary.+ - Fail a page-2 fetch to **confirm gap ④** (the vanished "loading more" + observer re-fire).+ - Drive a bulk favorite/archive with one write forced to fail to **confirm gap ⑤** (no+ toast, selection already cleared).+ - **Measure CLS** on the card→list toggle and on the load-more append.diff --git a/.agents/skills/ux/SKILL.md b/.agents/skills/ux/SKILL.mdindex 2d9360e82bc..de98e1a69b0 100644--- a/.agents/skills/ux/SKILL.md+++ b/.agents/skills/ux/SKILL.md@@ -87,9 +87,9 @@ The one-screen scan. Each line links back to a module above for the full rule +**Read — viewing data & lists** ([read.md](references/read.md))- [ ] Empty / loading / error states are all designed; empty is a real page with a CTA. Always-rendered chrome (toolbar/header) still gets a body empty state. If the `Empty` component ships a `search`/no-match variant, **wire it** — don't render `<Empty/>` bare so a zero-result search shows the first-run onboarding.-- [ ] Error is checked before the empty branch — a failed fetch never renders as empty (read `error`, don't coerce `data ?? [] → Empty`); a detail page reads `error` before falling to `NotFound` (failed-to-load ≠ deleted/404). On a **metrics/dashboard** surface the failure default is a zero-valued object (`?? {…:0}`) that renders as a confident `$0` — read `error` before any aggregate, don't fall through to zeros.+- [ ] Error is checked before the empty branch — a failed fetch never renders as empty (read `error`, don't coerce `data ?? [] → Empty`); a detail page reads `error` before falling to `NotFound` (failed-to-load ≠ deleted/404). On a **metrics/dashboard** surface the failure default is a zero-valued object (`?? {…:0}`) that renders as a confident `$0` — read `error` before any aggregate, don't fall through to zeros. A list **merged from a fetched set + a static/frontend set** (`[...fetched, ...placeholders]`) branches `error` before merging — the static half keeps `length > 0`, so a failed fetch renders a plausible partial catalog neither the empty guard nor an error-unread call site catches (channel).- [ ] List designed across 1 → 10k rows (virtual scroll / pagination / batch as needed).-- [ ] Search / filter over a paginated list queries the full set server-side, not just the loaded page (no false "no results" for unfetched rows).+- [ ] Search / filter over a paginated list queries the full set server-side, not just the loaded page (no false "no results" for unfetched rows). Server-side coverage isn't just the search box — **sort, facet filters, the count badges, and any "act on the filtered set" bulk op** run over the full set too; server-side search + client-side sort/filter/counts still false-empties, mis-orders across pages, and under-counts (topics).- [ ] Capped/scrollable/virtualized list scrolls the restored active item into view on mount (`block: 'nearest'`, re-run after async rows mount).- [ ] Pickers show all valid targets (default/inbox included); empty = truly none.- [ ] Large numbers roll the unit at each 1000× (K→M→B→T), never a coefficient ≥ 1000; use the shared `formatUsageValue` / `formatShortenNumber`.@@ -100,7 +100,7 @@ The one-screen scan. Each line links back to a module above for the full rule +**Edit — entering & changing content** ([edit.md](references/edit.md))-- [ ] Editors back up in-progress input to durable storage (survives reload, not in-memory only) and recover it after refresh/crash/failed-save; destructive exits warn, never silently discard.+- [ ] Editors back up in-progress input to durable storage (survives reload, not in-memory only) and recover it after refresh/crash/failed-save; destructive exits warn, never silently discard — including **switching the active item in a master-detail** (a shared form `resetFields()` on selection change silently wipes unsaved input, worst when it's pasted secrets — channel).- [ ] Input affordances are stable: static placeholder, no clickable/retrievable content hidden in it.**Act — operations, flows & buttons** ([act.md](references/act.md))@@ -125,8 +125,8 @@ The one-screen scan. Each line links back to a module above for the full rule +**Feedback — loading & system response** ([feedback.md](references/feedback.md))- [ ] No antd `Spin`; use `NeuralNetworkLoading` / project loaders.-- [ ] Every loading state can fail: on error or timeout, show a failed state with a Reload/Retry action — never an infinite spinner. In an auto-dismissing surface (upload dock / progress toast), the countdown clears **success only** — a failed item persists with Retry. An error state / retry action that's **modeled in the store but consumed by no surface** (`isXError` selector / `retryX` action with zero `rg` call sites) is still a missing error state — a built-but-orphaned path is a permanent skeleton at the pixel.-- [ ] A compound gate waiting on a secondary/dependent fetch gates on its **in-flight** flag and releases on settled (data / resolved-`null` / error) — never on the dependency being present in a map, or an absent-by-design dependency hangs it forever.+- [ ] Every loading state can fail: on error or timeout, show a failed state with a Reload/Retry action — never an infinite spinner. In an auto-dismissing surface (upload dock / progress toast), the countdown clears **success only** — a failed item persists with Retry. An error state / retry action that's **modeled in the store but consumed by no surface** (`isXError` selector / `retryX` action with zero `rg` call sites) is still a missing error state — a built-but-orphaned path is a permanent skeleton at the pixel. A **load-more / infinite-scroll** page fetch that fails shows an inline Retry at the list tail (distinct from end-of-list), never a silently vanished "loading more" row with `hasMore` still true that an `IntersectionObserver` re-fires into a silent retry loop (topics).+- [ ] A compound gate waiting on a secondary/dependent fetch gates on its **in-flight** flag and releases on settled (data / resolved-`null` / error) — never on the dependency being present in a map, or an absent-by-design dependency hangs it forever. An error branch **ordered after** a data-presence gate (`{error && …}` below `if (isLoading = !map[id]) return <Skeleton/>`) is unreachable on first-load failure — it paints only on revalidation, and a resolved-`null` not-found hangs the same permanent skeleton; check error/not-found **before** the gate.- [ ] An awaited write that gates navigation/advance resets its busy flag in `finally` + offers retry — a failed write never permanently disables the forward/Back control.- [ ] Autosave surfaces a save-state (saving → saved → failed with retry), never a silent write; the save-state enum actually includes a `failed` variant (a catch that resets to `idle` is a silent write); one save-feedback convention across a multi-field surface, ideally in the shared form wrapper.- [ ] Capability-gated feature warns (soft, reactive, load-gated) when the model can't deliver it; copy gives the remedy.diff --git a/.agents/skills/ux/references/edit.md b/.agents/skills/ux/references/edit.mdindex d4da5cf9dfc..5556c82e6b6 100644--- a/.agents/skills/ux/references/edit.md+++ b/.agents/skills/ux/references/edit.md@@ -28,6 +28,14 @@ in-memory store alone doesn't count.> an empty editor on mount (`useChatInputDraft.ts:32-43`), flushes on unmount (`:30`), and> **removes** the draft on send (`ChatInput/store/action.ts:85`) — durable across reload/crash,> scoped per topic so drafts never bleed, with 50-entry LRU eviction (`draftStorage.ts:108-126`).+> ❌ **Channel** (`/agent/:aid/channel`) is the **master-detail** form of this trap: the detail+> credential form is an in-memory antd `Form`, and selecting another platform in the list runs+> `form.resetFields()` (`channel/detail/index.tsx:77,245-251`) with **no dirty-guard and no+> persistence** — pasting a bot token + app secret then clicking a sibling platform (or reloading)+> **silently wipes** it. Worst-case content, too: secrets copied from a third-party console, the+> least recreatable input there is. A shared form instance reset on the active-item change is the+> common shape — the switch that _looks_ like navigation-within is a destructive exit for the+> editor. ✅ Warn on a dirty switch/exit, or back the draft to storage keyed by `agentId+platform`.**Checklist**diff --git a/.agents/skills/ux/references/feedback.md b/.agents/skills/ux/references/feedback.mdindex 8c2aade6aad..8607efae747 100644--- a/.agents/skills/ux/references/feedback.md+++ b/.agents/skills/ux/references/feedback.md@@ -119,6 +119,29 @@ one.> instead of spinning forever (`useActiveTaskDetail.ts:66-77`); the task skeleton itself is likewise> gated on "resolving", not on `data === undefined`.+A close cousin, and the most deceptive: the error branch **exists in the very same component+and even reads the real fetch `error`** — but it's ordered **after** an `if (isLoading) return <Skeleton/>` early-return whose `isLoading` is the data-presence flag (`!map[id]`). On a+first-load failure the entry never lands, so `isLoading` stays true, the skeleton+short-circuits the function, and the error render **below it is unreachable** — it paints only+on a **revalidation** failure, when the data is already present. A resolved **not-found**+(`null`) hits the same wall: dropped in the success handler, it never populates the map either,+so a deleted / missing record shows a **permanent skeleton** instead of a 404. Ordering is the+bug: a built error branch a first-load failure can't reach is as good as an absent one. Check+`error` / not-found **before** the loading gate, or make the gate go false on **settled** (data+/ `null` / error).++> ❌ **Agent document view** (`/agent/:aid/docs/:docId`) has the error state written but+> ordering-dead: `DocumentIdMode` renders `{error && <EditorError/>}` off the real SWR `error`,+> but only after `if (isLoading) return <EditorSkeleton/>`, where `isLoading =+editorSelectors.isDocumentLoading(id) = !documents[id]` (`EditorCanvas/DocumentIdMode.tsx`,+> `store/document/slices/editor/selectors.ts`). `useFetchDocument` writes `documents[id]` only in+> its `onData`, and returns **`null` (not a throw) on not-found**, dropped by an early return+> (`store/document/slices/document/action.ts`). So a first-load 500 **and** a deleted / bad+> `docId` both leave the entry `undefined` → **permanent skeleton, no retry**; the `EditorError`+> alert can only appear when a later focus-revalidation fails over already-loaded content. ✅+> Branch `error` and resolved-`null` **before** the loading gate → a failed state (reason ++> Reload via `mutate`) and a real not-found, keeping the skeleton only for `!error && no-data-yet`.+A third shape, in a **transient / auto-dismissing** surface (an upload dock, a progress toast,a status snackbar that clears itself after N seconds): auto-dismiss is a **success** affordance,not a universal one. When the timer also fires on the **failed** state it clears the error — and@@ -207,12 +230,35 @@ xSearchLoading || !xInit` flips only on success, so a failed load hangs a **perm> skeleton** on the core chat — no reason, no Reload. ✅ Branch the fetch's `error` to a failed> state with Retry (see the topic audit).+A distinct shape lives on the **load-more / infinite-scroll** path, not the initial load. The+first page renders fine, so the surface _looks_ healthy — the trap is the **next-page** fetch:+its `catch` merely resets `isLoadingMore` to false with **no error state and no retry**, so a+failed page-N load makes the "Loading more…" row **vanish** and the list just stops,+indistinguishable from reaching the end — while `hasMore` is still `true`. Worse, when the+trigger is an `IntersectionObserver`, any scroll nudge re-fires it → the surface **silently+retries a failing endpoint** with zero user feedback. A pagination failure owes the same+terminal state as an initial one: an inline **"couldn't load more — Retry"** row at the list+tail, kept distinct from the genuine end-of-list.++> ❌ **Agent topics** (`/agent/:aid/topics`) hits both shapes. The initial fetch reads only+> `{ isLoading }` and **never `error`** (`AgentTopicManager/index.tsx:76`); the view map is+> populated only in the SWR success `onData`, so a failed load leaves it empty and the page+> renders the **first-run "no topics yet — start a chat" empty** (`EmptyState.tsx:35`) — a+> failure masquerading as onboarding, no reason, no retry (Read §1.1). And+> `loadMoreAgentTopicsView`'s `catch` only flips `isLoadingMore` back to false+> (`store/chat/slices/topic/action.ts:678-689`, same in `loadMoreTopics:765-776`) — a failed+> page-N load silently drops the "Loading more…" row (`index.tsx:251`) with `hasMore` still+> true and the observer (`index.tsx:185-193`) re-firing on scroll. ✅ Branch the initial `error`+> to a failed state with Reload; render a Retry row when a page fetch rejects.+**Checklist**- [ ] Every loading state has a terminal failure path — on error or after a bounded timeout, not an infinite spinner. _(Certainty)_+- [ ] A **load-more / infinite-scroll** page fetch that fails shows an inline Retry at the list tail (distinct from end-of-list), never a silently vanished "loading more" row with `hasMore` still true — and doesn't let an `IntersectionObserver` re-fire into a silent retry loop. _(Certainty)_- [ ] An init/ready flag isn't gated on success only — the error path resolves the loading state too, no permanent skeleton. _(Certainty)_- [ ] The error state is actually **consumed by a surface**, not just modeled in the store — an `errorMap` / `isXError` selector / `retryX` action with **zero call sites** (`rg` the consumers) is a permanent skeleton wearing a built-but-orphaned error path; the store having the right shape doesn't discharge the obligation. _(Certainty)_- [ ] A compound gate waiting on a **secondary/dependent** fetch gates on its **in-flight** flag and releases on settled (data / resolved-`null` / error), never on the dependency being **present** in a map — a legitimately absent dependency (deleted / out-of-scope) must not hang the gate. _(Certainty)_+- [ ] An error branch isn't **ordered after** a data-presence loading gate — `{error && …}` placed below `if (isLoading) return <Skeleton/>` where `isLoading = !map[id]` is **unreachable on first-load failure** (a failed / not-found fetch never populates the map, so the skeleton short-circuits; it paints only on a **revalidation** failure over already-loaded data), and a resolved-`null` not-found hangs the same permanent skeleton. Check `error` / not-found **before** the loading gate, or flip the gate on settled. _(Certainty)_- [ ] An awaited write that gates navigation resets its in-progress flag in `finally` and offers retry on `catch` — a failed write never permanently disables the advance / Back control. _(Certainty)_- [ ] The failed state names the failure and offers a **Reload / Retry** action. _(Meaningful)_- [ ] Retry re-runs the same fetch, shows loading while re-running, and stays available on repeat failure. _(Certainty)_diff --git a/.agents/skills/ux/references/read.md b/.agents/skills/ux/references/read.mdindex bfd78aa5379..65a93a87ac3 100644--- a/.agents/skills/ux/references/read.md+++ b/.agents/skills/ux/references/read.md@@ -53,6 +53,24 @@ are different screens.> ❌ A detail page that `return null`s until its record loads is **not** a loading state — it's a blank flash on the happy path and a **permanent blank** if the fetch fails (no skeleton, no error): **Eval** run / case / dataset detail all `if (!record) return null` (`eval/bench/[benchmarkId]/runs/[runId]/index.tsx`, `.../cases/[caseId]/index.tsx`, `.../datasets/[datasetId]/index.tsx`). Render a skeleton, then an error state.> ❌ **Resource** repeats the failure-as-empty trap four times: the Explorer reads only `{ isLoading, isValidating }` (the swr already exposes `error`, unread) so a failed resource fetch renders the "create your first resource" onboarding (`ResourceManager/components/Explorer/index.tsx`, `EmptyPlaceholder.tsx`); the sidebar KB list (`resource/(home)/_layout/Body/LibraryList/index.tsx`), the search overlay (`SearchResultsOverlay.tsx` → false "no results"), and the folder tree (`LibraryHierarchy/index.tsx` → false "add folder") all do the same.+**A third mask: the failed fetch hidden behind a non-empty _static_ fallback.** When a list is+assembled by **merging a fetched set with a static / frontend-only set** — `[...fetched,+...PLACEHOLDERS]`, a catalog padded with "coming soon" rows, defaults spliced in — a failed+fetch doesn't even read as empty: the static half keeps `length > 0`, so **both** a `length ===+0 → <Empty>` guard **and** an `error`-unread call site render a **plausible partial catalog**,+silently dropping the entire fetched half. A `fallbackData: []` on the fetch makes it automatic.+Read `error` and branch a failed state _before_ merging in the static entries — a non-empty+length is not proof the fetch succeeded.++> ❌ **Channel** (`/agent/:aid/channel`) reads only `{ data, isLoading }` from+> `useFetchPlatformDefinitions` / `useFetchBotProviders` (`channel/index.tsx:37-42`), both with+> `fallbackData: []` (`store/agent/slices/bot/action.ts:122,130`). A failed platform-definitions+> fetch → `platforms = []` → `allPlatforms` becomes just the frontend-only+> `COMING_SOON_PLATFORMS` (`index.tsx:62-68`), so `allPlatforms.length > 0` stays true and the+> surface renders a **coming-soon-only catalog** — every real and already-connected channel gone,+> no error, no retry; a failed providers fetch makes a configured bot read as never-connected,+> inviting a duplicate credential re-entry. ✅ Branch `error` before assembling the merged list.+**Distinguishing the two empty variants is a call-site wiring job, not just a component one.** A common miss: the `Empty` component _already_ ships a `search` / "no match" variant, but the list renders it **bare** and never passes the flag — so a legitimate zero-result search shows the first-run "create your first…" onboarding, and the built variant + its i18n keys are dead code. The query is in scope at the call site; thread it in (`search={!!q || !!category}`) and add a clear-filters action.> ❌ **Discover / Community** lists: all five `*Empty` components take a `search?: boolean` that swaps to the "no results" copy (`community/features/AssistantEmpty.tsx:11-27` + McpEmpty / ModelEmpty / ProviderEmpty / SkillEmpty twins), but every `features/List/index.tsx:17` renders `<XEmpty/>` with **no prop** (`grep 'search={'` over the area → 0 hits), so `q=zzznomatch` returns zero rows and shows the onboarding empty with no clear-filters — the built variant unreachable. (`SearchResultCount.tsx`, a "N results for X" affirmation, is likewise imported by nothing.) ✅ Pass `search` from the page → `List` → `Empty` and add a clear-filters CTA.@@ -88,6 +106,7 @@ Distinguish `error` (transient → reason + retry, keep the URL) from a resolved- [ ] Empty variants distinguished: "no data yet" vs "no filter match". _(Certainty)_- [ ] Error is checked **before** the empty branch — a failed fetch never renders as empty (`!error && length === 0` gates empty); read `error`, don't coerce `data ?? []`. _(Certainty・Meaningful)_- [ ] On a **metrics / aggregate** surface (dashboard, stats, cost), a failed fetch never falls through to a **zero-valued default** (`data?.summary ?? {…:0}`, `?? 0`) — a confident `$0` reads as real data, not "empty"; branch `error` before rendering any aggregate. _(Certainty・Meaningful)_+- [ ] A list merged from a fetched set + a **static/frontend set** (`[...fetched, ...placeholders]`, a catalog padded with "coming soon" rows) branches `error` **before** merging — a failed fetch there keeps `length > 0` via the static entries, so neither the empty guard nor an error-unread call site catches it (a plausible partial catalog); `fallbackData: []` makes it automatic. _(Certainty・Meaningful)_- [ ] A detail page reads `error` before falling to `NotFound` — a failed fetch shows a reload state, not a "doesn't exist" 404 (deleted vs failed-to-load are different screens). _(Certainty・Meaningful)_- [ ] Always-rendered chrome still renders a body empty placeholder. _(Meaningful)_- [ ] Loading designed (skeleton / NeuralNetworkLoading), no layout shift — a detail page's "record not loaded yet" is a skeleton, never a bare `return null` / blank. _(Natural)_@@ -117,6 +136,30 @@ URL; and there's no local-vs-server divergence to reconcile. Reach for this whenhas more than one read-state dimension — the alternative (local `useState` per control + amanual refetch) is where the partial-page traps breed.+**Getting the search box server-side is not the whole job.** _Every_ read dimension that+narrows, reorders, or **summarizes** the set must run server-side too — a surface can query+search correctly and still lie through the other dimensions, each held client-side over the+loaded page: a **facet filter** (status / type / date) hides matches on unfetched pages → a+**false empty**; a **sort** (by title / created) orders only the loaded rows while lazy-loaded+later pages append out of order → a list that visibly _isn't_ sorted; a **count badge** that+tallies the loaded rows **under-reports** ("Completed 3" when 40 exist unfetched); and a **bulk+action scoped to "the filtered set"** (archive-stale, select-all-then-act) silently operates on+the partial page only. A per-dimension audit that greenlights the surface because "search hits+the server" misses the four that don't — so check filter, sort, the counts, and bulk-scope+_each_ against the full set, not just the search input.++> ❌ **Agent topics** (`/agent/:aid/topics`) infinite-scrolls 30 rows/page but applies **all**+> of status/trigger/time/project filtering, `sortTopics`, grouping, and the per-status **count+> badges** client-side over the loaded pages (`AgentTopicManager/index.tsx:99-140`,+> `utils.ts:68`), while only **search** goes server-side (BM25, `useSearchTopics`). So sorting+> by title orders just the loaded rows (later pages append unsorted), filtering to a rare status+> shows a **false "no match"** with matches unfetched, the tab counts under-report, and "Archive+> stale >3mo" (`Toolbar.tsx:349`) mutates only the loaded page — the search dimension is right,+> the other four lie. The kicker: `getTopics` **already accepts** `excludeStatuses` /+> `excludeTriggers` (the sidebar's `loadMoreTopics` passes them, `store/chat/slices/topic/action.ts:724-734`);+> the management fetch just omits them. ✅ Send filter/sort into the query, or lift the read-state+> to the URL + fetch key (above).+> ❌ The Pages "all pages" drawer filters `displayDocuments` with a client-side> `title/content.includes(keyword)` over the loaded set **and disables load-more while> searching**, so searching for a page past the loaded window returns "no results" though it@@ -147,6 +190,7 @@ manual refetch) is where the partial-page traps breed.- [ ] List designed across 1 → 10k rows (plain → pagination → virtual scroll). _(Certainty)_- [ ] Batch-select / bulk actions added once counts get large. _(Certainty)_- [ ] Search / filter over a paginated list queries the full set server-side, not just the loaded page — no false "no results" for unfetched rows. _(Certainty・Meaningful)_+- [ ] Server-side coverage isn't just the search box — **sort, facet filters, the count badges, and any "act on the filtered set" bulk op** each query/compute over the full set too; server-side search + client-side sort/filter/counts still false-empties, mis-orders across pages, and under-counts. _(Certainty・Meaningful)_- [ ] Multi-dimension list read-state (`q`/`sort`/`filter`/`page`) lives in the URL and the fetch key derives from it — server-query, deep-link, and restore by construction, not local state + manual refetch. _(Certainty・Natural)_- [ ] Empty / loading / error co-designed with the data state (§1.1). _(Natural)_