Skip to content

[4.0.0-beta desktop] Packaged app does not install the OpenAI SDK so AI analysis is dead #254

Closed

Description

@Fujio-Turner

PROBLEM

Server Edition AI (OpenAI / Grok via the OpenAI SDK, Anthropic via requests) is a headline feature. The desktop CI job never pip installs openai.

app/ai_analyzer.py:

try:
    from openai import OpenAI, OpenAIError
except ImportError:
    logger.warning("OpenAI SDK not installed. Please run: pip install openai")

app/requirements.txt has no openai (and no httpx, which the SDK path imports). The workflow hiddenimports list includes 'openai', which only produces a PyInstaller warning when the package is absent — the build still succeeds.

Result: packaged .app / .exe can open the UI, but /api/ai/* SDK path cannot work. Anthropic still uses requests (which is in requirements), so Claude may work while OpenAI/Grok do not — inconsistent.

Suggested RCA

requirements.txt is the Docker/server set (Flask + CBL build-from-source). Desktop extras were added ad-hoc in the workflow (rumps, pystray) and openai was forgotten even there. Hiddenimport without pip install is a no-op.

Suggested FIX

Add to app/requirements.txt or the desktop extra file (see tray issue):

openai>=1.40.0,<2
httpx>=0.27,<1

Workflow:

pip install -r requirements.txt
pip install openai httpx pyinstaller rumps

Keep the try/except so tests without the SDK still run, but the packaged app must include the wheel (PyInstaller will then collect it because the import succeeds at analysis time).

Unit tests

# tests/python/test_ai_packaging.py
from pathlib import Path

def test_openai_is_declared_for_desktop():
    req = Path("app/requirements.txt").read_text() + Path("app/requirements-desktop.txt").read_text() if Path("app/requirements-desktop.txt").exists() else Path("app/requirements.txt").read_text()
    assert "openai" in req

def test_ai_analyzer_flags_sdk_availability_consistently():
    import ai_analyzer
    try:
        import openai  # noqa: F401
        installed = True
    except ImportError:
        installed = False
    assert ai_analyzer.OPENAI_SDK_AVAILABLE is installed

If you add a packaging manifest (CBL issue), also assert "openai" is in hiddenimports.

Context: found on branch release-4.0.0-beta while reviewing standalone macOS .app / Windows .exe packaging. Issues in this batch share the title prefix [4.0.0-beta desktop].

Activity

  1. Fujio-Turner commented on Sep 15, 2026

    @Fujio-Turner
    OwnerAuthor

    Fixed on release-4.0.0-beta via #263

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions