fix: reopen preserved coding projects when selecting their folder

This commit is contained in:
2026-09-21 15:39:57 +08:00
parent 576edb2720
commit 6aa30a57b4
5 changed files with 186 additions and 1 deletions

View File

@@ -268,6 +268,22 @@ export class CodingProjectService {
}
try {
return await this.transitionActiveProject(async () => {
// Removing a project only forgets the catalog entry. Selecting its folder
// again must reuse the project-owned configuration, not overwrite it.
if (selectedPath && input.identity.kind === 'create') {
const existing = await readCodingProjectConfigV2(projectPath);
if (existing.status === 'invalid') {
throw new CodingProjectServiceError(
409,
'CODING_PROJECT_CONFIG_INVALID',
'Coding project configuration is unavailable',
);
}
if (existing.status === 'valid') {
const project = await this.store.openFolder(projectPath);
return { project, value: await this.getConfig(project.id) };
}
}
const { project, config } = await createLocalCodingProject({
projectPath,
projectId,