feat: scheduled task permission auto-accept and composer-style editor toggles

This commit is contained in:
Bohdan Triapitsyn
2026-07-20 23:07:01 +03:00
parent ac24d321f4
commit 0e47b388d5
17 changed files with 114 additions and 22 deletions
+1
View File
@@ -1068,6 +1068,7 @@ const scheduledTasksRuntime = createScheduledTasksRuntime({
buildOpenCodeUrl,
getOpenCodeAuthHeaders,
waitForOpenCodeReady,
setSessionAutoAccept: (sessionId, enabled, directory) => permissionAutoAcceptRuntime.setSessionPolicy(sessionId, enabled, directory),
emitTaskRunEvent: (event) => {
for (const client of uiOpenChamberEventClients) {
try {
@@ -214,6 +214,7 @@ const normalizeExecution = (value) => {
const variant = asNonEmptyString(value.variant);
const agent = asNonEmptyString(value.agent);
const goalEnabled = value.goalEnabled === true;
const permissionAutoAccept = value.permissionAutoAccept === true;
const goalTokenBudget = typeof value.goalTokenBudget === 'number'
&& Number.isFinite(value.goalTokenBudget)
&& value.goalTokenBudget > 0
@@ -238,6 +239,7 @@ const normalizeExecution = (value) => {
...(agent ? { agent } : {}),
...(goalEnabled ? { goalEnabled: true } : {}),
...(goalEnabled && goalTokenBudget ? { goalTokenBudget } : {}),
...(permissionAutoAccept ? { permissionAutoAccept: true } : {}),
};
};
@@ -225,6 +225,7 @@ export const createScheduledTasksRuntime = (deps) => {
getOpenCodeAuthHeaders,
waitForOpenCodeReady,
emitTaskRunEvent,
setSessionAutoAccept,
logger = console,
maxGlobalConcurrency = DEFAULT_GLOBAL_CONCURRENCY,
maxProjectConcurrency = DEFAULT_PROJECT_CONCURRENCY,
@@ -611,6 +612,17 @@ export const createScheduledTasksRuntime = (deps) => {
} catch {
}
if (task.execution.permissionAutoAccept && typeof setSessionAutoAccept === 'function') {
// Enroll before the prompt goes out so the very first permission request
// is already auto-approved. Enrollment failure must not kill the run —
// the task still executes, permissions just wait for the user.
try {
await setSessionAutoAccept(sessionID, true, projectPath);
} catch (error) {
logger.warn?.('[scheduled-tasks] failed to enable permission auto-accept for session', sessionID, error?.message ?? error);
}
}
if (task.execution.goalEnabled) {
await createTaskGoal({ baseUrl, authHeaders, sessionID, projectPath, task });
}