Skip to content

feat(mac): Fix extension startup failures from missing deps; add safe cross-platform auto-repair for known modules#131

Merged
lightningpixel merged 2 commits into
lightningpixel:devfrom
deya-eldeen:macos_fix
May 11, 2026
Merged

feat(mac): Fix extension startup failures from missing deps; add safe cross-platform auto-repair for known modules#131
lightningpixel merged 2 commits into
lightningpixel:devfrom
deya-eldeen:macos_fix

Conversation

@deya-eldeen
Copy link
Copy Markdown

Summary

This PR fixes model extension startup crashes when an extension venv is present but incomplete (for example, ModuleNotFoundError: No module named 'PIL').

It adds a conservative auto-repair step in the extension subprocess startup path:

  • Detect missing-module errors from runner startup.
  • Auto-install only explicitly allowed module mappings (currently PIL -> Pillow).
  • Retry startup after successful install.

Why

Some extension setups can leave a partially initialized venv, causing startup to fail before the extension can report as ready.
Previously, this resulted in runtime errors like:

  • Expected 'ready', got: ... Failed to load generator class
  • ModuleNotFoundError: No module named 'PIL'

Changes

  • Updated api/services/extension_process.py:
  1. Added missing-module parsing from startup error payloads.
  2. Added safe mapping-based auto-repair (_AUTO_REPAIR_PACKAGE_MAP).
  3. Added startup retry loop (up to 3 attempts total).
  4. Added explicit error reporting when auto-repair install fails.

Safety / Compatibility

  • Cross-platform compatible (macOS/Linux/Windows): uses the extension’s own venv Python (python -m pip install ...).
  • Conservative behavior: no arbitrary package-name guessing; only known mappings are auto-installed.
  • If mapping is unknown, behavior falls back to normal startup error (no hidden installs).

Validation

  • Python syntax check passed:
    • python3 -m py_compile api/services/extension_process.py
  • Manual verification confirmed extension runner can reach ready after installing missing Pillow.

@deya-eldeen deya-eldeen changed the title Fix extension startup failures from missing deps; add safe cross-platform auto-repair for known modules feat(mac): Fix extension startup failures from missing deps; add safe cross-platform auto-repair for known modules May 8, 2026
@lightningpixel lightningpixel changed the base branch from main to dev May 11, 2026 07:58
@lightningpixel lightningpixel merged commit 089677f into lightningpixel:dev May 11, 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.

2 participants