task-1770947391780 (#270)
* fix: OpenCode SDKサーバー起動タイムアウトを30秒に延長 * takt: task-1770947391780
This commit is contained in:
parent
c85f23cb6e
commit
3ff6f99152
2
OPENCODE_CONFIG_CONTENT
Normal file
2
OPENCODE_CONFIG_CONTENT
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://opencode.ai/config.json","model":"zai-coding-plan/glm-5","small_model":"zai-coding-plan/glm-5","permission":"deny"}
|
||||||
@ -139,14 +139,43 @@ describe('saveTaskFromInteractive', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should record issue number in tasks.yaml when issue option is provided', async () => {
|
it('should record issue number in tasks.yaml when issue option is provided', async () => {
|
||||||
// Given: user declines worktree
|
|
||||||
mockConfirm.mockResolvedValueOnce(false);
|
mockConfirm.mockResolvedValueOnce(false);
|
||||||
|
|
||||||
// When
|
|
||||||
await saveTaskFromInteractive(testDir, 'Fix login bug', 'default', { issue: 42 });
|
await saveTaskFromInteractive(testDir, 'Fix login bug', 'default', { issue: 42 });
|
||||||
|
|
||||||
// Then
|
|
||||||
const task = loadTasks(testDir).tasks[0]!;
|
const task = loadTasks(testDir).tasks[0]!;
|
||||||
expect(task.issue).toBe(42);
|
expect(task.issue).toBe(42);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('with confirmAtEndMessage', () => {
|
||||||
|
it('should not save task when user declines confirmAtEndMessage', async () => {
|
||||||
|
mockConfirm.mockResolvedValueOnce(false);
|
||||||
|
|
||||||
|
await saveTaskFromInteractive(testDir, 'Task content', 'default', {
|
||||||
|
issue: 42,
|
||||||
|
confirmAtEndMessage: 'Add this issue to tasks?',
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(fs.existsSync(path.join(testDir, '.takt', 'tasks.yaml'))).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should prompt worktree settings after confirming confirmAtEndMessage', async () => {
|
||||||
|
mockConfirm.mockResolvedValueOnce(true);
|
||||||
|
mockPromptInput.mockResolvedValueOnce('');
|
||||||
|
mockPromptInput.mockResolvedValueOnce('');
|
||||||
|
mockConfirm.mockResolvedValueOnce(true);
|
||||||
|
mockConfirm.mockResolvedValueOnce(false);
|
||||||
|
|
||||||
|
await saveTaskFromInteractive(testDir, 'Task content', 'default', {
|
||||||
|
issue: 42,
|
||||||
|
confirmAtEndMessage: 'Add this issue to tasks?',
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(mockConfirm).toHaveBeenNthCalledWith(1, 'Add this issue to tasks?', true);
|
||||||
|
expect(mockConfirm).toHaveBeenNthCalledWith(2, 'Create worktree?', true);
|
||||||
|
const task = loadTasks(testDir).tasks[0]!;
|
||||||
|
expect(task.issue).toBe(42);
|
||||||
|
expect(task.worktree).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -151,13 +151,13 @@ export async function saveTaskFromInteractive(
|
|||||||
piece?: string,
|
piece?: string,
|
||||||
options?: { issue?: number; confirmAtEndMessage?: string },
|
options?: { issue?: number; confirmAtEndMessage?: string },
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const settings = await promptWorktreeSettings();
|
|
||||||
if (options?.confirmAtEndMessage) {
|
if (options?.confirmAtEndMessage) {
|
||||||
const approved = await confirm(options.confirmAtEndMessage, true);
|
const approved = await confirm(options.confirmAtEndMessage, true);
|
||||||
if (!approved) {
|
if (!approved) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const settings = await promptWorktreeSettings();
|
||||||
const created = await saveTaskFile(cwd, task, { piece, issue: options?.issue, ...settings });
|
const created = await saveTaskFile(cwd, task, { piece, issue: options?.issue, ...settings });
|
||||||
displayTaskCreationResult(created, settings, piece);
|
displayTaskCreationResult(created, settings, piece);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,6 +36,7 @@ const OPENCODE_STREAM_ABORTED_MESSAGE = 'OpenCode execution aborted';
|
|||||||
const OPENCODE_RETRY_MAX_ATTEMPTS = 3;
|
const OPENCODE_RETRY_MAX_ATTEMPTS = 3;
|
||||||
const OPENCODE_RETRY_BASE_DELAY_MS = 250;
|
const OPENCODE_RETRY_BASE_DELAY_MS = 250;
|
||||||
const OPENCODE_INTERACTION_TIMEOUT_MS = 5000;
|
const OPENCODE_INTERACTION_TIMEOUT_MS = 5000;
|
||||||
|
const OPENCODE_SERVER_START_TIMEOUT_MS = 30000;
|
||||||
const OPENCODE_RETRYABLE_ERROR_PATTERNS = [
|
const OPENCODE_RETRYABLE_ERROR_PATTERNS = [
|
||||||
'stream disconnected before completion',
|
'stream disconnected before completion',
|
||||||
'transport error',
|
'transport error',
|
||||||
@ -324,6 +325,7 @@ export class OpenCodeClient {
|
|||||||
port,
|
port,
|
||||||
signal: streamAbortController.signal,
|
signal: streamAbortController.signal,
|
||||||
config,
|
config,
|
||||||
|
timeout: OPENCODE_SERVER_START_TIMEOUT_MS,
|
||||||
});
|
});
|
||||||
opencodeApiClient = client;
|
opencodeApiClient = client;
|
||||||
serverClose = server.close;
|
serverClose = server.close;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user