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
7 changes: 6 additions & 1 deletion packages/opencode/src/tasks/pulse-monitoring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Log } from "../util/log"
import { Store } from "./store"
import { sanitizeWorktree, isSessionActivelyRunning, isPidAlive, removeLockFile } from "./pulse-scheduler"
import type { Task } from "./types"
import { resolveModel } from "./pulse"

const log = Log.create({ service: "taskctl.pulse.monitoring" })

Expand Down Expand Up @@ -190,10 +191,12 @@ ${history}

Assess the developer's progress and respond with the appropriate JSON action.`

const model = await resolveModel(pmSessionId)
try {
await SessionPrompt.prompt({
sessionID: steeringSession.id,
agent: "steering",
model,
parts: [{ type: "text", text: prompt }],
})
} catch (e) {
Expand Down Expand Up @@ -230,7 +233,7 @@ Assess the developer's progress and respond with the appropriate JSON action.`
return { action: "continue", message: null }
}

const responseText = textParts.map((p) => (p as any).text).join("\n")
const responseText = textParts.map((p) => p.text).join("\n")

let response
try {
Expand Down Expand Up @@ -295,9 +298,11 @@ export async function checkSteering(jobId: string, projectId: string, pmSessionI
if (task.assignee) {
const sessionId = task.assignee
try {
const model = await resolveModel(pmSessionId)
await SessionPrompt.prompt({
sessionID: sessionId,
agent: "developer-pipeline",
model,
parts: [{ type: "text", text: `[Steering guidance]: ${result.message}` }],
})
} catch (e) {
Expand Down
11 changes: 9 additions & 2 deletions packages/opencode/src/tasks/pulse-scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Global } from "../global"
import { Instance as InstanceImport } from "../project/instance"
import type { Task, AdversarialVerdict } from "./types"
import { MAX_ADVERSARIAL_ATTEMPTS } from "./pulse-verdicts"
import { resolveModel } from "./pulse"

const log = Log.create({ service: "taskctl.pulse.scheduler" })

Expand Down Expand Up @@ -228,11 +229,13 @@ async function spawnDeveloper(task: Task, jobId: string, projectId: string, pmSe
true,
)

const model = await resolveModel(pmSessionId)
const prompt = buildDeveloperPrompt(task)
try {
await SessionPrompt.prompt({
sessionID: devSession.id,
agent: "developer-pipeline",
model,
parts: [{ type: "text", text: prompt }],
})
} catch (e) {
Expand Down Expand Up @@ -344,12 +347,14 @@ git diff ${task.base_commit || "dev"}..HEAD

This ensures you only review changes made by the developer, not commits that were already in dev.

Read the changed files in the worktree, run typecheck, and record your verdict with taskctl verdict.`
Read the changed files in the worktree, run typecheck, and record your verdict with taskctl verdict.`

const model = await resolveModel(pmSessionId)
try {
await SessionPrompt.prompt({
sessionID: adversarialSession.id,
agent: "adversarial-pipeline",
model,
parts: [{ type: "text", text: prompt }],
})
} catch (e) {
Expand Down Expand Up @@ -451,12 +456,14 @@ Summary: ${verdict.summary}
Issues:
${issueLines}

The codebase changes are already in this worktree. Fix the specific issues listed above, run tests, and complete your work. The pulse system automatically detects completion.`
The codebase changes are already in this worktree. Fix the specific issues listed above, run tests, and complete your work. The pulse system automatically detects completion.`

const model = await resolveModel(pmSessionId)
try {
await SessionPrompt.prompt({
sessionID: devSession.id,
agent: "developer-pipeline",
model,
parts: [{ type: "text", text: prompt }],
})
} catch (e) {
Expand Down