Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(cindy-make): 恢复隔离测试流程与启动进度

Lizic23c209dcf44
diff --git a/apps/desktop/src/main/cindy-make/__tests__/testRunner.test.ts b/apps/desktop/src/main/cindy-make/__tests__/testRunner.test.ts
index 803d71d080..adf702dd4f 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/testRunner.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/testRunner.test.ts
@@ -43,14 +43,16 @@ function processHarness() {
);
const controller = new AbortController();
const progress = vi.fn();
+ const diagnostics = vi.fn();
const process = launchMakeTest(
task,
- path.join(profile, 'node'),
- { PATH: '/tools', XDT_USER_DATA_DIR: '/host' },
+ { node: path.join(profile, 'node'), pnpm: path.join(profile, 'tools', 'pnpm.cmd') },
+ { PATH: '/tools', XDT_USER_DATA_DIR: '/host', npm_execpath: '/host/pnpm.cjs' },
'global',
controller.signal,
spawn,
progress,
+ diagnostics,
);
void process.ready.catch(() => {});
const verdict = (extra: Partial<Record<string, string>> = {}) => {
@@ -74,6 +76,7 @@ function processHarness() {
return {
process,
progress,
+ diagnostics,
spawn,
kill,
controller,
@@ -100,6 +103,40 @@ beforeEach(() => {
afterEach(() => vi.useRealTimers());
describe('isolated Make test runner', () => {
+ it('records a wrapper failure code across chunks without raw output or free-form messages', async () => {
+ const h = processHarness();
+ h.emit(
+ 'compiler output with private data\r\nDESKTOP_DEV_STEP=launching\r\nDESKTOP_DEV_VERDICT=failed\r\n',
+ );
+ expect(h.kill).not.toHaveBeenCalled();
+ h.emit('co');
+ h.emit('de=DEV_PROCESS_EXITED\r\nmessage=private credentials and paths\r\n');
+ await expect(h.process.ready).rejects.toMatchObject({ code: 'launchFailed' });
+ expect(h.diagnostics).toHaveBeenCalledWith(
+ expect.objectContaining({
+ event: 'failed',
+ reason: 'wrapperFailed',
+ step: 'launching',
+ wrapperCode: 'DEV_PROCESS_EXITED',
+ }),
+ );
+ expect(JSON.stringify(h.diagnostics.mock.calls)).not.toMatch(/private|credentials|compiler/);
+ expect(h.kill).toHaveBeenCalledOnce();
+ });
+ it('bounds incomplete failure verdicts and rejects unknown diagnostic codes', async () => {
+ vi.useFakeTimers();
+ const h = processHarness();
+ h.emit('DESKTOP_DEV_VERDICT=failed\r\n');
+ await vi.advanceTimersByTimeAsync(250);
+ await expect(h.process.ready).rejects.toMatchObject({ code: 'launchFailed' });
+ const next = processHarness();
+ next.emit('DESKTOP_DEV_VERDICT=failed\r\ncode=PRIVATE_SECRET\r\n');
+ await expect(next.process.ready).rejects.toMatchObject({ code: 'launchFailed' });
+ expect(next.diagnostics).toHaveBeenCalledWith(
+ expect.objectContaining({ wrapperCode: 'UNKNOWN' }),
+ );
+ expect(JSON.stringify(next.diagnostics.mock.calls)).not.toContain('PRIVATE_SECRET');
+ });
it('reports bounded known steps across PTY chunks and ignores raw output and late progress', async () => {
const h = processHarness();
h.emit('DESKTOP_DEV_ST');
@@ -172,6 +209,9 @@ describe('isolated Make test runner', () => {
]);
expect(h.spawn.mock.calls[0][2].cwd).toBe(task.workingDir);
expect(h.spawn.mock.calls[0][2].env).not.toHaveProperty('XDT_USER_DATA_DIR');
+ expect(h.spawn.mock.calls[0][2].env?.npm_execpath).toBe(
+ path.join(profile, 'tools', 'pnpm.cmd'),
+ );
const text = h.verdict();
h.emit(text.slice(0, 17));
h.emit(text.slice(17));
diff --git a/apps/desktop/src/main/cindy-make/__tests__/testRuntime.test.ts b/apps/desktop/src/main/cindy-make/__tests__/testRuntime.test.ts
index 7f8c18112d..cda17d3730 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/testRuntime.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/testRuntime.test.ts
@@ -12,6 +12,7 @@ const h = vi.hoisted(() => ({
write: vi.fn(),
broadcast: vi.fn(),
launch: vi.fn(),
+ probe: vi.fn(),
verify: vi.fn(),
build: vi.fn(),
saveBuild: vi.fn(),
@@ -53,7 +54,7 @@ vi.mock('../personalBuild.js', () => ({
}));
vi.mock('../toolchainEnvironment.js', () => ({
createMakeToolchainEnvironment: async () => ({
- probe: async () => ({ status: 'ok', path: process.execPath }),
+ probe: h.probe,
}),
resolveMakeToolEnvironment: async () => ({}),
}));
@@ -145,6 +146,10 @@ beforeEach(() => {
h.current = true;
h.laterUser = false;
h.profile = path.join(os.tmpdir(), 'make-runtime-unit');
+ h.probe.mockReset().mockImplementation(async (command) => ({
+ status: 'ok',
+ path: command === 'pnpm' ? path.join(h.profile, 'tools', 'pnpm.cmd') : process.execPath,
+ }));
h.row = {
id: 'session',
source: 'cindy-make',
@@ -191,6 +196,10 @@ describe('Cindy Make test IPC ownership and persistence', () => {
);
expect(steps).toEqual(['environment', 'workspace', 'stopping', 'assets', 'launching']);
expect(h.verify).toHaveBeenCalledOnce();
+ expect(h.launch.mock.calls[0][1]).toEqual({
+ node: process.execPath,
+ pnpm: path.join(h.profile, 'tools', 'pnpm.cmd'),
+ });
expect(JSON.parse(String(h.card.agentMeta)).otherMetadata).toBe('preserved');
} finally {
close();
@@ -198,6 +207,21 @@ describe('Cindy Make test IPC ownership and persistence', () => {
h.broadcast.mockReset();
}
});
+ it.each([{ status: 'missing' }, { status: 'ok', path: 'pnpm.cmd' }])(
+ 'does not launch when the checked pnpm entry is unavailable: %j',
+ async (pnpm) => {
+ h.probe.mockImplementation(async (command) =>
+ command === 'pnpm' ? pnpm : { status: 'ok', path: process.execPath },
+ );
+ await actCindyMakeTest('session', 'completion', 'start');
+ await vi.waitFor(() => expect(cindyMakeTestController.hasActiveJobs()).toBe(false));
+ expect(JSON.parse(String(h.card.agentMeta)).cindyMakeCompletion.test).toMatchObject({
+ status: 'failed',
+ error: 'environment',
+ });
+ expect(h.launch).not.toHaveBeenCalled();
+ },
+ );
it('does not start a completion build while Settings owns another build', async () => {
const release = cindyMakeManager.claimPersonalBuild();
try {
diff --git a/apps/desktop/src/main/cindy-make/__tests__/versionStartup.test.ts b/apps/desktop/src/main/cindy-make/__tests__/versionStartup.test.ts
index 7eb8bfd0d3..c6492b072b 100644
--- a/apps/desktop/src/main/cindy-make/__tests__/versionStartup.test.ts
+++ b/apps/desktop/src/main/cindy-make/__tests__/versionStartup.test.ts
@@ -185,8 +185,17 @@ describe('one original version type for Dev and installed Cindy', () => {
expect(h.spawn).not.toHaveBeenCalled();
});
it('rejects a declared endpoint realm that differs from the running original', async () => {
- await writeFile(path.join(root, 'checkout/config/endpoint.json'), JSON.stringify({ schemaVersion: 1, region: 'cn', authApiBaseUrl: 'https://auth.example.invalid' }));
- await expect(startup.rememberOriginalVersion(originalExec)).rejects.toMatchObject({ code: 'unavailable' });
+ await writeFile(
+ path.join(root, 'checkout/config/endpoint.json'),
+ JSON.stringify({
+ schemaVersion: 1,
+ region: 'cn',
+ authApiBaseUrl: 'https://auth.example.invalid',
+ }),
+ );
+ await expect(startup.rememberOriginalVersion(originalExec)).rejects.toMatchObject({
+ code: 'unavailable',
+ });
expect(h.spawn).not.toHaveBeenCalled();
});
it('pins a validated launch to its original profile and consumes launch arguments before ordinary relaunch', async () => {
@@ -310,6 +319,10 @@ describe('one original version type for Dev and installed Cindy', () => {
expect(store.selectedVersion(h.profile)).toBe('original');
});
it('starts the original Dev through the complete existing runner and retains its PTY until exit', async () => {
+ vi.stubEnv('DISPLAY', ':8');
+ vi.stubEnv('WAYLAND_DISPLAY', 'wayland-1');
+ vi.stubEnv('XDG_RUNTIME_DIR', '/run/user/1000');
+ vi.stubEnv('DBUS_SESSION_BUS_ADDRESS', 'unix:path=/run/user/1000/bus');
saveOriginal();
const value = launchRequest({ state: 'pending' });
process.argv.push('--cindy-version-profile=' + h.profile, '--cindy-version-helper=' + value.id);
@@ -317,6 +330,12 @@ describe('one original version type for Dev and installed Cindy', () => {
const kill = vi.fn(() => onExit());
h.pty.mockImplementation((_node, _args, options) => {
expect(options.env.CINDY_VERSION_LAUNCH).toBe(value.id);
+ expect(options.env).toMatchObject({
+ DISPLAY: ':8',
+ WAYLAND_DISPLAY: 'wayland-1',
+ XDG_RUNTIME_DIR: '/run/user/1000',
+ DBUS_SESSION_BUS_ADDRESS: 'unix:path=/run/user/1000/bus',
+ });
queueMicrotask(() => {
const file = startup.versionRequestPath(h.profile, value.id);
store.writeVersionJson(file, {
diff --git a/apps/desktop/src/main/cindy-make/taskNote.ts b/apps/desktop/src/main/cindy-make/taskNote.ts
index c113a49bad..478ffb95aa 100644
--- a/apps/desktop/src/main/cindy-make/taskNote.ts
+++ b/apps/desktop/src/main/cindy-make/taskNote.ts
@@ -15,7 +15,9 @@ export function buildCindyMakeTaskNote(): string {
'请按仓库根目录 AGENTS.md 的规则,在这个目录内完成用户提出的修改需求;' +
'只在当前任务分支和 worktree 修改文件,不要切换分支,不要修改 main、cindy-personal 或其他工作目录。' +
'不要自行提交或推送,也不要改动版本号或打包配置;完成回报后由 Cindy 在本任务分支创建带签名的本地提交,生成个人版时再合入个人分支,永不自动推送。' +
- '修改完成并通过仓库要求的提交前检查后,必须调用 cindy_make 的 report_complete 工具并附改动说明;' +
- '这是向用户报告完成的唯一方式。'
+ '每轮修改完成并通过仓库要求的提交前检查后,都必须调用 cindy_make 的 report_complete 工具(无需参数),再给出完成说明;' +
+ '用户点击“继续修改”后的新一轮也必须重新调用,之前的完成回报不能代替本轮。' +
+ '用户要求恢复或继续测试流程时,先核对当前修改与检查结果,满足完成条件后重新回报;不要让用户输入工具名。' +
+ '只有完成回报才能恢复测试与生成个人版的卡片;仅回复“已完成”不会恢复卡片。检查失败或仍需用户补充信息时不要回报完成。'
);
}
diff --git a/apps/desktop/src/main/cindy-make/testRunner.ts b/apps/desktop/src/main/cindy-make/testRunner.ts
index c569cf905f..89eeab614d 100644
--- a/apps/desktop/src/main/cindy-make/testRunner.ts
+++ b/apps/desktop/src/main/cindy-make/testRunner.ts
@@ -179,17 +179,47 @@ export interface MakeTestProcess {
stop(): void;
}
+// Only fixed protocol codes enter diagnostics. Raw compiler output, paths,
+// environment values and the wrapper's free-form message are never logged.
+const WRAPPER_FAILURE_CODES = new Set([
+ 'DEV_PROCESS_EXITED',
+ 'STARTUP_TIMEOUT',
+ 'STARTUP_FAILED',
+ 'WHOAMI_MISMATCH',
+ 'MIGRATION_POLICY',
+ 'MIGRATE_FAILED',
+ 'AUTH_INIT_FAILED',
+ 'HOSTED_RESTART_REFUSED',
+ 'HOSTED_SHARED_REFUSED',
+ 'PRESERVE_RUNNING_INCOMPATIBLE',
+ 'USERDATA_IN_USE',
+ 'ISOLATED_OFFICIAL_PROFILE',
+ 'INVALID_ISOLATED_NAME',
+]);
+export interface MakeTestDiagnostic {
+ event: 'spawn' | 'step' | 'ready' | 'failed' | 'exit';
+ step?: CindyMakeTestStep;
+ reason?: 'wrapperFailed' | 'earlyExit' | 'identityMismatch' | 'timeout';
+ wrapperCode?: string;
+ exitCode?: number;
+ elapsedMs: number;
+}
+
/** The existing restart pipeline keeps its TTY runner without opening a terminal window. */
export function launchMakeTest(
task: MakeTestWorkspace,
- node: string,
+ tools: { node: string; pnpm: string },
environment: NodeJS.ProcessEnv,
region: 'cn' | 'global',
signal: AbortSignal,
spawn: PtySpawnFn = defaultPtySpawn,
onStep?: (step: CindyMakeTestStep) => void,
+ onDiagnostic?: (diagnostic: MakeTestDiagnostic) => void,
): MakeTestProcess {
signal.throwIfAborted();
+ const startedAt = Date.now();
+ const diagnostic = (value: Omit<MakeTestDiagnostic, 'elapsedMs'>) =>
+ onDiagnostic?.({ ...value, elapsedMs: Date.now() - startedAt });
const sandbox =
'make-' +
createHash('sha256')
@@ -197,7 +227,7 @@ export function launchMakeTest(
.digest('hex')
.slice(0, 20);
const child = spawn(
- node,
+ tools.node,
[
path.join(task.workingDir, 'scripts', 'desktop-restart-runner.mjs'),
'--wait-ready',
@@ -207,7 +237,13 @@ export function launchMakeTest(
],
{
cwd: task.workingDir,
- env: makeTestEnvironment(environment),
+ env: {
+ ...makeTestEnvironment(environment),
+ // Use the probed entry, not the host's npm_execpath. On Windows, the
+ // restart runner's bare pnpm fallback can give .cmd shims the task cwd
+ // as %~dp0, so they look for pnpm.cjs outside their installation.
+ npm_execpath: tools.pnpm,
+ },
// Keep the machine-readable identity lines intact even with long profile paths.
cols: 4096,
rows: 30,
@@ -230,11 +266,14 @@ export function launchMakeTest(
let pending = '';
let verdict: Record<string, string> | undefined;
let lastStep: CindyMakeTestStep | undefined;
- const timeout = setTimeout(() => fail('timeout'), 25 * 60_000);
+ let failedVerdict = false;
+ let failureTimer: ReturnType<typeof setTimeout> | undefined;
+ const timeout = setTimeout(() => fail('timeout', 'timeout'), 25 * 60_000);
const finish = () => {
if (stopped) return;
stopped = true;
clearTimeout(timeout);
+ clearTimeout(failureTimer);
signal.removeEventListener('abort', abort);
if (!settled) {
settled = true;
@@ -246,6 +285,7 @@ export function launchMakeTest(
if (stopped || stopping) return;
stopping = true;
clearTimeout(timeout);
+ clearTimeout(failureTimer);
if (!settled) {
settled = true;
rejectReady(makeTestError('interrupted'));
@@ -256,8 +296,13 @@ export function launchMakeTest(
finish();
}
};
- const fail = (code: MakeTestError) => {
+ const fail = (
+ code: MakeTestError,
+ reason: MakeTestDiagnostic['reason'],
+ wrapperCode?: string,
+ ) => {
if (!settled) {
+ diagnostic({ event: 'failed', reason, step: lastStep, wrapperCode });
settled = true;
rejectReady(makeTestError(code));
}
@@ -265,8 +310,14 @@ export function launchMakeTest(
};
const abort = () => stop();
signal.addEventListener('abort', abort, { once: true });
- child.onExit(() => {
+ child.onExit(({ exitCode }) => {
+ diagnostic({ event: 'exit', exitCode, step: lastStep });
if (!settled) {
+ diagnostic({
+ event: 'failed',
+ reason: failedVerdict ? 'wrapperFailed' : 'earlyExit',
+ step: lastStep,
+ });
settled = true;
rejectReady(makeTestError('launchFailed'));
}
@@ -279,7 +330,7 @@ export function launchMakeTest(
pending = lines.pop() ?? '';
for (const raw of lines) {
const line = raw.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g, '').trim();
- if (!settled && !stopping) {
+ if (!settled && !stopping && !failedVerdict) {
// Older checkouts have no step protocol. Read only fixed stage prefixes;
// arbitrary terminal output is never forwarded or persisted.
const step = /^DESKTOP_DEV_STEP=(stopping|dependencies|assets|launching)$/.exec(
@@ -297,12 +348,24 @@ export function launchMakeTest(
: undefined);
if (next && next !== lastStep) {
lastStep = next;
+ diagnostic({ event: 'step', step: next });
onStep?.(next);
}
}
- if (line === 'DESKTOP_DEV_VERDICT=failed') {
- fail('launchFailed');
- return;
+ if (line === 'DESKTOP_DEV_VERDICT=failed' && !settled && !failedVerdict) {
+ failedVerdict = true;
+ // The code follows the marker and can arrive in a later PTY chunk.
+ // Bound this wait so malformed/older wrappers cannot hang the launch.
+ failureTimer = setTimeout(() => fail('launchFailed', 'wrapperFailed'), 250);
+ continue;
+ }
+ if (failedVerdict) {
+ if (line.startsWith('code=')) {
+ const code = line.slice(5);
+ fail('launchFailed', 'wrapperFailed', WRAPPER_FAILURE_CODES.has(code) ? code : 'UNKNOWN');
+ return;
+ }
+ continue;
}
if (line === 'DESKTOP_DEV_VERDICT=ready') {
verdict = {};
@@ -326,14 +389,16 @@ export function launchMakeTest(
verdict.region !== region ||
!/^[1-9][0-9]*$/.test(verdict.pid)
) {
- fail('launchFailed');
+ fail('launchFailed', 'identityMismatch');
return;
}
settled = true;
clearTimeout(timeout);
+ diagnostic({ event: 'ready' });
resolveReady();
}
});
+ diagnostic({ event: 'spawn' });
if (signal.aborted) stop();
return { ready, closed, stop };
}
diff --git a/apps/desktop/src/main/cindy-make/testRuntime.ts b/apps/desktop/src/main/cindy-make/testRuntime.ts
index 7e39e45bfd..23000119c6 100644
--- a/apps/desktop/src/main/cindy-make/testRuntime.ts
+++ b/apps/desktop/src/main/cindy-make/testRuntime.ts
@@ -10,6 +10,7 @@ import {
isDataOwnerBroadcastScopeCurrent,
} from '../device-link/broadcast-tap.js';
import { throwIpcError } from '../utils/ipcValidate.js';
+import { createLogger } from '../logger.js';
import { CURRENT_CINDY_REGION } from '../../shared/brandRegion.js';
import type {
CindyMakeCompletionMeta,
@@ -36,6 +37,7 @@ import { captureMakeHistoryCompletion } from './historyCapture.js';
import { broadcastMakeRemoteChanged } from './remoteBroadcast.js';
let isRunning: (sessionId: string) => boolean = () => true;
+const log = createLogger('cindy-make-test');
export function configureCindyMakeTestRuntime(probe: typeof isRunning): void {
isRunning = probe;
}
@@ -152,6 +154,17 @@ async function save(
)
.returning({ id: messages.id });
if (!context.isCurrent() || !result.length) throw makeTestError('unavailable');
+ if (patch.test) {
+ const receipt = {
+ runId: context.runId,
+ completionId: context.completionId,
+ status: patch.test.status,
+ step: patch.test.step,
+ error: patch.test.error,
+ };
+ if (patch.test.status === 'failed') log.warn('Isolated test failed', receipt);
+ else log.debug('Isolated test state', receipt);
+ }
captureMakeHistoryCompletion(
captureMakeHistoryStore(),
context.runId,
@@ -293,19 +306,36 @@ export const cindyMakeTestController = createMakeTestController({
publish('workspace');
await verifyMakeTestWorkspace(context, env, signal);
const node = await environment.probe('node', ['--version'], signal);
- if (node.status !== 'ok' || !node.path || !path.isAbsolute(node.path))
+ const pnpm = await environment.probe('pnpm', ['--version'], signal);
+ if (
+ node.status !== 'ok' ||
+ !node.path ||
+ !path.isAbsolute(node.path) ||
+ pnpm.status !== 'ok' ||
+ !pnpm.path ||
+ !path.isAbsolute(pnpm.path)
+ )
throw makeTestError('environment');
signal.throwIfAborted();
if (!context.isCurrent()) throw makeTestError('unavailable');
publish('stopping');
return launchMakeTest(
context,
- node.path,
+ { node: node.path, pnpm: pnpm.path },
env,
CURRENT_CINDY_REGION === 'cn' ? 'cn' : 'global',
signal,
undefined,
publish,
+ (diagnostic) => {
+ const entry = {
+ runId: context.runId,
+ completionId: context.completionId,
+ ...diagnostic,
+ };
+ if (diagnostic.event === 'failed') log.warn('Isolated test launcher failed', entry);
+ else log.debug('Isolated test launcher', entry);
+ },
);
},
signal,
diff --git a/apps/desktop/src/renderer/__tests__/cindyMakeInlineEntry.test.ts b/apps/desktop/src/renderer/__tests__/cindyMakeInlineEntry.test.ts
index d858897ccf..0c80d4b605 100644
--- a/apps/desktop/src/renderer/__tests__/cindyMakeInlineEntry.test.ts
+++ b/apps/desktop/src/renderer/__tests__/cindyMakeInlineEntry.test.ts
@@ -31,6 +31,12 @@ describe('Cindy Make composer presentation', () => {
/pendingPlanReview ||[\s\S]*pendingPermission ||[\s\S]*pendingAskUser/,
);
expect(interactionGuard).toContain('pendingGhostGrantConfirm ? null');
- expect(sessionView).toContain('if (cindyMakeComposerPhase || cindyMakePendingTest) return false;');
+ expect(sessionView).toContain('if (cindyMakeInputLocked) return false;');
+ expect(sessionView).not.toContain('CindyMakeResumeCard');
+ const recovery = sessionView.indexOf(') : cindyMakeRecoveryId && session ? (');
+ expect(recovery).toBeGreaterThan(mask);
+ expect(recovery).toBeLessThan(input);
+ expect(sessionView.slice(recovery, input)).toContain('<CindyMakeTestCard');
+ expect(sessionView.slice(recovery, input)).toContain(') : (');
});
});
diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeCompleteCard.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeCompleteCard.tsx
index 414119e951..7c47607011 100644
--- a/apps/desktop/src/renderer/components/cindy-make/CindyMakeCompleteCard.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeCompleteCard.tsx
@@ -1,5 +1,5 @@
import type { ReactNode } from 'react';
-import { Check, CircleAlert } from 'lucide-react';
+import { Check, CircleAlert, CircleHelp } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { cn } from '@/lib/utils';
import { Spinner } from '@/components/ui/spinner';
@@ -10,16 +10,20 @@ export function CindyMakeCompleteCard({
composer = false,
heading,
description,
+ detail,
busy,
failed,
+ needsCheck,
children,
}: {
data?: Record<string, unknown>;
composer?: boolean;
heading?: string;
description?: string;
+ detail?: ReactNode;
busy?: boolean;
failed?: boolean;
+ needsCheck?: boolean;
children?: ReactNode;
}) {
const { t, i18n } = useTranslation();
@@ -62,6 +66,8 @@ export function CindyMakeCompleteCard({
<Spinner size={18} />
) : failed ? (
<CircleAlert size={18} className="text-[var(--status-danger)]" aria-hidden />
+ ) : needsCheck ? (
+ <CircleHelp size={18} className="text-[var(--text-secondary)]" aria-hidden />
) : (
<Check size={18} className="text-[var(--status-success)]" aria-hidden />
)}
@@ -73,6 +79,7 @@ export function CindyMakeCompleteCard({
{description ?? t('cindyMake.complete.description')}
</p>
</div>
+ {detail}
{meta.length > 0 && (
<p className="mt-2 break-words text-12 text-[var(--text-secondary)]">
{meta.join(' · ')}
diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeTestCard.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeTestCard.tsx
index f8193ed288..9f0961b7fb 100644
--- a/apps/desktop/src/renderer/components/cindy-make/CindyMakeTestCard.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeTestCard.tsx
@@ -13,21 +13,129 @@ import type {
CindyMakeCompletionMeta,
CindyMakeTestAction,
CindyMakeTestState,
+ CindyMakePersonalBuildState,
} from '../../../shared/cindyMakeSession';
import { CindyMakeCompleteCard } from './CindyMakeCompleteCard';
+import { CindyMakeTestStep } from './CindyMakeTestStep';
-export function CindyMakeTestCard({
- sessionId,
- completionId,
- meta,
-}: {
+type CompletedTestProps = {
sessionId: string;
completionId: string;
meta: CindyMakeCompletionMeta;
-}) {
+ onContinue?: () => void;
+};
+
+type RecoveryTestProps = {
+ sessionId: string;
+ recovery: { onCheck: () => Promise<boolean | void>; onContinue: () => void };
+};
+
+/** Completion and missing-report recovery occupy the same composer card. */
+export function CindyMakeTestCard(props: CompletedTestProps | RecoveryTestProps) {
+ return 'recovery' in props ? (
+ <CindyMakeTestRecovery {...props} />
+ ) : (
+ <CindyMakeCompletedTest {...props} />
+ );
+}
+
+function CindyMakeTestRecovery({ sessionId, recovery }: RecoveryTestProps) {
+ const { t } = useTranslation();
+ const owner = getDataOwnerGeneration();
+ const [pending, setPending] = useState(false);
+ const [failed, setFailed] = useState(false);
+ const busy = useRef(false);
+ const active = useRef(true);
+ const current = () =>
+ active.current && isDataOwnerGenerationCurrent(owner) && !getStickySessionDeviceId(sessionId);
+ useEffect(() => {
+ active.current = true;
+ return () => {
+ active.current = false;
+ };
+ }, []);
+ const check = async () => {
+ if (busy.current || !current()) return;
+ busy.current = true;
+ setPending(true);
+ setFailed(false);
+ try {
+ const accepted = await recovery.onCheck();
+ if (current() && accepted === false) setFailed(true);
+ } catch {
+ if (current()) setFailed(true);
+ } finally {
+ busy.current = false;
+ if (current()) setPending(false);
+ }
+ };
+ return (
+ <CindyMakeCompleteCard
+ composer
+ needsCheck
+ busy={pending}
+ failed={failed}
+ heading={t('cindyMake.test.resume.title')}
+ description={t('cindyMake.test.resume.description')}
+ >
+ {failed && (
+ <p role="alert" className="text-12 text-[var(--status-danger)]">
+ {t('cindyMake.test.resume.failed')}
+ </p>
+ )}
+ <div className="flex flex-wrap justify-end gap-2">
+ <Button
+ variant="secondary"
+ disabled={pending}
+ onClick={() => {
+ if (!busy.current && current()) recovery.onContinue();
+ }}
+ >
+ {t('cindyMake.test.continue')}
+ </Button>
+ <Button
+ variant="secondary"
+ disabled={pending}
+ loading={pending}
+ onClick={() => void check()}
+ >
+ {t('cindyMake.test.resume.action')}
+ </Button>
+ </div>
+ </CindyMakeCompleteCard>
+ );
+}
+
+function CindyMakeCompletedTest({ sessionId, completionId, meta, onContinue }: CompletedTestProps) {
const { t } = useTranslation();
- const versions = useCindyVersions(!!meta.personal?.versionId, meta.personal?.versionId);
+ const owner = getDataOwnerGeneration();
const [pending, setPending] = useState<Exclude<CindyMakeTestAction, 'status'>>();
+ const [buildSnapshot, setBuildSnapshot] = useState<{
+ owner: typeof owner;
+ sessionId: string;
+ completionId: string;
+ build?: CindyMakePersonalBuildState;
+ }>();
+ const sharedBuild =
+ buildSnapshot &&
+ isDataOwnerGenerationCurrent(buildSnapshot.owner) &&
+ buildSnapshot.sessionId === sessionId &&
+ buildSnapshot.completionId === completionId
+ ? buildSnapshot.build
+ : undefined;
+ const setSharedBuild = (build?: CindyMakePersonalBuildState) =>
+ setBuildSnapshot({ owner, sessionId, completionId, build });
+ const latestSharedBuild = useRef(sharedBuild);
+ latestSharedBuild.current = sharedBuild;
+ const personal =
+ sharedBuild?.buildId === meta.personal?.buildId &&
+ meta.personal &&
+ ['ready', 'failed'].includes(meta.personal.status)
+ ? meta.personal
+ : (sharedBuild ?? meta.personal);
+ const versions = useCindyVersions(!!personal?.versionId, personal?.versionId);
+ const [stoppingBuild, setStoppingBuild] = useState(false);
+ const buildRequest = useRef(0);
const [error, setError] = useState<{
mode: 'test' | 'build';
code: CindyMakeTestState['error'];
@@ -37,9 +145,46 @@ export function CindyMakeTestCard({
const version = useRef(0);
const latest = useRef(meta);
latest.current = meta;
- const owner = getDataOwnerGeneration();
const current = () =>
active.current && isDataOwnerGenerationCurrent(owner) && !getStickySessionDeviceId(sessionId);
+ useEffect(() => {
+ if (typeof window.electronAPI.getCindyMakeHistory !== 'function') return;
+ let disposed = false;
+ let reading = false;
+ const refresh = async () => {
+ if (disposed || reading || !current() || document.visibilityState === 'hidden') return;
+ reading = true;
+ const request = ++buildRequest.current;
+ try {
+ const state = await window.electronAPI.getCindyMakeHistory();
+ if (!disposed && current() && request === buildRequest.current) {
+ const build = state.build;
+ const previous = latestSharedBuild.current;
+ if (
+ build &&
+ (!['ready', 'failed'].includes(build.status) ||
+ (build.buildId &&
+ (build.buildId === previous?.buildId ||
+ build.buildId === latest.current.personal?.buildId)))
+ )
+ setSharedBuild(build);
+ else setSharedBuild(undefined);
+ }
+ } catch {
+ /* The persisted completion remains available when refresh fails. */
+ } finally {
+ reading = false;
+ }
+ };
+ void refresh();
+ const timer = window.setInterval(() => void refresh(), 5000);
+ window.addEventListener('focus', refresh);
+ return () => {
+ disposed = true;
+ window.clearInterval(timer);
+ window.removeEventListener('focus', refresh);
+ };
+ }, [sessionId, completionId, owner.dataOwnerId, owner.generation]);
useEffect(() => {
active.current = true;
const initial = latest.current;
@@ -61,11 +206,23 @@ export function CindyMakeTestCard({
version.current += 1;
setPending(action);
setError(undefined);
+ if (action !== 'open-build') setSharedBuild(undefined);
+ buildRequest.current += 1;
const initial = latest.current;
try {
+ if (
+ action === 'open-build' &&
+ sharedBuild?.status === 'ready' &&
+ sharedBuild.buildId !== meta.personal?.buildId
+ ) {
+ await window.electronAPI.openCindyMakeHistoryBuild();
+ return;
+ }
const next = await window.electronAPI.cindyMakeTest(sessionId, completionId, action);
- if (current() && (action === 'continue' || latest.current === initial))
+ if (current() && (action === 'continue' || latest.current === initial)) {
+ if (action === 'continue') onContinue?.();
makerChatStore.updateSystemCardData(sessionId, completionId, { ...next });
+ }
} catch (error) {
if (current()) {
const code = extractIpcError(error)?.message;
@@ -79,27 +236,43 @@ export function CindyMakeTestCard({
if (active.current) setPending(undefined);
}
};
- const buildMode =
- pending === 'build' ||
- pending === 'open-build' ||
- (pending !== 'start' &&
- (error?.mode ?? meta.lastAction ?? (meta.personal ? 'build' : 'test')) === 'build');
const testStatus = pending === 'start' ? 'starting' : (meta.test?.status ?? 'waiting');
- const buildStatus = pending === 'build' ? 'waiting' : meta.personal?.status;
+ const buildStatus = pending === 'build' ? 'waiting' : personal?.status;
const building = ['waiting', 'checking', 'merging', 'packaging', 'publishing'].includes(
buildStatus ?? '',
);
const starting = testStatus === 'starting';
+ const buildMode =
+ !starting &&
+ ((!!sharedBuild && (building || meta.lastAction !== 'test')) ||
+ pending === 'build' ||
+ pending === 'open-build' ||
+ (error?.mode ?? meta.lastAction ?? (meta.personal ? 'build' : 'test')) === 'build');
+ const retryTest =
+ !starting && (testStatus === 'failed' || testStatus === 'stopped' || error?.mode === 'test');
+ const stopping = building && (stoppingBuild || personal?.stopping === true);
+ const stopBuild = async () => {
+ if (!personal?.buildId || stopping || !current()) return;
+ setStoppingBuild(true);
+ buildRequest.current += 1;
+ try {
+ const state = await window.electronAPI.cancelCindyMakePersonal(personal.buildId);
+ if (current()) setSharedBuild(state.build);
+ } catch {
+ if (current()) setError({ mode: 'build', code: 'unavailable' });
+ } finally {
+ if (current()) setStoppingBuild(false);
+ }
+ };
const switching = !!versions.pending || versions.state?.switching === true;
- const usingPersonal =
- !!meta.personal?.versionId && versions.state?.currentId === meta.personal.versionId;
+ const usingPersonal = !!personal?.versionId && versions.state?.currentId === personal.versionId;
const working = buildMode ? building : starting;
const errorCode =
- starting || building
+ error?.code ??
+ (starting || building
? undefined
- : (error?.code ??
- (buildMode ? meta.personal?.error : meta.test?.error) ??
- (!meta.commit ? 'unavailable' : undefined));
+ : ((buildMode ? personal?.error : meta.test?.error) ??
+ (!meta.commit ? 'unavailable' : undefined)));
return (
<CindyMakeCompleteCard
composer
@@ -108,23 +281,34 @@ export function CindyMakeTestCard({
failed={Boolean(errorCode)}
heading={t(
buildMode && buildStatus
- ? buildStatus === 'checking' && meta.personal?.checkStep
- ? 'cindyMake.personal.checkStep.' + meta.personal.checkStep
- : 'cindyMake.personal.status.' + buildStatus
+ ? stopping
+ ? 'cindyMake.history.stopping'
+ : buildStatus === 'checking' && personal?.checkStep
+ ? 'cindyMake.personal.checkStep.' + personal.checkStep
+ : 'cindyMake.personal.status.' + buildStatus
: 'cindyMake.test.status.' + testStatus,
)}
description={t(
buildMode && buildStatus === 'ready'
- ? meta.personal?.versionId
+ ? personal?.versionId
? 'cindyMake.versions.readyHint'
: 'cindyMake.personal.readyHint'
: buildMode && building
? 'cindyMake.personal.description'
- : testStatus === 'ready'
- ? 'cindyMake.test.readyHint'
- : 'cindyMake.test.description',
- { name: meta.personal?.artifactName ?? '' },
+ : starting
+ ? 'cindyMake.test.startingHint'
+ : testStatus === 'ready'
+ ? 'cindyMake.test.readyHint'
+ : 'cindyMake.test.description',
+ { name: personal?.artifactName ?? '' },
)}
+ detail={
+ !buildMode ? (
+ <CindyMakeTestStep
+ test={pending === 'start' ? { status: 'starting', step: 'waiting' } : meta.test}
+ />
+ ) : undefined
+ }
>
{versions.error && (
<p role="alert" className="text-12 text-[var(--status-danger)]">
@@ -137,9 +321,19 @@ export function CindyMakeTestCard({
</p>
)}
<div className="flex flex-wrap justify-end gap-2">
+ {building && personal?.buildId && (
+ <Button
+ variant="secondary"
+ disabled={stopping}
+ loading={stopping}
+ onClick={() => void stopBuild()}
+ >
+ {t(stopping ? 'cindyMake.history.stopping' : 'cindyMake.history.stop')}
+ </Button>
+ )}
<Button
variant="secondary"
- disabled={!!pending || building || switching}
+ disabled={!!pending || building || starting || switching}
loading={pending === 'continue'}
onClick={() => void act('continue')}
>
@@ -153,23 +347,29 @@ export function CindyMakeTestCard({
loading={starting}
onClick={() => void act('start')}
>
- {t(testStatus === 'ready' ? 'cindyMake.test.started' : 'cindyMake.test.start')}
+ {t(
+ testStatus === 'ready'
+ ? 'cindyMake.test.started'
+ : retryTest
+ ? 'cindyMake.test.retry'
+ : 'cindyMake.test.start',
+ )}
</Button>
<Button
variant="secondary"
disabled={!!pending || building || starting || switching || usingPersonal || !meta.commit}
loading={building || switching || pending === 'open-build'}
onClick={() => {
- if (meta.personal?.status === 'ready' && meta.personal.versionId)
- void versions.act('switch', meta.personal.versionId);
- else void act(meta.personal?.status === 'ready' ? 'open-build' : 'build');
+ if (personal?.status === 'ready' && personal.versionId)
+ void versions.act('switch', personal.versionId);
+ else void act(personal?.status === 'ready' ? 'open-build' : 'build');
}}
>
{t(
- meta.personal?.status === 'ready'
+ personal?.status === 'ready'
? usingPersonal
? 'cindyMake.versions.using'
- : meta.personal.versionId
+ : personal.versionId
? 'cindyMake.versions.switchPersonal'
: 'cindyMake.personal.open'
: 'cindyMake.personal.generate',
diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeTestStep.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeTestStep.tsx
new file mode 100644
index 0000000000..2aeafe0fdc
--- /dev/null
+++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeTestStep.tsx
@@ -0,0 +1,16 @@
+import { useTranslation } from 'react-i18next';
+import type { CindyMakeTestState } from '../../../shared/cindyMakeSession';
+
+/** Task and Settings display the same persisted startup step and failure location. */
+export function CindyMakeTestStep({ test }: { test?: CindyMakeTestState }) {
+ const { t } = useTranslation();
+ const starting = test?.status === 'starting';
+ if (!starting && !(test?.step && test.error)) return null;
+ return (
+ <p role="status" className="mt-2 text-12 text-[var(--text-secondary)]">
+ {t(starting ? 'cindyMake.test.currentStep' : 'cindyMake.test.failedStep', {
+ step: t('cindyMake.test.steps.' + (test?.step ?? 'waiting')),
+ })}
+ </p>
+ );
+}
diff --git a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestCard.test.tsx b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestCard.test.tsx
index 30b6daf3c4..91cd14dd05 100644
--- a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestCard.test.tsx
+++ b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestCard.test.tsx
@@ -6,7 +6,11 @@ import { setDataOwnerGeneration } from '@/contexts/dataOwnerGeneration';
import type { CindyMakeCompletionMeta } from '../../../../shared/cindyMakeSession';
const h = vi.hoisted(() => ({ api: vi.fn(), patch: vi.fn() }));
vi.mock('react-i18next', () => ({
- useTranslation: () => ({ t: (key: string) => key, i18n: { language: 'en' } }),
+ useTranslation: () => ({
+ t: (key: string, options?: { step?: string }) =>
+ options?.step ? key + ': ' + options.step : key,
+ i18n: { language: 'en' },
+ }),
}));
vi.mock('@/lib/makerChatStore', () => ({ makerChatStore: { updateSystemCardData: h.patch } }));
vi.mock('@/features/device-link/stickySessionOrigin', () => ({
@@ -27,6 +31,228 @@ afterEach(() => {
});
describe('completion card in the input area', () => {
+ it('releases input only after Continue Editing succeeds', async () => {
+ const onContinue = vi.fn();
+ render(
+ <CindyMakeTestCard
+ sessionId="session"
+ completionId="completion"
+ meta={meta}
+ onContinue={onContinue}
+ />,
+ );
+ await waitFor(() => expect(h.api).toHaveBeenCalledOnce());
+ h.api.mockRejectedValueOnce(new Error('unavailable'));
+ fireEvent.click(screen.getByRole('button', { name: 'cindyMake.test.continue' }));
+ await screen.findByRole('alert');
+ expect(onContinue).not.toHaveBeenCalled();
+ h.api.mockResolvedValueOnce({ ...meta, continuedAt: 456 });
+ fireEvent.click(screen.getByRole('button', { name: 'cindyMake.test.continue' }));
+ await waitFor(() => expect(onContinue).toHaveBeenCalledOnce());
+ expect(h.patch).toHaveBeenLastCalledWith('session', 'completion', {
+ ...meta,
+ continuedAt: 456,
+ });
+ });
+ it('keeps the current test progress and failure ahead of an older personal build receipt', async () => {
+ const personal = { buildId: 'previous-build', status: 'ready' as const };
+ const history = vi.fn().mockResolvedValue({ build: personal });
+ vi.stubGlobal('electronAPI', { cindyMakeTest: h.api, getCindyMakeHistory: history });
+ const { rerender } = render(
+ <CindyMakeTestCard
+ sessionId="session"
+ completionId="completion"
+ meta={{
+ ...meta,
+ lastAction: 'test',
+ personal,
+ test: { status: 'starting', step: 'assets' },
+ }}
+ />,
+ );
+ await waitFor(() => expect(history).toHaveBeenCalledOnce());
+ expect(
+ screen.getByText('cindyMake.test.currentStep: cindyMake.test.steps.assets'),
+ ).toBeDefined();
+ expect(screen.queryByText('cindyMake.personal.status.ready')).toBeNull();
+ rerender(
+ <CindyMakeTestCard
+ sessionId="session"
+ completionId="completion"
+ meta={{
+ ...meta,
+ lastAction: 'test',
+ personal,
+ test: { status: 'failed', step: 'assets', error: 'launchFailed' },
+ }}
+ />,
+ );
+ expect(screen.getByRole('alert').textContent).toBe('cindyMake.test.errors.launchFailed');
+ expect(
+ screen.getByText('cindyMake.test.failedStep: cindyMake.test.steps.assets'),
+ ).toBeDefined();
+ });
+ it('shows live startup steps, blocks editing, and offers retry with the failed step', async () => {
+ const { rerender } = render(
+ <CindyMakeTestCard
+ sessionId="session"
+ completionId="completion"
+ meta={{ ...meta, test: { status: 'starting', step: 'dependencies' } }}
+ />,
+ );
+ await waitFor(() => expect(h.api).toHaveBeenCalledOnce());
+ expect(
+ screen.getByText('cindyMake.test.currentStep: cindyMake.test.steps.dependencies'),
+ ).toBeDefined();
+ expect(screen.getByText('cindyMake.test.startingHint')).toBeDefined();
+ expect(screen.queryByText('cindyMake.test.description')).toBeNull();
+ const continueButton = screen.getByRole('button', { name: 'cindyMake.test.continue' });
+ expect((continueButton as HTMLButtonElement).disabled).toBe(true);
+ fireEvent.click(continueButton);
+ expect(h.api.mock.calls.every(([, , action]) => action === 'status')).toBe(true);
+ rerender(
+ <CindyMakeTestCard
+ sessionId="session"
+ completionId="completion"
+ meta={{ ...meta, test: { status: 'starting', step: 'launching' } }}
+ />,
+ );
+ expect(
+ screen.getByText('cindyMake.test.currentStep: cindyMake.test.steps.launching'),
+ ).toBeDefined();
+ rerender(
+ <CindyMakeTestCard
+ sessionId="session"
+ completionId="completion"
+ meta={{ ...meta, test: { status: 'failed', step: 'launching', error: 'timeout' } }}
+ />,
+ );
+ expect(
+ screen.getByText('cindyMake.test.failedStep: cindyMake.test.steps.launching'),
+ ).toBeDefined();
+ expect(screen.getByRole('alert').textContent).toBe('cindyMake.test.errors.timeout');
+ expect((continueButton as HTMLButtonElement).disabled).toBe(false);
+ h.api.mockImplementationOnce(() => new Promise(() => {}));
+ fireEvent.click(screen.getByRole('button', { name: 'cindyMake.test.retry' }));
+ expect(h.api).toHaveBeenLastCalledWith('session', 'completion', 'start');
+ expect((continueButton as HTMLButtonElement).disabled).toBe(true);
+ expect(screen.queryByRole('alert')).toBeNull();
+ expect(
+ screen.getByText('cindyMake.test.currentStep: cindyMake.test.steps.waiting'),
+ ).toBeDefined();
+ });
+ it('supports older starting records without a step and unlocks editing after readiness', () => {
+ const { rerender } = render(
+ <CindyMakeTestCard
+ sessionId="session"
+ completionId="completion"
+ meta={{ ...meta, test: { status: 'starting' } }}
+ />,
+ );
+ expect(
+ screen.getByText('cindyMake.test.currentStep: cindyMake.test.steps.waiting'),
+ ).toBeDefined();
+ rerender(
+ <CindyMakeTestCard
+ sessionId="session"
+ completionId="completion"
+ meta={{ ...meta, test: { status: 'ready' } }}
+ />,
+ );
+ expect(
+ (screen.getByRole('button', { name: 'cindyMake.test.continue' }) as HTMLButtonElement)
+ .disabled,
+ ).toBe(false);
+ expect(
+ screen.queryByText('cindyMake.test.currentStep: cindyMake.test.steps.waiting'),
+ ).toBeNull();
+ });
+ it('opens a Settings-generated legacy installer through its own receipt', async () => {
+ const build = { buildId: 'settings-build', status: 'packaging' };
+ const history = vi.fn().mockResolvedValue({ build });
+ const open = vi.fn().mockResolvedValue(undefined);
+ vi.stubGlobal('electronAPI', {
+ cindyMakeTest: h.api,
+ getCindyMakeHistory: history,
+ openCindyMakeHistoryBuild: open,
+ });
+ view();
+ await screen.findByRole('button', { name: 'cindyMake.history.stop' });
+ history.mockResolvedValue({ build: { ...build, status: 'ready', artifactName: 'Cindy.exe' } });
+ fireEvent(window, new Event('focus'));
+ fireEvent.click(await screen.findByRole('button', { name: 'cindyMake.personal.open' }));
+ await waitFor(() => expect(open).toHaveBeenCalledOnce());
+ expect(
+ h.api.mock.calls.some(([, , action]) => action === 'build' || action === 'open-build'),
+ ).toBe(false);
+ });
+ it('does not show a previous account build after changing owners', async () => {
+ const history = vi
+ .fn()
+ .mockResolvedValue({ build: { buildId: 'other-owner', status: 'packaging' } });
+ vi.stubGlobal('electronAPI', { cindyMakeTest: h.api, getCindyMakeHistory: history });
+ const { rerender } = view();
+ await screen.findByRole('button', { name: 'cindyMake.history.stop' });
+ history.mockResolvedValue({});
+ setDataOwnerGeneration('next-owner');
+ rerender(<CindyMakeTestCard sessionId="session" completionId="completion" meta={meta} />);
+ expect(screen.queryByRole('button', { name: 'cindyMake.history.stop' })).toBeNull();
+ });
+ it('reopens a Settings build and stops the same build without continuing the task', async () => {
+ const build = { buildId: 'settings-build', status: 'packaging' as const };
+ const history = vi.fn().mockResolvedValue({ items: [], busy: true, canBuild: false, build });
+ const cancel = vi.fn().mockResolvedValue({ build: { ...build, stopping: true } });
+ vi.stubGlobal('electronAPI', {
+ cindyMakeTest: h.api,
+ getCindyMakeHistory: history,
+ cancelCindyMakePersonal: cancel,
+ });
+ const first = view();
+ await screen.findByRole('button', { name: 'cindyMake.history.stop' });
+ first.unmount();
+ view();
+ fireEvent.click(await screen.findByRole('button', { name: 'cindyMake.history.stop' }));
+ await waitFor(() => expect(cancel).toHaveBeenCalledWith('settings-build'));
+ expect(
+ (
+ (await screen.findByRole('button', {
+ name: 'cindyMake.history.stopping',
+ })) as HTMLButtonElement
+ ).disabled,
+ ).toBe(true);
+ expect(h.api.mock.calls.every(([, , action]) => action === 'status')).toBe(true);
+ history.mockResolvedValue({ build: { ...build, status: 'failed', error: 'cancelled' } });
+ fireEvent(window, new Event('focus'));
+ await screen.findByText('cindyMake.personal.errors.cancelled');
+ expect(
+ (screen.getByRole('button', { name: 'cindyMake.personal.generate' }) as HTMLButtonElement)
+ .disabled,
+ ).toBe(false);
+ });
+ it('uses terminal completion updates ahead of an older polled build progress', async () => {
+ const build = { buildId: 'card-build', status: 'packaging' as const };
+ vi.stubGlobal('electronAPI', {
+ cindyMakeTest: h.api,
+ getCindyMakeHistory: vi.fn().mockResolvedValue({ build }),
+ });
+ const { rerender } = render(
+ <CindyMakeTestCard
+ sessionId="session"
+ completionId="completion"
+ meta={{ ...meta, personal: build }}
+ />,
+ );
+ await screen.findByRole('button', { name: 'cindyMake.history.stop' });
+ rerender(
+ <CindyMakeTestCard
+ sessionId="session"
+ completionId="completion"
+ meta={{ ...meta, personal: { ...build, status: 'failed', error: 'checksFailed' } }}
+ />,
+ );
+ expect(screen.getByText('cindyMake.personal.errors.checksFailed')).toBeDefined();
+ expect(screen.queryByRole('button', { name: 'cindyMake.history.stop' })).toBeNull();
+ });
it('only reads status on mount and starts the isolated build after the user clicks', async () => {
view();
await waitFor(() => expect(h.api).toHaveBeenCalledWith('session', 'completion', 'status'));
@@ -174,24 +400,20 @@ describe('completion card in the input area', () => {
).toBe(false);
});
it('replaces the generation action with the shared version switch for a runnable snapshot', async () => {
- const switchVersion = vi
- .fn()
- .mockResolvedValue({
+ const switchVersion = vi.fn().mockResolvedValue({
+ currentId: 'original',
+ selectedId: 'original',
+ versions: [],
+ switching: true,
+ });
+ vi.stubGlobal('electronAPI', {
+ cindyMakeTest: h.api,
+ getCindyVersions: vi.fn().mockResolvedValue({
currentId: 'original',
selectedId: 'original',
versions: [],
- switching: true,
- });
- vi.stubGlobal('electronAPI', {
- cindyMakeTest: h.api,
- getCindyVersions: vi
- .fn()
- .mockResolvedValue({
- currentId: 'original',
- selectedId: 'original',
- versions: [],
- switching: false,
- }),
+ switching: false,
+ }),
actCindyVersion: switchVersion,
});
render(
diff --git a/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestRecovery.test.tsx b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestRecovery.test.tsx
new file mode 100644
index 0000000000..7c7dc18efd
--- /dev/null
+++ b/apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestRecovery.test.tsx
@@ -0,0 +1,133 @@
+// @vitest-environment jsdom
+import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { setDataOwnerGeneration } from '@/contexts/dataOwnerGeneration';
+import { useState } from 'react';
+import { CindyMakeTestCard } from '../CindyMakeTestCard';
+import { getCindyMakeTestRecovery } from '@/lib/cindyMakeComposer';
+import type { ChatMessage } from '@/lib/makerChatStore';
+
+vi.mock('react-i18next', () => ({
+ useTranslation: () => ({ t: (key: string) => key, i18n: { language: 'en' } }),
+}));
+vi.mock('@/lib/makerChatStore', () => ({ makerChatStore: { updateSystemCardData: vi.fn() } }));
+vi.mock('@/features/device-link/stickySessionOrigin', () => ({
+ getStickySessionDeviceId: () => undefined,
+}));
+beforeEach(() => setDataOwnerGeneration('make-owner'));
+afterEach(cleanup);
+const button = () => screen.getByRole('button', { name: 'cindyMake.test.resume.action' });
+const card = (onCheck: () => Promise<boolean | void>, key = 'task') => (
+ <CindyMakeTestCard key={key} sessionId={key} recovery={{ onCheck, onContinue: vi.fn() }} />
+);
+
+describe('Cindy Make resume checks', () => {
+ it('sends one request during repeated clicks and permits retry after rejection', async () => {
+ let finish!: (accepted: boolean) => void;
+ const resume = vi.fn(
+ () =>
+ new Promise<boolean>((resolve) => {
+ finish = resolve;
+ }),
+ );
+ render(card(resume));
+ fireEvent.click(button());
+ fireEvent.click(button());
+ expect(resume).toHaveBeenCalledOnce();
+ expect((button() as HTMLButtonElement).disabled).toBe(true);
+ await act(async () => finish(false));
+ expect(screen.getByRole('alert').textContent).toBe('cindyMake.test.resume.failed');
+ fireEvent.click(button());
+ expect(resume).toHaveBeenCalledTimes(2);
+ await act(async () => finish(true));
+ expect(screen.queryByRole('alert')).toBeNull();
+ });
+
+ it('shows send failures without losing the recovery action', async () => {
+ const resume = vi.fn().mockRejectedValueOnce(new Error('send failed')).mockResolvedValue(true);
+ render(card(resume));
+ fireEvent.click(button());
+ await waitFor(() => expect(screen.getByRole('alert')).toBeDefined());
+ fireEvent.click(button());
+ await waitFor(() => expect(screen.queryByRole('alert')).toBeNull());
+ expect(resume).toHaveBeenCalledTimes(2);
+ });
+
+ it('does not dispatch an old card after an account switch', () => {
+ const resume = vi.fn().mockResolvedValue(true);
+ render(card(resume));
+ setDataOwnerGeneration('another-owner');
+ fireEvent.click(button());
+ expect(resume).not.toHaveBeenCalled();
+ });
+
+ it('does not put a late failure onto the next task', async () => {
+ let finish!: (accepted: boolean) => void;
+ const resume = () =>
+ new Promise<boolean>((resolve) => {
+ finish = resolve;
+ });
+ const view = render(card(resume, 'old-task'));
+ fireEvent.click(button());
+ view.rerender(card(async () => true, 'new-task'));
+ await act(async () => finish(false));
+ expect(screen.queryByRole('alert')).toBeNull();
+ expect((button() as HTMLButtonElement).disabled).toBe(false);
+ });
+});
+
+describe('recovery uses the existing input-area flow card', () => {
+ const session = {
+ id: 'make-task',
+ source: 'cindy-make' as const,
+ status: 'active' as const,
+ clearedAt: null,
+ };
+ const reply = (clientId: string): ChatMessage => ({
+ clientId,
+ role: 'assistant',
+ content: 'Done',
+ turnCompleted: true,
+ });
+ function Composer({ messages }: { messages: ChatMessage[] }) {
+ const [dismissedId, dismiss] = useState<string>();
+ const recoveryId = getCindyMakeTestRecovery({
+ session,
+ messages,
+ busy: false,
+ historyLoaded: true,
+ dismissedId,
+ });
+ return recoveryId ? (
+ <CindyMakeTestCard
+ sessionId={session.id}
+ recovery={{
+ onCheck: async () => true,
+ onContinue: () => dismiss(recoveryId),
+ }}
+ />
+ ) : (
+ <textarea aria-label="editor" />
+ );
+ }
+
+ it('replaces input, releases it for editing, and restores the same card after the next reply', () => {
+ const view = render(<Composer messages={[reply('first')]} />);
+ const region = screen.getByRole('region', { name: 'cindyMake.test.title' });
+ expect(region.className).toContain('w-full');
+ expect(region.className).toContain('bg-[var(--chat-input-bg)]');
+ expect(screen.getAllByRole('region')).toHaveLength(1);
+ expect(screen.queryByRole('textbox')).toBeNull();
+ // No stale snapshot or successful verification is claimed in recovery.
+ expect(screen.queryByText(/changedFiles|commit/)).toBeNull();
+ expect(screen.queryByRole('button', { name: 'cindyMake.test.start' })).toBeNull();
+ fireEvent.click(screen.getByRole('button', { name: 'cindyMake.test.continue' }));
+ expect(screen.getByRole('textbox')).toBeDefined();
+ expect(screen.queryByRole('region')).toBeNull();
+ view.rerender(<Composer messages={[reply('first')]} />);
+ expect(screen.getByRole('textbox')).toBeDefined();
+ view.rerender(<Composer messages={[reply('first'), reply('second')]} />);
+ expect(screen.queryByRole('textbox')).toBeNull();
+ expect(screen.getByRole('region', { name: 'cindyMake.test.title' })).toBeDefined();
+ });
+});
diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
index 85f1aa46fe..dfbb79bfd1 100644
--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
@@ -62,7 +62,12 @@ import { setRemoteReceiptDisplayReady } from '@/lib/sessionAttentionStore';
import { shortSessionId } from '@/lib/sessionId';
import { ChatInput } from '@/components/new-chat/ChatInput';
import { CindyMakeComposerMask } from '@/components/cindy-make/CindyMakeComposerMask';
-import { getCindyMakeComposerPhase, getCindyMakePendingTest, getCindyMakePreparation } from '@/lib/cindyMakeComposer';
+import {
+ getCindyMakeTestRecovery,
+ getCindyMakeComposerPhase,
+ getCindyMakePendingTest,
+ getCindyMakePreparation,
+} from '@/lib/cindyMakeComposer';
import { CindyMakeTestCard } from '@/components/cindy-make/CindyMakeTestCard';
import { useCindyMakeState } from '@/lib/cindyMakeState';
import { GoalIndicator } from '@/components/new-chat/GoalIndicator';
@@ -1799,6 +1804,29 @@ export function CCAgentSessionView({
? getCindyMakePendingTest({ session, messages, busy: isAgentBusy }) : null,
[session, messages, isAgentBusy, remoteDeviceId, readOnly],
);
+ const [cindyMakeEditing, setCindyMakeEditing] = useState<{
+ sessionId: string;
+ messageId: string;
+ }>();
+ const cindyMakeRecoveryId =
+ !remoteDeviceId &&
+ !readOnly &&
+ !pendingQueue.length &&
+ typeof window.electronAPI.cindyMakeTest === 'function'
+ ? getCindyMakeTestRecovery({
+ session,
+ messages,
+ busy: isAgentBusy,
+ historyLoaded,
+ dismissedId:
+ cindyMakeEditing && cindyMakeEditing.sessionId === sessionId
+ ? cindyMakeEditing.messageId
+ : undefined,
+ })
+ : null;
+ const cindyMakeInputLocked = Boolean(
+ cindyMakeComposerPhase || cindyMakePendingTest || cindyMakeRecoveryId,
+ );
useEffect(() => {
if (!sessionId || !isOrcaLeadSessionView || !historyLoaded) return;
const recoveredAssignment = getRecoverableDeferredUiAssignment({
@@ -3409,10 +3437,16 @@ export function CCAgentSessionView({
slashCommandRanges?: SlashCommandRange[];
onRemoteOptimisticFailure?: (clientId: string, error?: unknown) => void;
onDeferredAccepted?: () => void;
+ cindyMakeRecovery?: boolean;
},
) => {
if (readOnly) return false;
- if (cindyMakeComposerPhase || cindyMakePendingTest) return false;
+ if (
+ cindyMakeComposerPhase ||
+ cindyMakePendingTest ||
+ (cindyMakeRecoveryId && !opts?.cindyMakeRecovery)
+ )
+ return false;
const deliveryMode = opts?.deliveryMode ?? 'queue';
const originalMessage = message;
const navigationRequestVersion =
@@ -3697,6 +3731,7 @@ export function CCAgentSessionView({
sessionHandoffPreparing,
cindyMakeComposerPhase,
cindyMakePendingTest,
+ cindyMakeRecoveryId,
],
);
@@ -3866,10 +3901,10 @@ export function CCAgentSessionView({
]);
const handleBeforeVoiceInputStart = useCallback(async () => {
- if (cindyMakeComposerPhase || cindyMakePendingTest) return false;
+ if (cindyMakeInputLocked) return false;
const { proceed } = await vendorAuthGate.checkAndConfirm('codex', { purpose: 'voice-input' });
return proceed;
- }, [vendorAuthGate, cindyMakeComposerPhase, cindyMakePendingTest]);
+ }, [vendorAuthGate, cindyMakeInputLocked]);
// M32: Retry — ErrorBanner 的 retryText 现在只是兼容展示值。真正的
// recovery target 由 main coordinator 持有,避免把已发出的文本重新走普通
@@ -4470,7 +4505,7 @@ export function CCAgentSessionView({
const shareSelectionBlocked =
Boolean(sessionBinding.attached) ||
worktreePreparing ||
- Boolean(cindyMakeComposerPhase || cindyMakePendingTest) ||
+ cindyMakeInputLocked ||
Boolean(
pendingPlanReview ||
pendingPermission ||
@@ -4620,7 +4655,7 @@ export function CCAgentSessionView({
if (hasSplitGroupSessionType(e.dataTransfer.types)) return;
e.preventDefault();
e.stopPropagation();
- if (cindyMakeComposerPhase || cindyMakePendingTest) return;
+ if (cindyMakeInputLocked) return;
dragCounterRef.current += 1;
if (dragCounterRef.current === 1) setIsDragOver(true);
}}
@@ -4628,7 +4663,7 @@ export function CCAgentSessionView({
if (hasSplitGroupSessionType(e.dataTransfer.types)) return;
e.preventDefault();
e.stopPropagation();
- e.dataTransfer.dropEffect = cindyMakeComposerPhase || cindyMakePendingTest ? 'none' : 'copy';
+ e.dataTransfer.dropEffect = cindyMakeInputLocked ? 'none' : 'copy';
}}
onDragLeave={(e) => {
if (hasSplitGroupSessionType(e.dataTransfer.types)) return;
@@ -4643,7 +4678,7 @@ export function CCAgentSessionView({
e.stopPropagation();
dragCounterRef.current = 0;
setIsDragOver(false);
- if (cindyMakeComposerPhase || cindyMakePendingTest) return;
+ if (cindyMakeInputLocked) return;
// .cindy / .cshare 已被窗口级 capture 接管(装入 / 导入链路),
// 只清理拖拽 UI 状态,不当附件消费。
if (isGlobalDropIntercepted(e.nativeEvent)) return;
@@ -5210,6 +5245,9 @@ export function CCAgentSessionView({
sessionId={sessionId}
completionId={cindyMakePendingTest.completionId}
meta={cindyMakePendingTest.meta}
+ onContinue={() =>
+ setCindyMakeEditing({ sessionId, messageId: cindyMakePendingTest.completionId })
+ }
/>
) : worktreePreparing && smoothedBranchName ? (
<WorktreeCreatingOverlay branchName={smoothedBranchName} />
@@ -5219,6 +5257,25 @@ export function CCAgentSessionView({
barWidth={inputWidth}
getContentWidth={getMessageWidth}
/>
+ ) : cindyMakeRecoveryId && session ? (
+ <CindyMakeTestCard
+ key={`${session.id}:${cindyMakeRecoveryId}`}
+ sessionId={session.id}
+ recovery={{
+ onContinue: () =>
+ setCindyMakeEditing({ sessionId: session.id, messageId: cindyMakeRecoveryId }),
+ onCheck: () =>
+ handleSend(
+ t('cindyMake.test.resume.request'),
+ session.model,
+ session.effort as Effort,
+ session.permissionMode as PermissionMode,
+ undefined,
+ undefined,
+ { cindyMakeRecovery: true },
+ ),
+ }}
+ />
) : (
<ChatInput
onSend={handleSend}
diff --git a/apps/desktop/src/renderer/lib/__tests__/cindyMakeComposer.test.ts b/apps/desktop/src/renderer/lib/__tests__/cindyMakeComposer.test.ts
index b762b02d3c..4c5225c946 100644
--- a/apps/desktop/src/renderer/lib/__tests__/cindyMakeComposer.test.ts
+++ b/apps/desktop/src/renderer/lib/__tests__/cindyMakeComposer.test.ts
@@ -1,5 +1,6 @@
import { describe, expect, it } from 'vitest';
import {
+ getCindyMakeTestRecovery,
getCindyMakeComposerPhase,
getCindyMakePendingTest,
getCindyMakePreparation,
@@ -90,6 +91,113 @@ describe('Cindy Make waiting-for-test card', () => {
});
});
+describe('Cindy Make test flow recovery', () => {
+ const continued: ChatMessage = {
+ clientId: 'old-completion',
+ role: 'assistant',
+ content: '',
+ systemCardType: 'cindy-make-complete',
+ systemCardData: { reportedAt: 123, commit: 'a'.repeat(40), continuedAt: 456 },
+ };
+ const request: ChatMessage = { clientId: 'edit', role: 'user', content: 'edit again' };
+ const reply: ChatMessage = {
+ clientId: 'reply',
+ role: 'assistant',
+ content: 'Done',
+ turnCompleted: true,
+ };
+ const select = (messages: ChatMessage[]) =>
+ getCindyMakeTestRecovery({
+ session: { ...session, status: 'active' },
+ messages,
+ busy: false,
+ historyLoaded: true,
+ });
+
+ it('offers checks after Continue Editing, including when reopening without another edit', () => {
+ expect(
+ getCindyMakePendingTest({
+ session: { ...session, status: 'active' },
+ messages: [continued],
+ busy: false,
+ }),
+ ).toBeNull();
+ expect(select([continued])).toBe('old-completion');
+ });
+
+ it('recovers a later successful reply without report_complete and yields to a fresh completion', () => {
+ expect(select([continued, request])).toBeNull();
+ expect(select([continued, request, reply])).toBe('reply');
+ const fresh = {
+ ...continued,
+ clientId: 'new-completion',
+ systemCardData: { reportedAt: 789, commit: 'b'.repeat(40) },
+ };
+ expect(select([continued, request, reply, fresh])).toBeNull();
+ expect(select([continued, request, reply, fresh, request, reply])).toBe('reply');
+ expect(select([request, reply])).toBe('reply');
+ });
+
+ it('does not mistake incomplete, failed, or nested replies for a finished editing turn', () => {
+ expect(select([continued, request, { ...reply, turnCompleted: undefined }])).toBeNull();
+ expect(select([continued, request, { ...reply, turnCompleted: false }])).toBeNull();
+ expect(select([continued, request, { ...reply, parentToolUseId: 'subagent' }])).toBeNull();
+ expect(select([continued, request, reply, request])).toBeNull();
+ });
+
+ it('waits for loaded idle history and leaves non-active Make tasks alone', () => {
+ const base = {
+ session: { ...session, status: 'active' as const },
+ messages: [continued, request, reply],
+ busy: false,
+ historyLoaded: true,
+ };
+ expect(getCindyMakeTestRecovery({ ...base, busy: true })).toBeNull();
+ expect(getCindyMakeTestRecovery({ ...base, historyLoaded: false })).toBeNull();
+ for (const extra of [
+ { source: 'desktop' as const },
+ { status: 'archived' as const },
+ { clearedAt: '2026-09-19T10:00:00Z' },
+ ]) {
+ expect(
+ getCindyMakeTestRecovery({ ...base, session: { ...base.session, ...extra } }),
+ ).toBeNull();
+ }
+ });
+
+ it('does not reclaim input after Continue Editing until a new result arrives', () => {
+ const base = {
+ session: { ...session, status: 'active' as const },
+ busy: false,
+ historyLoaded: true,
+ };
+ expect(
+ getCindyMakeTestRecovery({ ...base, messages: [continued], dismissedId: continued.clientId }),
+ ).toBeNull();
+ expect(
+ getCindyMakeTestRecovery({
+ ...base,
+ messages: [continued, request, reply],
+ dismissedId: continued.clientId,
+ }),
+ ).toBe(reply.clientId);
+ expect(
+ getCindyMakeTestRecovery({
+ ...base,
+ messages: [continued, request, reply],
+ dismissedId: reply.clientId,
+ }),
+ ).toBeNull();
+ expect(
+ getCindyMakeTestRecovery({
+ ...base,
+ messages: [continued, request, reply, request, { ...reply, clientId: 'next-reply' }],
+ dismissedId: reply.clientId,
+ }),
+ ).toBe('next-reply');
+ });
+});
+
describe('Cindy Make composer lifecycle', () => {
it('restores the full preparation card and retry request from persisted history', () => {
const saved = card(preparing);
diff --git a/apps/desktop/src/renderer/lib/cindyMakeComposer.ts b/apps/desktop/src/renderer/lib/cindyMakeComposer.ts
index 4e5e1115f5..4ab179e429 100644
--- a/apps/desktop/src/renderer/lib/cindyMakeComposer.ts
+++ b/apps/desktop/src/renderer/lib/cindyMakeComposer.ts
@@ -46,6 +46,47 @@ export function getCindyMakePendingTest({
return null;
}
+/**
+ * Keep a way back to testing after Continue Editing, including when a later
+ * reply omitted report_complete. This offers verification, not a completion:
+ * an ended assistant reply alone cannot certify the current workspace.
+ */
+export function getCindyMakeTestRecovery({
+ session,
+ messages,
+ busy,
+ historyLoaded,
+ dismissedId,
+}: {
+ session: Pick<Session, 'id' | 'source' | 'status' | 'clearedAt'> | null;
+ messages: readonly ChatMessage[];
+ busy: boolean;
+ historyLoaded: boolean;
+ /** Continue Editing dismisses only this result, never a later editing turn. */
+ dismissedId?: string;
+}): string | null {
+ if (
+ session?.source !== CINDY_MAKE_SESSION_SOURCE ||
+ session.status !== 'active' ||
+ session.clearedAt ||
+ busy ||
+ !historyLoaded ||
+ getCindyMakePendingTest({ session, messages, busy })
+ )
+ return null;
+ for (let i = messages.length - 1; i >= 0; i -= 1) {
+ const message = messages[i];
+ if (message.parentToolUseId) continue;
+ if (message.role === 'user' || message.clientId === dismissedId) return null;
+ if (isCindyMakeCompletionMessage(message)) {
+ return typeof message.systemCardData?.continuedAt === 'number' ? message.clientId : null;
+ }
+ if (message.role === 'assistant' && typeof message.turnCompleted === 'boolean')
+ return message.turnCompleted ? message.clientId : null;
+ }
+ return null;
+}
+
type MakeSession = Pick<
Session,
'id' | 'source' | 'clearedAt' | 'lastTurnEndedAt' | 'interruptedTurnStartedAt'
diff --git a/docs/cindy-make-upstream.md b/docs/cindy-make-upstream.md
index eb15416d2c..ee40dbd6e1 100644
--- a/docs/cindy-make-upstream.md
+++ b/docs/cindy-make-upstream.md
@@ -118,13 +118,30 @@ rebase 到新官方基线(禁止 update-refs 自动改动其他任务分支)
底栏提供“继续修改”“启动隔离版测试”和“生成个人版”。同一完成记录
不再重复出现在本机消息流。继续修改需 Main 确认并持久化,重载不恢复已收起的旧卡;
新的用户消息或下一次完成回报会取代旧结果。提问、计划和权限交互保持原有优先级。
+- 修改回复结束但缺少新的完成回报,或重新打开待恢复任务时,本机任务复用原有输入区
+ 流程卡的“继续测试”状态,与输入框互斥,不在输入框上方另建卡片。点击“检查并继续”沿用本任务的正常发送
+ 流程核对当前修改,检查通过并重新回报后恢复测试/生成个人版卡片,不需要用户输入工具名。
+ 点击“继续修改”收起当前流程卡并恢复输入,同一结果不立即抢回输入;下一轮结束后再次显示。
+ 恢复状态不把旧完成记录或一条成功回复当作当前代码已完成的凭据,
+ 不自动启动测试或生成个人版;发送失败可以重试,运行、排队或等待交互时不抢占原流程。
- 测试必须由用户点击启动。Main 只接受当前账号的本机制作任务及最新完成记录,检查
工作目录仍属于托管 worktree、没有链接替换、分支与原有 HEAD 匹配,且文件内容与完成
时的 tree 一致,然后经既有开发版启动器启动独立命名的隔离实例。旧完成记录沿用干净
HEAD 的核验。PTY 保留启动器的终端语义,
- 不另开命令行窗口;环境只保留系统及工具配置,不继承宿主 profile、凭证和 Node 注入。
+ 不另开命令行窗口;环境只保留系统及工具配置,包含 Linux 的 X11/Wayland、桌面会话和
+ D-Bus 连接变量,不继承宿主 profile、凭证和 Node 注入;版本切换复用同一白名单。
+ 测试启动单独注入环境检查已验证的 pnpm 绝对入口,不继承宿主的 `npm_execpath`,
+ 避免 Windows 的命令包装脚本从任务目录误找 pnpm 安装文件;已有任务的旧启动脚本同样适用。
只有与目标目录、commit、隔离名及区域匹配的 ready 回执才显示已启动,不能把它当作
用户验收通过。状态写入该完成记录并沿用消息推送;切换页面不取消启动。
+ 启动卡片另起一行显示当前步骤:等待启动、环境检查、修改核验、隔离实例准备、依赖、
+ 运行资源及编译启动。启动期间禁用“继续修改”,Main 同样拒绝此操作;启动完成或失败后
+ 恢复。失败保留中断步骤和已知错误原因,提供“重试启动”,重试清除上次错误与步骤。
+ 步骤只记录白名单标识,不保存或展示终端原始输出;旧源码仍从固定阶段前缀读取粗粒度进度。
+ 本机主日志的 `cindy-make-test` 记录任务/完成记录标识、阶段、耗时、退出码及白名单启动器
+ 失败码;失败标记后的跨块 `code=` 也会保留,不记录原始输出、环境或自由文本错误。
+ 见 [启动控制器](../apps/desktop/src/main/cindy-make/testController.ts) 和
+ [完成卡回归](../apps/desktop/src/renderer/components/cindy-make/__tests__/CindyMakeTestCard.test.tsx)。
- “生成个人版”同样由用户点击触发:固定本次完成的提交和文件树,在临时工作目录与
当前 cindy-personal 合并,无冲突则将本地合并提交采纳到个人版并保存合入记录。
旧版仅含文件树的完成记录兼容转换为本地提交。随后依赖安装、相关单测、类型检查与打包都在
@@ -149,6 +166,8 @@ rebase 到新官方基线(禁止 update-refs 自动改动其他任务分支)
个人版创建入口、成品启用/切换仍在本机 Desktop;远端 Desktop 保留完成记录与输入框。
设置页制作历史在生成期间收敛为一个状态卡,显示合并、检查(依赖/测试/类型)、打包和保存步骤,
提供“停止制作”。停止只中止本次构建进程,并清理临时合并目录、未完成安装包、打包输出和构建元数据;
+ 完成卡与设置页显示同一次构建的身份、进度和停止状态,从任一入口都能停止;
+ 离开页面不会丢失进度,旧构建的停止请求不能取消重试产生的新构建。
不回退个人源码、已合入提交、历史记录或已生成版本。历史记录没有安全动作时,Main 返回不可用原因,
页面必须显示原因,不能留下空白按钮区。
实现与回归见 [testRuntime](../apps/desktop/src/main/cindy-make/testRuntime.ts)、