Skip to content

feat(runner): Add injectable executor backend - #3

Merged
JustinJLeopard merged 1 commit into
mainfrom
justinjleopard/feat/justai-executor-factory
Aug 10, 2026
Merged

feat(runner): Add injectable executor backend#3
JustinJLeopard merged 1 commit into
mainfrom
justinjleopard/feat/justai-executor-factory

Conversation

@JustinJLeopard

Copy link
Copy Markdown
Owner

Summary

  • add an opt-in executor factory to SafeMiniRunner
  • route injected backends through model actions and final verification
  • retain legacy final verification for existing callers

Verification

  • PYTHONDONTWRITEBYTECODE=1 /usr/bin/python3 -B -m pytest -q -p no:cacheprovider tests/test_runner_integration.py tests/test_executor_policies.py tests/test_protocol_contract.py
  • PYTHONDONTWRITEBYTECODE=1 /usr/bin/python3 -B -m pytest -q -p no:cacheprovider
  • git diff --check

Configured ruff and mypy are not installed in the checked worktree Python environment.

Copilot AI lite review requested due to automatic review settings August 10, 2026 13:06

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 92c6db40f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread safe_mini/runner.py

executor_cls = ExecutorPolicies[executor_policy]
executor = executor_cls(cwd)
executor = (self.executor_factory or _default_executor_factory)(cwd, executor_policy)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clean up the worktree when factory creation fails

If an injected factory raises while initializing its backend (for example, when a container or remote executor cannot start), this call occurs before the try/finally, so provisioner.cleanup() is never reached even when keep_worktree=False. Each failed run therefore leaves its copied temporary repository behind; move executor creation inside the protected region so factory failures follow the normal cleanup path.

Useful? React with 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an opt-in executor_factory to SafeMiniRunner so callers can inject a custom execution backend, and ensures that when a backend is injected, both model actions and final verification run through that same backend while preserving the legacy final verification behavior for existing callers.

Changes:

  • Add executor_factory support to SafeMiniRunner and default it to the existing policy-based executors.
  • Route final verification through the injected executor when provided, otherwise keep using final_tests_pass.
  • Add integration tests covering injected executor behavior and legacy final-check behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
safe_mini/runner.py Introduces injectable executor factory and routes final verification through injected executors while keeping legacy verification for default callers.
tests/test_runner_integration.py Adds tests ensuring injected executors see both actions and verification, and that legacy final verification remains in place by default.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread safe_mini/runner.py
Comment on lines +120 to +124
if self._final_check(cwd, executor):
success = True
break

tests_pass = final_tests_pass(cwd, command=self.final_check_command)
tests_pass = self._final_check(cwd, executor)
@JustinJLeopard
JustinJLeopard force-pushed the justinjleopard/feat/justai-executor-factory branch from 92c6db4 to b4b704d Compare August 10, 2026 13:13
Allow integrations to supply one executor backend for model actions and final verification. Preserve the legacy final checker when no backend is injected.

Co-Authored-By: Codex <noreply@openai.com>
@JustinJLeopard
JustinJLeopard force-pushed the justinjleopard/feat/justai-executor-factory branch from b4b704d to 18f3a68 Compare August 10, 2026 13:14
@JustinJLeopard
JustinJLeopard merged commit 17c8514 into main Aug 10, 2026
2 checks passed
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.

3 participants