Skip to content

fix(env): fail-closed Cloud Agent start and hash-locked install - #427

Draft
cursor[bot] wants to merge 7 commits into
mainfrom
cursor/bc-ddbe8a70-5cc2-4231-8e8c-27ff88db1949-24fd
Draft

fix(env): fail-closed Cloud Agent start and hash-locked install#427
cursor[bot] wants to merge 7 commits into
mainfrom
cursor/bc-ddbe8a70-5cc2-4231-8e8c-27ff88db1949-24fd

Conversation

@cursor

@cursor cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown

What

Successor to #426. Keeps the repo-managed Cloud Agent environment and makes a green start mean the SaaS UI is actually listening.

  • .cursor/install.sh now cds to the repository root, installs Python with --require-hashes -r requirements-lock.txt then --no-index --no-deps -e . (same contract as CI), and adds rustfmt fail-closed.
  • .cursor/start.sh rebuilds codec-carver-core only when missing, starts saas_web:app on 0.0.0.0:8000, and waits on GET /health. It exits non-zero if uvicorn dies or the probe times out.
  • GET /health returns {"status":"ok","service":"codec-carver"} and stays auth-exempt like the upload page so load balancers and Cloud Agent start can probe without a key.
  • ARCHITECTURE.md and docs/doctoring/cloud-agent-environment.md record the install/start split, job-store ERD debt, and APA 7th citations (NIST SP 800-218, SLSA v1.0, pip hash-checking).

Why

#426 at e0ca48f returned from start immediately after nohup, swallowed rustfmt failures with || true, and resolved extras from PyPI without the hash lock. A Cloud Agent could report a successful boot while :8000 was dead, and cargo fmt --check could be missing.

Validation

  • python3 -m unittest tests.test_cloud_agent_environment tests.test_saas_web.TestApiKeyAuth -v — 18 passed
  • python3 -m unittest tests.test_saas_web -v — 76 passed
  • python3 -m interrogate saas_web.py — 100%
  • bash -n .cursor/install.sh .cursor/start.sh — clean
  • Live GET http://127.0.0.1:8010/health{"status":"ok","service":"codec-carver"}

Notes

Open in Web View Automation 

cursoragent and others added 3 commits August 16, 2026 15:32
Add repo-managed .cursor/environment.json plus install/start scripts so
Cloud Agents boot fully set up for both the Python CLI/web/MCP package and
the Rust core backend:

- install.sh: ensure ffmpeg, add rustfmt, pip --user install the package
  with web/mcp/dev + test deps, build the rust-core release binary, and put
  ~/.local/bin on PATH for non-login shells.
- start.sh: rebuild codec-carver-core if a fresh checkout wiped rust-core/target.
- environment.json: run the FastAPI SaaS web service (saas_web:app) on
  0.0.0.0:8000 and expose the port.

Validated end-to-end: 631 Python tests, 22 Rust tests, cargo fmt, the
codec-carver CLI (FLAC + Opus fallback), the codec-carver-library Rust
bridge, and a browser upload through the web UI.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
A prebuilt-build/snapshot boot does not always replay the environment.json
terminals, so the FastAPI service could be down on boot. Launch it from
start.sh (guarded single-instance, backgrounded, logs to
/tmp/codec-carver-web.log) so it comes up on every boot mode, and drop the
terminals entry to avoid a double bind on port 8000.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Wait on GET /health before start exits, install rustfmt without
|| true, and match CI's require-hashes pip contract so a green
environment boot means the SaaS UI is actually listening.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the environment landing vehicle for #426. Head 404b1b9 has the fail-closed rustfmt install, hash-locked pip contract, repo-root cd, auth-exempt GET /health, and a start that waits or exits non-zero.

Next actions:

  • Keep this PR as the named environment head. Do not open a third environment PR and do not merge #426 at 8a60d4a.
  • After required checks finish on this head, mark ready for review. Do not self-approve.
  • Residual risk: _web_is_ready depends on curl. If a future base image omits it, start fail-closes (correct) but never becomes ready. A follow-up can probe with python3/urllib so the wait uses the same interpreter as uvicorn.
  • Residual risk: requirements-dev.txt is still unhashed. That matches CI’s test-tool install; do not weaken the runtime lock to “fix” it.
  • Do not mix credential-registry (#329/#373) or drop-zone (#428) work into this branch.
Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

Comment thread .cursor/install.sh Fixed
Add the fail-closed regression first: unattended Cloud Agent bootstrap may use the repository hash lock or the offline editable tree, but must not install the unhashed requirements-dev.txt surface.
Satisfy the supply-chain review at its causal boundary: unattended setup now matches CI exactly by installing only the authenticated requirements lock and the offline editable tree. Keep requirements-dev.txt opt-in until it has its own reviewed hash lock.
@opencode-agent opencode-agent Bot added priority: medium Normal-priority or P2 work status: draft Draft pull request type: bug Defect or incorrect behavior labels Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: medium Normal-priority or P2 work status: draft Draft pull request type: bug Defect or incorrect behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants