Skip to content

Commit 06890e5

Browse files
ndemiancclaude
andcommitted
fix(ai): apply the autopilot toggle live, not as a run-start snapshot
ctx.autopilot was captured when the run started, so flipping Autopilot mid-run had no effect on the in-flight run — it kept gating every command with no "Autopilot paused" reason (the manual-mode path). Pass it as a getter so agent.js reads the current value at each run_command; toggling now takes effect on the very next command. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent cdf2549 commit 06890e5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎extensions/levelcode-ai/extension.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,10 @@ async function agentFlow(text) {
959959
maxSteps: Math.max(1, cfg.get('agent.maxSteps', 25)),
960960
maxTokens: Math.max(1024, cfg.get('agent.maxTokens', 8192)), // per-turn output cap; continued across turns if hit
961961
post, dbg,
962-
autopilot: autopilot, // run commands without asking, except the danger set (commandSafety.js)
962+
// LIVE, not a snapshot: agent.js reads ctx.autopilot at each run_command, so flipping the
963+
// Autopilot toggle mid-run takes effect on the very next command (run commands without asking,
964+
// except the danger set — commandSafety.js).
965+
get autopilot() { return autopilot; },
963966
approve: requestApproval, // run_command only
964967
ask: requestQuestions, // ask_user — clickable clarifying questions
965968
// Gateway-mode token refresh for the agent loop: on a mid-run 401 (expired access token)

0 commit comments

Comments
 (0)