fix: isolate concurrent OpenCode chat runs

This commit is contained in:
brother7 committed 2026-08-17 22:03:37 +08:00
1 parent 7e8d9e3811
commit 65040730ec
29 files changed
+5207 -427

No files matched your search

+43
View File
@@ -194,6 +194,49 @@ describe('project-owned contact configuration', () => {
expect(markdown).toContain('"*": deny');
});
it('removes only previously generated Agent files when configured Agents are deleted', async () => {
const projectPath = await mkdtemp(path.join(tmpdir(), 'makelore-project-config-managed-agents-'));
const initial = await createInitialProjectConfig(projectPath);
const retainedAgent = createContact();
const removedAgent = createContact({ id: 'agent-removed', name: '小红' });
const userModifiedAgent = createContact({ id: 'agent-user-modified', name: '小蓝' });
await writeProjectConfig(projectPath, {
...initial,
initialized: true,
agents: [retainedAgent, removedAgent, userModifiedAgent],
});
await writeFile(
path.join(projectPath, '.opencode', 'agent', 'agent-user-modified.md'),
'# User replaced the generated file\n',
'utf8',
);
await writeFile(
path.join(projectPath, '.opencode', 'agent', 'custom-user-agent.md'),
'# User-owned Agent\n',
'utf8',
);
await writeProjectConfig(projectPath, {
...initial,
initialized: true,
agents: [retainedAgent],
});
expect((await readdir(path.join(projectPath, '.opencode', 'agent'))).sort()).toEqual([
'agent-test.md',
'agent-user-modified.md',
'custom-user-agent.md',
]);
expect(await readFile(
path.join(projectPath, '.opencode', 'agent', 'agent-user-modified.md'),
'utf8',
)).toBe('# User replaced the generated file\n');
expect(await readFile(
path.join(projectPath, '.opencode', 'agent', 'custom-user-agent.md'),
'utf8',
)).toBe('# User-owned Agent\n');
});
it('grants selected presentation and planning Skills to the materialized OpenCode Agent', async () => {
const projectPath = await mkdtemp(path.join(tmpdir(), 'makelore-project-config-planning-skills-'));
const initial = await createInitialProjectConfig(projectPath);