Repository navigation
feat(apps): ctx.chat_slots.open(hidden=True) opens an app's hidden chat - #39246
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the new keyword goes through the existing Notes
[DESIGN-REVIEWED] ad4b3d1 Description read[DESCRIPTION-READ] 743c057eee5805c3b1df40ccdf7ce3b018591024fbbe1376b5f127524bc9aa93 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: the keyword is opt-in, closes #39193, and reuses the existing Notes
What this change shipsInventory (4 items) — 2 justifiedIntent: let an app's backend open a chat that stays out of the session lists and still counts as the app's chat for app-scoped rules (ADDITION).
[FIRST-PRINCIPLES-REVIEWED] ad4b3d1 Description read[DESCRIPTION-READ] 81617bc29b9363f2f9a8489e81c251f62da6b91ab795d883e1f6139a2e2314ac 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 detailsNo findings. False positive or not applicable? A repository writer can comment: |
6165439 to
ad4b3d1
Compare
Code change approver recommendation: A person should decideWhy: the decider estimates a 10% chance that this change introduces a defect, within the 12% limit for approving on its own, but it is held at tier 2: security-sensitive path. This adds an opt-in Trust boundary. The mode is always the app's own id, never one the caller supplies, which is the same rule Lifecycle. Disable, untrust and uninstall already go through Tier: 2, held for a person: security-sensitive path. 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 |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved. On head ad4b3d1 the review checked four things. open(hidden=True) runs the existing may_hide_sessions check off the loop. The check happens only when no live slot exists, and the key is looked up again after the await. A refused open creates nothing. An existing chat keeps its mode. All three new tests go red when the production hunk is reverted, and the _CALLS_PER_SITE row matches the real call count.
Security: the new path adds no hiding rule. The mode it sets is always the app name the host fixes when it builds the SDK, so an app cannot hide another app's chat or a person's chat. may_hide_sessions refuses the core member mode and retired or invalid names, and returns False on any manifest or trust read error. The result matches what the existing app-token POST /api/chat/slots path already produces, behind the same hiddenSessions grant.
Done well: the tests drive the real slot listing route and refresh, and show the chat lists again once the app may not hide it.
Optional:
- On main an app backend can already get a hidden chat with
_appstamped through its app token andPOST /api/chat/slotswithmode=<app>. A short comment that names that path would help. The real gain here is the in-process call, with no extrapermissions.apigrant and no HTTP round trip. - The spec line about the
chatSlotstrust copy could say that thehiddenSessionsrow carries the exception. - No test pins that the
may_hide_sessionsread runs off the event loop. A stub that recordsthreading.get_ident()would pin it.
Problem / Motivation
Goal: An app's backend can open a chat that stays out of the session lists and still carries the app's name, so app-scoped rules treat it as the app's.
Today an app picks one of two:
ctx.chat_slots.open(state, key)stamps the chat with the app's name (slot._app), so the app's tool profile,browserSitesand/api/browser/mediasee it as the app's. But it always opens as a plain chat, listed in the sidebar, even for an app that declarespermissions.hiddenSessions: true.POST /api/chat/slotswithmodeset to the app's id). That request is the owner's, so the chat gets no_app, and the app-scoped rules do not see it as the app's.Reproduced on
mainwith the real dashboard state: the SDK chat comes out_app='acme-app' mode='' surface=''(listed); the page chat comes out_app='' mode='acme-app' surface='acme-app'(hidden).Why it matters
The Mood Music app's DJ chat drives the Crew Browser, whose site grants check the chat is the app's. It also declares
hiddenSessionsso that chat stays out of the person's list. Neither path gives both, so the app either clutters the sidebar or loses its Browser grants.Not a goal
_app: a page's claim can be forged.hiddenSessionsrule (installed, enabled, trusted, declaring) decides.opendoes without the new keyword.What changed (motivation → approach → change)
ctx.chat_slots.open(src/kiro_crew/apps/chat_slot_sdk.py) gainshidden=False. Withhidden=True, a new chat is created under the app's own mode, the same modePOST /api/chat/slotsalready accepts from a hiding app, and keeps its_appstamp. The SDK asks the existingmay_hide_sessionsoff the event loop first; when the app may not hide, it raisesChatSlotRefusedand creates nothing. An existing chat is returned with the mode it has. Listing, resume and the switch back to listed when the app is disabled or untrusted are the existinghiddenSessionscode, unchanged.The API reference, the manifest reference, the App Kit spec and the
src/kiro_crew/apps/hidden_sessions.pydocstring now name the keyword.Backwards compatibility
Compatible:
hiddenis a new keyword that defaults to the old behaviour; an older host'sopentakes nohiddenand raisesTypeError, which the API reference states.Removes nothing: the diff only adds an opt-in keyword; no path, key, row or validator is taken away.
Tests
test/test_app_hidden_sessions.py, against the real dashboard state:test_chat_slots_opens_a_hidden_chat_stamped_with_its_app:open(..., hidden=True)gives_appandmodeboth the app's name, the slot listing reports it hidden, and once the app may not hide, the open chat lists again while keeping its mode.test_chat_slots_refuses_a_hidden_chat_to_an_app_that_may_not_hide:ChatSlotRefused, no slot created.test_chat_slots_opens_a_listed_chat_by_default: no keyword gives a plain chat; a laterhidden=Trueopen of that chat keeps its mode and asks nothing.test/test_chat_follow_default_slot_kinds.py:opennow has twoget_or_create_slotcalls, both passingapp=; the registry count says so.Determinism: the file passed 3 repeats and once in reversed order (46 passed). By hand, dropping the
may_hide_sessionscheck fails two new tests, and droppingmode=fails the first.Proof: PROVEN test/test_chat_follow_default_slot_kinds.py::TestSlotCreatorRegistry::test_every_creator_is_classified (head 6165439, same tree rebased)
Manual verification
N/A — unit coverage sufficient: the tests drive the real
get_or_create_slot, the real slot listing route and the real hidden-chat refresh; onlymay_hide_sessionsis stubbed, whichtest_any_other_app_may_notalready covers.Real-machine verification
N/A -- the change is an in-process SDK keyword covered by tests on the real dashboard state; no host, install or OS path differs.
Related Issues
Closes #39193
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)