Repository navigation
feat(app-sdk): let the owner edit an app's declared ceiling in core - #47902
bolichen97 wants to merge 5 commits into
Conversation
Owner ruling D11 (option A) on #26967: an app gets no write path to its autonomy ceiling; its page shows the current ceiling and links to core's owner-only settings. Until now the only writer of such a file was the built-in copy's own settings route, which leaves with the copy. This adds the generic core writer, App Kit seam level 59: - app.json ownerCeilings: the data-home file that holds the ceiling (named for the app) and its fields, five plain form types (choice, choices, text, pairs, list of those). Any error refuses the manifest; the declaration is signed with it. - GET /api/apps/{name}/owner-ceilings and PUT /api/apps/{name}/owner-ceilings/{file}, owner dashboard only (app tokens and internal callers refused), both unstable. Core serves a file only for a first-party app, only when it is already on both halves of core's floor over the agent and is not a credential; it reads those tables and changes none of them. - The read fails closed on an unreadable, linked, multi-linked, oversized, corrupt or out-of-shape file. The write keeps every undeclared key, refuses a stale revision, publishes through the masked staging directory, and writes its allowed SEL row fail-closed before the publish; every refusal writes a denied row. - The app detail page shows one card per declared ceiling with a form control per field, and scrolls to #owner-ceilings when linked. The app reads its own file: an in-process backend opens it under the data home, so no app read seam is added. Part of #26967
UX Review (Opus 5.5) — 🔴 BLOCKUX-level review of UX-Verdict: BLOCK When a ceiling can't be shown or changed, the only way forward the card offers is "Ask the agent", and that's the one actor this design locks out of the file. The owner is stuck and can't see what the app is allowed to do. BlockersThe blocked-state card offers a fix that can't work Evidence gaps
Notes
[UX-REVIEWED] 6ed63d7 Description read[DESCRIPTION-READ] fa893a7bf28af85b4b1e4f1414182f9e55c12e8c641c3e20164dc8bb59dcda21 That sha256 names everything this verdict read: the PR description, plus the 7 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 |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: core is now the only writer of the ceiling file, the app can only read it, and no file's sandbox or tool-gate protection changes. Notes
[DESIGN-REVIEWED] 6ed63d7 Description read[DESCRIPTION-READ] ea1076dc764f05d7115227ad679bcb369d696d1717d0a8a87eafa8a7e4f182ab 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) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Every item lets the owner change an app's ceiling once the built-in writer is deleted. Ruling D11 option A and AGENTS.md's "generic, app-agnostic seam" rule both require this approach. What this change shipsInventory (9 items) — 9 justifiedIntent: let the owner keep changing an adopted first-party app's autonomy ceiling, such as Ops Mission Control's mode and act-rules, from core once the built-in copy's
[FIRST-PRINCIPLES-REVIEWED] 6ed63d7 Description read[DESCRIPTION-READ] 11bb7c658903c4de59e5ec692dc4f63af553a156a986317c98ee94a22011e95a 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 — 🔴 changes requested (blocking)GPT 6.1 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING -- website/src/pages/appDetailOwnerCeilingFields.tsx:85 -- Form trimming silently rewrites accepted ceiling values
BLOCKING -- website/src/pages/AppDetailOwnerCeilings.tsx:72 -- Client validation hints share the failed-request error surface
[BLOCK-MERGE] 6ed63d7 Adjudication (Opus 5.5) — is blocking on each finding proportionate?The harm rung is LOW. It confirms that F1 (fenced): the conditions are plausible. A value with a leading U+FEFF passes the backend round-trip check, but False positive or not applicable? A repository writer can comment: |
The declared field type is narrowed to a string before it picks the field's options, the per-type caps get names of their own, and the feature map gains the app detail page's owner ceilings row. Part of #26967
A stored value the page would save differently (text, a pair name or value with spaces around it) now reads as outside the shape, so a save of an unrelated field cannot trim a label the app compares exactly. A save whose file would pass the read's 256 KiB cap is refused before the audit row and the publish. Name and value rows that cannot become one object as entered stop the save with a message instead of dropping a row, and the card rebuilds its draft in the same render a new declaration arrives, so no control renders against another shape. Part of #26967
The revision a save names now covers the app's declaration as well as the file's bytes, so a form opened before an app update that declares one more field is refused instead of saving without that field and deleting its stored value. A required field binds what the owner saves, not what the file holds, so a file that already carries the app's other values still shows. The oversized-file case gets explicit test ids, so its bytes are not the test's node id. Part of #26967
The ceiling card's catalog values spell the product name with the productName placeholder, the French save error puts a narrow no-break space before its colon, and the short Add label has translator context. The per-file lock table is marked as a cache that holds no test state, and the builtin snapshot round-trip probe declares an owner ceiling so the copy of that field is exercised. Part of #26967
Problem / Motivation
Goal: The owner changes an installed first-party app's owner-only ceiling, such as Ops Mission Control's autonomy limits, with plain form fields on that app's page in Kiro Crew, while the app itself can only read it.
Part of #26967. Campaign ruling D11, option A, in the owner's words: "A: OMC gets no write seam; its page only shows the current ceiling and links to core's owner-only settings page."
Today the only writer of
ops_mission_control_policy.json(the app's mode and act-rules) is the built-in copy's own authenticatedPUT /settings. Core fences the file (the agent's file tools refuse it, every sandbox masks it) but has no surface of its own that edits it. When the copy is deleted, that writer goes with it, so the deletion draft currently tells the owner to hand-edit the JSON file in the data home.Why it matters
Without a core writer, deleting the copy leaves an ordinary owner hand-editing a protected JSON file to change how much an ops app may do on its own against their production incident tooling, and the deletion cannot follow ruling D11 option A, which is what keeps the app from being able to raise its own ceiling.
Not a goal
ownerCeilings, and the app adds the declaration and its link in its own repository.What changed (motivation → approach → change)
Approach. The app declares which data-home file holds its ceiling and what fields it holds; core decides whether it serves that file, shows a form for it on the app's page, and is its only writer. Generic and app-agnostic: no core module names an app or an app's file, and the one file served today is found from core's existing floor tables and the first-party app list, not from a new table.
ownerCeilings(App Kit seam level 59). Up to 4 ceilings, each afile, atitle, an optionaldescriptionand up to 16 fields of five plain types:choice,choices,text,pairs(name and value rows) andlist(rows of the other four).filemust be one.jsonname at the data-home root starting with the app's name (-as_) and_. Any error refuses the manifest; a non-empty declaration is in the signed payload.APP_SDK_LEVELbecomes 59 on both sides andscripts/adoption_pin.pycounts a declaration at level 59. The grammar module is imported only when a manifest declares the key, so an MCP server's listing loads nothing new.apps/owner_ceilings.serving_refusal, re-checked on every read and write): the name rule above; a first-party app (a built-in this build ships, or a former built-in with an adoption pin row); the file already insecurity._CREW_SECRET_LEAVESand in the sandbox's HIDDEN or READONLY leaves; and not a file the sandbox treats as a credential. A table that cannot be read refuses. A test judges every root leaf on the floor for every first-party app: exactlyops_mission_control_policy.jsonpasses, and its provider-token store beside it is refused as a credential.apps/owner_ceilings_routes.py, bothunstableinroute_access,owner-ceilingsadded toCORE_APP_ROUTE_SEGMENTSon both sides):GET /api/apps/{name}/owner-ceilings(apps.owner_ceilings.read): every declared ceiling with itsstate,revisionand, when it can be saved over,values.PUT /api/apps/{name}/owner-ceilings/{file}(apps.owner_ceilings.write):{"values": {...}, "revision": "..."}replaces the declared fields.absent,ok,unreadable,corrupt,outside_shape,refused. Onlyabsentandokcarry values or accept a save. A stored empty value the page never writes ("",[],{},null) is outside the shape, because an app may read it differently from an absent key: for this app's act-rules, noactionsgrants every action andactions: []grants none, so reading one and saving it back as the other would widen a grant. A stored value the write would store differently (a text, pair name or pair value with spaces around it) is outside the shape too, so saving an unrelated field never rewrites a label the app compares exactly.revision(SHA-256 of the bytes the page read) is refused with 409, the declared keys are replaced, every undeclared key is kept as it is, a result over the read's 256 KiB cap is refused (413owner_ceiling_too_large, so no save leaves a file the page can no longer read), and the file is published through the existing masked staging directory (hidden_leaf_staging.publish_through_auth_store_staging), owner-only.AppDetailOwnerCeilingsshows one card per declared ceiling on the app's detail page: radio buttons, checkboxes, text boxes and rows, never raw JSON. A state it cannot show explains why and has no form; a stale save says so and reads the file again; name and value rows that cannot become one object as entered (a repeated name, a value with no name) stop the save with a message instead of dropping a row; a new declaration rebuilds the draft in the same render, so no control renders against another shape; a session the owner gate refuses sees nothing. The stable link for an app's page is/apps/detail/<name>#owner-ceilings.backend.hooks), where it already opensctx.data_home / "ops_mission_control_policy.json", so no read seam is added. A spawned backend would see the file masked, as it does today; that is recorded as the case that would need a read seam.Security
The file this writes is a security ceiling over the agent, so every check fails closed and nothing about its protection moves. Who may call: the owner's dashboard only, the read included; an app token (the app's own included, although the path is in its namespace) gets 403
app_token_forbidden, an internal caller (an agent's MCP tools and kiro-cli) gets 403dashboard_session_required, and every other session getsowner_onlyfrom the same owner gate every owner setting uses (the built-in's own settings route used it too). What may be written: only a first-party app's own file that is already on both halves of core's floor and is not a credential, so a manifest cannot point the writer at a core record (for example a third-party app namedaws-serviceandaws_service_consent.json), and only the declared keys, of the declared types, under their caps. The agent can neither declare a ceiling (installed manifests are sealed read-only in its sandbox) nor reach the routes. Audit: every refusal of either route writes adeniedSecurity Event Log row with its code; every save writesallowedwithcritical=Trueafter all checks and before the publish, so a save whose row cannot land is not made (500owner_ceiling_not_saved), andfailedwhen the publish does not land; rows name the app, the file and the keys, never a value. Disposition: the file keeps HIDDEN, its tool-gate rows and its staged publish; this reads those tables and changes none of them. Residual, unchanged: a HIDDEN file absent when a sandbox started is not masked in that sandbox, so the first save that creates the file is visible to sessions already running until they restart, as with the built-in's writer.Backwards compatibility
Compatible: a manifest without
ownerCeilingsparses, validates and signs exactly as before (the key is left out of the signed payload when absent), and no existing route, file or disposition changes.Writer sweep on origin/main @ fbb2051: no manifest, fixture, pin row or registry entry in the tree declares
ownerCeilingsor an endpoint under anowner-ceilingssegment.ownerCeilingskey that used to sit unread inextranow refuses the install only when it is declared and invalid; nothing in the sweep declares one -- test_app_owner_ceilings.py::test_a_declaration_outside_the_grammar_refuses_the_manifest/api/apps/<app>/owner-ceilingsis refused now that core serves that segment; nothing in the sweep declares one -- test_file_menu_items.py::test_core_route_segments_covers_every_core_route_in_the_app_namespaceTests
test/test_app_owner_ceilings.py(new; every test fails on main, where the module, the routes and the key do not exist): the grammar and its refusals, the signed payload, level 59 in the pin tool; value checks, the stored-empty refusal (theactions: []widening case) and the stored-value-would-change refusal (" prod "labels); the served set over every first-party app and floor leaf, each refusal reason, and a floor that cannot be read; absent, ok, unreadable (second name, oversize), corrupt and out-of-shape reads, undeclared keys kept, stale revision, a save whose file would pass the read cap is refused before its audit row, an audit that raises writes nothing; both routes refuse an app token, an internal caller and a non-owner session with a row each, the owner's read and save, every refused save writes nothing and one denied row, a save the audit cannot record is not made.website/src/pages/AppDetailOwnerCeilings.test.tsx(new): hidden with no declaration, the fields with stored values and the exact stored shape saved with the read revision, no form over an out-of-shape file, the stale-save notice and refetch, nothing for a refused session, the#owner-ceilingsscroll, a repeated pair name stops the save with nothing sent, a field a newer declaration adds renders after a save, a control given another shape renders empty, and the form value conversions.Proof: not provable -- other: feature PR; the tests target a new module, new routes and a new manifest key that main does not have.
Manual verification
Not run on this host (lint and check scripts only). CI is the test evidence; the real-machine run below drives the routes end to end.
Real-machine verification
Machine: the user-reserved EC2 host in us-west-2, driven over SSM only: Ubuntu 24.04.5 LTS, x86_64, 8 vCPU, CPython 3.12.3, run as an unprivileged user; the namespace sandbox is available.
Method: one venv got the dependencies from an editable install of the head; each tree under test (a shallow fetch of that commit) is first on
PYTHONPATH. The same probe script (not in the repo) ran against each tree with the same command,PYTHONPATH=<tree>/src <venv>/python -P probe.py <work-dir>/omc-app.json, with its own throwawayHOME,KIROCREW_HOMEand temp folder. The probe writes the adopted app's real manifest (its repository'sapp.jsonat the pinned commit, version 0.2.4) plus anownerCeilingsblock forops_mission_control_policy.jsoninto the data home, mounts the core app routes withregister_app_routesbehind a stand-in for token auth that sets the caller (the local owner subject with the real owner gate, the app's token, an internal caller, another dashboard user), and calls them on a loopback ephemeral port. Then it reads and writes the file from a child started withbackend_sdk.run_sandboxed(..., mode="standard"), and prints the Security Event Log rows the routes wrote.Before (base
fbb20518397d):APP_SDK_LEVEL 58; the manifest'sownerCeilingsis left unread inextra.GET /api/apps/ops-mission-control/owner-ceilingsandPUT .../owner-ceilings/ops_mission_control_policy.json, for every caller, answers 404: core has no surface that reads or writes the ceiling; the file stays absent.catof the file sees 0 bytes (the host file holds 42), and a write leaves the host file unchanged. Noapps.owner_ceilingsrow.After (head
c9879c67df64; the earlier heads957e24454a2band1d2f5059b820gave the same lines, without the two refusals that head added):APP_SDK_LEVEL 59; the declaration parses intoownerCeilingsand validates.GET-> 200,state=absent,values={}.app_token_forbidden; internal caller -> 403dashboard_session_required; another dashboard user -> 403owner_only; on both routes, and the file is still absent.PUTofmode: actand one act-rule -> 200state=ok; the file holds exactly those two keys, mode0o600; the app's in-process read of the file givesmode = act.PUTagain with the old revision -> 409owner_ceiling_changed;mode: everything-> 400owner_ceiling_invalid; an undeclaredledger_sync_remote-> 400owner_ceiling_invalid.actions: []->state=outside_shapeand thePUTover it -> 409owner_ceiling_outside_shape, the file byte-identical; a planted label" prod "->state=outside_shape(would save differently) and aPUTof an unrelated field -> 409, the file byte-identical; a corrupt file ->state=corruptand 409owner_ceiling_corrupt; a 162,712-byte save whose file would pass 256 KiB -> 413owner_ceiling_too_large, the file unchanged; a declaration namingops_mission_control_secrets.json->state=refused(owner_ceiling_is_credential) and itsPUT-> 403.catsees 0 bytes, the write leaves the host file unchanged), so the file's disposition did not move.deniedfor each of the six caller refusals, oneallowedwithkeys=['autonomy_rules', 'mode']and no values, anddeniedwith its code for each of the nine refusals above.Cleanup: removed the run directory (the venv, both source trees, the probe, the fetched manifest and every throwaway home); no process from that directory left running; instances left running (user-reserved).
Screenshots / video
The real
AppDetailPagein the capture harness, opened at/apps/detail/ops-mission-control#owner-ceilingswith only gateway reads stubbed, so the page has scrolled to the card the app's own page links to.Dark, the stored ceiling as the form shows it:
Dark, after the owner picks "Act on its own" (Save enabled):
Light theme, and a file the page cannot show
A stored value the page never writes: the card says why and offers no form.
Related Issues
Part of #26967
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commitsContribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.