Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/flutter-linux-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write # gh release create/upload

jobs:
build:
name: Flutter Build on Linux
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/type-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
type-check:
runs-on: ubuntu-latest
Expand Down
12 changes: 7 additions & 5 deletions services/voxtral-local/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,9 +980,10 @@ async def generate() -> Any:
async for progress in model_manager.download_model():
yield f"data: {json.dumps(progress)}\n\n"

except Exception as e:
logger.error(f"Model pull error: {e}")
yield f"data: {json.dumps({'status': 'error', 'error': str(e)})}\n\n"
except Exception:
# The exception text stays in the server log; clients get a fixed message.
logger.exception("Model pull error")
yield f"data: {json.dumps({'status': 'error', 'error': 'Model download failed'})}\n\n"

if request.stream:
return StreamingResponse(generate(), media_type="text/event-stream")
Expand All @@ -995,8 +996,9 @@ async def generate() -> Any:
pass

return {"status": "success", "message": "Model downloaded"}
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
except Exception:
logger.exception("Model pull error")
raise HTTPException(status_code=500, detail="Model download failed")


@app.get("/v1/models")
Expand Down
19 changes: 19 additions & 0 deletions services/voxtral-local/tests/test_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,25 @@ def test_model_pull_returns_status(self, client):
assert "status" in data
assert data["status"] == "success"

@pytest.mark.parametrize("stream", [True, False])
def test_model_pull_failure_hides_exception_text(self, client, monkeypatch, stream):
"""A failed download reports a fixed message, never the exception text."""
import main

async def failing_download():
raise RuntimeError("secret /home/user/.cache token=abc")
yield # pragma: no cover - makes this an async generator

monkeypatch.setattr(main.model_manager, "is_model_available", lambda: False)
monkeypatch.setattr(main.model_manager, "download_model", failing_download)
response = client.post(
"/v1/models/pull",
json={"model_name": "mistralai/Voxtral-Mini-3B-2507", "stream": stream},
)
assert "Model download failed" in response.text
assert "secret" not in response.text
assert response.status_code == (200 if stream else 500)


class TestModelLoadEndpoint:
"""Tests for model load endpoint."""
Expand Down
2 changes: 0 additions & 2 deletions tool/lotti_gym.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def atomic_json(path, value):
temporary = path.with_name(path.name + ".tmp")
# Connection credentials are excluded before manifests, checkpoints and
# aggregate summaries reach this deliberate local artifact sink.
# codeql[py/clear-text-storage-sensitive-data]
temporary.write_text(
json.dumps(value, indent=2, ensure_ascii=False) + "\n", encoding="utf-8"
)
Expand Down Expand Up @@ -1236,7 +1235,6 @@ def main(argv=None):
cost_label = "Run spend so far" if summary["verdict"] == "incomplete" else "Run price"
# These fields are validated numeric billing aggregates and public
# request counts, so printing them cannot disclose provider content.
# codeql[py/clear-text-logging-sensitive-data]
print(
f"{cost_label} (EUR equivalent): {cost['totalCostEur']}"
if cost["complete"] else
Expand Down
1 change: 0 additions & 1 deletion tool/lotti_gym_billing.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ def record(self, event, **fields):
with self.lock, self.ledger.open("a", encoding="utf-8") as output:
# Provider payloads are reduced to validated numeric billing fields
# and a fixed enum before this deliberate accounting sink.
# codeql[py/clear-text-storage-sensitive-data]
output.write(json.dumps(record, ensure_ascii=False) + "\n")
output.flush()

Expand Down
1 change: 0 additions & 1 deletion tool/lotti_gym_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ def record_history(root, record):
temporary = root / "build/lotti_gym_history.jsonl.tmp"
# history_record projects only public aggregate fields; its tests reject
# private source fields before this deliberate checked-in ledger sink.
# codeql[py/clear-text-storage-sensitive-data]
temporary.write_text("".join(json.dumps(row, sort_keys=True, ensure_ascii=False) + "\n" for row in rows))
temporary.replace(path)

Expand Down
Loading