Commit Graph
4 Commits
Author SHA1 Message Date
Brett Williams f73a5bbb2f Fix disappearing artifacts and guard against empty builds
The agent's background build threads called jsonify()/send_file() with no
Flask app context, so after a successful build they crashed with
'Working outside of application context', which triggered the error
handler that rmtree'd the whole build dir before the controller could
download the artifact. Wrap both runners in app.app_context().

Also guard all three layers against empty results: the agent refuses to
report success or serve a zip when dist/ has no files, and the scheduler
flags a downloaded empty zip as a failure rather than marking the job
done.
2026-08-31 10:07:04 -05:00
Brett Williams 8a6f02b7e9 Add controller logging and return readable errors
The controller ran silently and surfaced errors as opaque/empty bodies,
making it impossible to diagnose failures from either the UI or the server.
- Configure Python logging (timestamps, levels) and log job lifecycle events
  (created / dispatched / done / failed) plus startup and dispatch warnings.
- Add a catch-all error handler so unhandled exceptions return a JSON error
  with the exception type+message instead of an empty response.
- Remove the frontend submit bug that hand-set multipart Content-Type without
  a boundary (and built an opts object it never used); post the FormData
  directly so the browser sets the correct content type + boundary.
2026-08-30 22:39:16 -05:00
Brett Williams b5b1cd740b Stream live worker progress via async build dispatch
The agent's /upload and /checkout_git were synchronous, blocking until a
build finished, so the controller could not relay live per-step progress.
Add ?async=1 support: the agent saves/clones the source, starts the build in
a background thread (holding build_lock), and returns 202 + {"id": ...}
immediately. The controller dispatches async, then polls /progress/<job_id>,
appending each step/log line to the job log and SSE stream, and treats the
build as done when progress clears (404) and the worker reports ready.
2026-08-30 21:59:46 -05:00
Brett Williams 0e89919342 Add controller with web UI and retire CLI
- Add ctrl/ package: Flask app (waitress), SQLite job store, background
  scheduler that probes configured workers, dispatches via /upload and
  /checkout_git, fetches artifacts, and serves a single-page UI
- Supporting API: /api/jobs (create/list/detail/cancel), /api/workers,
  /api/capabilities, artifact download, and SSE log stream
- Workers keep the existing HTTP API; add /progress/<job_id> endpoint and
  per-step build tracking for live status
- Retire agent_manager.py and the cross-py-builder CLI; controller UI is
  the primary frontend
- Record design in DESIGN.md; add waitress dependency

Note: /progress is exposed on the worker but the synchronous /upload and
/checkout endpoints block until a build completes, so per-step worker
progress is not yet relayed live in the UI. Live streaming needs an
async-start worker endpoint as a follow-up.
2026-08-30 21:55:46 -05:00