Skip to content

fix: provide local import allowlist before code execution - #3614

Open
EDDIWARD wants to merge 3 commits into
developfrom
edward/bugfix-import-whitelist
Open

fix: provide local import allowlist before code execution#3614
EDDIWARD wants to merge 3 commits into
developfrom
edward/bugfix-import-whitelist

Conversation

@EDDIWARD

@EDDIWARD EDDIWARD commented Aug 7, 2026

Copy link
Copy Markdown

Summary

Expose the local Python import allowlist in the agent context before code execution. This lets the model choose an available approach or report the restriction instead of probing unavailable packages.

Root cause

In local execution, the interpreter enforces an import allowlist. The original prompt did not describe that boundary, so some models learned it only from failed executions and retried with different unavailable packages.

Before

The reproduction task triggered attempts to import requests and urllib.request, both rejected by the local interpreter.
image

After

The agent receives the permitted imports before planning. The same task no longer runs a restricted import and reports the execution boundary directly.
image

Validation

  • Focused backend tests: 20 passed.
  • Manual reproduction with the same network-request prompt: no restricted import attempt.

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@EDDIWARD
EDDIWARD marked this pull request as ready for review August 7, 2026 07:10
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.

1 participant