Repository navigation
feat: let sessionApproval reach Bot threads with memberThreads - #26271
Conversation
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level concerns. Notes
[DESIGN-REVIEWED] d8c5dda Description read[DESCRIPTION-READ] 61e1c6a18ae6e4c67af3868b0d9140a423222191892aa80f97fa3c747b2ad126 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 |
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks: the nine screenshots show every web surface this PR adds, in both themes. This lane has no blind read, so whether a first-time user understands the new "Bots" line is still unknown; pushing the branch to this repository runs one. Notes
[UX-REVIEWED] d8c5dda Description read[DESCRIPTION-READ] f7d17ad14a3bf76df2483ce48c3bb6ff8d45805d684ca89bd7685f89a7c0dc95 That sha256 names everything this verdict read: the PR description, plus the 12 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, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Every item comes from the reported dead end (Bot DM slots visible to Notes
What this change shipsInventory (10 items) — 9 justifiedIntent: let a trusted companion or hardware app answer a Bot's pinned DM thread, if the owner opts in. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] d8c5dda Description read[DESCRIPTION-READ] d54bd6063d6450b132b56f667847008f321a7951f849dd0e22861388d870317e That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
6c192da to
416a788
Compare
416a788 to
182cc72
Compare
Head branch was pushed to by a user without write access
182cc72 to
1239336
Compare
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
1239336 to
b303015
Compare
4dfa5c1 to
294c3a8
Compare
|
|
|
|
|
|
|
|
|
|
|
|
|
Naming update to the title, the The branch is also rebased onto current |
|
Backend Tests (3.12, 2) is red at |
bolichen97
left a comment
There was a problem hiding this comment.
Approving. This adds permissions.memberThreads, a scope of sessionApproval that grants nothing on its own. With both declared, the same four session-control actions (send, choose an option, approve or deny, switch Normal/Reads/Trust) also reach a Bot's live pinned DM thread, and nothing else about the Bot.
The boundary holds where it matters:
- A thread counts only when it carries both of its birth marks (
mode: "member"and themember-key). A member-mode session under any other key stays denied. /api/members/*and/api/teams*still answer an app 404. The thread's transcript stays owner-only. An app still never creates a member slot: a member key with no live thread is the uniform 404.- The scope is read from the same manifest as the grant's consent. A manifest that newly declares it on a held grant lands disabled with
session_approval_reconsent. The enable must carrymemberThreadsConsentfrom a dialog that named the user's Bots. test_member_thread_grantand the consent tests pin these cases.
It widens what an app can do only after the owner opts in, and it adds no new refusal. No regex in product code. All checks are green.
|
Backend Tests (3.12, 5) and (3.12, 6) are red at
Security Scope Review did not run: both attempts lost the runner's connection to github.com ( |
An app holding permissions.sessionApproval can send a turn, pick an
[OPTIONS:] choice, approve or deny a tool request and switch the
approval mode on a person's session, but a Bot's pinned DM thread (a
member-mode slot) was excluded outright, so a companion or hardware app
could watch a Bot ask a question and never answer it.
permissions.memberThreads is a scope of that grant, not a grant of its
own: with both declared, the same four actions reach the live member-*
thread the owner opened, and nothing else about the Bot. The key names
the thread the way the slot does (member-<slug>, mode "member"); main
already uses crewmate_threads for a different feature (reply threads).
The thread is recognised on both marks it is born with (mode "member"
and the member- key); the scope alone grants nothing; and an app still
never mints or holds a member slot, because the key reservation stands
down only for a live thread on a grant route. /api/members/*, the
thread's transcript, resume and the OpenAI-compatible route stay
refused.
One manifest read decides grant and scope together.
permissions.app_session_control_grant reads the manifest once,
app_can_manage_session_approvals judges consent and enablement against
that same manifest (keyword-only `manifest=`, the _read_installed
convention), and the scope is that manifest's flag, held only with the
grant. slot_ownership.read_session_control_grant is the one off-loop
hop; session_grant memoizes both fields from it for every app caller,
so a refusal costs the same whatever slot was named, and
app_admission._app_may_send_to_slot judges on the same value. An
update landing between a request's reads can therefore never lend its
new scope to the old, consented record.
A manifest that newly declares the scope on a held grant is a widened
grant: an update or an external registration lands disabled pending
re-consent, as a newly declared sessionApproval does, and the store's
pre-install disclosure carries the scope beside the grant.
manager_records._session_control_widening names the keys actually
added (sessionApproval, memberThreads, or both), so the
session_approval_widened SEL row and the operator notice say what the
update added. A manifest gaining memberThreads outside an update
disables the app at the next reconcile until the owner consents again.
The owner sees the scope where that consent is given. The trust modal
and the app detail page add one line inside the session-approval box
when the manifest declares it, the detail page lists the manifest key
beside sessionApproval and carries the same line in its re-consent
dialog, and the kirocrew app enable refusal prints the sentence as a
second line of its Chats entry. Without the flag every surface says
nothing about Bots. Following the Bot naming decision, every sentence a
person reads calls the agent a Bot, untranslated in every locale ("This
includes your own chats with your Bots."). A consent refused because
the confirmed dialog predates the scope shows the catalog sentence
pages.appDetailPage.session_approval_member_threads_refused, picked by
the journaled session_approval_consent_required code; the server
sentence stays as the English for every other caller.
With this change chat_send.py would pass the 2,000-line cap, so its SSE
writer, write_sse_or_abort, moves verbatim to its own chat_api owner,
sse_write, composed onto the chat_handlers globals like the others.
Tests: the rule reaches a Bot thread only with grant and scope, never
either alone, never a member-mode slot under another key; the one
read's truth table and fault paths; a manifest updated mid-request
cannot lend its scope; an update adding the scope reaches nothing until
re-consent and everything after it, with the SEL row naming the scope,
and the same row for register_external_app; the checkpoint reads the
manifest once whatever slot was named; approve, mode change and send
admit the thread with the scope and answer the uniform 404 without it;
a send never mints a member slot; the CLI refusal, the trust modal and
the detail-page dialog name the Bots' chats only when the manifest
declares the scope.
|
Rebased onto |
Problem / Motivation
Goal: An app the owner already trusts to control their chats can, when its manifest asks for it and the owner consents, also answer a Bot's pinned DM thread: pick one of the Bot's
[OPTIONS:]choices, approve or deny its tool prompt, or switch its approval mode.An app holding
permissions.sessionApprovalcan send a turn, choose a response option, approve or deny a tool request and change the approval mode on a user's session, and it already sees Bot DM slots (member-<slug>,mode: "member") inGET /api/chat/slotsand on theslots:userstream with theiroptions,pending_approvalandlast_message. But every write to such a slot is refused with404 slot_not_found:app_slot_is_local_user_sessionexcludedmode == "member"andapp_reserved_key_reasonrefused themember-prefix outright. A companion or hardware app (Keeb Crew is the first) can watch a Bot ask a question and never answer it.Why it matters
A Bot "asks one thing once, with an
[OPTIONS:]line", which is exactly what a three-key device or a companion app is best at answering from the desk. Without this the owner must open the dashboard for every Bot question, and the apps built onsessionApprovalcan only ever do show-and-jump for Bots.Not a goal
/api/members/*or/api/teams*: creating, editing, deleting, greeting, fresh-starting or managing a Bot stays owner-only.member-*key with no live thread is still refused and never minted.POST /v1/chat/completionsor the resume route for member keys.sessionApprovalalone behaves exactly as before.sessionApproval.What changed (motivation → approach → change)
With
permissions.memberThreadsdeclared besidesessionApproval, and the owner's consent, the four actions an app already has on the owner's sessions reach a Bot's live DM thread. Nothing else about the Bot opens.The flag is a scope of the existing grant, not a silent widening of
sessionApprovaland not a grant of its own. An owner who consented to "your chats" did not consent to the agents they gave their own memory, goals and heartbeat to, and "which apps can speak to my Bots" must be answerable from the manifest, asspawnandjobsare. A standalone grant would double the consent machinery for a hypothetical Bots-only app; the scope reuses all of it. Grant and scope come from one manifest read: consent and enablement are judged against the same manifest the scope is taken from, so a manifest update landing between two reads of one request can never lend its new scope to the old, consented record.The key is
memberThreadsbecause it names the thread the way the slot does (member-<slug>,mode: "member", and main's own "member threads" for a member's DM threads).crewmate_threadsalready names a different feature on main, the reply threads on Bot chat messages (dashboard.crewmate_threads,useCrewmateThreadsFlag), so the scope does not reuse it.src/kiro_crew/apps/manifest_sections.py,permissions.py)permissions.memberThreads, held only when literallytrue; round-trips throughto_dict/from_dict.app_session_control_grant(app)returnsSessionControlGrant(granted, member_threads)from one read;app_can_manage_session_approvals(app, manifest=...)judges consent and enabled state against that manifest.src/kiro_crew/dashboard/slot_ownership.py)is_member_threadneeds both marks the thread is born with (mode="member"and amember-key).app_slot_is_local_user_session(..., member_threads=)admits it only with the scope.read_session_control_grantis the one off-loop hop, memoized per request formember_thread_grant(request);app_may_control_sessionanddeny_app_session_controlapply it.app_reserved_key_reasonandapp_new_key_refusal(..., session_grant_route=True)stand down for amember-key only when a live Bot thread holds exactly that key on a grant route, so an app still never mints or holds a member slot.src/kiro_crew/dashboard/chat_api/chat_send.py,app_admission.py,chat_handlers.py)permissions.sessionApproval+memberThreads|slot=...._app_may_send_to_slot, and through it/api/approvals/{id}/{action}, judges on the same one read. The facade re-exports the reader. The SSE writerwrite_sse_or_abortmoves unchanged to its own owner,chat_api/sse_write.py, sochat_send.pystays under the 2,000-line cap.src/kiro_crew/apps/manager_records.py,manager_install.py,manager_external.py,manager_activation.py,manager.py,official_catalog.py,routes_enable.py)_session_control_wideningnames what a manifest adds to session control:sessionApproval,memberThreads, or both.update_appandregister_external_appland such a manifest disabled pending re-consent, as a newly declaredsessionApprovaldoes; the SELsession_approval_widenedrow and the operator notice name the added key. The record holdsmemberThreadsConsented, set only when the owner consents while the manifest declares the scope; a record without it (written by an older host) reads as consent-pending. The enable request carriesmemberThreadsConsentonly when the confirmed dialog named the scope, and a consent without it is refused while the live manifest declares the scope, so a dialog left open across an update cannot grant it. The store's pre-install projection carries the scope beside the grant.website/src/components/appstore,website/src/pages,website/src/pages/apps,website/src/api,src/kiro_crew/cli_commands_app.py, re-exported fromsrc/kiro_crew/cli_commands.py)sessionApprovalon the detail page; thekirocrew app enablerefusal prints it as a second, unlabelled line of itsChats:entry. A refused stale consent reloads the page and says "This app now also asks to reach your chats with your Bots. Review it and enable again." The page takes that sentence from its catalog (pages.appDetailPage.session_approval_member_threads_refused), picked by the journaledsession_approval_consent_requiredcode while the reloaded manifest declares the scope, so it is translated; the gateway's English sentence stays for every other caller and as the error report's key. Every surface says nothing about Bots unless the manifest declares the scope. Wording follows the Bot naming decision: people read "Bot"/"Bots", untranslated in every locale. Catalog keyssession_approval_member_threads(trust modal and detail page) andsession_approval_member_threads_refused(detail page) for every shipped language underwebsite/src/i18n/locales, each naming the untranslated Bot in that language's grammar,en-XAregenerated.docs/app-kit/manifest-reference.md(new subsection),docs/app-kit/api-reference.md,docs/system-specs/modules/app-kit-platform.md(including that a manifest gainingmemberThreadsoutside an update leaves the app disabled at the next reconcile until the owner consents again),docs/architecture/app-platform-trust-model.md, and thechat_apiowner list indocs/system-specs/modules/learn-cron-dashboard.md.No RFC is linked: the change adds a manifest flag, changes no default and removes no user-facing capability. It was agreed with the maintainers before the PR.
Backwards compatibility
Compatible: the flag is additive and defaults to
false; an app without it keeps today's behaviour on every route, including the404 slot_not_foundon member slots. The new parameters onapp_slot_is_local_user_session,app_may_control_session,app_reserved_key_reason,app_new_key_refusal,app_can_manage_session_approvalsand_app_slot_acquisition_recheckare keyword-only with defaults that keep the old behaviour; the pinned base-surface signature intest_chat_handlers_composition_contract.pyfollows.slot_ownership.read_session_grantis renamed toread_session_control_grant(it returns the grant and the scope together). Its readers onorigin/main @ e791ba56c5:Reader: src/kiro_crew/dashboard/chat_api/app_admission.py:_app_may_send_to_slot -- app -- calls read_session_control_grant and judges on both fields; test_member_thread_grant.py
Reader: src/kiro_crew/dashboard/chat_handlers.py:read_session_control_grant -- app -- the facade re-export follows the rename; test_chat_handlers_composition_contract.py pins the new name
Reader: src/kiro_crew/dashboard/slot_ownership.py:session_grant -- app -- reads the one hop and memoizes grant and scope on the request; test_slot_ownership_checkpoint.py
Reader: test/test_slack_auto_link.py:test_app_token_send_does_not_link -- app -- its patch target is the renamed reader; the test passes
Tests
test/test_member_thread_grant.py(new): the rule reaches a Bot thread only with grant and scope, never grant alone, never scope alone, never a member-mode slot under another key; the scope widens no other app-control target; approve, mode change and send admit the thread with the scope and answer the uniform 404 without it; a send never mints a member slot; manifest round-trip; the one read's truth table and fault paths (missing or unreadable manifest refuses); the manifest handed to the record read is the one the scope came from; a manifest updated mid-request cannot lend its scope (one read, the new manifest never consulted); an update adding the scope reaches nothing until re-consent and everything after it, with the SEL row namingpermissions.memberThreads, and the same row forregister_external_app; the widening table pins the names.test/test_slot_ownership_checkpoint.pyand its helpers: at the checkpoint the grant reachesmember-mate/approveonly with the scope (with theSESSION_CONTROL_DENIEDaudit row without it), the scope alone reaches nothing, and the manifest is read once whatever slot was named.test/test_app_cli_session_approval_consent.py: the CLI refusal prints the scope sentence as the second, unlabelled line of theChats:entry only when the manifest widens to Bots, and says nothing about Bots otherwise.website/src/test/TrustAppModal.test.tsxandAppDetailPageCoverage.test.tsx: the modal and the detail page's re-consent dialog show the scope line only when the manifest declares it, inside the session-approval box, never the raw key; confirming the dialog sendsmemberThreadsConsentonly when it named the scope; a stale-dialog refusal reloads the app and shows the catalog sentence rather than the server's; the same refusal code with no scope declared keeps the server's sentence.test/test_member_thread_grant.pyandtest/test_apps_routes_coverage_enable_disable.py: an enable records the scope consent only while the scope is declared; a consent whose dialog did not name the scope is refused and keeps the app pending; a record from an older host withoutmemberThreadsConsenteddoes not get the scope; the route sends the scope consent only together with the grant consent.test_chat_mode_security_send.py,test_slack_auto_link.py,test_slot_question_native_steer.py,test_slot_question_routes.pyandtest_slot_ownership_checkpoint_owner_session.pyaccept the manifest keyword.Manual verification
Rendered copy: captured at this head with headless Chrome (Playwright) against a disposable gateway started from the worktree (its own
KIROCREW_HOMEandKIRO_HOME, loopback only, port picked at run time) and the worktree's Vite dev server, light and dark. A test app installed by path declaressessionApprovalandmemberThreads. The run asserts the scope line and thememberThreadskey in the Permissions box, the two-paragraph re-consent dialog, and the scope line in the trust modal that the enable's execution-trust refusal opens. The stale-consent banner was reproduced for real: with the scope removed from the installed manifest the page showed no Bots line and the dialog opened chat-only; the manifest then gainedmemberThreadsin place, the dialog was confirmed, the gateway refused, and the reloaded page showed the catalog sentence (also captured in German). The CLI refusal is a file-onlykirocrew app enableagainst a second disposable home that already trusts the app.Still required: send an
[OPTIONS:]choice from an app with both flags to a live Bot thread and see it land as the owner's reply. Unit coverage pins the gateway decisions for it.Screenshots / video
Light and dark, captured at this head with a test app that declares
sessionApproval+memberThreads(Crew Keyboard).1. Detail page Permissions box, scope declared


2. Re-consent dialog, two paragraphs


3. Trust modal opened by the enable refusal, scope line inside the session-approval box


4. Refusal when the manifest gained the scope while the dialog was open (from the catalog)


The same refusal with the dashboard in German:

5.
kirocrew app enablerefusalRelated Issues
N/A -- agreed with the maintainers in Slack ahead of the PR.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.