Skip to content

Epic 4.4: Extract RecordingService from OpenSpace#33

Merged
Deepfreezechill merged 2 commits intomainfrom
epic/4.4-recording-service
Apr 3, 2026
Merged

Epic 4.4: Extract RecordingService from OpenSpace#33
Deepfreezechill merged 2 commits intomainfrom
epic/4.4-recording-service

Conversation

@Deepfreezechill
Copy link
Copy Markdown
Owner

Summary

Extracts recording factory/wiring/cleanup from \OpenSpace.initialize()\ into a focused \RecordingService\ class.

What moved

  • RecordingManager construction (8 config params) → \RecordingService.create()\
  • LLM registration → inside \create()\
  • GroundingClient injection → \RecordingService.wire()\
  • Recording cleanup in \cleanup()\ → \RecordingService.cleanup()\

Impact


  • ecording_service.py: 70 lines (new)
  • \ ool_layer.py: -12 net lines (19 removed, 7 added)
  • Moved \RecordingManager\ import to TYPE_CHECKING
  • 17 tests in \ est_recording_service.py\
  • 1,356 existing tests pass

Review Protocol

  • /8eyes: 3 agents (implementer, test-writer, security)
  • /collab: 2 agents (GPT-5.4 pending, Opus 4.6 approved)
  • Round 1 fixes: CancelledError handling, manager null after cleanup, logger assertion, edge case tests (create×2, cleanup×2, wire-before-create)

Brian Krafft and others added 2 commits April 3, 2026 12:55
New module: openspace/recording_service.py (66 lines)
- RecordingService class: factory + wiring + cleanup for RecordingManager
- create(): builds RecordingManager from config, registers to LLM
- wire(): injects manager into GroundingClient
- cleanup(): graceful stop with exception handling

tool_layer.py: replaced 19 lines of inline recording setup/teardown
with 7 lines delegating to RecordingService (-12 net lines)

Tests: 14 new tests in test_recording_service.py
- Init, create (enabled/disabled/config passthrough/LLM registration)
- Wire (inject/noop), cleanup (active/inactive/no-manager/exception)
- OpenSpace backward compatibility (both attrs present)

All 1,356 existing tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Code fixes:
- Null manager after cleanup() (prevents stale references, enables safe double-cleanup)
- Re-raise CancelledError in cleanup() (proper async cancellation semantics)
- Add debug log after successful recording stop (observability parity)
- Move RecordingManager import to TYPE_CHECKING in tool_layer.py (dead runtime import)
- Add asyncio import to recording_service.py for CancelledError

Test improvements (14 → 17 tests):
- C1: Assert logger.warning called on exception (not just 'no raise')
- C2: create() twice replaces manager (idempotency coverage)
- H1: cleanup() twice only stops once (double-cleanup safety)
- H2: wire() before create() is safe noop
- Strengthen noop assertions (verify manager is None, not just 'no raise')
- Verify manager nulled after cleanup

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Deepfreezechill Deepfreezechill merged commit b95b863 into main Apr 3, 2026
0 of 5 checks passed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 3, 2026

🔒 Phase Gate Enforcement — 🚫 FAIL

Check Result Detail
Issue linkage No linked issues found. PR must contain "Closes #N", "Fixes #N", or "Resolves #N".

Verdict: FAIL
Timestamp: 2026-04-03T20:02:58.831Z
Run: View workflow run


How to fix: Ensure all prerequisite phases are complete, or add emergency:bypass label with a ## Bypass Reason section in the PR body.

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>
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