Skip to content

feat(api): add Hosted fleet control endpoints - #1714

Merged
integry merged 10 commits into
mainfrom
feat/hosted-fleet-api
Oct 10, 2026
Merged

integry merged 10 commits into
mainfrom
feat/hosted-fleet-api

Conversation

@integry

@integry integry commented Aug 1, 2026 •

Copy link
Copy Markdown
Owner

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 on
that PR's durable numeric-GitHub-ID role model and administrator claim state.
After #1713 merges, this PR can be retargeted to main without changing its
scope.

Endpoints

  • GET /api/internal/hosted/bootstrap reports whether the configured immutable
    GitHub user ID has claimed the durable administrator role and whether the
    temporary bootstrap controls can be removed.
  • GET /api/internal/hosted/status returns bounded API/RoutingHub operational
    state for Fleet verification and heartbeat collection.
  • GET /api/internal/hosted/queue returns bounded waiting/active queue counts
    for 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

  • Requires PROPR_FLEET_CONTROL_SECRET with at least 32 characters.
  • Accepts the secret only through X-ProPR-Fleet-Secret and compares it with
    timingSafeEqual after equal-length validation.
  • Validates PROPR_HOSTED_INITIAL_ADMIN_GITHUB_USER_ID as a positive safe
    integer and uses it—not the mutable login—to verify administrator ownership.
  • Treats PROPR_HOSTED_INITIAL_ADMIN_GITHUB_LOGIN as an operational snapshot
    only and does not return it from the API.
  • Reads durable instance roles and preserves ProPR as the authority for local
    administrator/member authorization.

Configuration

Adds the following documented environment values:

  • PROPR_FLEET_CONTROL_SECRET
  • PROPR_HOSTED_INITIAL_ADMIN_GITHUB_USER_ID
  • PROPR_HOSTED_INITIAL_ADMIN_GITHUB_LOGIN

Fleet/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 typecheck
  • Native Node test suite: 5/5 hosted Fleet route tests pass.
  • Covers missing/incorrect credentials, pending claim without login leakage,
    verified immutable administrator identity, rejection of a different admin,
    and protected operational status.
  • git diff --check passes.

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.

@integry integry added the AI label Aug 2, 2026
Repository owner deleted a comment from propr-dev Bot Aug 2, 2026
Repository owner deleted a comment from propr-dev Bot Aug 2, 2026
Repository owner deleted a comment from propr-dev Bot Aug 2, 2026
Repository owner deleted a comment from propr-dev Bot Aug 2, 2026
@integry

integry commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

Hosted fleet routes should only be enabled if fleet control is enabled via env

@propr-dev

propr-dev Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ Applied the requested follow-up changes in commit 8db5de0

Summary of Changes

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

🤖 Implementation Details

  • Model: GPT-5.6 Sol (max)
  • Requested By: @integry
  • Time: 8m 13s
  • Tokens: 1,558,347 (1,544,126 in / 14,221 out)
  • Cost: $1.59

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Implement fixes for issues found by /review /fix or /fix address the null check issue
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 5155392232✓

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
@integry

integry commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

/ultrafix

@propr-dev propr-dev Bot added the ultrafix label Aug 2, 2026
@propr-dev

propr-dev Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🔄 Ultrafix loop started (goal: 8/10, max cycles: 10)

First action: /review

💡 Tip: Remove the ultrafix label from this PR to stop further ultrafix cycles.

@propr-dev

propr-dev Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🔍 AI Code Review — codex:gpt-5.6-sol

Overall Evaluation

This 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 — packages/api/routes/hostedFleetRoutes.ts:78-98 forwards directly to the normal status and queue handlers. Any current or future fields added to /api/status or /api/queue/stats will automatically become accessible through the Fleet credential. Construct explicit Fleet response objects or adapters that allowlist the intended fields.

🟡 Bootstrap cleanup state is ambiguous when additional bootstrap administrators exist — packages/api/routes/hostedFleetRoutes.ts:53-68 reports whether the initial login appears anywhere in PROPR_ADMIN_USERS, but not whether it is the only entry. A configuration such as owner,break-glass-admin produces the same environmentBootstrapActive value as owner; a consumer could consequently treat removal of the whole bootstrap variable as safe. Return an explicit bootstrapOnlyInitialOwner or authoritative temporaryControlsRemovable result.

🟡 The supposedly timing-safe comparison leaks length — packages/api/routes/hostedFleetRoutes.ts:23-27 returns before timingSafeEqual when byte lengths differ. This principally exposes credential length rather than contents, so exploitation over a network is unlikely, but it weakens the authentication primitive. Comparing fixed-length hashes would avoid the early-exit distinction.

🟡 Normalized whitelist entries are not deduplicated — packages/api/routes/hostedFleetRoutes.ts:56-68 treats owner,OWNER as two entries even though GitHub usernames are case-insensitive. That incorrectly makes whitelistOnlyInitialOwner false and could prevent automated cleanup. Normalize into a Set before evaluating cardinality.

🟡 Security-critical server wiring is not integration-tested — packages/api/test/hostedFleetRoutes.test.ts:65-160 tests the helper and handlers independently, but does not prove that the routes are absent when the gate is disabled, present before OAuth middleware when enabled, and protected through an actual Express request. An integration test would catch route-order or registration regressions.

🟢 Canonicalize the configured GitHub ID — packages/api/routes/hostedFleetRoutes.ts:44-51 accepts leading-zero IDs such as 00100, which will not match a stored canonical value such as 100. Trimming and canonicalizing the decimal string, or rejecting noncanonical forms, would prevent confusing false negatives.

🟢 Cover the remaining response branches — Tests should exercise invalid or missing initial-admin IDs (409), unavailable delegated handlers (503), incorrect credentials on the queue endpoint, mixed-case/duplicate whitelist entries, and delegated-handler failures.

🟢 Document secure secret generation — .env.example:203-211 requires only 32 characters, which does not ensure entropy. Adding an operator command such as openssl rand -hex 32 would reduce the chance of weak manually chosen Fleet credentials.

🟢 Reduce ambient environment dependence in tests and construction — createHostedFleetRoutes injects most configuration but environmentBootstrapActive still calls getBootstrapAdminUsernames() against global process state. Injecting the resolved bootstrap usernames would make configuration snapshots and unit tests more deterministic.

✅ Hosted routes are genuinely disabled without Fleet control — packages/api/server.ts:226-238 conditionally registers all three endpoints, while each handler independently rechecks the captured credential. This provides useful defense in depth and addresses the latest review requirement.

✅ Route ordering correctly supports machine-to-machine access — The Fleet routes are registered before ensureAuthenticated but retain their own narrow authentication, while normal API routes remain protected.

✅ Durable verification uses the immutable identity and required role — packages/api/routes/hostedFleetRoutes.ts:48-52 checks both the configured numeric GitHub ID and role: 'admin', avoiding username-renaming and “some other administrator exists” errors.

✅ 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 401 responses avoid credential-oracle details, successful responses are marked no-store, and dependency injection keeps the new logic readily testable.

Score

The 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

  • Model: GPT-5.6 Sol
  • Time: 3m 26s
  • Tokens: 36,664 (30,994 in / 5,670 out)
  • Cost: $0.28

View Task


💡 Next step: Comment /fix on this PR to have the AI automatically implement the suggestions above.
The /fix command gathers all unprocessed AI review comments and applies fixes in a single pass.
You can edit or delete review comments before running /fix to control which suggestions are applied.
Add extra instructions if needed, e.g. /fix only address the critical findings.

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ Applied the requested follow-up changes in commit 4b4a088

Addressed 1 AI review comment (IDs: 5155503575)

Summary of Changes

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, server.ts, hostedFleetRoutes.test.ts.

Verification passed:

  • Repository-wide TypeScript check
  • API lint
  • 12 Fleet route tests
  • 32 combined Fleet/status tests
  • git diff --check

No commit created.


🤖 Implementation Details

  • Model: GPT-5.6 Sol (max)
  • Requested By: @propr-ultrafix
  • Time: 13m 29s
  • Tokens: 2,170,275 (2,143,477 in / 26,798 out)
  • Cost: $2.47

View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Implement fixes for issues found by /review /fix or /fix address the null check issue
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 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
@propr-dev

propr-dev Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🔍 AI Code Review — codex:gpt-5.6-sol

Overall Evaluation

This 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 — packages/api/routes/hostedFleetRoutes.ts:167 awaits the instance_members query outside a try/catch. A database error can produce an unhandled rejected handler under Express 4 or an inconsistent default error response under Express 5, unlike the sanitized JSON errors from the status endpoints. Catch failures and return a stable 503 response, with a corresponding test.

🟡 Operational string values are not actually bounded — packages/api/routes/hostedFleetRoutes.ts:66-80 allowlists field names but accepts arbitrary strings of any length. A future delegated handler could place diagnostic details or secrets in one of these fields and have them forwarded verbatim. Validate known enum values or, where forward compatibility is required, impose conservative length and character limits.

🟡 Delegating through a fabricated Express response is fragile — captureDelegatedJson at packages/api/routes/hostedFleetRoutes.ts:101-129 relies on an as unknown as Response object implementing only a few response methods. A harmless future change to getStatus or getQueueStats, such as using send, sendStatus, end, type, or response locals, could silently turn Fleet health checks into 503 responses. Extract pure status-collection functions shared by both routes instead of adapting HTTP handlers.

🟡 Tests do not verify compatibility with the real delegated handlers — packages/api/test/hostedFleetRoutes.test.ts:69-88 uses simplified mock handlers, while production wires createStatusRoutes().getStatus and createQueueRoutes().getQueueStats. At least one wiring-level test using those actual handlers would catch response-shape changes and incompatibilities with the fabricated response adapter.

🟡 Invalid numeric GitHub IDs can be treated as configured — canonicalizeGithubUserId at packages/api/routes/hostedFleetRoutes.ts:49-53 accepts values such as 0 and arbitrarily long digit strings. Those are reported as pending claims rather than producing the intended configuration error. Retain string-based handling for large IDs, but require a positive, reasonably bounded decimal identifier.

🟢 Delegated failures should use a stable outward status contract — packages/api/routes/hostedFleetRoutes.ts:195-199 and 224-228 mirror any non-2xx status, including inappropriate redirect or client-error statuses, while replacing the body with an “unavailable” error. Normalizing delegated failures to 503 would make Fleet behavior predictable.

🟢 Route exports are inconsistent — packages/api/routes/index.ts:27 exports createHostedFleetRoutes and isHostedFleetControlEnabled, but not registerHostedFleetRoutes, forcing packages/api/server.ts:34 to import directly from the module alongside the existing route barrel. Exporting all three together would keep the public route API coherent.

🟢 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 — registerHostedFleetRoutes registers nothing unless PROPR_FLEET_CONTROL_SECRET meets the configured minimum length, directly addressing the latest review context.

✅ Authentication handling is careful — The implementation uses a dedicated header, digest-based constant-time comparison, and Cache-Control: no-store, while keeping these endpoints independent of customer OAuth sessions.

✅ 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 admin role, preventing another administrator or a renamed login from incorrectly satisfying the initial-owner claim.

✅ 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.

Score

Strong 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

  • Model: GPT-5.6 Sol
  • Time: 3m 36s
  • Tokens: 43,597 (36,401 in / 7,196 out)
  • Cost: $0.35

View Task


💡 Next step: Comment /fix on this PR to have the AI automatically implement the suggestions above.
The /fix command gathers all unprocessed AI review comments and applies fixes in a single pass.
You can edit or delete review comments before running /fix to control which suggestions are applied.
Add extra instructions if needed, e.g. /fix only address the critical findings.

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ Applied the requested follow-up changes in commit e2f58c0

Addressed 1 AI review comment (IDs: 5155610491)

Summary of Changes

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.
  • Replaced fabricated Express responses with shared pure collectors in statusRoutes.ts and queueRoutes.ts.
  • 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.


🤖 Implementation Details

  • Model: GPT-5.6 Sol (max)
  • Requested By: @propr-ultrafix
  • Time: 11m 59s
  • Tokens: 2,962,345 (2,939,213 in / 23,132 out)
  • Cost: $2.87

View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Implement fixes for issues found by /review /fix or /fix address the null check issue
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 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
@propr-dev

propr-dev Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🔍 AI Code Review — codex:gpt-5.6-sol

Overall Evaluation

This PR adds narrowly scoped, secret-protected Fleet bootstrap and health endpoints, correctly gated by PROPR_FLEET_CONTROL_SECRET and registered before OAuth authentication. The implementation is security-conscious and well tested, but needs minor changes to keep Fleet heartbeat collection lightweight and reliably bounded.

Findings

🟡 Fleet status collection performs substantially more work than the endpoint needs — server.ts:228-229 passes the complete statusRoutes.collectStatus pipeline into Fleet, while hostedFleetRoutes.ts:162-181 retains only four GitHub fields. Each heartbeat can therefore initialize agents, run agent health checks, inspect indexing, load summarization state, and inspect agent-runtime status (statusRoutes.ts:139-168). This increases latency and load and couples Fleet availability to unrelated subsystems. Provide a dedicated narrow collector for auth/intake state.

🟡 Collectors have no overall response deadline — Database, Redis, BullMQ, agent, or indexing operations that never settle can leave /bootstrap, /status, or /queue requests open indefinitely (hostedFleetRoutes.ts:126-138, 162-201). Some agent checks have individual timeouts, but there is no endpoint-wide deadline. Fleet heartbeat endpoints should fail with a bounded 503 response.

🟡 A missing initial-admin login produces ambiguous bootstrap results — Only the numeric ID is required by getBootstrapStatus (hostedFleetRoutes.ts:123-127). If PROPR_HOSTED_INITIAL_ADMIN_GITHUB_LOGIN is absent, the endpoint returns 200 with all login-derived flags set to false, which is indistinguishable from valid configuration where the controls are inactive or contain additional users. Either validate the login as required, return an explicit initialAdminLoginConfigured field, or document this fail-closed behavior and test it.

🟢 Queue heartbeats collect unused historical counts — Fleet only returns waiting and active, but queueRoutes.ts:13-23 also requests completed, failed, and delayed counts on every call. A narrow Fleet collector using only the two required BullMQ calls would reduce recurring Redis work.

🟢 Authentication logic is duplicated across all three handlers — hostedFleetRoutes.ts:117-200 repeats the cache and authorization checks. A small route middleware would make it harder for future Fleet endpoints to omit either protection accidentally. The expected secret digest could also be precomputed once at route creation.

🟢 Document the hosted configuration contract more explicitly — .env.example:206-214 explains the activation secret but not the required format and purpose of the two initial-administrator variables, the resulting 409 behavior, or whether changing them requires a restart. This is important for operator-managed bootstrap automation.

🟢 Consider a standard bearer credential or explicit header-redaction guidance — A custom x-propr-fleet-secret header works, but observability and proxy products commonly redact Authorization automatically and may retain custom headers. If the custom header remains, deployment guidance should require it to be redacted from proxy/APM logs.

🟢 Avoid process-global console mutation in tests — Tests temporarily replace console.error (hostedFleetRoutes.test.ts:214-227, 334-348). This can suppress unrelated output if test concurrency changes. Injecting a logger or using a scoped mock would make the tests safer.

✅ Hosted routes are genuinely disabled by default — registerHostedFleetRoutes registers nothing unless the configured secret is at least 32 characters, and the Express wiring tests verify disabled routes fall through to normal OAuth protection.

✅ Credential checking and response handling are defensive — The implementation compares fixed-size SHA-256 digests with timingSafeEqual, consistently returns sanitized errors, and applies Cache-Control: no-store.

✅ 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.

Score

The 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

  • Model: GPT-5.6 Sol
  • Time: 4m 47s
  • Tokens: 54,032 (45,810 in / 8,222 out)
  • Cost: $0.43

View Task


💡 Next step: Comment /fix on this PR to have the AI automatically implement the suggestions above.
The /fix command gathers all unprocessed AI review comments and applies fixes in a single pass.
You can edit or delete review comments before running /fix to control which suggestions are applied.
Add extra instructions if needed, e.g. /fix only address the critical findings.

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Aug 2, 2026
Base automatically changed from feat/instance-admin-roles to main August 3, 2026 07:16
@integry

integry commented Sep 26, 2026

Copy link
Copy Markdown
Owner Author

/merge

@propr-dev

propr-dev Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🔀 Resolved merge conflicts from main into feat/hosted-fleet-api in commit c097f82

Conflicting Files

  • packages/api/routes/index.ts
  • packages/api/routes/queueRoutes.ts
  • packages/api/routes/statusRoutes.ts
  • packages/api/server.ts

Resolution Summary

Resolved all eight conflict blocks in the four requested files.

  • routes/index.ts: Both branches added route exports. Kept hosted fleet exports alongside all new exports from main, preserving both feature sets.
  • routes/queueRoutes.ts: The PR extracted a queue-count collector; main added active-job details, goal counts, and timing. Kept the numeric collector for fleet access and the richer HTTP response for UI compatibility.
  • routes/statusRoutes.ts: The PR extracted status collection while main changed health checks, caching, discovery, and notifications. Incorporated those updates into collectStatus(), retained cache invalidation and desktop discovery, and kept notification projection in the HTTP handler. This preserves fleet reuse and main’s behavior.
  • server.ts: Both branches changed imports and route initialization. Combined them and registered fleet endpoints before the shared authentication guard, preserving their service-secret authentication alongside main’s desktop/MCP registration, rate limiting, and notification wiring.

Verification passed: TypeScript syntax checks, API typecheck, all 67 focused tests, and git diff --check. The repository-wide scan found no remaining unresolved conflict markers; remaining matches are intentional literals and Markdown separators.


🤖 Resolution Details

  • Model: gpt-6-astra
  • Time: 3m 51s

View Task Execution


System-triggered merge conflict resolution

Automatically resolved merge conflicts after merging target branch into PR branch.
Resolved conflicts in:
- packages/api/routes/index.ts
- packages/api/routes/queueRoutes.ts
- packages/api/routes/statusRoutes.ts
- packages/api/server.ts

PR: #1714
Model: gpt-6-astra
@propr-dev

propr-dev Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

CI failed: CodeQL

Please investigate and fix this CI failure.

Failure evidence

packages/api/test/hostedFleetRoutes.test.ts:147 — Missing rate limiting
This route handler performs authorization, but is not rate-limited.
This route handler performs authorization, but is not rate-limited.
This route handler performs authorization, but is not rate-limited.
This route handler performs authorization, but is not rate-limited.

packages/api/test/hostedFleetRoutes.test.ts:147 — Missing rate limiting
This route handler performs authorization, but is not rate-limited.

@propr-dev

propr-dev Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ Applied the requested follow-up changes in commit c919784

Processed 2 comments:

  • Comment 1 by @github-advanced-security[bot] (ID: 4111160786✓)
  • Comment 2 by @github-advanced-security[bot] (ID: 4111160795✓)

Summary of Changes

Updated hostedFleetRoutes.test.ts to apply the production API rate limiter before Fleet and OAuth authentication. Added regression coverage for HTTP 429 responses across all three hosted endpoints with Fleet enabled and disabled.

Validation: 27 tests passed, typecheck passed, and git diff --check passed. No visual changes.


🤖 Implementation Details

  • Model: GPT-6 Astra (high)
  • Requested By: @github-advanced-security[bot]
  • Time: 3m 12s
  • Tokens: 346,206 (344,125 in / 2,081 out)
  • Cost: $0.84

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Implement fixes for issues found by /review /fix or /fix address the null check issue
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment IDs: 4111160786✓, 4111160795✓

@propr-dev

propr-dev Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ AI Code Review Complete requested by @integry

Posted 2 reviews:

View Task Details

@propr-dev

propr-dev Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🔍 AI Code Review — fable

Overall Evaluation

This PR adds three machine-to-machine GET /api/internal/hosted/* endpoints for ProPR Fleet, gated at startup on PROPR_FLEET_CONTROL_SECRET (≥32 chars) and authenticated per request via X-ProPR-Fleet-Secret. It exposes two collectors (collectStatus, collectQueueStats) from existing route factories and registers the hosted routes in server.ts ahead of the shared OAuth guard. The implementation is small, defensive, and well tested; current head checks are all green. The PR is ready to merge within scope, with a few optional follow-ups.

✅ Credential comparison is length-independent and constant-time — safeEqual in packages/api/routes/hostedFleetRoutes.ts hashes both sides with SHA-256 before timingSafeEqual, so a wrong-length header cannot throw or short-circuit, and isAuthorized additionally re-checks isHostedFleetControlEnabled(fleetSecret) so a directly constructed route set with a weak/undefined secret fails closed (verified by the missing/short/same-length test cases).

✅ Responses are strictly allowlisted — parseOperationalStatus and parseQueueStatus project the rich /api/status and queue snapshots down to four enum-validated strings and two non-negative safe integers respectively, returning a stable 503 on any shape mismatch. The tests confirm that routing.routingUrl, redis, completed/failed/delayed/total, and arbitrary extra keys never reach the wire, and that the configured login is absent from the bootstrap body.

✅ Disabled-state behavior is verified end-to-end — registerHostedFleetRoutes returns false and registers nothing when the secret is absent/short, and the Express wiring test proves the three paths then fall through to the generic guard's 401 Unauthorized, so no unauthenticated surface exists outside hosted instances (consistent with the "only enabled via env" request in the comment history).

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S1: 🟢 Confirm the general API limiter precedes hosted routes in server.ts

The wiring test installs createApiRequestRateLimiter() on /api before registerHostedFleetRoutes and calls that "production ordering", but the server.ts diff does not show where the general /api limiter is mounted, and the comment history includes CodeQL "missing rate limiting" alerts on these handlers. I could not verify from the supplied context whether setupMiddleware applies createApiRequestRateLimiter() before setupRoutes(). If it does, nothing is needed; if not, attaching a limiter explicitly in registerHostedFleetRoutes (as /api/compatibility does with createDiscoveryRequestRateLimiter()) would make the protection self-evident and independent of middleware order. Optional because current CodeQL at head passes and the test documents the intended ordering.

S2: 🟢 The demo-mode guard in getStatus is unrelated to this PR's objective

packages/api/routes/statusRoutes.ts now skips projectSystemSnapshot when isDemoMode(). This is reasonable (the demo snapshot is synthetic and demo users have no instance.manage_settings permission, so the projection was effectively a no-op), but it is not mentioned in the PR description and is unrelated to Fleet routes. Consider noting it in the description or splitting it so the behavior change is discoverable in history.

S3: 🟢 collectStatus duplicates existing exports

createStatusRoutes already returns readStatusSnapshot and getStatusSnapshot (the same function); server.ts itself calls statusRoutes.getStatusSnapshot() a few lines above the new registration. Adding a third alias collectStatus increases the surface without adding behavior. Reusing readStatusSnapshot in registerHostedFleetRoutes(...) and dropping the alias would keep the factory contract tighter.

S4: 🟢 Log a startup notice when Fleet control is misconfigured

If PROPR_FLEET_CONTROL_SECRET is set but shorter than 32 characters (or carries stray whitespace from a provisioning template), registerHostedFleetRoutes silently returns false and Fleet verification will fail with a generic 401 Unauthorized from the OAuth guard, which is hard to diagnose remotely. Similarly, when the secret is valid but PROPR_HOSTED_INITIAL_ADMIN_GITHUB_USER_ID is unset or non-canonical, the bootstrap route only reveals this at request time via 409. A single console.warn at startup in each case (without printing values) would shorten operator debugging. Optional hardening; the fail-closed behavior itself is correct.

S5: 🟢 .env.example guidance vs. active empty lines

The new comment says "Leave all three unset outside operator-managed hosted instances", yet the three variables are added as active KEY= lines. Empty strings are treated as unset by the gate, so this is functionally fine and matches SYSTEM_TASK_SECRET=, but other per-install secrets in this file (relay token, tunnel token) are deliberately commented out so an unedited copy is not mistaken for a configured value. Commenting these three out would be consistent with that convention.

Score

No PR-introduced defects were found; authentication, response allowlisting, startup gating, and failure paths are implemented carefully and covered by unit and Express-level tests, and all current head checks pass. The only open item is a verification gap on limiter placement in server.ts that the supplied diff does not resolve.

Score: 8/10


🤖 Review Details

  • Model: Claude Fable 5.1
  • Time: 1m 31s
  • Tokens: 71,131 (64,907 in / 6,224 out)
  • Cost: $1.12

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S1 S2 S3 S4 S5

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🔍 AI Code Review — astra

Overall Evaluation

Ready to merge within the reviewed scope. The PR adds narrowly scoped Fleet endpoints with dedicated authentication and explicit response filtering. The authoritative current-head checks report 30 passed and no failures or pending checks. This assessment is based on static review; no commands were run.

✅ Controlled activation — Route registration is skipped unless the Fleet secret meets the minimum length, and enabled handlers authenticate before accessing collectors or the database.

✅ Restricted disclosure — Responses explicitly allowlist fields, exclude login snapshots and sensitive operational details, and set Cache-Control: no-store.

✅ Durable identity verification — Bootstrap verification queries the configured GitHub ID and administrator role, with tests covering renamed owners, different administrators, and database failures.

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S6: 🟢 Collect only necessary queue counts

packages/api/routes/queueRoutes.ts:collectQueueStats fetches completed, failed, and delayed counts even though the Fleet response retains only waiting and active counts. Restricting this collector to the two consumed values would reduce Redis operations and unnecessary failure dependencies. This is an optional efficiency improvement; the current response remains correctly filtered.

S7: 🟢 Reconcile the identity range contract

packages/api/routes/hostedFleetRoutes.ts:canonicalizeGithubUserId intentionally accepts decimal strings beyond JavaScript’s safe-integer range, and the new tests explicitly preserve that behavior. This differs from the original objective’s safe-integer wording, but the supplied durable identity schema stores IDs as text and this lookup performs no numeric conversion. Documenting the string-based contract would clarify the intentional distinction without requiring a runtime change.

Score

The implementation provides focused authentication, disclosure controls, and substantial coverage of success and refusal paths. Static review found no demonstrated merge blocker, and all current-head checks are passing or skipped.

Score: 9/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 29s
  • Tokens: 51,335 (50,706 in / 629 out)
  • Cost: $0.43

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S6 S7

🤖 Review by ProPR

@integry

integry commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

/fix all

@propr-dev

propr-dev Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ Applied the requested follow-up changes in commit 2a76c40

Addressed 2 AI review comments (IDs: 5991917920, 5991925695)

Addressed suggestions S1, S2, S3, S4, S5, S6, S7

Summary of Changes

I've applied S1–S7. All 19 hosted Fleet route tests pass, statusRoutes and requestRateLimits pass (54/54), and npm run typecheck and git diff --check are clean.

  • S1 (rate limiter order): The general limiter is already in place. server.ts:244 mounts app.use('/api', createApiRequestRateLimiter()) when the module loads, and setupRoutes() (which registers the hosted routes) only runs later inside start(). So I didn't add a second limiter. I added a comment at the registration saying this, and a test that reads server.ts and fails if the limiter ever moves after the setupRoutes() call.

  • S2 (demo-mode guard): History shows the isDemoMode() guard in getStatus came in through an automated merge-conflict resolution (c097f8278), not from this PR's own work. I took it out of this PR rather than editing the PR description, so statusRoutes.ts now only differs from main by what Fleet needs. If you want the demo guard, it should go in its own change.

  • S3 (duplicate alias): Removed the collectStatus alias. server.ts and the wiring test now use the existing statusRoutes.readStatusSnapshot.

  • S4 (startup warnings): registerHostedFleetRoutes now logs a console.warn at startup, naming the variable but never its value, when:

    • PROPR_FLEET_CONTROL_SECRET is set but shorter than 32 characters (the routes stay off).
    • the secret has leading or trailing whitespace. HTTP header values are trimmed in transit, so a padded secret could never match and every request would get a 401.
    • PROPR_HOSTED_INITIAL_ADMIN_GITHUB_USER_ID is unset or invalid.

    A new test covers each case, checks that an unset secret and a valid configuration log nothing, and checks that no logged message contains a configured value.

  • S5 (.env.example): The three variables are now commented out, the same way the relay and tunnel tokens are.

  • S6 (queue counts): collectQueueStats now fetches only the waiting and active counts. In the wiring test, the completed, failed and delayed counters now throw if called, so the test fails if they're read again.

  • S7 (ID range): Added a doc comment on canonicalizeGithubUserId explaining that IDs are handled as decimal strings: the durable column is text and is never converted to a number, so IDs larger than JavaScript's safe-integer limit are kept intact. No runtime change.

node_modules was missing in the container, so I ran the repo's own npm ci && npm run test:prepare before testing; no setup files changed. These changes aren't visible in the UI, so there are no previews.

Other things I noticed: none.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @integry
  • Time: 3m 9s
  • Tokens: 991,822 (983,192 in / 8,630 out)
  • Cost: $0.61

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 5991938265✓

…statusRoutes` and `requestRateLimits` pass (54/54), and `npm run typecheck` and `git diff --check` are clean.

I've applied S1–S7. All 19 hosted Fleet route tests pass, `statusRoutes` and `requestRateLimits` pass (54/54), and `npm run typecheck` and `git diff --check` are clean.

- **S1 (rate limiter order):** The general limiter is already in place. `server.ts:244` mounts `app.use('/api', createApiRequestRateLimiter())` when the module loads, and `setupRoutes()` (which registers the hosted routes) only runs later inside `start()`. So I didn't add a second limiter. I added a comment at the registration saying this, and a test that reads `server.ts` and fails if the limiter ever moves after the `setupRoutes()` call.
- **S2 (demo-mode guard):** History shows the `isDemoMode()` guard in `getStatus` came in through an automated merge-conflict resolution (`c097f8278`), not from this PR's own work. I took it out of this PR rather than editing the PR description, so `statusRoutes.ts` now only differs from `main` by what Fleet needs. If you want the demo guard, it should go in its own change.
- **S3 (duplicate alias):** Removed the `collectStatus` alias. `server.ts` and the wiring test now use the existing `statusRoutes.readStatusSnapshot`.
- **S4 (startup warnings):** `registerHostedFleetRoutes` now logs a `console.warn` at startup, naming the variable but never its value, when:
  - `PROPR_FLEET_CONTROL_SECRET` is set but shorter than 32 characters (the routes stay off).
  - the secret has leading or trailing whitespace. HTTP header values are trimmed in transit, so a padded secret could never match and every request would get a 401.
  - `PROPR_HOSTED_INITIAL_ADMIN_GITHUB_USER_ID` is unset or invalid.

  A new test covers each case, checks that an unset secret and a valid configuration log nothing, and checks that no logged message contains a configured value.
- **S5 (`.env.example`):** The three variables are now commented out, the same way the relay and tunnel tokens are.
- **S6 (queue counts):** `collectQueueStats` now fetches only the waiting and active counts. In the wiring test, the completed, failed and delayed counters now throw if called, so the test fails if they're read again.
- **S7 (ID range):** Added a doc comment on `canonicalizeGithubUserId` explaining that IDs are handled as decimal strings: the durable column is text and is never converted to a number, so IDs larger than JavaScript's safe-integer limit are kept intact. No runtime change.

`node_modules` was missing in the container, so I ran the repo's own `npm ci && npm run test:prepare` before testing; no setup files changed. These changes aren't visible in the UI, so there are no previews.

**Other things I noticed:** none.

PR: #1714
Comment by: @integry (ID: 5991938265)
Model: claude-opus-5-5
@integry

integry commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

/review fable astra

@propr-dev

propr-dev Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ AI Code Review Complete requested by @integry

Posted 2 reviews:

View Task Details

@propr-dev

propr-dev Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🔍 AI Code Review — fable

Overall Evaluation

This PR adds three machine-to-machine GET /api/internal/hosted/* endpoints (bootstrap, status, queue) for ProPR Fleet, gated by a ≥32-character PROPR_FLEET_CONTROL_SECRET, registered in setupRoutes() ahead of registerDesktopApiBoundary's shared OAuth guard but after the module-level /api rate limiter. The routes return strictly allowlisted fields, never echo the configured login, and read durable admin state by canonical numeric GitHub ID string. The accompanying queueRoutes.collectQueueStats helper and the createQueueRoutes hoist in server.ts are behavior-neutral refactors.

I traced the registration order in packages/api/server.ts (prohibitApiResponseCaching → CORS → /api limiter → express.json → demo read-only middleware → setupAuth → /api/compatibility → registerHostedFleetRoutes → mountMcp → registerDesktopApiBoundary guard), the authorization path in hostedFleetRoutes.ts, the input canonicalization, the allowlist parsers against the actual value spaces produced by statusRoutes.ts (resolveAuthMode, resolveIntakeMode, resolveIntakeStatus), and the failure/refusal paths (401 / 409 / 503, all with Cache-Control: no-store and no backend detail leakage). I found no PR-introduced correctness or security defect. The PR is merge-ready within scope, conditional on the currently pending Validate Changes / test-shard checks completing green.

✅ Fail-closed activation and credential handling — registerHostedFleetRoutes returns without registering anything unless isHostedFleetControlEnabled passes; safeEqual hashes both sides with SHA-256 before timingSafeEqual, so length mismatch cannot short-circuit, and startup warnings name variables only (verified by the test that asserts no secret/ID values appear in console.warn output).

✅ Strict response allowlisting with matching value spaces — parseOperationalStatus and parseQueueStatus rebuild fresh objects from enumerated/validated fields; the enumerated mode/status sets match exactly what resolveAuthMode, resolveIntakeStatus, and the demo-mode snapshot in statusRoutes.ts can produce, so the allowlist will not spuriously 503 in any legitimate configuration.

✅ Meaningful wiring tests — hostedFleetRoutes.test.ts exercises real Express with the production limiter, ensureAuthenticated, and resolveAuthorization, verifying both the disabled path (routes absent → generic 401 Unauthorized) and the enabled path (Fleet 401 vs 200 with allowlisted keys), plus rate limiting ahead of Fleet auth.

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S8: 🟢 Replace source-text ordering test with a behavioral check

packages/api/test/hostedFleetRoutes.test.ts ("server mounts the general /api limiter before setupRoutes…") asserts middleware ordering by indexOf over the raw text of server.ts. This will break on harmless reformatting (e.g. a changed indentation of setupRoutes(); or a line-wrapped limiter call) and can pass while being wrong if the limiter line is moved inside a function body that appears textually earlier. The adjacent wiredApp test already demonstrates the behavioral property; consider dropping the text scan or extracting the module-level middleware stack into a factory that tests can mount directly. Optional because the current test is correct for the code as written.

S9: 🟢 Decide between trimming or refusing a whitespace-padded secret

registerHostedFleetRoutes warns when PROPR_FLEET_CONTROL_SECRET has leading/trailing whitespace but still registers routes that can never authenticate (every request 401s). Fleet treats this as failed verification, so it is safe, but an operator debugging it sees an enabled surface that silently rejects everything. Either trimming the configured value before the length check and comparison, or refusing startup/registration with a clear error, would make the failure mode more obvious. Not required for merge since the current behavior fails closed and is logged.

S10: 🟢 Document the startup snapshot of bootstrap/whitelist inputs

createHostedFleetRoutes captures PROPR_ADMIN_USERS, GITHUB_USER_WHITELIST, and PROPR_HOSTED_INITIAL_ADMIN_GITHUB_LOGIN once at route creation, whereas durableAdminVerified and the status/queue collectors are read live per request. That is consistent with how env-driven configuration is treated elsewhere, but Fleet's "bootstrap controls can be removed" decision depends on the snapshot, so the Fleet-side contract should note that bootstrapOnlyInitialOwner / whitelistOnlyInitialOwner / environmentBootstrapActive reflect the environment at the instance's last restart. Documentation-only; no code change needed.

S11: 🟢 Align the PR description with the ID validation actually implemented

The description says the initial admin ID is validated "as a positive safe integer", but canonicalizeGithubUserId deliberately accepts up to 20 decimal digits (beyond Number.MAX_SAFE_INTEGER) as a string, and a test asserts 9007199254740993 is preserved. The code's choice is the better one given the text primary key in instance_members; the description and the .env.example comment should say "positive decimal integer (string, up to 20 digits)" so operators and the Fleet side do not add an unnecessary safe-integer constraint.

S12: 🟢 Consider a dedicated limiter or peer restriction for the Fleet surface

The handlers rely on the shared /api limiter (600/min per client) mounted at module load, and the tests prove it applies. CodeQL's "missing rate limiting" alerts will likely persist because the analyzer does not see the global app.use as covering these handlers. Adding a route-local limiter (as /api/compatibility does with createDiscoveryRequestRateLimiter()), or an optional trusted-peer allowlist for /api/internal/hosted/*, would both silence the alert and tighten the credential-guessing budget for a secret-only endpoint. Optional: the existing protection is real and the secret is ≥32 characters.

Score

No verified blockers; the changed behavior is correct, fail-closed, well-tested at both unit and Express-wiring levels, and consistent with the stated objective. Merge readiness is conditional only on the pending Validate Changes and test-shard checks finishing green.

Score: 8/10


🤖 Review Details

  • Model: Claude Fable 5.1
  • Time: 1m 47s
  • Tokens: 79,788 (70,936 in / 8,852 out)
  • Cost: $1.33

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S8 S9 S10 S11 S12

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🔍 AI Code Review — astra

Overall Evaluation

The PR adds narrowly scoped Fleet endpoints with dedicated authentication, durable administrator verification, and bounded health responses. It is merge-ready within the reviewed scope, conditional on the seven pending checks completing successfully. Review was static; no commands or tests were run.

✅ Protected registration — Routes require a sufficiently long configured secret, run behind the general API limiter, and authenticate before invoking collectors.

✅ Minimal disclosure — Responses explicitly allowlist fields, omit the login snapshot and backend error details, and disable caching.

✅ Durable identity verification — Bootstrap verification queries the configured GitHub ID and administrator role rather than trusting a mutable username.

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S13: 🟢 Document the final identity contract

packages/api/routes/hostedFleetRoutes.ts deliberately accepts canonical decimal strings beyond JavaScript’s safe-integer range, whereas the original objective describes positive safe integers. Document the implemented range and string response type for Fleet consumers. The lookup preserves precision against the text database column, so this documentation discrepancy does not demonstrate a correctness blocker.

S14: 🟢 Consider a narrower health collector

The Fleet status endpoint uses readStatusSnapshot, which also awaits agent health, indexing, and warning collectors before returning four GitHub-related fields. A dedicated collector could reduce heartbeat work and dependencies. This is an optional performance and resilience improvement; the supplied code does not demonstrate a resulting failure.

Score

The changed implementation provides strong authentication boundaries, conservative response validation, and substantial targeted coverage. No verified blocker or current-head check failure remains; seven checks are pending.

Score: 9/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 27s
  • Tokens: 54,001 (53,499 in / 502 out)
  • Cost: $0.45

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S13 S14

🤖 Review by ProPR

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

Checks Failed

Validation failed during setup, tests, CLI packaging, linting, or build checks.

View Logs
Build check diagnostics for run 37292023053, attempt 1
Checkout outcome: success

--- GitHub Actions workflow lint ---
docker.io/rhysd/actionlint@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667: Pulling from rhysd/actionlint
589002ba0eae: Pulling fs layer
c09af8888d6a: Pulling fs layer
4ccd7d76ca98: Pulling fs layer
b6b4b7b0e257: Pulling fs layer
b6b4b7b0e257: Waiting
c09af8888d6a: Verifying Checksum
c09af8888d6a: Download complete
589002ba0eae: Verifying Checksum
589002ba0eae: Download complete
4ccd7d76ca98: Verifying Checksum
4ccd7d76ca98: Download complete
589002ba0eae: Pull complete
b6b4b7b0e257: Verifying Checksum
b6b4b7b0e257: Download complete
c09af8888d6a: Pull complete
4ccd7d76ca98: Pull complete
b6b4b7b0e257: Pull complete
Digest: sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667
Status: Downloaded newer image for rhysd/actionlint@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667
docker.io/rhysd/actionlint@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667

--- Release shell script lint ---

--- Toolchain ---
v22.23.3
10.9.9

--- Dependency installation ---
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated [email protected]: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]

added 1120 packages, and audited 1129 packages in 17s

322 packages are looking for funding
  run `npm fund` for details

8 high severity vulnerabilities

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.

--- CLI release package ---
Verifying propr-cli release package...

> [email protected] cli:pack
> node packages/cli/scripts/build-publish.mjs


> @propr/[email protected] build
> tsc


> @propr/[email protected] build
> tsc


> @propr/[email protected] build
> tsc && node scripts/copy-assets.mjs

copy-assets: copied 9 file(s) into the CLI package.

Staged [email protected] at /home/runner/work/propr/propr/dist-publish/propr-cli
npm notice
npm notice 📦  [email protected]
npm notice Tarball Contents
npm notice 26.0kB README.md
npm notice 36.3kB dist/agentSkill.js
npm notice 754B dist/api/agentRuntime.js
npm notice 7.1kB dist/api/agents.js
npm notice 2.6kB dist/api/agentTank.js
npm notice 10.9kB dist/api/client.js
npm notice 4.7kB dist/api/errors.js
npm notice 10.1kB dist/api/goals.js
npm notice 5.4kB dist/api/implement.js
npm notice 2.3kB dist/api/index.js
npm notice 1.9kB dist/api/logs.js
npm notice 5.7kB dist/api/plans.js
npm notice 4.2kB dist/api/relay.js
npm notice 10.4kB dist/api/repos.js
npm notice 11.4kB dist/api/settings.js
npm notice 1.6kB dist/api/syntheticPools.js
npm notice 1.8kB dist/api/system.js
npm notice 5.8kB dist/api/tasks.js
npm notice 2.9kB dist/api/todos.js
npm notice 86B dist/api/types.js
npm notice 313B dist/api/visualPreviewAuth.js
npm notice 26.5kB dist/assets/env.example.txt
npm notice 5.7kB dist/auth/githubLogin.js
npm notice 19.5kB dist/commands/agentCommands.js
npm notice 4.2kB dist/commands/agentPoolCommands.js
npm notice 4.3kB dist/commands/agentSkillCommands.js
npm notice 28.7kB dist/commands/agentValidation.js
npm notice 66.7kB dist/commands/checkCommands.js
npm notice 8.9kB dist/commands/configCommands.js
npm notice 14.6kB dist/commands/connectCommand.js
npm notice 5.5kB dist/commands/githubAppApi.js
npm notice 27.7kB dist/commands/githubAppCommands.js
npm notice 47.7kB dist/commands/goalCommands.js
npm notice 2.4kB dist/commands/imageCommands.js
npm notice 7.2kB dist/commands/implementCommands.js
npm notice 1.7kB dist/commands/index.js
npm notice 6.0kB dist/commands/initCommands.js
npm notice 14.1kB dist/commands/initStack.js
npm notice 6.1kB dist/commands/logCommands.js
npm notice 24.9kB dist/commands/planCommands.js
npm notice 8.4kB dist/commands/relayCommands.js
npm notice 30.1kB dist/commands/repoCommands.js
npm notice 7.5kB dist/commands/runtimeCommands.js
npm notice 16.5kB dist/commands/settingCommands.js
npm notice 4.1kB dist/commands/setup/agentHostActions.js
npm notice 123B dist/commands/setup/agents.js
npm notice 4.5kB dist/commands/setup/engine.js
npm notice 51B dist/commands/setup/github.js
npm notice 15.3kB dist/commands/setup/hostActions.js
npm notice 27.3kB dist/commands/setup/sequential.js
npm notice 51B dist/commands/setup/state.js
npm notice 51B dist/commands/setup/types.js
npm notice 10.7kB dist/commands/setupCommand.js
npm notice 4.4kB dist/commands/stackCommands.js
npm notice 1.4kB dist/commands/startCommand.js
npm notice 13.5kB dist/commands/systemCommands.js
npm notice 3.5kB dist/commands/tankCommands.js
npm notice 43.2kB dist/commands/taskCommands.js
npm notice 29.6kB dist/commands/todoCommands.js
npm notice 31.0kB dist/commands/tunnelCommand.js
npm notice 2.7kB dist/commands/uiDocsCommands.js
npm notice 8.3kB dist/completion.js
npm notice 20.0kB dist/config/ConfigManager.js
npm notice 276B dist/config/index.js
npm notice 989B dist/config/rootKey.js
npm notice 345B dist/config/types.js
npm notice 42.9kB dist/connectIdentity.js
npm notice 25.0kB dist/connectRootAuthority.js
npm notice 32.5kB dist/connectWindowsAuthority.js
npm notice 2.2kB dist/desktopDiscovery.js
npm notice 12.4kB dist/desktopLocalSetup.js
npm notice 16.7kB dist/index.js
npm notice 4.5kB dist/native/darwin-authority-broker.c
npm notice 8.9kB dist/native/directory-operations.c
npm notice 50.1kB dist/native/prebuilds/darwin-arm64/connect-authority-broker
npm notice 54.2kB dist/native/prebuilds/darwin-arm64/directory-operations.node
npm notice 17.1kB dist/native/prebuilds/darwin-x64/connect-authority-broker
npm notice 24.3kB dist/native/prebuilds/darwin-x64/directory-operations.node
npm notice 28.9kB dist/native/prebuilds/linux-arm64/directory-operations.node
npm notice 17.4kB dist/native/prebuilds/linux-x64/directory-operations.node
npm notice 1.2kB dist/native/README.md
npm notice 3.1kB dist/orchestrator/format.js
npm notice 13.4kB dist/orchestrator/index.js
npm notice 302B dist/orchestrator/manifest.json
npm notice 118.3kB dist/orchestrator/orchestrator.mjs
npm notice 408B dist/orchestrator/types.js
npm notice 237B dist/skill/propr/agents/openai.yaml
npm notice 8.7kB dist/skill/propr/SKILL.md
npm notice 4.5kB dist/tui/AgentTableApp.js
npm notice 4.5kB dist/tui/app.js
npm notice 11.6kB dist/tui/CheckApp.js
npm notice 5.1kB dist/tui/render.js
npm notice 32.5kB dist/tui/SetupApp.js
npm notice 18.4kB dist/tui/SetupApp.test.js
npm notice 8.2kB dist/tui/StartApp.js
npm notice 3.6kB dist/utils/apiErrorPresentation.js
npm notice 12.0kB dist/utils/directoryDescriptor.js
npm notice 739B dist/utils/dockerPort.js
npm notice 5.0kB dist/utils/envFile.js
npm notice 520B dist/utils/index.js
npm notice 5.7kB dist/utils/io.js
npm notice 1.5kB dist/utils/nativeArtifact.js
npm notice 544B dist/utils/parseState.js
npm notice 417B dist/utils/positiveInteger.js
npm notice 4.5kB dist/utils/privateFilesystem.js
npm notice 4.2kB dist/utils/resolveProject.js
npm notice 7.2kB dist/vendor/local-setup/agents.js
npm notice 62.7kB dist/vendor/local-setup/engine.js
npm notice 5.0kB dist/vendor/local-setup/envFile.js
npm notice 9.1kB dist/vendor/local-setup/github.js
npm notice 188B dist/vendor/local-setup/index.js
npm notice 27.0kB dist/vendor/local-setup/publicInstanceIdentity.js
npm notice 14.6kB dist/vendor/local-setup/state.js
npm notice 2.8kB dist/vendor/local-setup/types.js
npm notice 1.0kB dist/vendor/shared/accountStatusTimestamp.js
npm notice 7.6kB dist/vendor/shared/activityEvents.js
npm notice 3.4kB dist/vendor/shared/agentLogin.js
npm notice 3.1kB dist/vendor/shared/agentTank.js
npm notice 1.8kB dist/vendor/shared/analyticsTimeframe.js
npm notice 2.0kB dist/vendor/shared/antigravityCompatibility.js
npm notice 5.1kB dist/vendor/shared/apiOrigin.js
npm notice 8.5kB dist/vendor/shared/connectDiscovery.js
npm notice 254B dist/vendor/shared/demoMode.js
npm notice 4.3kB dist/vendor/shared/desktopPairing.js
npm notice 481B dist/vendor/shared/desktopTokenRevocation.js
npm notice 8.9kB dist/vendor/shared/events.js
npm notice 2.5kB dist/vendor/shared/githubAppManifest.js
npm notice 1.6kB dist/vendor/shared/githubAuthMode.js
npm notice 2.0kB dist/vendor/shared/githubEventIntakeMode.js
npm notice 11.6kB dist/vendor/shared/goalBlockers.js
npm notice 6.0kB dist/vendor/shared/goalCheckpoints.js
npm notice 4.0kB dist/vendor/shared/goalCreation.js
npm notice 11.5kB dist/vendor/shared/index.js
npm notice 214B dist/vendor/shared/instanceAuthorization.js
npm notice 54B dist/vendor/shared/instanceCatalog.js
npm notice 4.0kB dist/vendor/shared/intakeModePrerequisites.js
npm notice 2.9kB dist/vendor/shared/labelUtils.js
npm notice 16.6kB dist/vendor/shared/modelDefinitions.js
npm notice 3.5kB dist/vendor/shared/notificationLinks.js
npm notice 51.3kB dist/vendor/shared/notifications.js
npm notice 866B dist/vendor/shared/projectSlug.js
npm notice 3.8kB dist/vendor/shared/proprCompatibility.js
npm notice 13.0kB dist/vendor/shared/proprServiceUrls.js
npm notice 2.2kB dist/vendor/shared/publishedVisualPreviews.js
npm notice 2.6kB dist/vendor/shared/reasoningLevels.js
npm notice 1.2kB dist/vendor/shared/repositoryIcon.js
npm notice 1.4kB dist/vendor/shared/repositoryIconUrl.js
npm notice 3.7kB dist/vendor/shared/repositoryPresentation.js
npm notice 9.5kB dist/vendor/shared/reviewContextBudget.js
npm notice 5.8kB dist/vendor/shared/reviewFeedbackIds.js
npm notice 1.7kB dist/vendor/shared/reviewPrompt.js
npm notice 861B dist/vendor/shared/sessionSecret.js
npm notice 603B dist/vendor/shared/statusKeys.js
npm notice 7.5kB dist/vendor/shared/syntheticAgents.js
npm notice 2.2kB dist/vendor/shared/taskIdentifiers.js
npm notice 1.5kB dist/vendor/shared/taskLifecycle.js
npm notice 5.6kB dist/vendor/shared/usageTips.js
npm notice 503B dist/vendor/shared/usageTypes.js
npm notice 1.1kB dist/vendor/shared/userWhitelist.js
npm notice 758B dist/vendor/shared/validateRelayUrl.js
npm notice 2.2kB dist/vendor/shared/validateRoutingUrl.js
npm notice 7.1kB dist/vendor/shared/visualPreviewCapacity.js
npm notice 9.3kB dist/vendor/shared/voice.js
npm notice 222B dist/vendor/shared/workEvidence.js
npm notice 622B package.json
npm notice Tarball Details
npm notice name: propr-cli
npm notice version: 0.9.0
npm notice filename: propr-cli-0.9.0.tgz
npm notice package size: 415.9 kB
npm notice unpacked size: 1.7 MB
npm notice shasum: 00e965c5b950b6863e2969561c257a773c4d6ea2
npm notice integrity: sha512-kFetEEb+OSyLa[...]EjEyF/hh2xdsQ==
npm notice total files: 165
npm notice
propr-cli-0.9.0.tgz

Dry run only. Re-run with --publish to publish to npm.
✅ propr-cli release package verified
Starting changed-area validation process...
Reusing this job's @propr/shared build from CLI packaging.
Reusing this job's @propr/local-setup build from CLI packaging.

--- Core Service: Lint & Build ---
✅ Core Lint passed
✅ Core Source Build passed

--- UI: Typecheck, Lint & Build ---
✅ Client Package validation passed
✅ UI Typecheck passed
✅ UI Lint passed
✅ UI Build passed

--- Docs: Typecheck & Build ---
✅ Docs Typecheck passed
✅ Docs Build passed

--- Core Package: Build & Lint ---
✅ Core Package Build passed
✅ Core Package Lint passed

--- CLI: Lint ---
✅ CLI Lint passed

--- API: Build & Lint ---
✅ API Build passed
❌ API Lint FAILED

> @propr/[email protected] lint
> eslint . --max-warnings 0


/home/runner/work/propr/propr/packages/api/test/hostedFleetRoutes.test.ts
  441:1  warning  File has too many lines (447). Maximum allowed is 400  max-lines

✖ 1 problem (0 errors, 1 warning)

ESLint found too many warnings (maximum: 0).
npm error Lifecycle script `lint` failed with error:
npm error code 1
npm error path /home/runner/work/propr/propr/packages/api
npm error workspace @propr/[email protected]
npm error location /home/runner/work/propr/propr/packages/api
npm error command failed
npm error command sh -c eslint . --max-warnings 0

--- Stage outcomes ---
Workflow lint: success
Release shell lint: success
Pre-setup gate: skipped
Node setup: success
Toolchain: success
Dependency install: success
Release metadata: success
CLI packaging: success
Change detection: success
Changed-area checks: failure

View Workflow

@propr-dev

propr-dev Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

CI failed: Validate Changes

Please investigate and fix this CI failure.

Failure evidence

.github:8
Process completed with exit code 1.

.github:360
Process completed with exit code 1.

.github:405 — 🎭 Playwright Run Summary
179 passed (8.4m)

@propr-dev

propr-dev Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ Applied the requested follow-up changes in commit 4171b6c

Processed 2 comments:

  • Comment 1 by @github-actions[bot] (ID: 5992179463✓)
  • Comment 2 by @propr-dev[bot] (ID: 5992179753✓)

Summary of Changes

I fixed the failing API lint check. packages/api/test/hostedFleetRoutes.test.ts was 447 lines once blank lines and comments are left out, over the 400-line max-lines limit, so I split it into two files. No tests changed; they only moved.

  • packages/api/test/hostedFleetRoutes.test.ts keeps the bootstrap-status and health-status tests and their helpers.
  • packages/api/test/hostedFleetRoutesWiring.test.ts (new) holds the "hosted fleet Express wiring" tests, with the helpers only they use (fetchFromApp, wiredApp). It has its own copy of the in-memory database setup and teardown.

Checks run locally:

  • All 19 hosted Fleet route tests pass across the two files.
  • eslint --max-warnings 0 is clean on both files, and the full @propr/api lint passes.
  • npm run typecheck and git diff --check are clean.

Neither file is named in a package.json test script, so the suite should pick up the new file the same way it found the original. I didn't confirm that against the CI runner. There's nothing visual in this change, so no previews were created.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @github-actions[bot], @propr-dev[bot]
  • Time: 1m 34s
  • Tokens: 481,057 (478,107 in / 2,950 out)
  • Cost: $0.35

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment IDs: 5992179463✓, 5992179753✓

…edFleetRoutes.test.ts` was 447 lines once blank lines and comments are left out, over the 400-line `max-lines` limit, so I split it into two files. No tests changed; they only moved.

I fixed the failing API lint check. `packages/api/test/hostedFleetRoutes.test.ts` was 447 lines once blank lines and comments are left out, over the 400-line `max-lines` limit, so I split it into two files. No tests changed; they only moved.

- **`packages/api/test/hostedFleetRoutes.test.ts`** keeps the bootstrap-status and health-status tests and their helpers.
- **`packages/api/test/hostedFleetRoutesWiring.test.ts`** (new) holds the "hosted fleet Express wiring" tests, with the helpers only they use (`fetchFromApp`, `wiredApp`). It has its own copy of the in-memory database setup and teardown.

**Checks run locally:**
- All 19 hosted Fleet route tests pass across the two files.
- `eslint --max-warnings 0` is clean on both files, and the full `@propr/api` lint passes.
- `npm run typecheck` and `git diff --check` are clean.

Neither file is named in a `package.json` test script, so the suite should pick up the new file the same way it found the original. I didn't confirm that against the CI runner. There's nothing visual in this change, so no previews were created.

PR: #1714
Comment by: @github-actions[bot] (ID: 5992179463)
Comment by: @propr-dev[bot] (ID: 5992179753)
Model: claude-opus-5-5
@integry

integry commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

/review fable astra

@propr-dev

propr-dev Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ AI Code Review Complete requested by @integry

Posted 2 reviews:

View Task Details

@propr-dev

propr-dev Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🔍 AI Code Review — fable

Overall Evaluation

This PR adds three GET endpoints under /api/internal/hosted/* that let ProPR Fleet verify Hosted bootstrap state and collect bounded operational/queue health, authenticated by a dedicated X-ProPR-Fleet-Secret service credential rather than the customer OAuth session. The implementation is small, well-scoped, and addresses the two prior review concerns: registration is now a no-op unless PROPR_FLEET_CONTROL_SECRET is ≥32 characters (registerHostedFleetRoutes returns false and installs nothing), and the routes sit behind the module-level /api limiter, which CodeQL now accepts. Secret comparison hashes both sides before timingSafeEqual, so no length oracle exists. All response bodies are allowlisted (four status strings validated against closed sets; two non-negative safe-integer queue counts), and the configured login is never returned. Current head checks are all green, and the two new test files exercise credential rejection, ID canonicalization, pending/verified/wrong-admin claim states, collector failures, startup warnings (asserting no secret/ID values leak into logs), limiter ordering, and the disabled-path 401 from the shared guard.

I traced the Express ordering in server.ts: registerHostedFleetRoutes runs after app.use('/api', createApiRequestRateLimiter()) (module load) and before registerDesktopApiBoundary installs ensureAuthenticated/resolveAuthorization, so authenticated Fleet requests terminate in the handler and never reach the OAuth guard, while unauthenticated-but-disabled requests fall through to the normal 401. Demo mode is safe: createDemoTaskQueue provides getWaitingCount/getActiveCount. I found no merge-blocking defect.

✅ Fail-closed activation gate — registerHostedFleetRoutes returns without calling app.get when the secret is absent/short, and the wiring test proves every hosted path then yields the standard { error: 'Unauthorized' } from the shared guard rather than any fleet-specific response.

✅ Strict output allowlisting — parseOperationalStatus/parseQueueStatus re-validate collector output against closed value sets and reject anything else with a stable 503, so a future change to getStatusSnapshot (e.g., routing URL, agent inventory, redis state) cannot leak through this surface; the test sanitizes invalid collector results… confirms this.

✅ ID handling matches the durable schema — canonicalizeGithubUserId keeps IDs as decimal strings (never Number), matching the text primary key in instance_members, and the 9007199254740993 test proves IDs beyond MAX_SAFE_INTEGER round-trip intact.

The PR is ready to merge within scope.

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S15: 🟢 Reject whitespace-padded secrets instead of warning

isHostedFleetControlEnabled measures the raw string, so a value like 31 non-space characters plus a trailing newline enables the routes while registerHostedFleetRoutes (packages/api/routes/hostedFleetRoutes.ts) only warns that authentication "will fail". Since Node strips OWS from header values, such a secret can never authenticate; treating it as disabled (or trimming before the length check and comparison) would make the gate's behavior match the warning. This fails closed today, so it is optional.

S16: 🟢 Log an explicit "enabled" notice at startup

Registration logs only misconfiguration cases. When the secret is valid there is no startup line indicating that /api/internal/hosted/* is live, which makes operator audits of a tenant harder (the only evidence is the absence of warnings). A single console.log naming the paths (never the value) would help Fleet/Ansible debugging. Not required for correctness.

S17: 🟢 Source-text ordering test is brittle

hostedFleetRoutesWiring.test.ts asserts limiter ordering by indexOf on literal substrings of server.ts ("app.use('/api', createApiRequestRateLimiter());", ' setupRoutes();'). Any innocuous formatting change (quote style, indentation, a wrapped argument) will fail this test without any behavioral regression. The Express-level test above it already proves the behavior; consider dropping the source-text test or asserting via a small exported ordering helper instead.

S18: 🟢 Heavy snapshot for a heartbeat endpoint

/api/internal/hosted/status is wired to statusRoutes.readStatusSnapshot, which (per statusRoutes.ts:307-340) also gathers agent health, indexing queue counts, and cached warnings before the four fields are extracted. For a frequently polled heartbeat this does more work than necessary. A lighter collector that computes only auth mode, intake mode, routing state, and daemon heartbeat would reduce load; the existing caches make this acceptable for now.

S19: 🟢 Whitelist flag reflects env only

whitelistOnlyInitialOwner is derived from GITHUB_USER_WHITELIST in the environment at registration time. If the instance also manages its whitelist through persisted settings (reloadConfigs/Settings UI), Fleet may see a stale or incomplete picture. I could not verify from the supplied context whether a persisted override exists; if it does, consider reading the effective value through the same resolver the daemon uses. Informational only.

Score

Well-scoped, fail-closed, thoroughly tested addition that resolves both earlier review concerns (env gating and rate limiting) with all current-head checks passing; only minor hardening and test-brittleness notes remain.

Score: 9/10


🤖 Review Details

  • Model: Claude Fable 5.1
  • Time: 1m 39s
  • Tokens: 79,712 (71,734 in / 7,978 out)
  • Cost: $1.30

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S15 S16 S17 S18 S19

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🔍 AI Code Review — astra

Overall Evaluation

Ready to merge within the reviewed scope. The PR adds narrowly scoped Fleet endpoints with explicit environment activation, dedicated authentication, and bounded responses. The authoritative current-head checks report 30 passed and no failures or pending checks.

✅ Protected registration — Routes register only with a sufficiently long Fleet secret, precede the shared OAuth guard, and remain behind the general API rate limiter.

✅ Immutable administrator verification — Bootstrap verification queries the configured GitHub ID and durable admin role without returning the login snapshot.

✅ Bounded responses — Operational fields and queue counts are explicitly validated and allowlisted; collector failures return sanitized errors.

This review used static tracing of the supplied diff and surrounding context. No commands or tests were run.

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S20: 🟢 Test loss of administrator authority

Add a regression test that verifies the configured owner, demotes or removes their durable role, then repeats the request using the same route instance. The fresh database lookup in packages/api/routes/hostedFleetRoutes.ts already appears to handle this correctly; the optional test would preserve that behavior against future caching changes. A configured owner with an existing member row would also complement the current different-administrator test.

Score

The implementation satisfies the reviewed bootstrap, authentication, and response-minimization requirements, with substantial unit and wiring coverage and passing current-head checks. No merge-blocking defect was demonstrated.

Score: 9/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 21s
  • Tokens: 54,388 (53,943 in / 445 out)
  • Cost: $0.45

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S20

🤖 Review by ProPR

@integry
integry merged commit dc049dc into main Oct 10, 2026
44 checks passed
@integry
integry deleted the feat/hosted-fleet-api branch October 10, 2026 20:58
propr-dev Bot pushed a commit that referenced this pull request Oct 10, 2026
…w passes locally. The failure wasn't caused by this PR's Planner change. It came from the hosted Fleet API that was merged into `main` (#1714, `dc049dcdf`). `main` has the same problem and nothing on it has fixed it yet.

I fixed the Shard 1/4 failure, and the failing test file now passes locally. The failure wasn't caused by this PR's Planner change. It came from the hosted Fleet API that was merged into `main` (#1714, `dc049dcdf`). `main` has the same problem and nothing on it has fixed it yet.

**Cause:** `packages/api/test/openapiRouteCoverage.test.ts` was the only failing file in the shard. It requires every route registered directly on the app to be listed in `packages/api/openapi/directRoutes.ts`. #1714 added three such routes in `routes/hostedFleetRoutes.ts` and didn't list them:
- `GET /api/internal/hosted/bootstrap`
- `GET /api/internal/hosted/status`
- `GET /api/internal/hosted/queue`

**Fix:**
- **`packages/api/openapi/directRoutes.ts`:** listed the three routes as `auth: 'public'`, the same way the other secret-protected internal routes (`/api/internal/agent-runs/...`) are listed. A comment notes they check the `X-ProPR-Fleet-Secret` header and only exist when `PROPR_FLEET_CONTROL_SECRET` is set.
- **`packages/api/openapi/buildSpec.ts`:** added `/api/internal/hosted` to the `System` group of the API spec. With the routes listed, the spec builder needs a group for them or it throws an error.
- **`docs/static/openapi/propr-api.yaml`:** regenerated with `npm run gen:openapi`. It now has the three routes, marked as not yet documented, and the route count goes from 258 to 261. The generated client types didn't change.

**Checks run locally:**
- The route-coverage, response-conformance, hosted Fleet wiring and API reference page tests: 30 passed, 0 failed.
- `npm run gen:openapi:check` and `npm run check:client-contract` both pass.
- `tsc --noEmit` on `packages/api` reports no errors.

I didn't run the rest of the full suite locally. Only this one file failed in the CI shard.

There's nothing visible to preview, so I didn't create one.

PR: #2949
Comment by: @propr-dev[bot] (ID: 6102275771)
Model: Claude Opus 5.5
propr-dev Bot pushed a commit that referenced this pull request Oct 10, 2026
…ckages/api/test/openapiRouteCoverage.test.ts`, which isn't related to the badge change.

I fixed the Shard 1/4 failure. The test that failed was `packages/api/test/openapiRouteCoverage.test.ts`, which isn't related to the badge change.

**Cause:** the hosted-fleet API merge (#1714) added three routes in `packages/api/routes/hostedFleetRoutes.ts`: `GET /api/internal/hosted/bootstrap`, `/status` and `/queue`. They aren't in `packages/api/openapi/directRoutes.ts`, and the test requires every route registered directly on the app to be listed there. CI only named `bootstrap` because the test stops at the first missing route, but all three were missing. `main` has the same gap and no open PR fixes it, so other branches will fail this test too until it's fixed there.

**Fix:**
- **`packages/api/openapi/directRoutes.ts`:** listed the three routes. They're marked `public` with a comment saying Fleet authenticates with the `X-ProPR-Fleet-Secret` header, the same way the existing internal agent-run routes are listed.
- **`packages/api/openapi/buildSpec.ts`:** once the routes were listed, the spec generator stopped because no API section covered them. I added `/api/internal/hosted` to the "System" section (health, compatibility and status).
- **`docs/static/openapi/propr-api.yaml`:** regenerated with `npm run gen:openapi`. This adds the three routes, marked undocumented, and the route count goes from 258 to 261.

The changes only add lines, so they should merge cleanly with `main`.

**Verification:**
- `openapiRouteCoverage.test.ts` now passes (14 of 14).
- `npm run gen:openapi:check` reports the committed spec is up to date.
- Shard 1 had no other failures.
- `hostedFleetRoutesWiring.test.ts` fails 2 of 5 here, but it passed in CI on Shard 4. My changes are to the spec files and data lists, not the route wiring, so I put it down to this container's setup.

This only changes the API spec, so there's nothing visible to preview.

PR: #2951
Comment by: @propr-dev[bot] (ID: 6102296581)
Model: Claude Opus 5.5
propr-dev Bot pushed a commit that referenced this pull request Oct 10, 2026
…hanges: it came from main, from the hosted fleet merge (#1714) that this branch's commit sits on top of.

I fixed the shard 1/4 failure. The cause wasn't this PR's changes: it came from main, from the hosted fleet merge (#1714) that this branch's commit sits on top of.

**What failed:** one test in `packages/api/test/openapiRouteCoverage.test.ts` checks that every route registered directly on the app is listed in the OpenAPI route table. The hosted fleet merge added three routes without listing them, and the test stopped at the first one: `GET /api/internal/hosted/bootstrap is registered directly; list it in openapi/directRoutes.ts`.

**Fix:**
- **`packages/api/openapi/directRoutes.ts`:** listed `/api/internal/hosted/bootstrap`, `/status` and `/queue` as `public`, with a comment explaining why. They are checked against `PROPR_FLEET_CONTROL_SECRET` rather than a user login, and they only exist when that secret is set. The two existing `/api/internal/agent-runs` routes are listed the same way.
- **`packages/api/openapi/buildSpec.ts`:** the spec generator then refused to run because no group in the API docs covered `/api/internal/hosted`. I put it in the System group ("Health, compatibility and status").
- **Regenerated `docs/static/openapi/propr-api.yaml`:** three new entries, total route count 258 → 261.

**Checked locally:** the route coverage test and the response conformance test both pass (22 pass, 0 fail) when run with the same flags the CI unit-test command uses, and `npm run gen:openapi:check` reports the spec and client types are up to date. Run without those flags, the conformance test fails, so a bare `npx tsx --test` run will show a failure. I did not re-run the full shard.

There are no visual changes, so I didn't make previews.

PR: #2953
Comment by: @propr-dev[bot] (ID: 6102411979)
Model: Claude Opus 5.5
propr-dev Bot pushed a commit that referenced this pull request Oct 10, 2026
…in`, not by this PR.

I fixed the shard 1/4 failure. It was caused by code on `main`, not by this PR.

**Cause:** the failing test was `packages/api/test/openapiRouteCoverage.test.ts`:

> `GET /api/internal/hosted/bootstrap is registered directly; list it in openapi/directRoutes.ts`

The hosted-fleet merge (#1714, `dc049dcdf`) added three routes in `packages/api/routes/hostedFleetRoutes.ts:232-234` but didn't list them in the OpenAPI route list. This branch is based on that merge, and `main` still doesn't have the fix, so any PR built on it fails the same way. Open PR #2951 already carries the fix, and I copied it exactly so the two PRs won't conflict when they merge.

**Changes:**
- **`packages/api/openapi/directRoutes.ts`**: lists the `bootstrap`, `status` and `queue` routes under `/api/internal/hosted/`.
- **`packages/api/openapi/buildSpec.ts`**: adds `/api/internal/hosted` to the `System` tag's prefixes.
- **`docs/static/openapi/propr-api.yaml`**: the updated spec. I ran `npm run gen:openapi` and it produced the same file.

**Tests:** `openapiRouteCoverage.test.ts`, `openapiResponseConformance.test.ts` and `test/openapiReferencePage.test.mjs` pass (25 passed, 0 failed) when run from the repo root with the `test:unit` flags. I didn't run the rest of shard 1/4.

I made no visual changes, so there are no previews.

PR: #2950
Comment by: @propr-dev[bot] (ID: 6102456989)
Model: Claude Opus 5.5
propr-dev Bot pushed a commit that referenced this pull request Oct 10, 2026
…es to the OpenAPI route list. The cause is a defect on `main`, not anything in this PR's docs changes.

I fixed the Shard 1/4 failure by adding three internal routes to the OpenAPI route list. The cause is a defect on `main`, not anything in this PR's docs changes.

**Cause:** CI tests this branch merged with current `main`. On `main`, merge #1714 (hosted fleet API, `dc049dcdf`) added three routes in `routes/hostedFleetRoutes.ts` but didn't list them in `packages/api/openapi/directRoutes.ts`:
- `GET /api/internal/hosted/bootstrap`
- `GET /api/internal/hosted/status`
- `GET /api/internal/hosted/queue`

So `test/openapiRouteCoverage.test.ts` failed with:
> `GET /api/internal/hosted/bootstrap is registered directly; list it in openapi/directRoutes.ts`

`main` still has the gap. The PR that fixes it (#2951) is open and not merged.

**Fix:** I applied the same route-listing changes #2951 makes, and nothing else from it:
- `packages/api/openapi/directRoutes.ts`: lists the three routes.
- `packages/api/openapi/buildSpec.ts`: files `/api/internal/hosted` under the System tag.
- `docs/static/openapi/propr-api.yaml`: the generated spec with the three new entries.

**Verification:**
- **Merge with `main`:** I simulated it for each of the three files and none conflict.
- **Tests:** `openapiRouteCoverage` and the OpenAPI spec tests pass, 14 of 14. That holds both on the branch alone and with `main`'s `server.ts` and `hostedFleetRoutes.ts` copied in to match what CI builds. I then removed those copied files.

Because these hunks are identical to #2951's, the two PRs won't conflict whichever merges first.

PR: #2870
Comment by: @propr-dev[bot] (ID: 6102559369)
Model: Claude Opus 5.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants