Skip to content

feat(notifications): subscribe channels to app incident categories - #608

Merged
RentnerKev merged 6 commits into
rentner/feat/app-incidentsfrom
rentner/feat/app-incident-subscriptions
Nov 28, 2026
Merged

RentnerKev merged 6 commits into
rentner/feat/app-incidentsfrom
rentner/feat/app-incident-subscriptions

Conversation

@RentnerKev

Copy link
Copy Markdown
Member

Summary

PR 3 of 3 for #593, stacked on #607. Users subscribe their notification channels to the incident categories that installed apps declare.

  • Server function: a new GET server function lists the incident categories of installations that have an active generation and the incident grant, grouped by app name. It requires APP_ACCESS and the permission to select app incidents. App names come from the core catalog; if the catalog does not answer within 3 s, the app ID is shown instead.
  • Channel editor: it shows the categories per app. Selecting one adds the app_incident event to the channel, and clearing all removes it. Saving keeps the selection in appCategories.
  • Toasts and texts follow the existing patterns, in all eight languages.
  • Out of scope: the admin side has no channel editor today (only server functions), so this PR changes no admin UI.

Related issue

Closes #593 together with #606 and #607.

Testing

  • Service and UI tests cover the category listing and the editor toggles.
  • Typecheck and lint are clean.
  • The UserSettings suites pass in Kiri.

Type of change

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

Checklist

  • I tested the relevant functionality.
  • Existing tests pass. (CI pending)
  • 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. Not needed.
  • I linked the relevant issue for a feature or fix, or explained why no issue is needed.

🤖 Generated with Claude Code

The personal channel editor lists the incident categories of installed apps
that run an active generation and hold the incident grant, grouped by app
display name, and lets the owner toggle them. Selecting any category adds the
app_incident event to the channel and clearing all of them removes it, so the
event is no longer a separate choice. Subscriptions of apps that are gone stay
visible so they can be cleared.

A new GET server function exposes the categories under the same permission as
the app incident event and re-checks it in a read-only transaction. Names come
from the app catalog when it answers and fall back to the app ID.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

@RentnerKev
RentnerKev merged commit ccfca2f into rentner/feat/app-incidents Nov 28, 2026
46 checks passed
@RentnerKev
RentnerKev deleted the rentner/feat/app-incident-subscriptions branch November 28, 2026 00:12
RentnerKev added a commit that referenced this pull request Nov 28, 2026
…607)

* feat(apps): record the incident categories an app declares

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(notifications): deliver app incidents through platform channels

Apps with the notifications.incidents.manage.v1 grant assert incidents by key
through POST /platform/v1/incidents/{incidentKey}. The platform keeps them in
the notification engine as the app_incident category, deduplicated per
installation and key, and delivers them through the existing mail and webhook
channels.

- Grants and routing: the capability is approvable for the installation in the
  core, the core gateway forwards setIncident, and the web gateway dispatches
  it with an idempotency key. The grant approval shows its name in all locales.
- Endpoint: replays reuse app_runtime_messages (kind incident). Undeclared
  categories conflict, host categories need a covering host grant before the
  host is looked up, and notifications that are off or paused keep nothing.
- Engine: repeated state is a no-op, text changes update in place, only a
  severity rise notifies again, and a resolution notifies the channels that got
  the failure notice. Channels subscribe with appCategories (appId/categoryId).
- Delivery: the owner needs PROXY_HOSTS_VIEW for host incidents, the platform
  renders the host name when it sends, and app text is escaped plain text.
- Reconcile: incidents of stopped installations, revoked grants and vanished
  hosts end with a recorded reason. Stop and uninstall resolve at once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(notifications): keep app incidents open across restarts and updates

Every start and update retires the running generation before it
registers the next one, so resolving on retire closed every incident on
each restart. Treat an installation as live while a generation is not
revoked or a revoked one's lease still runs, drop the retire hook, and
let the reconcile resolve a stopped app's incidents once its lease ends.
Removing an installation still resolves them at once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* style: apply automatic formatting

* fix(apps): reject line separators in incident text and fold only ASCII case

Mirror the contract: incident text also excludes the Unicode line and
paragraph separators, and link detection lowercases only ASCII letters,
like both contract SDKs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(apps): keep incident category names to one plain line

Follow the contract: category names exclude line and paragraph
separators as well, and the marketplace pin moves to the contract
revision with that rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(apps): store incident categories in a stable order

Sort declared incident categories by ID before storing and comparing
them, as for capabilities, permission keys and provider profiles, so a
re-registration in a different order is no conflict. Cover an ordinary
Unicode category name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(apps): declare the incident capability with Unicode category names

Once the capability exists, categories are declared together with it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(notifications): subscribe channels to app incident categories (#608)

* feat(notifications): subscribe channels to app incident categories

The personal channel editor lists the incident categories of installed apps
that run an active generation and hold the incident grant, grouped by app
display name, and lets the owner toggle them. Selecting any category adds the
app_incident event to the channel and clearing all of them removes it, so the
event is no longer a separate choice. Subscriptions of apps that are gone stay
visible so they can be cleared.

A new GET server function exposes the categories under the same permission as
the app incident event and re-checks it in a read-only transaction. Names come
from the app catalog when it answers and fall back to the app ID.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* style: apply automatic formatting

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* chore(core): pin the merged app incident contract

Move the marketplace pin from the last head of RentnerProxy/marketplace#96
to its squash commit on main. The contract content is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(notifications): align app incident state with the contract and fix delivery edges

- Validate stored app text exactly as the App API admits it: code points,
  no line or paragraph separators, ASCII-only case folding for links,
  and category names by the plain line rule alone. Text the endpoint
  accepted can no longer fail the state write.
- Decide liveness by the lease alone, sampled before the reads: a crashed
  app stops counting once its lease ends, and a generation registered
  after the reads stays live.
- Show an app incident's ID instead of its installation-derived resource
  ID in the status channel owners read.
- Record the delivered severity as the channel's baseline, so a notice
  raised before it was sent is not escalated again, and keep a channel
  that received a failure notice owed its recovery after a failed
  escalation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: rentnerproxy-pr-automation[bot] <353791173+rentnerproxy-pr-automation[bot]@users.noreply.github.com>
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