Epic 4.3: Extract ExecutionEngine from OpenSpace#32
Merged
Deepfreezechill merged 3 commits intomainfrom Apr 3, 2026
Merged
Conversation
Extract task execution lifecycle, two-phase skill orchestration, and post-execution analysis into ExecutionEngine class. Moved methods: - execute() → ExecutionEngine.execute() - _maybe_analyze_execution() → ExecutionEngine._maybe_analyze_execution() - _maybe_evolve_quality() → ExecutionEngine._maybe_evolve_quality() - Workspace resolution → ExecutionEngine._resolve_workspace() - Workspace cleanup → ExecutionEngine._cleanup_workspace() Also extracted _execute_skill_first() and _log_result() as internal helpers. OpenSpace.execute() is now a thin delegate. ExecutionEngine is created at end of initialize() with all dependencies. tool_layer.py: 735 → 442 lines (-40%) execution_engine.py: 459 lines (new) 20 new tests in test_execution_engine.py All 1,356 existing tests pass unchanged. Epic 4.2 (SkillSelector) skipped — already extracted in 4.1. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixes from 5 reviewers (security, implementer, test-writer, GPT-5.4, Opus): CRITICAL: - C-1: Initialize execution_time=0.0 before try (NameError on CancelledError) - C-2: Copy caller context dict (dict(context)) to prevent mutation HIGH: - H-1: Propagate cleanup() to engine state (_running, _task_done) - H-2: Clear active_skills on fallback path, add attempted_skills key - H-3: Remove dead fields from OpenSpace (_execution_count, _last_evolved_skills, _task_done) MEDIUM: - M-2: __repr__ uses is_running() instead of stale _running field - M-3: Replace deprecated get_event_loop() with get_running_loop() - MED-2: Log save_execution_outcome failures instead of silent swallow LOW: - LOW-3: Remove dead 'import traceback' from tool_layer.py TESTS: 20 -> 31 tests - _resolve_workspace: 4 branches (explicit, config, recording, tempdir) - _cleanup_workspace: file removal + empty-path noop - Concurrency: exception resets _task_done, concurrent timeout - Quality triggers: metric check every 5, quality evolution - Analysis evolution: candidate_for_evolution triggers skill evolution Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Extraction must preserve original behavior. The fallback path reports injected skills in active_skills (matching monolith behavior). Behavioral improvement (distinguishing attempted vs active) tracked for future epic. Added test assertion: skills_used reflects attempted skills on fallback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🔒 Phase Gate Enforcement — 🚫 FAIL
Verdict: FAIL
|
Deepfreezechill
pushed a commit
that referenced
this pull request
Apr 3, 2026
Restructure initialize() from 190-line monolith into clean orchestration: - initialize(): 70-line high-level flow with numbered steps - _load_grounding_config(): config loading, backend scope resolution - _setup_skill_engine(): skill registry, store, analyzer, evolver Cleanup: - Remove dead imports (asyncio, uuid — now in ExecutionEngine) - Remove stale extraction comments (4.1/4.3 notes) - Update from_container docstring (remove Phase 4 TODO — it's done) Public API unchanged. All 1,356 tests pass. P4 tool_layer.py decomposition summary (788 → 477 lines, -39%): - 4.1: ToolRegistry (206 lines, PR #31) - 4.3: ExecutionEngine (459 lines, PR #32) - 4.4: RecordingService (70 lines, PR #33) - 4.5: LLMFactory (68 lines, PR #34) - 4.6: Facade cleanup (this PR) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Deepfreezechill
added a commit
that referenced
this pull request
Apr 3, 2026
* feat(4.6): refactor OpenSpace into clean facade Restructure initialize() from 190-line monolith into clean orchestration: - initialize(): 70-line high-level flow with numbered steps - _load_grounding_config(): config loading, backend scope resolution - _setup_skill_engine(): skill registry, store, analyzer, evolver Cleanup: - Remove dead imports (asyncio, uuid — now in ExecutionEngine) - Remove stale extraction comments (4.1/4.3 notes) - Update from_container docstring (remove Phase 4 TODO — it's done) Public API unchanged. All 1,356 tests pass. P4 tool_layer.py decomposition summary (788 → 477 lines, -39%): - 4.1: ToolRegistry (206 lines, PR #31) - 4.3: ExecutionEngine (459 lines, PR #32) - 4.4: RecordingService (70 lines, PR #33) - 4.5: LLMFactory (68 lines, PR #34) - 4.6: Facade cleanup (this PR) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: remove unused Path import (review finding) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chore: remove stray main_tool_layer.py artifact Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Brian Krafft <bkrafft@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extracts the execution lifecycle from \OpenSpace\ into a focused \ExecutionEngine\ class.
What moved
Impact
Review Protocol