Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/opencode/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ export namespace Config {
"@opencode-ai/plugin": targetVersion,
}
await Bun.write(pkg, JSON.stringify(json, null, 2))
await new Promise((resolve) => setTimeout(resolve, 3000))

const gitignore = path.join(dir, ".gitignore")
const hasGitIgnore = await Bun.file(gitignore).exists()
Expand Down
11 changes: 8 additions & 3 deletions packages/opencode/src/tasks/pulse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,8 @@ async function processAdversarialVerdicts(jobId: string, projectId: string, pmSe
continue
}

if (verdict.verdict === "APPROVED") {
await commitTask(updatedTask, projectId, pmSessionId)
if (verdict.verdict === "APPROVED") {
await commitTask(updatedTask, jobId, projectId, pmSessionId)
} else {
const newAttempt = (updatedTask.pipeline.attempt || 0) + 1
if (newAttempt >= 3) {
Expand All @@ -554,7 +554,7 @@ async function processAdversarialVerdicts(jobId: string, projectId: string, pmSe
}
}

async function commitTask(task: Task, projectId: string, pmSessionId: string): Promise<void> {
async function commitTask(task: Task, jobId: string, projectId: string, pmSessionId: string): Promise<void> {
const parentSession = await Session.get(pmSessionId).catch(() => null)
if (!parentSession?.directory) {
log.error("PM session not found for commit", { taskId: task.id })
Expand Down Expand Up @@ -690,6 +690,11 @@ If there is an error, report the full error output.`
})

log.info("task committed and closed", { taskId: task.id })

// Immediately reschedule after commit — don't wait for next Pulse tick
await scheduleReadyTasks(jobId, projectId, pmSessionId).catch((e) =>
log.error("failed to reschedule after commit", { taskId: task.id, error: String(e) }),
)
}

async function respawnDeveloper(
Expand Down
2 changes: 1 addition & 1 deletion packages/opencode/src/worktree/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export namespace Worktree {
const base = input?.name ? slug(input.name) : ""
const info = await candidate(root, base || undefined)

const created = await $`git worktree add --no-checkout -b ${info.branch} ${info.directory}`
const created = await $`git worktree add -b ${info.branch} ${info.directory}`
.quiet()
.nothrow()
.cwd(Instance.worktree)
Expand Down
14 changes: 14 additions & 0 deletions packages/opencode/test/config/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,20 @@ test("does not try to install dependencies in read-only OPENCODE_CONFIG_DIR", as
}
})

test("installDependencies completes without hardcoded delay", async () => {
await using tmp = await tmpdir<string>({
init: async (dir) => {
const cfg = path.join(dir, "configdir")
await fs.mkdir(cfg, { recursive: true })
return cfg
},
})

await Config.installDependencies(tmp.extra)

expect(await Bun.file(path.join(tmp.extra, "package.json")).exists()).toBe(true)
})

test("installs dependencies in writable OPENCODE_CONFIG_DIR", async () => {
await using tmp = await tmpdir<string>({
init: async (dir) => {
Expand Down