Skip to content

feat: let sessionApproval reach Bot threads with memberThreads - #26271

Merged
bolichen97 merged 1 commit into
kirodotdev:mainfrom
devsdmf:feat/crewmate-session-approval
Nov 8, 2026
Merged

bolichen97 merged 1 commit into
kirodotdev:mainfrom
devsdmf:feat/crewmate-session-approval

Conversation

@devsdmf

@devsdmf devsdmf commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

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.sessionApproval can 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") in GET /api/chat/slots and on the slots:user stream with their options, pending_approval and last_message. But every write to such a slot is refused with 404 slot_not_found: app_slot_is_local_user_session excluded mode == "member" and app_reserved_key_reason refused the member- 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 on sessionApproval can only ever do show-and-jump for Bots.

Not a goal

  • No app access to /api/members/* or /api/teams*: creating, editing, deleting, greeting, fresh-starting or managing a Bot stays owner-only.
  • No read of a Bot thread's transcript, and no app-created member slot: a member-* key with no live thread is still refused and never minted.
  • No change to POST /v1/chat/completions or the resume route for member keys.
  • No change for apps that do not declare the new flag: sessionApproval alone behaves exactly as before.
  • Not a standalone grant: the scope has no meaning without sessionApproval.

What changed (motivation → approach → change)

With permissions.memberThreads declared beside sessionApproval, 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 sessionApproval and 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, as spawn and jobs are. 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 memberThreads because 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_threads already names a different feature on main, the reply threads on Bot chat messages (dashboard.crewmate_threads, useCrewmateThreadsFlag), so the scope does not reuse it.

Part Change
Manifest (src/kiro_crew/apps/manifest_sections.py, permissions.py) permissions.memberThreads, held only when literally true; round-trips through to_dict/from_dict. app_session_control_grant(app) returns SessionControlGrant(granted, member_threads) from one read; app_can_manage_session_approvals(app, manifest=...) judges consent and enabled state against that manifest.
Thread rule (src/kiro_crew/dashboard/slot_ownership.py) is_member_thread needs both marks the thread is born with (mode="member" and a member- key). app_slot_is_local_user_session(..., member_threads=) admits it only with the scope. read_session_control_grant is the one off-loop hop, memoized per request for member_thread_grant(request); app_may_control_session and deny_app_session_control apply it. app_reserved_key_reason and app_new_key_refusal(..., session_grant_route=True) stand down for a member- 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.
Send and approve path (src/kiro_crew/dashboard/chat_api/chat_send.py, app_admission.py, chat_handlers.py) The acquisition check and the post-await re-check carry the route and the scope; the allow audit row reads 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 writer write_sse_or_abort moves unchanged to its own owner, chat_api/sse_write.py, so chat_send.py stays under the 2,000-line cap.
Consent (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_widening names what a manifest adds to session control: sessionApproval, memberThreads, or both. update_app and register_external_app land such a manifest disabled pending re-consent, as a newly declared sessionApproval does; the SEL session_approval_widened row and the operator notice name the added key. The record holds memberThreadsConsented, 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 carries memberThreadsConsent only 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.
Disclosure (website/src/components/appstore, website/src/pages, website/src/pages/apps, website/src/api, src/kiro_crew/cli_commands_app.py, re-exported from src/kiro_crew/cli_commands.py) One line, "This includes your own chats with your Bots.", inside the session-approval box of the trust modal, the app detail page's Permissions box and its re-consent dialog, plus the manifest key beside sessionApproval on the detail page; the kirocrew app enable refusal prints it as a second, unlabelled line of its Chats: 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 journaled session_approval_consent_required code 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 keys session_approval_member_threads (trust modal and detail page) and session_approval_member_threads_refused (detail page) for every shipped language under website/src/i18n/locales, each naming the untranslated Bot in that language's grammar, en-XA regenerated.
Docs 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 gaining memberThreads outside an update leaves the app disabled at the next reconcile until the owner consents again), docs/architecture/app-platform-trust-model.md, and the chat_api owner list in docs/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 the 404 slot_not_found on member slots. The new parameters on app_slot_is_local_user_session, app_may_control_session, app_reserved_key_reason, app_new_key_refusal, app_can_manage_session_approvals and _app_slot_acquisition_recheck are keyword-only with defaults that keep the old behaviour; the pinned base-surface signature in test_chat_handlers_composition_contract.py follows.

slot_ownership.read_session_grant is renamed to read_session_control_grant (it returns the grant and the scope together). Its readers on origin/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 naming permissions.memberThreads, and the same row for register_external_app; the widening table pins the names.
  • test/test_slot_ownership_checkpoint.py and its helpers: at the checkpoint the grant reaches member-mate/approve only with the scope (with the SESSION_CONTROL_DENIED audit 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 the Chats: entry only when the manifest widens to Bots, and says nothing about Bots otherwise.
  • website/src/test/TrustAppModal.test.tsx and AppDetailPageCoverage.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 sends memberThreadsConsent only 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.py and test/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 without memberThreadsConsented does not get the scope; the route sends the scope consent only together with the grant consent.
  • Grant stubs in test_chat_mode_security_send.py, test_slack_auto_link.py, test_slot_question_native_steer.py, test_slot_question_routes.py and test_slot_ownership_checkpoint_owner_session.py accept 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_HOME and KIRO_HOME, loopback only, port picked at run time) and the worktree's Vite dev server, light and dark. A test app installed by path declares sessionApproval and memberThreads. The run asserts the scope line and the memberThreads key 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 gained memberThreads in 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-only kirocrew app enable against 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
detail-permissions-member-threads-dark
detail-permissions-member-threads-light

2. Re-consent dialog, two paragraphs
reconsent-dialog-dark
reconsent-dialog-light

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

4. Refusal when the manifest gained the scope while the dialog was open (from the catalog)
stale-consent-refusal-dark
stale-consent-refusal-light

The same refusal with the dashboard in German:
stale-consent-refusal-de-light

5. kirocrew app enable refusal

$ kirocrew app enable crew-keys
❌ crew-keys asks to control your chats. Nothing was enabled.
   Chats:     Can send messages and choose response options in your chats, approve or deny tool prompts, and switch a chat's approval mode.
              This includes your own chats with your Bots.
   Storage:   app-scoped data directory
   To allow it, open the app in the dashboard: http://localhost:<port>/apps/detail/crew-keys

Related Issues

N/A -- agreed with the maintainers in Slack ahead of the PR.

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

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@devsdmf
devsdmf requested review from a team and KiroCrewCaptain as code owners October 30, 2026 16:35
@devsdmf
devsdmf requested a review from CrysisDeu October 30, 2026 16:35
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Oct 30, 2026
iamwhatever
iamwhatever previously approved these changes Oct 30, 2026
@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 Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of d8c5dda70ca67015cf7c3782336898a065c36a28 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level concerns. memberThreads is an opt-in scope that only takes effect alongside sessionApproval. Consent is captured fresh for it, and a record written by an older host is treated as consent-pending.

Notes

  • Two renames have readers outside this file set, and both still work. read_session_grant became read_session_control_grant, and its two test readers are updated in this patch. write_sse_or_abort moved to a new module; openai_compat.py still finds it because chat_handlers re-exports it.

[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 .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 Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of d8c5dda70ca67015cf7c3782336898a065c36a28 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • session_approval_member_threads says something different outside English. de, es, fr, it, pt, ru, hi, bn, ja, ko and zh-CN say roughly "your Bots' own chats" (de: "die eigenen Chats deiner Bots"). That can read as the Bot's chats with other people or channels, which is wider than the actual grant. The English says "your own chats with your Bots", and the _refused string in those same locales already says it correctly. Reword the disclosure in each of those locales to match the _refused phrasing ("your chats with your Bots").
  • No screenshot shows the second line the kirocrew app enable refusal now prints under its Chats: entry. It is plain CLI text rather than a control, so it doesn't block, but a terminal capture would let a reviewer check the wording.

[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 .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 Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of d8c5dda70ca67015cf7c3782336898a065c36a28 via the fork AI-review pipeline — 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

Every item comes from the reported dead end (Bot DM slots visible to sessionApproval apps but every write refused 404). The flag is off by default, nothing like it exists on base (0 memberThreads hits in src/), and no pin was deleted.

Notes

  • Item 4 — oversized: mark_session_approval_consent_pending adds a second raw json.loads of installed.json (scope_only = (isinstance(raw, dict) and SESSION_APPROVAL_PENDING_KEY in raw ...)) only to choose between two SEL error strings. Subtraction: delete the raw/scope_only read and keep one reason string. The disable that happens does not change.

What this change ships

Inventory (10 items) — 9 justified

Intent: let a trusted companion or hardware app answer a Bot's pinned DM thread, if the owner opts in. ADDITION.

  1. With memberThreads and sessionApproval declared, an app can send a turn or [OPTIONS:] choice to a live Bot thread — justified
  2. The same app can approve or deny a Bot thread's tool prompt (slot route and /api/approvals) — justified
  3. The same app can switch a Bot thread's approval mode — justified
  4. An update, registration or in-place edit that adds the scope disables the app until the owner re-consents — oversized (extra record re-read only for the audit wording)
  5. A consent recorded by an older host no longer covers the scope (memberThreadsConsented) — justified
  6. An enable from a dialog that did not name the scope is refused, and the page reloads with a translated message — justified
  7. The trust modal, detail page, re-consent dialog and CLI refusal add "This includes your own chats with your Bots." — justified
  8. The official catalog's pre-install projection carries the scope — justified
  9. SEL rows name the key actually added and +memberThreads on allowed sends — justified
  10. The SSE writer moves to chat_api/sse_write.py so chat_send.py stays under the 2,000-line cap — justified

[FIRST-PRINCIPLES-REVIEWED] d8c5dda

Description read

[DESCRIPTION-READ] d54bd6063d6450b132b56f667847008f321a7951f849dd0e22861388d870317e

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 Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed d8c5dda70ca67015cf7c3782336898a065c36a28 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] d8c5dda

@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 Oct 30, 2026
@devsdmf
devsdmf force-pushed the feat/crewmate-session-approval branch from 6c192da to 416a788 Compare October 31, 2026 19:26
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 31, 2026
@devsdmf
devsdmf force-pushed the feat/crewmate-session-approval branch from 416a788 to 182cc72 Compare October 31, 2026 19:40
@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 Oct 31, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) November 2, 2026 05:01
auto-merge was automatically disabled November 2, 2026 17:16

Head branch was pushed to by a user without write access

@devsdmf
devsdmf force-pushed the feat/crewmate-session-approval branch from 182cc72 to 1239336 Compare November 2, 2026 17:16
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed d8c5dda70ca67015cf7c3782336898a065c36a28 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] d8c5dda

@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 2, 2026
@devsdmf
devsdmf force-pushed the feat/crewmate-session-approval branch from 1239336 to b303015 Compare November 2, 2026 21:27
@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 2, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Nov 4, 2026
@devsdmf
devsdmf force-pushed the feat/crewmate-session-approval branch from 4dfa5c1 to 294c3a8 Compare November 4, 2026 22:29
@devsdmf

devsdmf commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author
  • New disclosures restore the superseded Mate name

fixed in 2b246e0 (a97c882 rebased onto main, same patch): every user-visible sentence this PR adds calls the agent a Bot, untranslated in every locale, per docs/decisions/2026-10-30-the-standing-agent-is-called-a-bot.md.
English disclosure (trust modal, detail page, re-consent dialog, en.json + en.manual.json): "This includes your own chats with your Bots."; en-XA regenerated.
All 11 other locales name the untranslated "Bot"/"Bots" in their own grammar, matching main's catalogs after #26452.
CLI enable refusal prints "Bots: ..."; the stale-consent refusal and both operator words= strings say "your chats with your Bots"; the docs this PR adds say Bot(s) and "Bots page".
Identifiers, i18n keys and manifest/API fields keep crewmate, as the decision requires. The earlier "mates" wording followed the 2026-10-15 Mate decision, which #26452 superseded after that round.

@devsdmf

devsdmf commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author
  • The description says "mates" and Mates: ... while the diff ships "Bots"

fixed in the description updated with 18d351c: it quotes the shipped copy, "This includes your own chats with your Bots.", and the CLI line as it now prints (the scope sentence as a second, unlabelled line of the Chats: entry), per docs/decisions/2026-10-30-the-standing-agent-is-called-a-bot.md.

@devsdmf

devsdmf commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author
  • _session_approval_consent_unrecorded now reads the manifest for consented records; say so in the spec

fixed in 18d351c: docs/system-specs/modules/app-kit-platform.md now says that a manifest gaining memberThreads without an update (edited in place, for example) leaves the app disabled at the next reconcile until the owner consents again.

@devsdmf

devsdmf commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author
  • Take-away check on the read_session_grant rename

No change needed: the review confirmed all four base-tree readers are updated (app_admission, the chat_handlers re-export, the composition contract test, test_slack_auto_link), and the description's Backwards compatibility section lists exactly those four as Reader: lines.

@devsdmf

devsdmf commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author
  • Evidence gap: trust modal scope line

fixed in 18d351c: re-captured at that head against a disposable gateway, light and dark (trust-modal-light.png, trust-modal-dark.png); the line reads "This includes your own chats with your Bots." inside the session-approval box.

@devsdmf

devsdmf commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author
  • Evidence gap: detail page Permissions box line

fixed in 18d351c: re-captured with memberThreads declared, light and dark (detail-permissions-member-threads-light.png, -dark.png), showing the line and the manifest keys sessionApproval, memberThreads.

@devsdmf

devsdmf commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author
  • Evidence gap: re-consent dialog body

fixed in 18d351c: re-captured the two-paragraph dialog, light and dark (reconsent-dialog-light.png, reconsent-dialog-dark.png).

@devsdmf

devsdmf commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author
  • Evidence gap: stale-consent refusal banner

fixed in 18d351c: reproduced for real (dialog opened on a chat-only manifest, memberThreads added in place, dialog confirmed) and captured light and dark (stale-consent-refusal-light.png, -dark.png), plus German (stale-consent-refusal-de-light.png) to show it is now translated.

@devsdmf

devsdmf commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author
  • The refusal banner is a hard-coded English backend string

fixed in 18d351c: the detail page maps the journaled session_approval_consent_required code to pages.appDetailPage.session_approval_member_threads_refused while the reloaded manifest declares memberThreads, translated in all 12 catalogs with "Bot" untranslated; the server sentence stays as the English for other callers and as the error report's key, and the grant's own pending refusal keeps the server text when no scope is declared. AppDetailPageCoverage pins both cases.

@devsdmf

devsdmf commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author
  • The CLI prints Bots: ...with your Bots., repeating the noun

fixed in 18d351c: the prefix is dropped; the sentence prints as a second line of the Chats: entry, aligned under its text, as the dashboard shows it inside the same box. test_app_cli_session_approval_consent pins the line.

@devsdmf

devsdmf commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author
  • permissions.crewmateThreads reuses a name main gives to reply threads

fixed in 18d351c: the scope is now permissions.memberThreads, built on the existing member-<slug> slot key and mode: "member"; every name this PR added follows (memberThreadsConsented, memberThreadsConsent, SessionControlGrant.member_threads, is_member_thread, member_thread_grant, the session_approval_member_threads catalog keys, test_member_thread_grant.py). dashboard.crewmate_threads and useCrewmateThreadsFlag are untouched.

@devsdmf

devsdmf commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author
  • The description says "mates" and Mates: ...; the diff ships "Bots"

fixed in the description updated with 18d351c: it quotes the shipped "...with your Bots." copy and the current CLI output, and names the scope memberThreads.

@bolichen97

bolichen97 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Naming update to the title, the **Goal:** line, ## Why it matters and ## Not a goal, at a maintainer's request: the prose now says "Bot" where it said "crewmate", per docs/decisions/2026-10-30-the-standing-agent-is-called-a-bot.md. The goal's substance is unchanged. Identifier references (crewmate_threads, dashboard.crewmate_threads, useCrewmateThreadsFlag) stay as written because they name main's code.

The branch is also rebased onto current main and squashed to one commit (author kept), with the subject feat: let sessionApproval reach Bot threads with memberThreads. One code change: on current main this PR took src/kiro_crew/dashboard/chat_api/chat_send.py to 2,009 lines, over the 2,000-line cap, so write_sse_or_abort moves unchanged to a new chat_api/sse_write.py owner (wired into the chat_handlers compose list, the composition contract test and the owner list in learn-cron-dashboard.md).

@bolichen97

Copy link
Copy Markdown
Contributor

Backend Tests (3.12, 2) is red at 6263be5172 on one test this PR does not touch: test_security_gate_liveness.py::test_the_package_stays_within_its_line_budget, which is red on main itself. #32183 fixes it; this PR waits for that to merge, then rebases. Coverage Gate fails closed on that shard.

@bolichen97

Copy link
Copy Markdown
Contributor

Rebased onto main @ bab2387339, which carries the line-budget fix (#32252, superseding #32183); new head 48ef211e1b, no change to the diff. CI re-running.

bolichen97
bolichen97 previously approved these changes Nov 7, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 the member- 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 carry memberThreadsConsent from a dialog that named the user's Bots.
  • test_member_thread_grant and 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.

@bolichen97

Copy link
Copy Markdown
Contributor

Rebased: main moved in files this PR touches (docs/app-kit, docs/system-specs and others) since this head went green (928d145 -> 0fdf1eb); new head b309245bb4, same patch. CI re-running.

@bolichen97

Copy link
Copy Markdown
Contributor

Backend Tests (3.12, 5) and (3.12, 6) are red at b309245bb4 on two tests this PR does not touch, both red on main itself and fixed by #32606:

  • test_dashboard_server_composition_contract.py::test_the_lazy_imports_stay_inside_the_functions_that_need_them (136 == 135)
  • test_held_note_turn_starts.py (slack/gateway_runtime/nudge_dashboard_fire.py)

Security Scope Review did not run: both attempts lost the runner's connection to github.com (Failed to connect to github.com port 443). This PR rebases once #32606 merges, which re-runs every lane.

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.
@bolichen97

Copy link
Copy Markdown
Contributor

Rebased onto main @ 0f1dd2bd02, which carries #32606 (the two main-red tests); new head d8c5dda70c, same patch. CI and every review lane re-running.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving again at d8c5dda. Against our approval at 48ef211, the range-diff shows only a rebase onto main: the commit's own patch is unchanged, and the only differences are main's surrounding context. All checks pass.

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

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants