feat(api): add Hosted fleet control endpoints - #1714
Conversation
|
Hosted fleet routes should only be enabled if fleet control is enabled via env |
|
✅ Applied the requested follow-up changes in commit 8db5de0 Summary of ChangesImplemented the PR follow-up without committing.
Validation passed:
🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
Implemented the PR follow-up without committing. - Hosted fleet routes are mounted only when `PROPR_FLEET_CONTROL_SECRET` is at least 32 characters. - Reused the same enablement check for authentication. - Updated `.env.example` documentation and added regression coverage. Validation passed: - API typecheck - API lint - Hosted fleet route tests: 6/6 - `git diff --check` PR: #1714 Comment by: @integry (ID: 5155392232) Model: gpt-5.6-sol
|
/ultrafix |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
🔍 AI Code Review — codex:gpt-5.6-solOverall EvaluationThis PR adds secret-gated, instance-local Fleet endpoints for bootstrap verification, operational health, and queue health. The implementation is focused and uses immutable GitHub IDs, defensive route gating, dependency injection, and no-store responses. It needs minor changes before merge, primarily to enforce the promised bounded response contract and make bootstrap-cleanup signals unambiguous. Findings🟡 Delegated handlers do not enforce a bounded Fleet response — 🟡 Bootstrap cleanup state is ambiguous when additional bootstrap administrators exist — 🟡 The supposedly timing-safe comparison leaks length — 🟡 Normalized whitelist entries are not deduplicated — 🟡 Security-critical server wiring is not integration-tested — 🟢 Canonicalize the configured GitHub ID — 🟢 Cover the remaining response branches — Tests should exercise invalid or missing initial-admin IDs ( 🟢 Document secure secret generation — 🟢 Reduce ambient environment dependence in tests and construction — ✅ Hosted routes are genuinely disabled without Fleet control — ✅ Route ordering correctly supports machine-to-machine access — The Fleet routes are registered before ✅ Durable verification uses the immutable identity and required role — ✅ Sensitive login data is not returned — The bootstrap response exposes only the configured immutable ID and boolean state, and the test explicitly verifies that the login is absent. ✅ Operational safeguards are appropriate — Generic ScoreThe core design is sound and the requested environment gate is correctly implemented, but the response allowlisting and bootstrap-cleanup semantics should be tightened before relying on these endpoints operationally. Score: 7/10 🤖 Review Details
🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 4b4a088
Summary of ChangesImplemented all review follow-ups for PR #1714.
Key files: hostedFleetRoutes.ts, server.ts, hostedFleetRoutes.test.ts. Verification passed:
No commit created. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
Implemented all review follow-ups for PR #1714. - Fleet status/queue responses are explicitly validated and allowlisted. - Added `bootstrapOnlyInitialOwner`, username deduplication, injected bootstrap configuration, and GitHub ID canonicalization. - Fleet-secret comparison now uses fixed-length SHA-256 digests. - Added gated route-registration wiring before OAuth middleware. - Expanded unit and Express integration coverage. - Documented `openssl rand -hex 32` secret generation. Key files: [hostedFleetRoutes.ts](/tmp/git-processor/worktrees/integry/propr/pr-1714-followup-2026-08-02T05-01-52/packages/api/routes/hostedFleetRoutes.ts:44), [server.ts](/tmp/git-processor/worktrees/integry/propr/pr-1714-followup-2026-08-02T05-01-52/packages/api/server.ts:217), [hostedFleetRoutes.test.ts](/tmp/git-processor/worktrees/integry/propr/pr-1714-followup-2026-08-02T05-01-52/packages/api/test/hostedFleetRoutes.test.ts:1). Verification passed: - Repository-wide TypeScript check - API lint - 12 Fleet route tests - 32 combined Fleet/status tests - `git diff --check` No commit created. PR: #1714 Comment by: @propr-ultrafix (ID: 0) Model: gpt-5.6-sol
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-5.6-solOverall EvaluationThis PR adds secret-protected, instance-local Fleet endpoints for bootstrap verification and bounded operational health reporting. The environment-controlled registration gate, durable numeric GitHub-ID lookup, response field filtering, and pre-OAuth routing are thoughtfully implemented and well tested. It needs minor changes before merging, primarily to make failure handling and delegated status collection robust. Findings🟡 Bootstrap database failures are not handled — 🟡 Operational string values are not actually bounded — 🟡 Delegating through a fabricated Express response is fragile — 🟡 Tests do not verify compatibility with the real delegated handlers — 🟡 Invalid numeric GitHub IDs can be treated as configured — 🟢 Delegated failures should use a stable outward status contract — 🟢 Route exports are inconsistent — 🟢 Additional malformed-output tests would strengthen the boundary — Tests should cover non-string operational fields, negative/fractional queue counts, excessively long status strings, zero GitHub IDs, and database-query failures. ✅ Fleet routes are now genuinely gated by environment configuration — ✅ Authentication handling is careful — The implementation uses a dedicated header, digest-based constant-time comparison, and ✅ Responses expose a deliberately small surface — Queue output is reduced to waiting/active counts, operational output is restricted to four fields, and the configured GitHub login is never returned. ✅ Bootstrap verification uses the durable identity correctly — The lookup matches the configured canonical numeric GitHub ID and the ✅ The test suite covers the principal security and registration paths well — It checks missing and incorrect credentials, route omission when disabled, placement before the OAuth boundary, response sanitization, numeric-ID canonicalization, and removal-state calculations. ScoreStrong security-conscious implementation with good coverage, held back by an avoidable handler-adaptation abstraction and incomplete error/value-boundary handling. Score: 7/10 🤖 Review Details
🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit e2f58c0
Summary of ChangesImplemented all requested review fixes without committing:
Verification passed:
The standalone demo-mode suite still has two unrelated pre-existing expectation mismatches; no demo-mode code was changed. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
Implemented all requested review fixes without committing: - Added sanitized bootstrap DB-error handling, positive bounded GitHub IDs, strict operational enums, and stable `503` health failures in [hostedFleetRoutes.ts](/tmp/git-processor/worktrees/integry/propr/pr-1714-followup-2026-08-02T05-21-25/packages/api/routes/hostedFleetRoutes.ts:30). - Replaced fabricated Express responses with shared pure collectors in [statusRoutes.ts](/tmp/git-processor/worktrees/integry/propr/pr-1714-followup-2026-08-02T05-21-25/packages/api/routes/statusRoutes.ts:68) and [queueRoutes.ts](/tmp/git-processor/worktrees/integry/propr/pr-1714-followup-2026-08-02T05-21-25/packages/api/routes/queueRoutes.ts:13). - Updated server/barrel wiring and added real-collector, malformed-output, database-failure, and ID-boundary tests. Verification passed: - 36 focused Fleet/status tests - 155 repository unit tests - Root and API TypeScript checks - Targeted ESLint - `git diff --check` The standalone demo-mode suite still has two unrelated pre-existing expectation mismatches; no demo-mode code was changed. PR: #1714 Comment by: @propr-ultrafix (ID: 0) Model: gpt-5.6-sol
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-5.6-solOverall EvaluationThis PR adds narrowly scoped, secret-protected Fleet bootstrap and health endpoints, correctly gated by Findings🟡 Fleet status collection performs substantially more work than the endpoint needs — 🟡 Collectors have no overall response deadline — Database, Redis, BullMQ, agent, or indexing operations that never settle can leave 🟡 A missing initial-admin login produces ambiguous bootstrap results — Only the numeric ID is required by 🟢 Queue heartbeats collect unused historical counts — Fleet only returns 🟢 Authentication logic is duplicated across all three handlers — 🟢 Document the hosted configuration contract more explicitly — 🟢 Consider a standard bearer credential or explicit header-redaction guidance — A custom 🟢 Avoid process-global console mutation in tests — Tests temporarily replace ✅ Hosted routes are genuinely disabled by default — ✅ Credential checking and response handling are defensive — The implementation compares fixed-size SHA-256 digests with ✅ Returned health data is tightly allowlisted — The parsers validate both types and bounded enum values and construct fresh response objects, preventing unrelated status fields, routing URLs, credentials, or backend error details from leaking. ✅ Bootstrap verification uses durable immutable identity correctly — GitHub IDs remain strings, are canonicalized without unsafe numeric conversion, and are matched against the exact administrator role. Tests cover renamed users, leading zeroes, IDs above JavaScript’s safe-integer range, and unrelated administrators. ✅ Test coverage is strong overall — The suite covers route gating, incorrect credentials, malformed configuration, database and collector failures, output allowlisting, administrator-state distinctions, and actual Express middleware ordering. ScoreThe core design and security boundaries are solid, with the main remaining concern being excessive and potentially unbounded work on a recurring operational endpoint. Score: 8/10 🤖 Review Details
🤖 Review by ProPR |
Summary
Adds the protected, instance-local API surface that ProPR Fleet uses to complete
Hosted bootstrap verification and collect operational health. These endpoints
expose only the minimum state Fleet needs and never expose OAuth tokens,
credentials, customer data, or the configured login snapshot.
Dependency / PR structure
This is a stacked PR based on
feat/instance-admin-roles/ #1713. It relies onthat PR's durable numeric-GitHub-ID role model and administrator claim state.
After #1713 merges, this PR can be retargeted to
mainwithout changing itsscope.
Endpoints
GET /api/internal/hosted/bootstrapreports whether the configured immutableGitHub user ID has claimed the durable administrator role and whether the
temporary bootstrap controls can be removed.
GET /api/internal/hosted/statusreturns bounded API/RoutingHub operationalstate for Fleet verification and heartbeat collection.
GET /api/internal/hosted/queuereturns bounded waiting/active queue countsfor health and drain decisions.
The routes are registered before normal OAuth middleware because they use a
dedicated service credential and are not customer-browser endpoints.
Security and identity
PROPR_FLEET_CONTROL_SECRETwith at least 32 characters.X-ProPR-Fleet-Secretand compares it withtimingSafeEqualafter equal-length validation.PROPR_HOSTED_INITIAL_ADMIN_GITHUB_USER_IDas a positive safeinteger and uses it—not the mutable login—to verify administrator ownership.
PROPR_HOSTED_INITIAL_ADMIN_GITHUB_LOGINas an operational snapshotonly and does not return it from the API.
administrator/member authorization.
Configuration
Adds the following documented environment values:
PROPR_FLEET_CONTROL_SECRETPROPR_HOSTED_INITIAL_ADMIN_GITHUB_USER_IDPROPR_HOSTED_INITIAL_ADMIN_GITHUB_LOGINFleet/Ansible supplies these per tenant through the protected Hosted
environment; they must not be baked into images or shared between tenants.
Cross-repository dependencies
Validation
npm run typecheckverified immutable administrator identity, rejection of a different admin,
and protected operational status.
git diff --checkpasses.Rollout and rollback
Deploy only after #1713 and configure the per-tenant secret/owner identity
through Ansible. Fleet treats an unavailable or inconclusive endpoint as failed
verification and does not report the instance
ACTIVE.Rollback removes the internal routes and environment values. Existing durable
role state is unchanged; Fleet must remain paused or in pre-active state until a
compatible ProPR version is restored.