Repository navigation
fix(apps): require permissions.cron when a manifest declares crons - #19231
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check one thing before merge: a self-managed registry install now fails and rolls back on every registration refusal, including admission and trust-repository ones, not only the missing cron grant. [DESIGN-REVIEWED] 362211b Description read[DESCRIPTION-READ] 4935ad2c3b563bb06cca855cae75fc68d83122e8d458bea61063e2489363f5f4 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The breaking install refusal targets authors, but the gap is the consent display reading a self-declared flag instead of the manifest's Not justified as shipped
What this change shipsInventory (6 items) — 3 justifiedIntent: make the permissions an operator reviews before installing name an app's scheduled jobs. Presented as a FIX; it is an ADDITION (a new admission rule).
[FIRST-PRINCIPLES-REVIEWED] 362211b Description read[DESCRIPTION-READ] bfc5e1187b10b2fe83a999e6f3f36f8c6a253670ea2b1d1e260412db92ddd7c8 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsFINDING -- src/kiro_crew/apps/registry_pipeline/install.py:2506 -- An unpinned same-origin update leaves the pulled revision checked out after registration refusal, contradicting “ False positive or not applicable? A repository writer can comment: |
Install, update and self-registration refuse a manifest whose crons is non-empty without "cron": true under permissions, with an error that names the fix. Load time is unchanged, so an app installed before it declared the grant keeps loading and firing its crons until its next update. The app init --cron scaffold, the full-app example and the manifest reference now declare the grant. Fixes #11040
… refused The self-managed branch of install_from_registry reported success and kept the new checkout even when register_external_app refused the manifest. A refused registration now fails the install with its error, so a manifest that schedules crons without the cron grant surfaces the fix, and the previous checkout is put back beside the unchanged record.
4ba6000 to
362211b
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Approved at head 362211b: PR Readiness is green, no open change requests, and the review lanes passed. (AI-assisted review at bolichen97's request.)
Problem / Motivation
Goal: An app that ships scheduled
cronssays so in itspermissionsblock, so the permissions an operator reviews before installing describe everything the app runs unattended.An app manifest can declare
cronswithout"cron": trueunderpermissions. Manifest validation never reads the grant and neither does cron registration, so those schedules register, fire and are removed whether or not it is declared. Thepermissionsblock then understates what the app does on its own, and the repo's ownkirocrew app init --cronscaffold, the full-app example and the manifest reference's Full Example all ship that shape.Why it matters
A schedule runs agent prompts or commands with nobody watching, and every run can cost model usage.
permissionsis where an operator reads what an app may do before installing it, so an app that can schedule work without saying so there is under-declared at the point of consent.Not a goal
permissions.crongates at runtime (ctx.cron), or how disabling an app cleans up its crons.What changed (motivation → approach → change)
Gap → design choice → change.
permissions.crongates only whetherctx.cronis built. Nothing ties it to manifestcrons.permissions.cronas covering only runtimectx.cron. Docs-only and non-breaking, but it leaves an unattended capability undeclared inpermissions.apps/manifest.py:cron_permission_error()andCRON_PERMISSION_REQUIRED_ERROR.AppManifest.validate()adds one error whencronsis non-empty andpermissions.cronis not literallytrue:crons is declared but permissions.cron is not: add "cron": true under "permissions" in app.json. Install and update reach this through their existing source validation, so a refused update leaves the installed version in place.apps/manager.pyregister_external_app: applies the same rule to a self-registered manifest. Self-managed apps re-register on every launch, so a re-registration at the version already on record, whose recorded manifest already lacked the grant, is treated as a relaunch and accepted. A new version, a first registration, or a relaunch that drops a grant it had is refused.apps/scaffold.py:app init --cronwrites"permissions": {"cron": true}.apps/registry_pipeline/install.py: a self-managed registry install now fails with the registration's error whenregister_external_apprefuses the manifest, and the previous checkout is put back. Before this, the branch reported success and kept the new checkout, so the cron-grant refusal would never reach the user.cronssection, thepermissions.cronrow and the validation rules state the requirement. The app-dev skill (kirocrew-app-dev) says the same.Breaking change for app authors. A manifest with a non-empty
cronsand no"cron": trueunderpermissionsis refused at install, at update and at self-registration of a new version. The one-line fix is to add"cron": trueunder"permissions"inapp.json. Apps already installed keep working until they are updated.Backwards compatibility
Breaking: install, update and self-registration refuse a manifest whose
cronsis non-empty withoutpermissions.cron: true. Writer sweep on origin/main @ ddb399c:kirocrew app init --cron(apps/scaffold.py): writes the grant now.docs/app-kit/examples/full-app/app.jsonand the manifest reference's Full Example: declare the grant now.ops_mission_controlis the only builtin withcrons, and it already declares the grant.apps/plugin_import.py): its emitted manifest carries nocrons.test_app_bridges.py,test_app_cli.py,test_app_manifest.py,test_apps_routes_coverage.py): declare the grant now.Reader: apps/discovery.py:discover_builtin_apps -- release -- runs validate() on every boot. Every shipped builtin with crons declares the grant | test_every_builtin_that_ships_crons_declares_the_grant
Reader: apps/manager.py:_validate_source_path (install_app, update_app) -- app -- refuses with the fix, and a refused update leaves the installed version | test_install_refuses_crons_without_the_grant, test_update_refuses_and_leaves_the_installed_app_in_place
Reader: apps/manager.py:register_external_app (POST /api/apps/register, registry pre-registration) -- app -- a same-version relaunch of an app already registered without the grant is accepted | test_relaunch_at_the_recorded_version_keeps_an_app_registered_before_the_rule
Reader: apps/registry_pipeline/install.py:install_from_registry (self-managed branch) -- app -- a refused registration fails the install with its error and restores the previous checkout | test_self_managed_install_fails_when_registration_is_refused
Reader: apps/bridges.py:register_app, reconcile_enabled_app_resources -- release -- never validates, so an installed app without the grant keeps registering its crons | test_an_installed_app_without_the_grant_keeps_registering_its_crons
Reader: apps/plugin_import.py:_convert_into -- app -- emits no crons, so the rule never fires there
Tests
New
test/test_app_cron_permission_required.py:true(false,"true",1,null) is refused. A cron shipped paused still needs the grant.register_appstill registers its cron.--cronscaffold, the full-app example, the reference's Full Example and every builtin with crons all satisfy the rule.test_app_scaffold.pychecks that--cronwrites the grant and that no-cron scaffolds do not. Existing fixtures that build cron manifests declare the grant.test_external_registry.py::test_self_managed_install_fails_when_registration_is_refused: a self-managed registry install whose registration is refused returnsok: falsewith the refusal, writes no provenance, and restores the previous checkout.Without the fix, the refusal, self-registration, registry and scaffold tests fail. Locally all new tests pass, plus the app suites (
test/test_app*.py,test/test_apps*.py, builtin app tests, CLI tests, registry install tests). Onecode_review_sagestore-ancestor test fails identically on unmodified main on this host. flake8, isort, mypy, the baselined black gate and the comment-history gate are clean on the touched files.Manual verification
N/A. Unit coverage exercises each admission path (install, update, self-registration) and the startup registration path directly.
Related Issues
Fixes #11040
Pattern harvest
Not generalizable: a single missing cross-field rule between one manifest section and the grant that names it. The other capability grants (
spawn,jobs,sessionApproval) already gate their runtime surface directly.Checklist
Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.