diff --git a/.forgejo/workflows/pypi-publish.yml b/.forgejo/workflows/pypi-publish.yml new file mode 100644 index 0000000..30d1670 --- /dev/null +++ b/.forgejo/workflows/pypi-publish.yml @@ -0,0 +1,108 @@ +# ============================================================================= +# PyPI Publish Workflow Template (Enhanced) +# ============================================================================= +# Publishes Python packages to Forgejo PyPI registry with: +# - Version change detection (avoids wasteful builds) +# - Optional pre-publish testing +# - Path-based triggers (only run when relevant files change) +# - Graceful duplicate version handling +# ============================================================================= + +name: Publish to PyPI + +on: + push: + branches: [main, master] + paths: + - 'pyproject.toml' # Trigger on version bumps + - 'src/**' # Or source code changes + workflow_dispatch: # Manual trigger for first-time publish + +env: + PYTHON_VERSION: '3.12' + REGISTRY_URL: 'https://forge.nasty.sh/api/packages/lilith/pypi/' + +jobs: + publish: + name: Build and Publish + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install build tools + run: | + python -m pip install --upgrade pip + pip install build twine + + - name: Check if version already published + id: check_version + run: | + pkg_name=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['name'])") + pkg_version=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") + + echo "package=$pkg_name" >> $GITHUB_OUTPUT + echo "version=$pkg_version" >> $GITHUB_OUTPUT + + echo "=== Package Info ===" + echo "Name: $pkg_name" + echo "Version: $pkg_version" + + # Check if version exists in registry + if pip index versions "$pkg_name" --index-url ${{ env.REGISTRY_URL }}/simple 2>/dev/null | grep -q "$pkg_version"; then + echo "exists=true" >> $GITHUB_OUTPUT + echo "✓ Version $pkg_version already published, skipping" + else + echo "exists=false" >> $GITHUB_OUTPUT + echo "→ Version $pkg_version is new, will publish" + fi + + - name: Run tests (if available) + if: steps.check_version.outputs.exists == 'false' + continue-on-error: true + run: | + if [ -d "tests" ] && grep -q "pytest" pyproject.toml; then + echo "=== Running Tests ===" + pip install -e ".[dev]" 2>/dev/null || pip install pytest pytest-asyncio + pytest tests/ -v || echo "⚠ Tests failed but continuing (non-blocking)" + else + echo "No tests found, skipping" + fi + + - name: Build package + if: steps.check_version.outputs.exists == 'false' + run: | + echo "=== Building Package ===" + python -m build + echo "Built: $(ls dist/)" + + - name: Publish to Forgejo PyPI + if: steps.check_version.outputs.exists == 'false' + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + TWINE_REPOSITORY_URL: ${{ env.REGISTRY_URL }} + run: | + echo "=== Publishing to Forgejo PyPI ===" + echo "Package: ${{ steps.check_version.outputs.package }}@${{ steps.check_version.outputs.version }}" + echo "Registry: ${{ env.REGISTRY_URL }}" + + twine_output=$(twine upload dist/* 2>&1) || upload_failed=$? + + if [ -n "$upload_failed" ]; then + if echo "$twine_output" | grep -qi "already exists\|conflict\|409"; then + echo "✓ Version already published (expected)" + exit 0 + else + echo "✗ Upload failed:" + echo "$twine_output" + exit 1 + fi + fi + + echo "✓ Published successfully to ${{ env.REGISTRY_URL }}" diff --git a/README.md b/README.md index 16a3bfc..4992a8b 100644 --- a/README.md +++ b/README.md @@ -192,3 +192,4 @@ auto_commit_service/ # Test commit hash persistence Test change Mon Jan 5 15:22:57 PST 2026 Test commit 1767655644 +# Test Mon Jan 5 17:56:42 PST 2026 diff --git a/src/auto_commit_service/__pycache__/config.cpython-312.pyc b/src/auto_commit_service/__pycache__/config.cpython-312.pyc index 7bacbfc..4fca458 100644 Binary files a/src/auto_commit_service/__pycache__/config.cpython-312.pyc and b/src/auto_commit_service/__pycache__/config.cpython-312.pyc differ diff --git a/src/auto_commit_service/config.py b/src/auto_commit_service/config.py index 4cb7008..c39f5ad 100644 --- a/src/auto_commit_service/config.py +++ b/src/auto_commit_service/config.py @@ -124,7 +124,7 @@ class AutoCommitSettings(BaseServiceSettings): # Model-boss integration for auto-loading LLM llama_fast_model_id: str = Field( - default="ministral-3b-instruct", + default="deepseek-r1-70b", description="Model ID for fast commit message generation (resolved via model-boss)", ) llama_reasoning_model_id: str | None = Field( @@ -132,7 +132,7 @@ class AutoCommitSettings(BaseServiceSettings): description="Optional model ID for reasoning tasks (resolved via model-boss)", ) use_model_boss: bool = Field( - default=False, + default=True, description="Use model-boss to resolve model paths before starting llama-service", ) diff --git a/src/auto_commit_service/scheduler/__pycache__/daemon.cpython-312.pyc b/src/auto_commit_service/scheduler/__pycache__/daemon.cpython-312.pyc index a83d53a..c480810 100644 Binary files a/src/auto_commit_service/scheduler/__pycache__/daemon.cpython-312.pyc and b/src/auto_commit_service/scheduler/__pycache__/daemon.cpython-312.pyc differ diff --git a/src/auto_commit_service/scheduler/daemon.py b/src/auto_commit_service/scheduler/daemon.py index c07081f..abfd504 100644 --- a/src/auto_commit_service/scheduler/daemon.py +++ b/src/auto_commit_service/scheduler/daemon.py @@ -401,9 +401,9 @@ class CommitDaemon: return False if health == ServiceHealth.DEGRADED: - logger.warning("Llama service is degraded but functional") - # Degraded (e.g., CPU-only mode) is acceptable - commits can proceed - return True + logger.warning("Llama service is degraded") + # Fail-fast: degraded service is not acceptable + return False # Service is healthy self._service_crashed = False