diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 9a31d7c..ec1dcbf 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -27,7 +27,14 @@ jobs: steps: - uses: actions/checkout@v4 - name: Ruff lint - run: ruff check backend/ tests/ alembic/ + # agent/ included so the GPU-agent is linted before its image is built + # (build.yml only `docker build`s it — this is where it gets checked). + run: ruff check backend/ tests/ alembic/ agent/ + - name: Agent syntax check + # The agent's runtime deps (torch/transformers/ultralytics) aren't in the + # CI image, so we can't import it — but compileall parses every module, + # catching syntax errors before the image build. + run: python -m compileall -q agent/fc_agent backend-lint-and-test: runs-on: python-ci diff --git a/agent/fc_agent/app.py b/agent/fc_agent/app.py index 87be87b..f52435a 100644 --- a/agent/fc_agent/app.py +++ b/agent/fc_agent/app.py @@ -12,6 +12,11 @@ from .config import Config from .gpu import read_gpu from .worker import Worker +# Bump on every agent change. The page embeds this and /status reports it; the UI +# warns to reload when they differ — so a stale browser-cached page can't be +# mistaken for "the new image didn't deploy". (Belt-and-braces with no-store.) +VERSION = "2026-06-30.5 · stop+poll+ci" + logbuf.install() cfg = Config.from_env() worker = Worker(cfg) @@ -41,7 +46,7 @@ def _maybe_autostart() -> None: @app.get("/", response_class=HTMLResponse) def index() -> str: - return _PAGE + return _PAGE.replace("__BUILD__", VERSION) @app.post("/start") @@ -92,10 +97,12 @@ def status(): # Pure in-memory read: worker.status() is lock-free and the queue snapshot is # kept fresh by a background poller — NO inline curator call, so this can't # stall the status view when curator is buried under a big backlog. + worker.note_ui() # a browser is watching → keep the queue snapshot warm s = worker.status() s["fc_url"] = cfg.fc_url s["configured"] = bool(cfg.token) s["queue"] = worker.latest_queue() + s["build"] = VERSION return JSONResponse(s) @@ -179,8 +186,11 @@ _PAGE = """