Skip to content

feat(app-kit): let an app open and drive its own chat slots - #36356

Merged
bolichen97 merged 1 commit into
mainfrom
feat/w5-chat-slot
Nov 14, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
feat/w5-chat-slot

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: An app can open and drive its own dashboard chat slots (turns and queue, restore and archive, stop, transcript, AutoNudge) through one generic, level-gated App Kit seam, so Spec Builder can leave core without reaching private gateway functions.

Spec Builder's worker is a visible dashboard chat. To run it, the built-in (and its external copy in KiroCrewCaptain/kirocrew-app-spec-builder) calls private gateway names: chat_runner._run_chat and _start_next_queued_turn, turn_dispatch.bounded_chat_turn, session_control.containment_meta, chat_persistence.rehydrate_slot_from_history_async and save_slot_off_loop, chat_utils._history_key_for, session_lifecycle.compaction_in_flight, the slot registry, and AutoNudge's service, maintenance view and authorize_and_add_nudge. An installed app has no public way to get any of them, so a refactor of any one silently stops it. Owner ruling 4 of 2026-11-13 on #26967 (comment 6841699202: "decide directly; users' normal use must not be affected; grant what is needed") asks for an app-owned chat slot API as a generic seam.

Why it matters

The campaign cannot move Spec Builder out of core (#26967) while its core function is a set of private host names. With the seam, the external copy runs on a public contract that keeps working across releases, and the safety the built-in has (slot identity, admission, redaction of text pushed to every dashboard, AutoNudge scoped to its own loops) is enforced by the host instead of re-implemented per app.

Not a goal

  • Deleting the built-in Spec Builder, or moving the wheel copy's own code onto the seam. The wheel copy only declares the permission here, so adopting the external copy is not a widening.
  • Editing adoption-pins.json or the catalog.
  • Any change to how a user's chat, the chat runner, the queue drain or AutoNudge behave.
  • Seams for the other private names the app still uses (sandboxed git spawn, critical audit record, no-follow readers, sensitive-path predicate).

What changed (motivation → approach → change)

One seam owns every chat-slot operation an app needs, keyed and checked by the app's own name.

  • ctx.chat_slots (apps/chat_slot_sdk.py), present only when permissions.chatSlots is the literal true. Keys are <app>-<id> (the ctx.turns grammar), at most the registry's folded key length, but ownership is the slot's _app, never the prefix (an app name can extend another's). open refuses a key whose live slot or saved transcript is someone else's, and restore never revives another owner's transcript; every call that acts on a slot refuses one that is not the app's (ChatSlotRefused), and the by-key ones also refuse a kept object that is not the live slot under its key. Turns start through the gateway's guarded start and chat runner as actor app under the unattended-turn cap, as an app's own /api/chat turn does, with the caller's provenance, after a restored note hold is delivered; send(reservation=) starts the turn a reserve held. A queued message gets the containment stamp and a redacted queued row, and keeps the person's origin only when it is typed, because the drain runs every entry as typed; a title is redacted before its push. stop_turn and archive drop queued work first; archive then runs the gateway's own close (close_slot, what a tab's close button runs), which owns every save, deletion and same-key race and answers False when it did not commit. A saved transcript is read only when it records the app as owner. The AutoNudge view acts only on loops on slots the app owns, a refused removal answering False; arm_nudge arms through authorize_and_add_nudge with source app:<app>. security_posture.py classifies the module as a non-egress redaction site.
  • Declared and shown. The trust prompt (TrustAppModal.tsx), the detail page (AppDetailGrantBoxes.tsx, AppDetailPage.tsx), the catalog's pre-install disclosure and the CLI install summary name it. Every trust prompt entry point (AppDetailPage.tsx, useAppActions.ts, appDetailPageLocalSwitch.ts) now reads the declared grants through one helper (trustGrants.ts, with the types in appDetailPageTypes.ts and types.ts), so the local-source switch prompt also shows workerAutoApprove and the user-session reach it missed. Adoption (E9) refuses a copy that declares it when the wheel copy does not; Spec Builder's wheel manifest declares it.
  • The prompt and detail copy is in every authored catalog under website/src/i18n/locales/ (en-XA regenerated).
  • App Kit seam level 7, in adoption_pin.py's level scan. compaction_in_flight's docstring (session_lifecycle_parts/stop_decline.py) lists the new caller.
  • The two source-tree registries classify the seam: its open creates an app-owned slot (test_chat_follow_default_slot_kinds.py), and its saved-transcript read is plumbing, like the Spec Builder read it replaces (test_transcript_derivation_seam.py).

Seam level 7, shared with #33589. Every seam of the open batch is level 7 (#26967, comment 6844003956). #33589 landed first and raised the level from 6 to 7, so this PR adds its rows to level 7 beside agentReadOnlyDirs and changes no level line. A level-7 host can lack any one of them, so the docs tell an app to test for ctx.chat_slots itself. Spec Builder's external copy detects both seams it uses by the seam, not the level (agentReadOnlyDirs in KiroCrewCaptain/kirocrew-app-spec-builder#6, merged).

Backwards compatibility

Compatible: the permission is new and off by default, so no installed app gets the seam until its manifest declares it; nothing a user does today changes. The E9 refusal applies only to an adopted manifest declaring the new key, which no shipped pin does.

Removes nothing: the change only adds a seam, a manifest key and a disclosure box.

Tests

  • test/test_app_chat_slot_sdk.py pins: presence only on a literal true; key grammar, including the longest key staying unfolded with file names that fit; title redaction, withholding and marking the slot for the next save; the restored hold delivered above the user row; send starting its own reservation and refusing an unread window until open; ownership refusals for every slot operation on a foreign or unscoped slot, leaving it untouched, and for a kept object whose key another app's slot now holds; open refusing a held key or another owner's saved transcript, and restore leaving one unpublished; send's provenance, app actor, unattended-turn cap and guarded start; the queued stamp, redaction and withheld-on-failure row; a queued composed message dropping the person's origin; the reservation and its drain; stop and archive order (queue dropped first, cooperative stop skipped while compacting, a successor started meanwhile left running, archive through the gateway's close, a close that did not commit answering False, and one archive run against the real state and close); transcript scoping (live owner, saved owner, off-loop window read); the AutoNudge view's slot-ownership scoping (a prefix-extending app's loop and a cold loop are invisible live), captured-loop removal, a removal the live service refused answering False, the maintenance view's saved owners, and arm_nudge's source; the install summary and catalog disclosure.
  • test/test_builtin_adoption_pins.py (level 7 for the key and the context seam) and test/test_builtin_adoption_apply.py (E9 refuses a new chatSlots).
  • website/src/test/TrustAppModalChatSlots.test.tsx: the trust prompt box, trustGrants (literal true only), the detail page box.
  • Each production file was reverted on its own and the tests above went red.
  • Local: the 919 test files that scan the source tree or touch apps and adoption (43821 passed; the one red, test_source_link_github_case.py, passes alone and touches nothing here); the related backend set (7082 passed: app context, manifest, permissions, catalog, adoption, decoupling, compaction stop, and the Spec Builder suite), tsc -p tsconfig.app.json, the i18n suite, black, isort, flake8, mypy on the touched modules, comment-history, brand, line-cap, docs lint, flake-pattern ratchet.
  • Determinism: every await is bounded (asyncio.wait_for), waits are on signals (a done callback setting an asyncio.Event), no clock, port or sleep. test_app_chat_slot_sdk.py: 20 runs at -n0 and 10 at -n 4 --dist loadgroup --max-worker-restart=2 beside test_app_agent_turn_sdk.py and test_app_context.py, all green; the 86 node ids shuffled with seed 36356, green.

Manual verification

The trust prompt was rendered from the built dashboard with stubbed API answers (screenshots below). The external Spec Builder copy runs on the seam in KiroCrewCaptain/kirocrew-app-spec-builder#4 and #5, whose suite passes on both a host with and without it.

Screenshots / video

The trust prompt for an app that declares permissions.chatSlots (built dashboard, stubbed API), dark and light:

Trust prompt, dark theme, with the chat sessions box

The detail page's permissions card, dark and light:

Detail page, dark theme, chat sessions box

Detail page, light theme, chat sessions box

Trust prompt, light theme, with the chat sessions box

Related Issues

Part of #26967

Owner ruling: #26967 (comment)

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 13, 2026 03:25
@bolichen97
bolichen97 enabled auto-merge (squash) November 13, 2026 03:26
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 13, 2026
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 62a48702498cf133ee31ee587bdd5fcdfc247d3b — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the seam only adds things, is off unless chatSlots is the literal true, checks ownership by the slot's own _app stamp, and drives turns through the gateway's existing runner and close paths.

Notes

  • The SDK is 777 lines, and every private gateway name it wraps is now pinned by a public contract. When those internals are refactored, the change should land in chat_slot_sdk.py together with test_app_chat_slot_sdk.py, not around them.

[DESIGN-REVIEWED] 62a4870

Description read

[DESCRIPTION-READ] c437c072dbc51f1a41d04d1e33c86fc1a884204c0f406927bf1ac41c51bc0c99

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 62a48702498cf133ee31ee587bdd5fcdfc247d3b — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

The seam replaces private host names that the Spec Builder backend calls today, so it answers a named need. The chatSlots flag is its own docs' "adds no reach" disclosure, and its only case is "answerable from the manifest".

Notes

  • Item 2 — inherited: the spec says "It is not a grant family… so the flag adds no reach. It names the seam so 'which apps run chats of their own' is answerable from the manifest." That is a manifest key, a trust-prompt box, a detail-page box, catalog and CLI lines, 13 locale strings and an E9 refusal, all for a disclosure with no named harm behind it. Subtraction: delete permissions.chatSlots, ChatSlotsBox, the trust-prompt row, the locale keys and the E9 branch, and build ctx.chat_slots for every app. Clears when: the flag is removed, or a human confirms the disclosure is wanted.

What this change ships

Inventory (6 items) — 5 justified

Intent: let an installed app run its own visible dashboard chats through a public contract, so Spec Builder can leave core. ADDITION.

  1. Apps get ctx.chat_slots to open, send, queue, stop, archive and restore owned chat slots, read transcripts and arm AutoNudge — justified
  2. New manifest permission chatSlots, shown on the trust prompt, detail page, catalog and CLI summary — inherited, disclosure only, adds no reach
  3. The local-source switch prompt now shows workerAutoApprove and user-session reach, via the shared trustGrants helper — justified
  4. Adoption refuses an external copy that declares chatSlots when the wheel copy does not — justified
  5. Spec Builder's wheel manifest declares chatSlots — justified
  6. App Kit seam level 7 now covers this seam — justified

[FIRST-PRINCIPLES-REVIEWED] 62a4870

Description read

[DESCRIPTION-READ] 00124aed363836188d465fefb2fb5cf0cc58cb00f9f9cc76181c6f550c7482ba

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 62a48702498cf133ee31ee587bdd5fcdfc247d3b — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks: the PR adds two information boxes and no new controls, both are shown in light and dark, and the blind reader understood them.

Notes

  • In chat_slots_desc (trust prompt), the reader did not know what "Their tool calls follow your approval rules for this app" means or where those rules are set. Suggested wording: "Anything they do needs your approval, the same as this app's other actions."
  • The reader could not tell whether chat sessions come with "all three" grants or are a fourth one. Suggested heading for chat_slots_heading: "Trusting also lets this app run its own chat sessions".

[UX-REVIEWED] 62a4870

Description read

[DESCRIPTION-READ] 8ce0511b03a0f9e03907da1e2c749aa6bb0dffb45680fe4fc14afb166930b15f

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 62a48702498cf133ee31ee587bdd5fcdfc247d3b — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 62a4870

Verdict parsed from the review's SHA-scoped output markers for commit 62a48702498cf133ee31ee587bdd5fcdfc247d3b.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 62a48702498cf133ee31ee587bdd5fcdfc247d3b false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 62a48702498cf133ee31ee587bdd5fcdfc247d3b and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 62a4870

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 62a48702498cf133ee31ee587bdd5fcdfc247d3b false-positive: <reason, 20 to 500 characters>

@bolichen97

Copy link
Copy Markdown
Contributor Author

span=6a034b31cd31 fixed in 7bcd172

  • send skipped the restored-hold flush (chat_slot_sdk.py:258)

fixed: send calls slot_buffers.flush_restored_hold above the user row when append_user is set; pinned by test_a_restored_note_hold_is_delivered_above_the_user_row.

@bolichen97

Copy link
Copy Markdown
Contributor Author

span=6a034b31cd31 fixed in 7bcd172

  • send could not start the turn its own reservation held (chat_slot_sdk.py:253)

fixed: send(reservation=r) clears slot.task while it is still r and starts the turn in the same step; a queued send returns None and attaches no callbacks, documented. Pinned by test_send_starts_the_turn_its_own_reservation_held.

@bolichen97

Copy link
Copy Markdown
Contributor Author

span=6a034b31cd31 fixed in 7bcd172

  • AutoNudge view decided ownership from the key prefix (chat_slot_sdk.py:553)

fixed: a loop is the app's only when the slot under its key is (live slot _app; in nudge_maintenance, the app its saved transcript records, read off the loop). Pinned by test_the_nudge_view_sees_only_loops_on_slots_the_app_owns.

@bolichen97

Copy link
Copy Markdown
Contributor Author

span=470aa782bec1 fixed in 7bcd172

  • Key prefixes do not establish slot ownership (chat_slot_sdk.py:554)

fixed: loops are scoped by the slot's owner (live _app, or the saved transcript's app in the maintenance view), and transcript() reads a saved conversation only when its metadata records this app. Pinned by the nudge-view tests and test_a_saved_transcript_another_owner_records_is_not_read.

@bolichen97

Copy link
Copy Markdown
Contributor Author

span=470aa782bec1 fixed in 7bcd172

  • Best-effort archival removes the transcript's retry path (chat_slot_sdk.py:445)

fixed: archive always saves with best_effort=False; a failed save puts the slot back onto a free key for the periodic flush and answers False. Pinned by test_an_archive_that_cannot_save_puts_the_slot_back_for_the_flush_to_retry.

@bolichen97

Copy link
Copy Markdown
Contributor Author

span=470aa782bec1 fixed in 7bcd172

  • Lazy transcript hydration blocks the gateway event loop (chat_slot_sdk.py:469)

fixed: open(), restore() and transcript() await load_window_off_loop first; send() raises on a slot whose window is still pending. Pinned by test_transcript_reads_a_restored_rows_window_off_the_loop_first.

@bolichen97

Copy link
Copy Markdown
Contributor Author

span=470aa782bec1 fixed in 7bcd172

  • Slot titles bypass outbound redaction (chat_slot_sdk.py:215)

fixed: set_title stores the ScrubSDK.outbound text and withholds the title (False, slot untouched) when redaction fails. Pinned by test_a_title_is_redacted_before_it_is_pushed_and_withheld_when_it_cannot_be.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/security_posture.py

  • @bolichen97 posted a complete reasoning template for 62a4870.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: c72ae6d
  • What rule changed: security_posture.NON_EGRESS_REDACTION_MODULES gains one row, apps/chat_slot_sdk.py. The posture test requires every module that calls a redactor to be either a registered egress sink or a named non-egress redaction site; the new App Kit chat slot seam redacts (through ScrubSDK) the two texts an app writes onto its own slot that the dashboard pushes to every client, a queued message's queued row and the slot title, and owns no output of its own.
  • Before -> after (what was allowed/blocked, now): before, no module named apps/chat_slot_sdk.py existed. After, it is classified as a redaction site that is not an egress point. No gate, mask, sandbox rule or allow/deny row changes; nothing that was blocked is allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): if the module did own an egress, the posture inventory would under-list one sink. It does not: the queued row and the title leave only through the dashboard's own slot frames, already a registered sink, and both are withheld when redaction fails (test_app_chat_slot_sdk.py pins the withholding). No command breaks, no user is locked out.
  • Evidence checked (which sandbox result proves it): no sandbox result applies (no sandbox or tool-gate code changed). test/test_security_posture.py and test/test_app_chat_slot_sdk.py pass locally on this tree; the seam's title and queued-row redaction tests fail when the scrub call is removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): the related backend set (adoption, app context, manifest, permissions, catalog, the chat slot seam, the Spec Builder suite) and 919 source-tree-scanning test files ran locally, green apart from one unrelated test that passes alone.
    • Backward compatible (old config / old data / old callers still work, how checked): the row only names a new module; ctx.chat_slots exists only for a manifest that declares permissions.chatSlots, which is new and off by default.
    • Existing tests (which suites passed on this head): local runs above; CI is re-running on this head.
  • How to undo: revert the PR; the row goes with the module.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 13, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Seam level moved from 8 to 7, per the #26967 driver decision (comment 6844003956): every seam of the open batch is level 7, so this PR no longer has to land after #33589, and whichever of them merges first raises APP_SDK_LEVEL from 6 to 7.

Because a level-7 host can lack any single seam of the batch, the api-reference and §40 tell an app to test for ctx.chat_slots itself. Spec Builder's external copy already detected ctx.chat_slots by attribute; its agentReadOnlyDirs gate was level-only, which on a level-7 host without that seam would have moved the decision record into an unfenced directory. That is fixed in KiroCrewCaptain/kirocrew-app-spec-builder#6 (merged as 1fe334488aad1414a77c87ba8f819eef96f7dae9; CI green on ubuntu, macOS, Windows and UI).

The same head also classifies the seam in the two source-tree registries the previous head's CI found it missing from (test_chat_follow_default_slot_kinds.py, test_transcript_derivation_seam.py). The other reds on 7bcd172 were the installation-token rate limit.

@KiroCrewCaptain

KiroCrewCaptain commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider estimates a 12% chance that this change introduces a defect, within the 12% limit for approving on its own, but it changes 2331 lines, more than the 400 it may approve on its own.

An additive App Kit seam that is off unless the manifest declares permissions.chatSlots as literally true. I checked every gateway name chat_slot_sdk.py calls against the repo: _run_chat kwargs, spawn_guarded_turn, run_background_turn, close_slot, rehydrate_slot_from_history_async, authorize_and_add_nudge, compaction_in_flight, load_window_off_loop, the AutoNudge live and maintenance views, and the slot-key length constants. All signatures match. Ownership checks use the slot's _app stamp, not the key prefix, and fail closed. Stop, reserve and queue logic matches the built-in Spec Builder code, and turns still pass _run_chat's gate_turn admission. The built-in doesn't use the seam yet and Spec Builder isn't in adoption-pins.json, so nothing that works on main changes. The frontend refactor puts all three trust-prompt entry points on one helper and adds the two grants the local-source switch prompt was missing. Backend and frontend tests cover the new behaviour. No blocking defects found.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 62a4870249 · 2331 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 13, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto main 6d61070 (from 0e5b203) to pick up the Coverage Gate fix #36804; the diff itself did not change, so the body and every review disposition still describe it. Head is now e1e17a0.

The reds on the previous head e9b37ee are not this PR's:

Locally on the rebased head: the five changed backend test files (264 passed), isort, flake8, mypy, black baseline, comment-history, brand-name and file-line-cap gates pass.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: e1e17a0
  • What rule changed: security_posture.NON_EGRESS_REDACTION_MODULES gains one row, apps/chat_slot_sdk.py. The posture test requires every module that calls a redactor to be either a registered egress sink or a named non-egress redaction site; the new App Kit chat slot seam redacts (through ScrubSDK) the two texts an app writes onto its own slot that the dashboard pushes to every client, a queued message's queued row and the slot title, and owns no output of its own.
  • Before -> after (what was allowed/blocked, now): before, no module named apps/chat_slot_sdk.py existed. After, it is classified as a redaction site that is not an egress point. No gate, mask, sandbox rule or allow/deny row changes; nothing that was blocked is allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): if the module did own an egress, the posture inventory would under-list one sink. It does not: the queued row and the title leave only through the dashboard's own slot frames, already a registered sink, and both are withheld when redaction fails (test_app_chat_slot_sdk.py pins the withholding). No command breaks, no user is locked out.
  • Evidence checked (which sandbox result proves it): no sandbox result applies (no sandbox or tool-gate code changed). test/test_security_posture.py and test/test_app_chat_slot_sdk.py pass locally on this tree; the seam's title and queued-row redaction tests fail when the scrub call is removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): the related backend set (adoption, app context, manifest, permissions, catalog, the chat slot seam, the Spec Builder suite) and 919 source-tree-scanning test files ran locally, green apart from one unrelated test that passes alone.
    • Backward compatible (old config / old data / old callers still work, how checked): the row only names a new module; ctx.chat_slots exists only for a manifest that declares permissions.chatSlots, which is new and off by default.
    • Existing tests (which suites passed on this head): this head is e9b37ee rebased onto main 6d61070 with an identical patch (every added and removed line matches). On this head the CI run (every Backend Tests shard on Linux and Windows, E2E, Coverage Gate) and all eight macOS shards are green; locally the five changed backend test files pass (264 tests), with isort, flake8 and mypy clean.
  • How to undo: revert the PR; the row goes with the module.

@bolichen97

Copy link
Copy Markdown
Contributor Author

self-added: no
mechanism: AppNudges.remove returns the live service's removal result, and remove_on_slot passes it through

  • Refused AutoNudge removal is reported as successful span=470aa782bec1

fixed in aa7d57e: AppNudges.remove returns bool(await service.remove(...)) on the live service, so a removal a maintenance quiesce refused answers False, and remove_on_slot returns that answer instead of a bare True.
The maintenance view's remove returns None and raises on a failed write under the lock it holds, so that branch answers True once the call returns.
Class swept in chat_slot_sdk.py (every return True and every await self._service. call): set_title, stop_turn, archive and deactivate_and_wait already report their real outcome.
Pinned by test_a_removal_the_live_service_refused_is_not_reported_as_done (red on e1e17a0, green here); the maintenance test asserts True.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: aa7d57e
  • What rule changed: security_posture.NON_EGRESS_REDACTION_MODULES gains one row, apps/chat_slot_sdk.py. The posture test requires every module that calls a redactor to be either a registered egress sink or a named non-egress redaction site; the new App Kit chat slot seam redacts (through ScrubSDK) the two texts an app writes onto its own slot that the dashboard pushes to every client, a queued message's queued row and the slot title, and owns no output of its own.
  • Before -> after (what was allowed/blocked, now): before, no module named apps/chat_slot_sdk.py existed. After, it is classified as a redaction site that is not an egress point. No gate, mask, sandbox rule or allow/deny row changes; nothing that was blocked is allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): if the module did own an egress, the posture inventory would under-list one sink. It does not: the queued row and the title leave only through the dashboard's own slot frames, already a registered sink, and both are withheld when redaction fails (test_app_chat_slot_sdk.py pins the withholding). No command breaks, no user is locked out.
  • Evidence checked (which sandbox result proves it): no sandbox result applies (no sandbox or tool-gate code changed). test/test_security_posture.py and test/test_app_chat_slot_sdk.py pass locally on this tree; the seam's title and queued-row redaction tests fail when the scrub call is removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): the related backend set (adoption, app context, manifest, permissions, catalog, the chat slot seam, the Spec Builder suite) and 919 source-tree-scanning test files ran locally, green apart from one unrelated test that passes alone.
    • Backward compatible (old config / old data / old callers still work, how checked): the row only names a new module; ctx.chat_slots exists only for a manifest that declares permissions.chatSlots, which is new and off by default.
    • Existing tests (which suites passed on this head): this head differs from e1e17a0 (whose CI run, every Backend Tests shard on Linux and Windows, E2E and Coverage Gate, and all eight macOS shards were green) only in the chat slot seam returning the AutoNudge service's removal result, its test and spec line, and a rebase onto main c275f70. Locally on this head the related set passes (322 tests: the chat slot seam, adoption, slot kinds, transcript seam and test_security_posture.py), with isort, flake8, mypy and the black, comment-history, brand and line-cap gates clean; CI is re-running here.
  • How to undo: revert the PR; the row goes with the module.

@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention labels Nov 14, 2026
An app whose worker is a visible dashboard chat (Spec Builder) reaches
private gateway names to run it: the chat runner and its queue drain,
the turn ceiling, the containment stamp, slot restore and archive, the
compaction probe, the slot registry and AutoNudge. Owner ruling 4 of
2026-11-13 on #26967 asks for an app-owned chat slot API instead.

ctx.chat_slots (App Kit seam level 8, permissions.chatSlots) is that
seam. Keys are <app>-<id>, every slot operation refuses a slot that is
not the app's, turns run through the gateway's own chat runner with the
caller's provenance, a queued message is stamped and its pushed row
redacted, stop and archive drop queued work first, and the AutoNudge
view and arm call see and act on the app's own loops only, through the
shared authorization chokepoint.

The declaration is shown on the trust prompt, the detail page, the
catalog disclosure and the CLI install summary; every trust prompt
entry point now reads the declared grants through one helper. Adoption
refuses a copy that declares it when the wheel copy does not, and Spec
Builder's wheel manifest declares it.
@bolichen97

bolichen97 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased onto main 8a82f59 to clear a merge conflict: main added an exact permissions.api entry as a level-7 seam in the same four places this PR adds permissions.chatSlots (scripts/adoption_pin.py, test/test_builtin_adoption_pins.py, docs/app-kit/api-reference.md, app-kit-platform.md). Each conflict is resolved as the union of both rows; nothing else in the diff changed. Head is now 62a4870.

On aa7d57e every lane was green (CI, all eight macOS shards, GPT, Opus, Design, First Principles, UX) except CodeQL Analyze (python), whose SARIF upload hit API rate limit exceeded for installation twice. Locally on 62a4870: 770 related tests pass (chat slot seam, app context, permissions, SDK level mirror, every builtin-adoption file, catalog, security posture), and the isort, flake8, mypy, black, comment-history, brand, line-cap and docs-lint gates pass.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 62a4870
  • What rule changed: security_posture.NON_EGRESS_REDACTION_MODULES gains one row, apps/chat_slot_sdk.py. The posture test requires every module that calls a redactor to be either a registered egress sink or a named non-egress redaction site; the new App Kit chat slot seam redacts (through ScrubSDK) the two texts an app writes onto its own slot that the dashboard pushes to every client, a queued message's queued row and the slot title, and owns no output of its own.
  • Before -> after (what was allowed/blocked, now): before, no module named apps/chat_slot_sdk.py existed. After, it is classified as a redaction site that is not an egress point. No gate, mask, sandbox rule or allow/deny row changes; nothing that was blocked is allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): if the module did own an egress, the posture inventory would under-list one sink. It does not: the queued row and the title leave only through the dashboard's own slot frames, already a registered sink, and both are withheld when redaction fails (test_app_chat_slot_sdk.py pins the withholding). No command breaks, no user is locked out.
  • Evidence checked (which sandbox result proves it): no sandbox result applies (no sandbox or tool-gate code changed). test/test_security_posture.py and test/test_app_chat_slot_sdk.py pass locally on this tree; the seam's title and queued-row redaction tests fail when the scrub call is removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): the related backend set (adoption, app context, manifest, permissions, catalog, the chat slot seam, the Spec Builder suite) and 919 source-tree-scanning test files ran locally, green apart from one unrelated test that passes alone.
    • Backward compatible (old config / old data / old callers still work, how checked): the row only names a new module; ctx.chat_slots exists only for a manifest that declares permissions.chatSlots, which is new and off by default.
    • Existing tests (which suites passed on this head): this head is aa7d57e rebased onto main 8a82f59, its four conflicts resolved as the union with main's exact permissions.api level-7 row (no change to security_posture.py or the seam). On aa7d57e the CI run (every Backend Tests shard on Linux and Windows, E2E, Coverage Gate) and all eight macOS shards were green. Locally on this head 770 related tests pass, test_security_posture.py among them; CI is re-running here.
  • How to undo: revert the PR; the row goes with the module.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 14, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Head 62a4870 is green (readiness: passed; CI, all eight macOS shards, GPT, Opus, Design, First Principles and UX pass on this head). green_age.py reports main 17 commits ahead (8a82f59 -> f9ebf3a) with overlap in app-kit-platform.md and same-directory files. I did not rebase: this PR waits on a human approval, and the re-sync budget is 2/3. Instead I checked this head against f9ebf3a locally. git merge-tree is clean, and with the commit applied on f9ebf3a the 770 related tests pass (chat slot seam, app context, permissions, SDK level mirror, every builtin-adoption file, catalog, security posture) and mypy is clean.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review checked head 62a4870. Every host call the new ctx.chat_slots seam makes exists with the arguments it passes. Ownership is decided by the slot's _app stamp plus live identity, not by key prefix. Keys stay under the registry's fold length. Store reads run off the event loop. Archive hands off to the gateway's own close_slot. The review also ran test/test_app_chat_slot_sdk.py from this head (86 passed, repeats green under xdist) and found 15 of 19 single-line mutations of chat_slot_sdk.py caught. Well done: each public method replaces a private gateway call the built-in Spec Builder already makes, so nothing in the seam is speculative.

Security: the new permission is declared in the manifest, the wheel copy declares it first, an adopted copy that adds it over a wheel copy without it is refused as a widening (E9), and the trust prompt shows it. Turns the seam starts run as actor app through spawn_guarded_turn and run_background_turn. They keep the unattended-turn cap and Shared Crew admission, and they queue only typed messages with the person's origin. Titles pass outbound redaction and are withheld when redaction fails. The flag is disclosure only, like agentTurns. It is not a boundary against the app's trusted in-gateway code, and the module says so.

Optional:

  • #36359 also adds website/src/components/appstore/trustGrants.ts, with a different API (trustGrantsOf(manifest), which includes desktop). Pick one owner and name the merge order in both bodies. Folding desktop into the single helper would also make its "reaches every entry point" docstring true.
  • The reservation-release guard at chat_slot_sdk.py:475 has no pin. Deleting it lets a finished reservation set slot.task = None over a running turn, and all 86 tests still pass. A test that waits for the reservation's done callbacks before checking slot.task would catch it.
  • Two more fences are pinned on one side only: restore's owns(restored) refusal on a foreign live slot, and the E9 chatSlots gate when both the wheel and adopted copies declare the flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: passed Eligible automated validation passed for the current revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants