Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(mobile): 标签展开页只对读取失败提供重试
kirozeng592029f30f96
diff --git a/apps/mobile/src/__tests__/taskTagsRecovery.test.tsx b/apps/mobile/src/__tests__/taskTagsRecovery.test.tsxindex ca9c600f43..3b167aac7b 100644--- a/apps/mobile/src/__tests__/taskTagsRecovery.test.tsx+++ b/apps/mobile/src/__tests__/taskTagsRecovery.test.tsx@@ -471,3 +471,40 @@ it("reports the native back arrow as disabled while a form save is in flight", aawait act(async () => finish({ tags: [], sessions: [] }));expect(pages.at(-1)![1]).toBe(false);});++it("offers retry only for failed reads, not for failed writes", async () => {+ let state: any;+ const mount = async () =>+ act(async () =>+ root.render(+ <TaskTagsPanel+ session={session}+ expanded+ onExpandedChange={onExpandedChange}+ renderExpanded={(value) => {+ state = value;+ return null;+ }}+ />,+ ),+ );+ // A catalog that never loaded can only be repaired by reading it again.+ h.invoke.mockRejectedValueOnce(new Error("boom"));+ await mount();+ expect(state.message).toBe("taskTags.loadFailed");+ expect(state.canRetry).toBe(true);+ await act(async () => root.unmount());++ // With a loaded catalog, a failed write is not something "refresh" can retry.+ root = createRoot(node);+ resetTaskTagCatalogCache();+ h.invoke.mockReset().mockResolvedValue({ tags: [tag], sessions: [] });+ await mount();+ expect(state.canRetry).toBe(false);+ await act(async () => state.onAdd());+ await act(async () => state.form.onNameChange("Ideas"));+ h.invoke.mockRejectedValueOnce(new Error("boom"));+ await act(async () => state.form.onSubmit());+ expect(state.message).toBe("taskTags.failed");+ expect(state.canRetry).toBe(false);+});diff --git a/apps/mobile/src/session/TaskTags.tsx b/apps/mobile/src/session/TaskTags.tsxindex 93d50b29c0..5c463fa68e 100644--- a/apps/mobile/src/session/TaskTags.tsx+++ b/apps/mobile/src/session/TaskTags.tsx@@ -881,7 +881,13 @@ export function TaskTagsPanel({disabled: busy || blocked,loading: !hasCatalog && busy,message: reason ? t(`taskTags.${reason}`) : undefined,- canRetry: !blocked && !busy && Boolean(error) && error !== 'unavailable',+ // Retry re-reads the catalog, so only offer it for a failed read. A failed write+ // (create / save / delete) must not look retried by a button that only refreshes.+ canRetry:+ !blocked &&+ !busy &&+ error !== 'unavailable' &&+ (error === 'loadFailed' || error === 'remoteBusy' || (!hasCatalog && Boolean(error))),canAdd: hasCatalog && error !== 'unavailable',onRetry: () => {void run({ action: 'get', sessionIds: [session.id] }, hasCatalog);