Skip to content

Fix auto_run not supporting callable values#1700

Open
Br1an67 wants to merge 1 commit intoopeninterpreter:mainfrom
Br1an67:fix/callable-auto-run
Open

Fix auto_run not supporting callable values#1700
Br1an67 wants to merge 1 commit intoopeninterpreter:mainfrom
Br1an67:fix/callable-auto-run

Conversation

@Br1an67
Copy link

@Br1an67 Br1an67 commented Mar 1, 2026

Describe the changes you have made:

When auto_run is set to a callable (as described in #1696), the interpreter fails to work correctly:

  1. core.py: self.auto_run == False never matches a callable (which is truthy), so the confirmation chunk is never yielded to the terminal interface — the user never gets a chance to approve/reject.
  2. terminal_interface.py: not interpreter.auto_run treats the callable as truthy, so the confirmation prompt is skipped entirely and all code runs without approval.

Fix:

  • core.py: Yield the confirmation chunk when auto_run is False or callable — both cases need the terminal interface to handle the confirmation flow.
  • terminal_interface.py: When auto_run is callable, call it with the code content to determine whether to auto-run. Otherwise fall back to the original boolean check.

Reference any relevant issues (e.g. "Fixes #000"):

Fixes #1696

Pre-Submission Checklist (optional but appreciated):

  • I have included relevant documentation updates (stored in /docs)
  • I have read docs/CONTRIBUTING.md
  • I have read docs/ROADMAP.md

OS Tests (optional but appreciated):

  • Tested on MacOS
  • Tested on Windows
  • Tested on Linux

When auto_run is set to a callable (e.g. a function that inspects the code
before deciding whether to run it), the previous logic failed:

- In core.py, `self.auto_run == False` never matched a callable (truthy),
  so the confirmation chunk was never yielded to the terminal interface.
- In terminal_interface.py, `not interpreter.auto_run` treated the callable
  as truthy, skipping the user confirmation prompt entirely.

Now:
- core.py yields the confirmation chunk when auto_run is False OR callable.
- terminal_interface.py calls the callable with the code content to determine
  whether to auto-run, falling back to the original bool check otherwise.

Fixes openinterpreter#1696
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: callable auto_run silently breaks — confirmation never shown, rejected commands vanish

1 participant