Repository navigation
[3763 by Claude Opus 5.5] Slim control plane: single-process mode and UI served by API - #3771
Conversation
I've added an all-in-one mode that runs the daemon, worker and API in one Node process. The API can now serve the UI itself, and `propr start --profile minimal` starts just Redis plus that one container. The multi-container stack is still the default and works as before. I didn't run the full stack, because there's no Docker or Redis in this environment. I did measure memory a simpler way: importing each compiled entry point with startup turned off. The four separate processes come to about 800 MB together on this machine, and one combined process to about 254 MB. That's roughly a third, before any real work is running. The issue's figures are lower (~450 MB on a 1 GB Fly Machine) because Node sizes its memory to the host, so compare the ratio, not the numbers. Whether it fits in 512 MB under real load is still unconfirmed; the docs say so. All-in-one entry (`src/allInOne.ts`, `npm run all-in-one` / `all-in-one:dev`, or `node dist/src/allInOne.js` as the image command) - Migrations run once, then the API (and UI) starts first. The worker can wait on an agent image build before taking jobs, and this way you can watch that from the dashboard. - The components share the SQLite handle, the task queue connection and other shared objects. Each component still opens some of its own Redis connections; I didn't merge those. - `PROPR_INDEXING=inline|separate|off`, defaulting to `inline`. - Shutdown order: stop taking in GitHub events → indexing worker → main worker → API → shared queue. The indexing worker has to stop before the main worker, because the main worker's cleanup closes every network proxy in the process. A second Ctrl-C/SIGTERM exits immediately. - To make this possible, the daemon, worker, indexing worker and API startup functions now take options to skip their own signal handlers and return a `close()`. Defaults are unchanged, so standalone behaviour is the same. UI served by the API (`packages/api/staticUi.ts`) - This is off unless `PROPR_SERVE_UI=1` or `PROPR_UI_DIST_DIR` is set; all-in-one turns it on. - `config.js` is still generated at startup and never cached. It defaults to the API's own origin and reads `PROPR_SERVED_UI_API_URL`, not `PROPR_UI_PUBLIC_API_URL`, because in tunnel mode that variable holds the hosted UI's proxy URL. - Unknown page paths fall back to `index.html`. API, Socket.IO, webhook and MCP/OAuth paths, missing assets and non-GET requests never do. - The API's own public origin is now allowed through CORS and Socket.IO, but only when it is serving the UI. - `docker/Dockerfile.app.prod` now builds the UI and bundles it into the app image, so building that image takes longer. Launcher and CLI - `PROPR_PROFILE=full|minimal` (bad values fail `propr check`), plus `propr start --profile minimal`. - The minimal profile starts redis and the all-in-one container, plus the indexing worker container when `PROPR_INDEXING=separate`. That container gets the combined mounts and settings of the four services it replaces. - In the minimal profile: - `FRONTEND_URL` defaults to the API address, so the UI is at `http://localhost:4000`. - The tunnel attaches to the all-in-one container. - The UI image isn't pulled, and the dashboard's `u` (toggle UI) key explains there's nothing to toggle. - Starting one profile removes any leftover containers from the other, so two control planes can't run against the same database. `propr status` shows the other profile's containers only while they still exist. Docs: a memory table in `setup.md`, a new "Slim Control Plane" section in the configuration reference, updates to the CLI and Docker Hub pages, and two new settings-catalog entries (settings-locations page regenerated). Tests: new tests cover the launcher profile, static UI serving (over a real HTTP server) and the all-in-one config and shutdown order; they're added to `test:unit`. Typecheck, lint and the related existing launcher, CLI, Dockerfile and API tests all pass. The API tests that load the real server only pass with `NODE_ENV=test`, which the repo's test runner sets; they fail the same way on unmodified code without it. The worker and daemon tests that need a live Redis weren't run. There are no preview images, since nothing in the UI looks different. ProPR-Agent: claude/claude-opus-5-5
|
/ultrafix goal=8 max=10 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
|
CI failed: Full Test Suite Shard 3/4 Please investigate and fix this CI failure.
Failure evidence
|
|
✅ Applied the requested follow-up changes in commit 7e20cd7 Summary of ChangesI fixed the Shard 3/4 failure. It was the only failing test file in that shard: Cause: that test scans the API source for routes registered directly on the Express app. Every one must be listed in Fix:
Checks run locally, all passing:
I didn't rerun the rest of the shard; CI will confirm that. There are no preview images, since nothing in the UI changed. Review digestRisk-tiered paths
Diff size: 3 files changed, +29/−2 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed the Shard 3/4 failure. It was the only failing test file in that shard: `packages/api/test/openapiRouteCoverage.test.ts`. **Cause:** that test scans the API source for routes registered directly on the Express app. Every one must be listed in `packages/api/openapi/directRoutes.ts`. This PR's new `GET /config.js` route in `packages/api/staticUi.ts` wasn't listed, so the test failed with "GET /config.js is registered directly; list it in openapi/directRoutes.ts". **Fix:** - **Listed the route:** `/config.js` is now in `packages/api/openapi/directRoutes.ts` as a public route from `staticUi.ts`. A comment notes it only exists when the API serves the UI. - **Documented it:** once listed, the spec generator also wants the route in a tag or with its own doc. I added a short System-tagged doc entry in `packages/api/openapi/routeDocsSystem.ts`, with response type `application/javascript`. I kept it to a few lines so the file stays under the 400-line lint limit. - **Regenerated the spec:** ran `npm run gen:openapi`, which adds the `/config.js` entry to `docs/static/openapi/propr-api.yaml` and moves the route counts from 327 to 328. The generated client types didn't change. **Checks run locally, all passing:** - `openapiRouteCoverage.test.ts`: 16 of 16 (with `NODE_ENV=test`, as CI sets). - `npm run gen:openapi:check`. - `scripts/check-client-contract.ts`. - `test/ciChangeClassification.test.mjs`. - `tsc --noEmit` and zero-warning eslint on `packages/api`. I didn't rerun the rest of the shard; CI will confirm that. There are no preview images, since nothing in the UI changed. PR: #3771 Comment by: @propr-dev[bot] (ID: 7118657360) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR implements the minimal profile with sensible separation between configuration, service composition, and UI serving. It needs a lifecycle correction before merge. ✅ Preserved default deployment — The full profile remains the default, while minimal mode explicitly selects Redis and the combined service. ✅ Protected server routes — Static UI middleware excludes API, Socket.IO, webhook, and OAuth paths and preserves runtime-config cache controls. ✅ Explicit shared-resource ownership — Inline indexing relinquishes proxy ownership, and normal shutdown orders indexing before the main worker. The supplied checks report 34 passed, one pending, and no failures. This review used static analysis only; no commands were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Coordinate shutdown with unfinished startup
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Measure the running minimal stackThe documented module-import measurements usefully distinguish baseline memory from operational usage. A Docker smoke test with Redis, an authenticated dashboard, and an indexing or task run would establish the actual memory footprint and exercise component coexistence. This is a follow-up because the documentation explicitly leaves the 512 MB target unconfirmed. S2: 🟢 Clean up rejected startupThe supervisor’s comment promises cleanup after startup failure, but its outer rejection handler logs and immediately exits without invoking registered close handles. Consider routing startup rejection through cleanup as well, particularly for callers importing ScoreThe implementation is focused and has substantial passing validation, but shutdown can omit components that finish starting after termination begins. That lifecycle defect prevents merge readiness. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 0247739
Summary of ChangesI fixed F1: a stop signal that arrives while the all-in-one process is still starting no longer misses components or lets startup carry on. The new tests pass, typecheck is clean, lint passes on both source files, and the main regression fails if the fix is taken out. As before, I couldn't run the real combined process (no Redis or Docker here). The fix
Tests (
Unchanged: if a component that is still starting never finishes, shutdown waits for it; a second Ctrl-C/SIGTERM still exits immediately. Separate issue, not fixed: if startup fails with no signal involved, the entry point still exits without closing the components that already started. That was already the case on this branch. I removed the old code comment that claimed otherwise but left the behaviour alone, since it is outside F1. No previews, since nothing visible changed. Review digestRisk-tiered paths
Diff size: 3 files changed, +265/−58 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed F1: a stop signal that arrives while the all-in-one process is still starting no longer misses components or lets startup carry on. The new tests pass, typecheck is clean, lint passes on both source files, and the main regression fails if the fix is taken out. As before, I couldn't run the real combined process (no Redis or Docker here). **The fix** - **Shared coordinator:** startup and shutdown now go through one coordinator, `createComponentSupervisor` in `src/allInOneConfig.ts`. Startup runs as an ordered list of stages: migrations, API, daemon, worker, PR status maintenance, then the indexing worker if enabled. - **No new starts once shutdown begins:** the coordinator checks before every stage. A signal during migrations or any component's startup starts nothing further, including status maintenance and inline indexing. - **The component still starting gets closed:** `close()` waits for any startup still in progress, then decides what to close. A worker that finishes starting during shutdown is closed with the rest, in the same order as before (daemon → indexing → worker → API → shared task queue). - **Startup failures during shutdown are logged, not thrown:** before, such an error reached the entry point's `process.exit(1)` and cut the drain short. A failure with no signal involved still fails startup as before. - `src/allInOne.ts` now feeds its startup steps through this coordinator instead of keeping its own list of handles. **Tests** (`test/allInOneConfig.test.ts`) - The test the finding asks for: worker startup is held back, shutdown starts and is shown to wait, then the worker finishes. The worker is closed in order, and status maintenance and indexing never start. - A worker startup that fails during shutdown is logged and the API still closes. - A startup failure with no signal still rejects. - A signal before startup means nothing starts. - A normal startup closes everything in the usual order. - The source-text order check now asserts the exported `SHUTDOWN_ORDER` directly. **Unchanged:** if a component that is still starting never finishes, shutdown waits for it; a second Ctrl-C/SIGTERM still exits immediately. **Separate issue, not fixed:** if startup fails with no signal involved, the entry point still exits without closing the components that already started. That was already the case on this branch. I removed the old code comment that claimed otherwise but left the behaviour alone, since it is outside F1. No previews, since nothing visible changed. PR: #3771 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds an opt-in combined control plane while retaining the full profile as the default. The changes are coherent with the objective; no merge-blocking defect is demonstrated by the supplied code. ✅ Ordered shutdown — The supervisor waits for an in-flight startup, captures its eventual close handle, and drains indexing before the worker closes shared egress proxies. ✅ Static routing boundaries — UI serving excludes server-owned paths, preserves runtime configuration precedence, and returns real errors for missing file assets. ✅ Profile isolation — Both synchronous and asynchronous stack startup remove inactive-profile services before migration and startup. Merge-ready within the reviewed scope, conditional on the remaining validation check. The authoritative status is 34 passed, one pending, and no failures. This review used static analysis only; no commands were run. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S3: 🟢 Exercise the composed runtimeAdd a Docker/Redis smoke test that starts the minimal profile, requests the UI and API, processes work, and terminates during startup and active processing. The new supervisor tests establish ordering with synthetic components, but cannot establish that actual components share resources safely. This is useful additional integration coverage, not a demonstrated code blocker. S4: 🟢 Qualify the memory guidanceIn ScoreThe implementation is appropriately scoped and includes focused configuration, routing, and shutdown tests. No actionable defect was verified; live runtime behavior and memory usage remain less directly validated than the pure helpers. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
AI Implementation Summary
Closes #3763
Branch:
3763/claude-opus-5-5-slim-control-plane-single-20261124-0015-aejCommits: ✅ Changes committed (35ac401)
AI Processing Completed
Execution Details:
Summary:
I've added an all-in-one mode that runs the daemon, worker and API in one Node process. The API can now serve the UI itself, and
propr start --profile minimalstarts just Redis plus that one container. The multi-container stack is still the default and works as before.I didn't run the full stack, because there's no Docker or Redis in this environment. I did measure memory a simpler way: importing each compiled entry point with startup turned off. The four separate processes come to about 800 MB together on this machine, and one combined process to about 254 MB. That's roughly a third, before any real work is running. The issue's figures are lower (~450 MB on a 1 GB Fly Machine) because Node sizes its memory to the host, so compare the ratio, not the numbers. Whether it fits in 512 MB under real load is still unconfirmed; the docs say so.
All-in-one entry (
src/allInOne.ts,npm run all-in-one/all-in-one:dev, ornode dist/src/allInOne.jsas the image command)PROPR_INDEXING=inline|separate|off, defaulting toinline.close(). Defaults are unchanged, so standalone behaviour is the same.UI served by the API (
packages/api/staticUi.ts)PROPR_SERVE_UI=1orPROPR_UI_DIST_DIRis set; all-in-one turns it on.config.jsis still generated at startup and never cached. It defaults to the API's own origin and readsPROPR_SERVED_UI_API_URL, notPROPR_UI_PUBLIC_API_URL, because in tunnel mode that variable holds the hosted UI's proxy URL.index.html. API, Socket.IO, webhook and MCP/OAuth paths, missing assets and non-GET requests never do.docker/Dockerfile.app.prodnow builds the UI and bundles it into the app image, so building that image takes longer.Launcher and CLI
PROPR_PROFILE=full|minimal(bad values failpropr check), pluspropr start --profile minimal.PROPR_INDEXING=separate. That container gets the combined mounts and settings of the four services it replaces.FRONTEND_URLdefaults to the API address, so the UI is athttp://localhost:4000.u(toggle UI) key explains there's nothing to toggle.propr statusshows the other profile's containers only while they still exist.Docs: a memory table in
setup.md, a new "Slim Control Plane" section in the configuration reference, updates to the CLI and Docker Hub pages, and two new settings-catalog entries (settings-locations page regenerated).Tests: new tests cover the launcher profile, static UI serving (over a real HTTP server) and the all-in-one config and shutdown order; they're added to
test:unit. Typecheck, lint and the related existing launcher, CLI, Dockerfile and API tests all pass. The API tests that load the real server only pass withNODE_ENV=test, which the repo's test runner sets; they fail the same way on unmodified code without it. The worker and daemon tests that need a live Redis weren't run.There are no preview images, since nothing in the UI looks different.
Review digest
Risk-tiered paths
package.json(+3/−1): dependency manifestdocker/Dockerfile.app.prod(+39/−2)docker/launcher/entrypoint.mjs(+1/−0)docker/launcher/orchestrator.mjs(+162/−48)packages/api/mcp/settingsCatalog.ts(+2/−0)packages/api/server.ts(+48/−7)packages/api/staticUi.ts(added, +174/−0)packages/cli/src/commands/startCommand.ts(+9/−1)packages/cli/src/orchestrator/index.ts(+3/−0)packages/cli/src/orchestrator/types.ts(+15/−0)packages/cli/src/tui/StartApp.tsx(+4/−0)packages/cli/src/tui/render.ts(+8/−2)src/allInOne.ts(added, +137/−0)src/allInOneConfig.ts(added, +71/−0)src/daemon.ts(+27/−9)src/indexing_worker.ts(+43/−14)src/worker.ts(+11/−6)docker/dockerhub/app.md(+2/−1)docker/dockerhub/launcher.md(+3/−0)docs/docs/features/propr-cli.md(+1/−0)docs/docs/operations/configuration-reference.md(+14/−0)docs/docs/operations/settings-locations.md(+2/−0)docs/docs/tutorials/setup.md(+17/−0)packages/api/test/staticUi.test.ts(added, +115/−0)test/allInOneConfig.test.ts(added, +77/−0)test/orchestratorMinimalProfile.test.mjs(added, +105/−0)Diff size: 26 files changed, +1,093/−91 lines
View task for the run's logs and conversation.
This PR was created automatically by ProPR after processing issue #3763.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!