Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(mobile): fail closed for unsupported worktree hosts
kafeifei26fe60010de0
diff --git a/apps/mobile/src/__tests__/newSessionWorktree.test.ts b/apps/mobile/src/__tests__/newSessionWorktree.test.tsindex 91218ee157..02f86975d2 100644--- a/apps/mobile/src/__tests__/newSessionWorktree.test.ts+++ b/apps/mobile/src/__tests__/newSessionWorktree.test.ts@@ -314,7 +314,7 @@ describe('shouldBlockNewSessionCreateForWorktree', () => {})).toBe(false);});- it('ON 时必须等当前目标 eligible,OFF 与老端 unsupported 允许普通创建', () => {+ it('ON 时必须等当前目标 eligible,unsupported 也不能把显式选择静默降级成普通创建', () => {expect(shouldBlockNewSessionCreateForWorktree({applicable: true, enabled: true, eligibility: { status: 'probing' }, preferenceSaving: false,})).toBe(true);@@ -332,7 +332,7 @@ describe('shouldBlockNewSessionCreateForWorktree', () => {})).toBe(false);expect(shouldBlockNewSessionCreateForWorktree({applicable: true, enabled: true, eligibility: { status: 'unsupported' }, preferenceSaving: false,- })).toBe(false);+ })).toBe(true);});});diff --git a/apps/mobile/src/session/newSessionWorktree.ts b/apps/mobile/src/session/newSessionWorktree.tsindex f74ef90d8b..471da78d84 100644--- a/apps/mobile/src/session/newSessionWorktree.ts+++ b/apps/mobile/src/session/newSessionWorktree.ts@@ -197,8 +197,8 @@ export function shouldShowWorktreeToggle(input: {/*** checkbox 正在写工作端时不能按旧镜像创建;已勾选且当前目标尚未确认 eligible 时,- * 也不能静默退化为普通目录会话。unsupported 是老工作端的兼容降级:控件整行隐藏,- * 继续允许创建普通会话,避免用户被一份无法在该工作端关闭的旧镜像永久卡住。+ * 也不能静默退化为普通目录会话。unsupported 只隐藏老工作端无法操作的控件;+ * 若当前镜像仍为已勾选,也必须 fail closed,不能绕过 worktree:create 落到 base repo。*/export function shouldBlockNewSessionCreateForWorktree(input: {/** 当前草稿是否真的会使用 worktree:仅 project + 已选目录。 */@@ -212,8 +212,7 @@ export function shouldBlockNewSessionCreateForWorktree(input: {if (!input.applicable) return false;if (input.preferenceSaving) return true;return input.enabled- && input.eligibility.status !== 'eligible'- && input.eligibility.status !== 'unsupported';+ && input.eligibility.status !== 'eligible';}/** 资格未通过时的 caption 文案 key(session.json);eligible/unsupported 无 caption。 */