Skip to content

Commit 5eed9f8

Browse files
Wire slicks into sandbox via uv and bump default model to MiniMax-M3
Sandbox slicks wiring (matches the slicks v0.3.0 TimescaleDB backend on the timescaledb-migration branch that was merged to main): - server/installer/sandbox/Dockerfile.sandbox: install uv, then use it for both requirements-docker.txt and the editable slicks install from /slicks_src (a docker compose additional_context pointing at the sibling slicks checkout). uv keeps the image layer smaller than pip and the install deterministic. Added a build-time smoke test that imports slicks to catch future regressions early. - server/installer/docker-compose.yml: * sandbox service: pass slicks source as a build-time additional_context and bind-mount the same path at runtime so live source edits are picked up on the next container recreate without an image rebuild (controlled by SLICKS_HOST_PATH env var, default points at /home/ubuntu/projects/slicks). * sandbox service: export POSTGRES_DSN, TIMESCALE_TABLE, TIMESCALE_SEASON, and POSTGRES_TABLE so slicks auto-connects on import. The published PyPI slicks (0.2.3) is the InfluxDB backend and would not be importable as TimescaleDB-aware code; install from local source instead. - server/installer/sandbox/requirements-docker.txt: drop the 'slicks>=0.2.0' PyPI pin. Slicks is now installed editable from the local source above; the pin was pulling the InfluxDB-only release. - server/installer/sandbox/requirements.txt: add psycopg2-binary (slicks depends on it; listing explicitly so the layer order is stable across slicks extras changes). Code-generator Dockerfile fix: - server/installer/sandbox/Dockerfile: the previous version only COPY'd prompt-guide.txt.example, so the active (gitignored) prompt-guide.txt was silently being ignored at every build. Switched to COPY prompt-guide.txt* ./ (with the existing fallback to copy the example when the active file is missing). This restores the team's customization workflow where the active prompt-guide lives in the build context and gets shipped to the container. Model bump: - server/installer/.env.example: ANTHROPIC_MODEL default MiniMax-M2.7 -> MiniMax-M3. - server/installer/sandbox/code_generator.py: same bump in the os.getenv default so a missing env var falls back to M3. Tested end-to-end: code-generator /api/generate-code returns result.status=success with a PNG, slicks.fetch_telemetry() returns 407k rows from a real TimescaleDB window, and the slackbot -> code-gen -> sandbox chain still works.
1 parent a6c623c commit 5eed9f8

7 files changed

Lines changed: 54 additions & 15 deletions

File tree

server/installer/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ ALLOWED_ORIGINS=http://localhost:3000,http://localhost:5173
9595
# ------------------------------------------------------------
9696
ANTHROPIC_API_KEY=your-minimax-api-key-here
9797
ANTHROPIC_BASE_URL=https://api.minimaxi.com/anthropic
98-
ANTHROPIC_MODEL=MiniMax-M2.7
98+
ANTHROPIC_MODEL=MiniMax-M3
9999

100100
# Maximum number of retries when generated code fails (default: 2)
101101
MAX_RETRIES=2

server/installer/docker-compose.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,15 +261,31 @@ services:
261261
build:
262262
context: ./sandbox
263263
dockerfile: Dockerfile.sandbox
264+
# slicks lives outside the build context (sibling repo at
265+
# /home/ubuntu/projects/slicks), so we pass it in as an additional
266+
# build context. The Dockerfile uses `COPY --from=slicks ...` to
267+
# pull files from it. Override SLICKS_HOST_PATH to relocate.
268+
additional_contexts:
269+
- slicks=${SLICKS_HOST_PATH:-/home/ubuntu/projects/slicks}
264270
container_name: sandbox
265271
restart: unless-stopped
266272
environment:
267273
SANDBOX_PORT: 8080
268274
SANDBOX_TIMEOUT: 120
269275
SANDBOX_MAX_FILE_MB: 20
270276
SANDBOX_MAX_FILES: 20
271-
# TimescaleDB connection for user scripts (follow-up: add psycopg2 boilerplate)
277+
# TimescaleDB connection for user scripts (consumed by `slicks`).
278+
# slicks v0.3.0 reads TIMESCALE_TABLE (with TIMESCALE_SEASON fallback);
279+
# we also keep POSTGRES_TABLE for backward compat with older code paths.
272280
POSTGRES_DSN: "${POSTGRES_DSN:-postgresql://wfr:wfr_password@timescaledb:5432/wfr}"
281+
TIMESCALE_TABLE: "${TIMESCALE_TABLE:-${POSTGRES_TABLE:-wfr26}}"
282+
TIMESCALE_SEASON: "${TIMESCALE_SEASON:-${POSTGRES_TABLE:-wfr26}}"
283+
POSTGRES_TABLE: "${POSTGRES_TABLE:-wfr26}"
284+
volumes:
285+
# slicks source (TimescaleDB-migration branch). Editable-installed at
286+
# image build time; the bind mount below lets live source edits show
287+
# up on the next container recreate without an image rebuild.
288+
- ${SLICKS_HOST_PATH:-/home/ubuntu/projects/slicks}:/slicks_src:rw
273289
depends_on:
274290
timescaledb:
275291
condition: service_healthy
@@ -314,7 +330,7 @@ services:
314330
environment:
315331
ANTHROPIC_API_KEY: "${ANTHROPIC_API_KEY}"
316332
ANTHROPIC_BASE_URL: "${ANTHROPIC_BASE_URL:-https://api.minimaxi.com/anthropic}"
317-
ANTHROPIC_MODEL: "${ANTHROPIC_MODEL:-MiniMax-M2.7}"
333+
ANTHROPIC_MODEL: "${ANTHROPIC_MODEL:-MiniMax-M3}"
318334
SANDBOX_URL: "http://sandbox:8080"
319335
MAX_RETRIES: "${MAX_RETRIES:-2}"
320336
CODE_GEN_PORT: 3030

server/installer/sandbox/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ RUN python -c "from langchain_community.embeddings import FastEmbedEmbeddings; F
1212
# Copy application code
1313
COPY code_generator.py .
1414
COPY stats_report.py .
15-
COPY prompt-guide.txt.example ./
16-
# prompt-guide.txt is optional (local customization); fall back to example if absent
15+
COPY anomaly_scan.py .
16+
# Use the wildcard so an existing prompt-guide.txt is preferred; otherwise
17+
# fall back to .example. The previous version only copied .example, which
18+
# silently ignored the active prompt-guide.txt customization.
19+
COPY prompt-guide.txt* ./
1720
RUN if [ ! -f prompt-guide.txt ]; then cp prompt-guide.txt.example prompt-guide.txt; fi
1821

1922
# Create directories for generated code, ChromaDB, and cache

server/installer/sandbox/Dockerfile.sandbox

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# syntax=docker/dockerfile:1
12
FROM python:3.11-slim
23

34
ENV PYTHONDONTWRITEBYTECODE=1 \
@@ -29,10 +30,24 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2930
fonts-liberation \
3031
&& rm -rf /var/lib/apt/lists/*
3132

33+
# Install uv (replaces pip for dependency management)
34+
RUN pip install --no-cache-dir uv
35+
36+
# Install runtime deps via uv. slicks itself is installed editable below.
3237
COPY requirements-docker.txt /tmp/requirements-docker.txt
33-
RUN pip install --upgrade pip \
34-
&& pip install --no-cache-dir -r /tmp/requirements-docker.txt \
35-
&& rm -rf /root/.cache/pip
38+
RUN uv pip install --system --no-cache -r /tmp/requirements-docker.txt \
39+
&& rm -rf /root/.cache/uv
40+
41+
# Install slicks editable. The `slicks` build context is passed in by
42+
# docker-compose.yml's `additional_contexts:` (lives outside this repo's
43+
# build context). At runtime, the docker-compose `volumes:` entry
44+
# bind-mounts the same host path over /slicks_src so live source edits
45+
# show up on the next container recreate (no image rebuild needed for
46+
# code-only changes; pyproject changes still need a rebuild).
47+
COPY --from=slicks pyproject.toml /slicks_src/pyproject.toml
48+
COPY --from=slicks README.md /slicks_src/README.md
49+
COPY --from=slicks src /slicks_src/src
50+
RUN uv pip install --system --no-cache -e /slicks_src
3651

3752
# Tell Kaleido where Chromium lives
3853
ENV CHROME_PATH=/usr/bin/chromium
@@ -42,10 +57,11 @@ RUN python3 - <<EOF
4257
import plotly.express as px
4358
fig = px.line(x=[1,2,3], y=[1,4,9])
4459
fig.write_image("test.png")
45-
print("PNG export OK")
60+
import slicks
61+
print("slicks OK from", slicks.__file__)
4662
EOF
4763

48-
COPY . /app
64+
COPY . /app/
4965

5066
EXPOSE 8080
5167
CMD ["python3", "sandbox_server.py"]

server/installer/sandbox/code_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
# ── Config ─────────────────────────────────────────────────────────────────────
3333
ANTHROPIC_API_KEY = os.environ["ANTHROPIC_API_KEY"]
3434
ANTHROPIC_BASE_URL = os.getenv("ANTHROPIC_BASE_URL", "https://api.minimaxi.com/anthropic")
35-
ANTHROPIC_MODEL = os.getenv("ANTHROPIC_MODEL", "MiniMax-M2.7")
35+
ANTHROPIC_MODEL = os.getenv("ANTHROPIC_MODEL", "MiniMax-M3")
3636
SANDBOX_URL = os.getenv("SANDBOX_URL", "http://sandbox:8080")
3737
MAX_RETRIES = int(os.getenv("MAX_RETRIES", "2"))
3838
DATA_DIR = Path(os.getenv("DATA_DIR", "/app/data"))

server/installer/sandbox/requirements-docker.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# Docker container requirements for sandbox execution environment
22
# These are the dependencies needed inside the Docker container
3+
#
4+
# NOTE: `slicks` is NOT pinned here — it is installed editable from
5+
# /slicks (a host bind mount) in Dockerfile.sandbox so source edits
6+
# land in the running container without a pip rebuild. The published
7+
# 0.2.x line on PyPI is the InfluxDB backend, which is not what we want.
38

4-
# WFR's telemetry analysis stack (pandas, matplotlib)
5-
slicks>=0.2.0
6-
7-
# SQL access for TimescaleDB (explicitly listed — slicks dep is indirect)
9+
# SQL access for TimescaleDB (slicks depends on these; listing explicitly
10+
# in case slicks changes its extras and to keep the layer order stable)
811
sqlalchemy
912
psycopg2-binary
1013

server/installer/sandbox/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ chromadb
1111
fastembed
1212
diskcache
1313
requests
14+
psycopg2-binary
1415
duckdb
1516
matplotlib
1617
pandas

0 commit comments

Comments
 (0)