Skip to content

fix(apps): let catalog apps start their work and probe upstreams - #624

Merged
RentnerKev merged 3 commits into
mainfrom
rentner/fix/app-api-preparing-generation
Nov 29, 2026
Merged

RentnerKev merged 3 commits into
mainfrom
rentner/fix/app-api-preparing-generation

Conversation

@RentnerKev

@RentnerKev RentnerKev commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Summary

An end-to-end test with the real published app found two platform bugs. The test ran on an appliance built from main (4206bb6) on a local Docker host, with synthetic hosts, history and an open outage. Monitoring 1.0.0 was installed from the public signed catalog through the real app manager. Neither bug shows up in the existing tests, because those use fake apps with UUID installation IDs and apps that wait before calling the platform.

1. The legacy handoff never began

The manager activates a registered generation only after the app reports ready. Monitoring starts its work as soon as its socket answers, about 200 ms earlier. A tap between the broker and the web gateway showed this order:

GET  /platform/v1/context                      -> 200
POST /platform/v1/proxy-hosts/query            -> 401 unauthorized
GET  /platform/v1/legacy-handoffs/monitoring   -> 401 unauthorized
POST /internal/v1/app-generations/activate     -> 204   (manager, ~200 ms later)

The SDK documents 401 as "the request credential is absent or invalid". The app, like the template and Greeting, therefore treats 401 as a stale generation and stops its handoff loop and host sync for good. Built-in monitoring kept running, so no data was lost, but the app never took over.

Fix: a generation that is still preparing and has a live lease now gets a retryable 503 generationPreparing.

  • The SDK clients repeat a 503 read or keyed change, so the call goes through once the generation is active.
  • context reads and secret staging keep working while preparing, as before.
  • A revoked generation, an expired lease or an unknown generation still gets 401.
  • The broker now refuses a provider invocation of a preparing generation as unavailable rather than as a rejected identity. In both cases the provider is not called.

2. App upstream probes always failed

App probes pass the installation ID to the controller for the per-installation probe budget. The web client (z.uuid()) and the controller (is_canonical_uuid) both required a UUID there, but core/src/app_manager/catalog.rs names catalog installations app- plus 32 hex digits. Every probe from a catalog app was rejected as invalid_input, and Monitoring recorded every check as unknown / runtime_unavailable.

Fix: both sides now accept any app record ID (^[a-z0-9][a-z0-9_-]{0,63}$), the format the web authority (appRecordId) and the manager already use. The core now has a single app_install::is_record_id, used by the IPC launch identity, the secret grant check and the probe validation. It replaces two identical private copies.

Related issue

Refs RentnerProxy/app-monitoring#1. Found by the first end-to-end handoff of the published app (Monitoring Phase 4). No separate issue, because the fix comes with its own regression tests.

Type of change

  • Bug fix
  • New feature
  • Refactoring
  • Documentation
  • CI / tooling
  • Dependency update
  • Other

Testing

Tests changed or added:

  • authority.db.test.ts: before activation the response is 503 generationPreparing. After revoke, the same generation gets 401 unauthorized. Principal resolution reports preparing.
  • providers.db.test.ts and LegacyHandoff/app-api.db.test.ts: expect the retryable 503 where they previously expected 401 for a preparing generation.
  • Controller/domain-diagnostics.test.ts and core/tests/private/domain_diagnostics.rs: catalog installation IDs and UUIDs are accepted. Uppercase, empty, a leading -, spaces and 65 characters are rejected.

Commands run:

  • bun --no-env-file run typecheck and bun --no-env-file run lint (oxlint with type-aware rules)
  • All AppRuntime, LegacyHandoff, HostMonitoring and AppUi DB tests against a fresh PostgreSQL 18.7 after db:migrate, plus the AppRuntime unit tests. A full batch on the slow local database hit the 5 s timeout in two tests that are unrelated and change between runs. Each passes on its own.
  • cargo check --tests, cargo fmt --check and all 43 domain_diagnostics Rust tests. The Linux-only modules are compiled by the appliance image build, and CI runs their tests natively.

End-to-end (appliance image from this branch, same volume, i.e. an in-place update with Monitoring installed):

Step Result
Handoff Committed 10 s after start: 5 parts, 3 policies, 394 observations and 4 incidents imported (1 open)
Built-in monitoring Stopped at the commit, no new observations
Open outage Delivered as a continuation of the exported incident
Proxy healthy.e2e.test returns 200 from the upstream, down.e2e.test returns 502
App checks Every minute: healthy.e2e.test healthy / expected_status (HTTP 200, 10–13 ms), down.e2e.test unhealthy / upstream_dns_failed. Before the probe fix, every check was unknown / runtime_unavailable
Open outage after the update Still 4 incidents, 1 open. The outage continues and no duplicate was opened
Deactivate App process stopped, app data kept (3 policies, 432 observations, 4 incidents), proxy still returns 200, built-in monitoring stays retired
Reactivate Running again as generation 5, real checks resume at once

Checklist

  • I tested the relevant functionality.
  • Existing tests pass.
  • I added or updated tests where appropriate.
  • This PR does not include secrets, credentials, production data, or private certificates/keys.
  • I updated documentation where necessary.
  • I linked the relevant issue for a feature or fix, or explained why no issue is needed.

Breaking changes

None for apps. A preparing generation now sees 503 instead of 401. Apps built on the SDK clients retry 503 automatically. Apps that treated 401 as stale no longer stop at startup.

Screenshots

None

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • App installation IDs now support the manager’s record ID format, while continuing to accept UUIDs where applicable.
    • App Runtime requests for a registered generation that is still preparing now receive a retryable “not active yet” response.
  • Bug Fixes
    • Requests for abandoned or revoked generations continue to receive an unauthorized response after revocation.

RentnerKev and others added 2 commits November 29, 2026 15:41
…ring

The app manager activates a registered generation only after the app
reports ready. An app that starts its work as soon as it serves, like
Monitoring 1.0.0, calls the App API in that window. The platform
answered 401 unauthorized, which the SDK defines as an absent or
invalid credential. The app read that as a stale generation and
stopped its legacy handoff and host sync for good, so the handoff
never began.

A generation that is still preparing, with a valid lease, now gets a
retryable 503 generationPreparing. The SDK clients repeat a 503 read
or keyed change, and the call succeeds once the manager activates the
generation. Context reads and secret staging keep working while
preparing. A revoked generation, an expired lease or an unknown
generation still gets 401. The broker now refuses a provider
invocation of a preparing generation as unavailable instead of a
rejected identity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
App upstream probes passed the installation ID to the controller for
the per-installation probe budget. The web client and the controller
both required a UUID there, but the app manager names a catalog
installation `app-` plus 32 hex digits. Every probe of a catalog app
was rejected as invalid input, and Monitoring recorded every check as
unknown with runtime_unavailable.

Both sides now accept any app record ID, the format the web authority
and the app manager use for installations. The core keeps one shared
`is_record_id` in `app_install`, which the IPC launch identity, the
secret grant check and the probe validation all use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 46 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between e5575a9 and 8c50f76.

Files selected for processing: 1

  • .github/scripts/ci/fixtures/production-app-runtime.ts

No actionable comments were generated in the recent review.

Walkthrough

The core and web code now use app record IDs for installation validation. App Runtime requests to live generations that are still preparing now receive a distinct error mapped to HTTP 503.

Changes: App Record ID Validation

Layer / File(s) Summary
Shared record ID validation
core/src/app_install.rs, core/src/app_install/grants.rs, core/src/app_ipc.rs, core/src/runtime/domain_diagnostics/models.rs, core/tests/private/domain_diagnostics.rs
The core adds a shared validator for nonempty record IDs of up to 64 bytes, using lowercase ASCII letters, digits, hyphens, and underscores. Secret-grant resource IDs, launch identities, and domain diagnostic installation IDs use the validator. Tests cover accepted and rejected values.
Web domain diagnostics
web/src/server/Controller/domain-diagnostics.server.ts, web/src/tests/server/Controller/domain-diagnostics.test.ts
The controller validates installation IDs with the app record ID schema. Tests check valid IDs, forwarding, and invalid inputs. The requirement for upstreamOnly: true remains.

Preparing App Runtime Generations

Layer / File(s) Summary
Preparing-generation response handling
web/src/server/AppRuntime/Types/authority.types.ts, web/src/server/AppRuntime/authority.server.ts, web/src/server/AppRuntime/services.server.ts, web/src/tests/server/AppRuntime/*, web/src/tests/server/LegacyHandoff/app-api.db.test.ts
A live preparing generation now produces a preparing authority error, which maps to HTTP 503 with code generationPreparing. Tests check authority resolution, gateway authorization, provider access, and status requests. Revoked generations continue to return unauthorized responses.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related issues

Possibly related PRs

  • RentnerProxy/platform#472: This change updates the generation-authentication response contract introduced by that PR and reuses the record ID validation used for IPC launch identity.
Merge Risk: Minimal · previous review e5575

Preparing app generations now get a retryable 503 instead of a terminal 401, and catalog app IDs are accepted by the app-probe validation. Revoked, expired, and unknown generations still receive 401. The changes are small and covered by tests, and no concrete defect was identified. The apps' automatic retry on 503 depends on SDK clients outside this repository and was not verified here.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(apps): let catalog apps start their work and probe upstreams" names the two main changes: the preparing-generation handoff and the catalog app probe validation. It is specific and match…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description follows the repository template closely. It has a Summary that explains two platform bugs, the root cause of each, and the fix. It names the related issue (Refs RentnerProxy/app-monito…
Full details: Title check

Explanation

The title "fix(apps): let catalog apps start their work and probe upstreams" names the two main changes: the preparing-generation handoff and the catalog app probe validation. It is specific and matches the changeset. It is a conventional-commit style title in one sentence and is 10 words long.

Full details: Description check

Explanation

The description follows the repository template closely. It has a Summary that explains two platform bugs, the root cause of each, and the fix. It names the related issue (Refs RentnerProxy/app-monitoring#1) and gives a reason for no separate issue. It marks the Bug fix type. It has a detailed Testing section that lists tests changed, commands run, and end-to-end results. All checklist items are ticked. It has a Breaking changes section that describes the 401 to 503 behavior change for preparing generations. The Screenshots section says None. The description is complete and specific, so it passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4206bb6 and e5575a9.

Files selected for processing: 13

  • core/src/app_install.rs
  • core/src/app_install/grants.rs
  • core/src/app_ipc.rs
  • core/src/runtime/domain_diagnostics/models.rs
  • core/tests/private/domain_diagnostics.rs
  • web/src/server/AppRuntime/Types/authority.types.ts
  • web/src/server/AppRuntime/authority.server.ts
  • web/src/server/AppRuntime/services.server.ts
  • web/src/server/Controller/domain-diagnostics.server.ts
  • web/src/tests/server/AppRuntime/authority.db.test.ts
  • web/src/tests/server/AppRuntime/providers.db.test.ts
  • web/src/tests/server/Controller/domain-diagnostics.test.ts
  • web/src/tests/server/LegacyHandoff/app-api.db.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

… app fixture

The native app fixture asserted 401 for calls of its preparing
generation. A preparing generation now gets 503 generationPreparing,
so the fixture checks that status and problem code instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RentnerKev
RentnerKev merged commit 67b3273 into main Nov 29, 2026
49 checks passed
@RentnerKev
RentnerKev deleted the rentner/fix/app-api-preparing-generation branch November 29, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant