Skip to content

feat(app-kit): let an app page open the person's chat it declares - #37492

Merged
bolichen97 merged 1 commit into
mainfrom
feat/app-seam-app-chat-slot-create
Nov 17, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
feat/app-seam-app-chat-slot-create

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: An app's page can open a named, persistent chat for the person with an agent and in a folder its manifest declares, without a broad /api/chat/slots grant, so Code Review Sage's follow-up chat keeps working once the app leaves core.

Part of #26967. Authority: the owner ruling of 2026-11-13 on #26967 (comment 6841699202: grant each app what its built-in already uses, declared in the manifest and shown at install) and the seam-level decision (comment 6844003956: one level per open batch, feature-detected).

Code Review Sage's review panel opens a follow-up session with the reviewer through the dashboard's own POST /api/chat/slots: the reviewer's agent, a title, the Sage Review folder, persistent memory. A built-in page calls that with the dashboard client. The adopted copy (KiroCrewCaptain/kirocrew-app-code-review-sage, PORTING.md gap 1) can only call the host through its scoped client, and declaring /api/chat/slots would hand its page every slot route under that entry, which adoption refuses as a widening (E9). So the adopted copy can only continue a follow-up that already exists, never open a new one: a user-visible regression that holds its adoption pin.

Why it matters

Without the seam, Code Review Sage cannot move out of core without losing "Open a follow-up session" for every user, and any other app that hands the person a conversation has to ask for the whole slot API. With it, an app declares exactly the one chat it opens (agents, folder, key prefix, memory mode), the owner sees that at install, and the gateway refuses anything else.

Not a goal

  • Changing what the follow-up chat is or does: it stays the person's chat, with the person's approval rules.
  • App-owned chats an app drives itself; that is ctx.chat_slots (section 41).
  • Moving Sage's backend off its private state.mutate_folders folder helper, or any other Sage gap in PORTING.md.
  • Making chatLaunch a staged grant held back on update (it adds no reach a page's code lacks; see the spec).
  • Changing adoption-pins.json, the catalog, or deleting any built-in.

What changed (motivation → approach → change)

Goal → a declared, narrow create instead of a path grant. Options weighed: (a) openChat creating a missing slot client-side only, which the gateway could not check; (b) ctx.chat_slots, which makes the slot app-owned, changes its governance to the app's profile and its key to <app>-<id>, so existing follow-ups would stop continuing; (c) the ordinary create, marked as an app launch and held by the gateway to the app's manifest. (c) keeps the built-in's create byte-identical and puts the check where the folder and existing slots are known.

  • Manifest permissions.chatLaunch (apps/chat_launch.py, Permissions.chatLaunch): keyPrefix, agents, optional folder, optional memoryModes. Fail-closed parse; a prefix that overlaps a core key namespace (chat-, cron-, workflow-, task-review-, member-) declares nothing.
  • Gate (dashboard/app_chat_launch.py): a POST /api/chat/slots carrying app_launch: <app> is checked right after the title check: a person's request, an enabled app that declares it, no other installed app (enabled or not) declaring an overlapping key prefix, only the launch fields, a key under the prefix, a declared agent, memory mode and folder, no app-owned or non-chat slot under the key, no other live slot with the key or its transcript up to letter case (slot_ownership.live_case_alias_reason, as an app's own create checks), no transcript that is unreadable or another app owns or opened; re-checked synchronously before the mint. One audited 403 app_chat_launch_refused; otherwise the ordinary create. The prefix rule is what keeps one app off another's chats, including the ones Sage's built-in page opens, which record no embed_app (sending it would write the chat's record at create time and drop its resume pointer on uninstall, which the follow-up has never done).
  • SDK: useChatLauncher().createChat({slotKey, agent, title?, folderId?, memoryMode?}) (website/src/app-sdk/index.ts, website/src/app-sdk/scopedApi.ts) sends it through the host, naming the app, on the same wire as the scoped client (one session header, one refusal shape). App Kit seam level 10, the level feat(app-kit): tool gate honours installed apps' credential masks #37459 already raised APP_SDK_LEVEL to on both sides (apps/app_sdk_level.py, website/src/app-sdk/sdkLevel.ts); this PR keeps it at 10 and adds its seam to the same level (level 9 is in the v0.13.0 release candidates, level 10 in no tag); scripts/adoption_pin.py counts the declaration as a level-10 use, beside feat(app-kit): tool gate honours installed apps' credential masks #37459's credentialMasks tool-gate use.
  • Disclosure: the whole declaration (agents, folder, key prefix, every memory mode) on the trust prompt (website/src/components/appstore/TrustAppModal.tsx, trustGrants.ts, types.ts, new chatLaunch.ts), the detail page (website/src/pages/AppDetailGrantBoxes.tsx, AppDetailPage.tsx, appDetailPageTypes.ts) and the CLI install summary, plus the catalog pre-install disclosure; E9 refuses a copy declaring more than the wheel copy. Nine new strings in website/src/i18n/locales/ (en.manual.json and the 11 translated catalogs, en-XA.json regenerated).
  • Built-in: Sage's wheel manifest declares its follow-up chat; its panel calls the dashboard client's new createAppChatSlot (website/src/api/client/chat.ts) with the same key, agent, title, folder and memory mode.
  • Specs: app-kit-platform section 44 (new) plus the level list (one level-10 entry naming both feat(app-kit): tool gate honours installed apps' credential masks #37459's tool gate fence and this seam) and host-mediated launch; session.md; app-kit api reference (the createChat contract and the shared level-10 entry in the seam-level list), manifest reference and getting-started.

Backwards compatibility

Compatible: a create without app_launch takes exactly the path it took; Sage's create carries the same fields plus app_launch, and its declaration covers every key, both agents, the folder and the memory mode it sends (test_manifest_chat_launch.py), including reopening follow-ups opened before this change (test_a_reopen_of_a_persons_chat_under_the_prefix_is_admitted).

Removes nothing: no path, field, record or validator that main accepts is removed or tightened; the new gate applies only to bodies carrying the new app_launch key.

Tests

  • test/test_app_chat_launch.py: parsing (valid, every malformed shape, core prefixes, the prefix list pinned to the core constants), covers_key, within, overlaps, manifest round-trip, disclosures (the install summary names the prefix and memory modes); the gate through the real create handler: an admitted launch is field-for-field the plain create and the person's slot; a reopen of a person's chat is admitted; embed_app is recorded; a bare launch defers its broadcast as the plain create does. Negative: 17 out-of-declaration bodies (undeclared app, invalid name, key outside the prefix or not normalized, undeclared agent, memory mode, folder, other app in embed_app, and each extra create option) each answer the uniform 403, create nothing and audit the reason; an app token is refused; another app's live slot and a live slot of another mode are left untouched; a live slot under the key in another letter case (the app's own, another app's or a person's) is left untouched, and one taken during the create's awaits is refused at the mint, while a person's live chat under exactly the key is reopened; an unreadable transcript and transcripts another app owns or launched are refused; a slot that takes the key during the create's awaits (injected at _app_claim_refused, after the gate) is refused at the mint; overlapping_declarers names every other installed tree with an overlapping prefix (same, wider, narrower; not a disjoint one, a sidecar or one declaring nothing); an app declaring another app's prefix cannot retitle a chat the built-in path left with no embed_app, neither app launches while they overlap, and the remaining one does once the other is uninstalled. Each new handler test was checked against a mutation of the branch it pins (recheck removed, mode branch dropped, unreadable admitted, deferral tweak reverted, overlap scan off): each mutation reds exactly its test.
  • test/test_code_review_sage_permission_parity.py: the wheel copy declares the chat; the repository copy declaring the same adopts; four wider declarations are permission_widening; the registered built-in yields its declaration only while enabled.
  • test/test_builtin_adoption_pins.py: the pin tool counts chatLaunch as level 10.
  • src/kiro_crew/apps/builtins/code_review_sage/tests/test_manifest_chat_launch.py: the declaration covers followup.slot_key, both review agents, FOLDER_NAME, persistent.
  • website/src/test/appChatLaunch.test.tsx: createChat's exact body and session header without a declared /api/chat/slots, the 403 rejection, the trust prompt and detail page lines including the key prefix and every memory mode in the gateway's order, malformed declarations (an unknown or empty memoryModes included) shown as none. CodeReviewSageReviewChat.test.tsx updated to the seam call; ApiClient.refactor.surface.test.ts lists createAppChatSlot.

Proof: not provable -- other: new seam and feature tests, no defect fix to revert.

Determinism: test/test_app_chat_launch.py passes 20 times at -n0 (10 more on this head, with the letter-case tests), 10 times at -n 4 --dist loadgroup --max-worker-restart=2 beside test_chat_slot_create_folder.py and test_app_chat_slot_sdk.py, and in a shuffled order (seed 8332). The new tests take no clock, sleep, port or thread; the mid-create race is injected by an awaited stub, not timed.

Manual verification

On this head, rebased onto 2e25036: the black baseline gate, subprocess-encoding, isort, flake8, mypy on the gate module, line cap, comment-history, brand, harness parity, the flake-pattern ratchet and docs lint pass. Backend: the touched test files, the seam-level mirror, adoption pins, both credential-mask suites, manifest, facade-mirror guards, the MCP listing import budget, and the slot-create, adoption, trust, app-permission and catalog files pass (793, 384 and 417 tests in three -n0 runs, the first two on the head rebased onto 8beb3f2 after #37459, before the letter-case fix). Frontend: the chat launch, Code Review Sage, API surface, trust prompt, i18n and every scoped-client and launcher file pass (32 files, 684 tests), i18n-check passes and en-XA.json is current. An earlier head, rebased onto 4c530d0, also passed the repository semgrep rules on the diff (0 findings), with tsc -p tsconfig.app.json and eslint src/ --max-warnings 0 clean, and the raw-fetch gate, protocol boundary and every App SDK provider file. scripts/local-gate.py is not run on this host (its frontend leg fails on the registry login and its backend leg on a python without pytest); CI runs both suites.

Screenshots / video

The trust prompt for an app declaring permissions.chatLaunch (built dashboard, stubbed API; the repository copy of Code Review Sage, which declares what the wheel copy now does), dark and light. These predate one added line: under the description, both boxes now also say Chat keys start with sage-followup-. Memory: persistent. in the muted text style; nothing else in them moved.

Trust prompt, dark, with the chat launch box

Trust prompt, light, with the chat launch box

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

Detail page, dark, chat launch box

Detail page, light, chat launch box

Related Issues

Part of #26967

Related seam already on main: #37426 (useHostSessions, level 8) gives a page the person's live session list and a create, but admits each member only once permissions.api declares every path it sends, so it needs the broad /api/chat/slots this seam avoids.

Same batch: #37459 (gate-adopted-masks, the agent tool gate's fence on installed apps' credential masks) landed level 10 first; this PR adds its seam to the same level. APP_SDK_LEVEL stays 10 on both sides, and each level summary (app-kit-platform's level list and section 44, the api reference's seam-level list, the app_sdk_level.py and pin-scanner docstrings) is one level-10 entry naming both seams. Separate lanes that claim no level: desktop-host-serve (desktop window host serving an app from the chosen crew) and desktop-host-prefs (desktop window host shortcuts and prefs store).

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.

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 15, 2026 03:44
@bolichen97
bolichen97 enabled auto-merge (squash) November 15, 2026 03:44
@bolichen97

Copy link
Copy Markdown
Contributor Author

Decisions taken for this seam (campaign #26967, under the owner ruling in comment 6841699202):

  • Where the gate sits. It sits in the gateway, on the ordinary POST /api/chat/slots, keyed on app_launch. It is not a client-only openChat extension, because the gateway is where the folder, the live slots and the saved transcripts are known. It is not ctx.chat_slots, because that makes the slot app-owned: the slot would be governed by the app's profile and keyed <app>-<id>, so Sage follow-ups opened before this change could no longer be continued.
  • The chat stays the person's. Nothing records an owning app. A reopen of a person's chat under the declared prefix is admitted, so legacy follow-ups keep working.
  • Not a staged grant. This follows the chatSlots precedent (section 41). It is disclosed at the trust prompt, on the detail page, in the catalog and in the CLI summary, and E9 refuses a declaration wider than the wheel copy's.
  • Seam level 9. Level 8 is already in v0.13.0-rc.1, so this batch (app-chat-slot-create, desktop-host-serve, desktop-host-prefs) shares level 9 (comment 6844003956). Whichever PR merges first raises the level, and an app feature-detects createChat.
  • Out of scope. Sage's backend still files the folder through its own state.mutate_folders helper; that is a separate PORTING.md gap.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: a declared, gateway-checked create is a narrow seam that keeps the built-in's create unchanged, the disclosure has rendered evidence, and nothing is taken away.

Notes

  • The narrowing only holds while the scoped client keeps /api/chat/slots closed to app pages. A page that can send the create without app_launch skips this gate entirely, so keep the E9 widening refusal pinned next to this seam.

[DESIGN-REVIEWED] 18ed2be

Description read

[DESCRIPTION-READ] 58b32510d4d8811d28e7562c7ac8000e5811bc4510e1f81b3533ccecbe12a8b6

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 15, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 18ed2be8d8ab630ee6b66e819cb7893e03353ad7 — 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 fills a gap that blocks Code Review Sage's adoption. Two items are wider than the Goal needs, but both can be undone later.

Notes

  • Item 4 — oversized: Sage's built-in panel switches from createChatSlot to createAppChatSlot, and the wheel manifest already declares the chat for E9 without that switch. The switch puts the built-in's working follow-up behind the new 403 (for example, a folder that is no longer named Sage Review). It also adds a dashboard-client method whose only consumer is code that is leaving core. Subtraction: delete createAppChatSlot from website/src/api/client/chat.ts and keep the built-in panel on createChatSlot.
  • Item 1 — one consumer, generalized: memoryModes accepts incognito and temporary. The only declaration (Sage's app.json) passes ["persistent"], so those two values have no consumer. Subtraction: remove the memoryModes field and MEMORY_MODES from chat_launch.py and the gate, and admit persistent only.

What this change ships

Inventory (7 items) — 5 justified

Intent: let an adopted app's page open the person's named follow-up chat without a broad /api/chat/slots grant. This is an ADDITION.

  1. A new manifest grant, permissions.chatLaunch (key prefix, agents, folder, memory modes) — one consumer, generalized: memoryModes beyond persistent is unused
  2. The gateway checks a create marked as an app launch against that grant and gives one audited 403 — justified
  3. The SDK gains useChatLauncher().createChat at seam level 10 — justified
  4. Sage's built-in panel now opens follow-ups as an app launch — oversized
  5. The trust prompt, detail page, CLI summary and catalog disclose the grant (nine strings) — justified
  6. E9 refuses an adopted copy that declares more than the wheel copy — justified
  7. The adoption-pin scan counts chatLaunch as a level-10 use — justified

[FIRST-PRINCIPLES-REVIEWED] 18ed2be

Description read

[DESCRIPTION-READ] c4a0b689905bf1ce18d022b9478749c4174962832232ad6cf5c420ba6b68d799

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 15, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

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

UX-Verdict: PASS

cannot evaluate: missing the second line of the chat box ("Chat keys start with sage-followup-. Memory: persistent."). The diff renders it on the trust prompt and on the detail page, but none of the four screenshots shows it.

Evidence gaps

  • The scope line in the trust prompt. TrustAppModal.tsx renders chatLaunchScopeLine(app.chatLaunch) under the chat description. shot-01 and shot-02 end that box at "Never your other chats." The PR says the prompt shows the "key prefix, every memory mode", so that claim has no screenshot behind it. Fix: attach a fresh trust-prompt screenshot taken at this HEAD.
  • The scope line on the detail page. ChatLaunchBox renders <div className="mt-1 text-muted">{chatLaunchScopeLine(launch)}</div>. shot-03 and shot-04 go straight from the description to "Manifest key: chatLaunch". Fix: attach a fresh screenshot of the detail page's grant box.
  • The box without a folder. chat_launch_desc_unfiled ("It can start or reopen a chat with {{agents}}…") is shown in no screenshot. Fix: add a screenshot of a declaration without folder, or explain in the PR why that case needs none.

Notes

  • Agent list. The blind reader could not tell what code-review-sage-reviewer, kirocrew was: "one name or two… a person, an assistant or a place". The raw ids are joined with ', '. Use fmtList(..., {type:'disjunction'}) and say they are agents, e.g. "a chat with the agent code-review-sage-reviewer or kirocrew".
  • "Chat keys start with {{keyPrefix}}". "Chat key" is an internal term. Either cut the line from the trust prompt or rephrase it in words a user knows. The memory part is the bit that tells the user something useful, so keep it.
  • "Manifest key: chatLaunch". The blind reader called it "computer jargon". It reuses an existing pattern, so this is not a blocker, but it gives the user nothing they can act on.

[UX-REVIEWED] 18ed2be

Description read

[DESCRIPTION-READ] ef3937b409bb56777ba299a3df2acdfb784dac0f51a33d536014f9c4c7135a52

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 15, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 18ed2be8d8ab630ee6b66e819cb7893e03353ad7 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 18ed2be

Verdict parsed from the review's SHA-scoped output markers for commit 18ed2be8d8ab630ee6b66e819cb7893e03353ad7.

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

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 18ed2be8d8ab630ee6b66e819cb7893e03353ad7 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 18ed2be

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

@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 15, 2026
@bolichen97
bolichen97 force-pushed the feat/app-seam-app-chat-slot-create branch from 2e22649 to 2448ffc Compare November 15, 2026 04:43
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed in 2448ffc: untested gate branches (mint-time recheck, non-chat slot, unreadable transcript, broadcast deferral)

Each now goes through the real api_chat_slot_create. The mid-create race stubs chat_handlers._app_claim_refused, which runs after the gate and before the mint, so it puts another app's slot under the key; the create answers 403 and that slot is untouched.
New handler tests: a live slot of another mode is refused, a transcript whose first line is not UTF-8 is refused, and a bare launch schedules exactly one deferred flush.
Each mutation was rerun on this head and fails exactly its own test: the recheck always returns None, the mode branch is dropped, the unreadable branch admits, set(body).difference(("app_launch",)) is reverted, and the overlap scan returns nothing.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed in 2448ffc: key prefixes not tied to one app; the built-in path records no embed_app

A launch is now refused while any other installed app, enabled or not, declares a prefix that overlaps its own (one prefix starts with the other). This is chat_launch.overlapping_declarers, which reads each non-sidecar tree's app.json, and the check runs in the same off-loop hop as the declaration lookup.
So the key says whose a chat is. That covers chats the built-in page opened, chats opened before the seam, and live slots that are not saved yet. Recording embed_app could not cover those last two.
createAppChatSlot still sends no embed_app. Sending it would write the chat's record at create time and drop the chat's resume pointer on uninstall, and Sage's follow-up has never done either.
Your probe now gets a 403 and the title is not changed (test_an_app_declaring_another_apps_prefix_reaches_none_of_its_chats). Neither app launches while the two overlap, and the remaining app launches again once the other is uninstalled. The API reference, manifest reference and spec §43 say this.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed in 2448ffc: developer docs stop at seam level 8; getting-started omits createChat

In docs/app-kit/api-reference.md, the seam-level list now ends with level 9, which adds permissions.chatLaunch and useChatLauncher().createChat. It also says level 9 is shared by the seams of its batch, so apps should feature-detect.
The useChatLauncher() row in docs/app-kit/getting-started.md now describes openChat and createChat, and says to feature-detect createChat.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed in 2448ffc: memoryModes and keyPrefix not shown at install

knownChatLaunch now keeps memoryModes the way the gateway parses it: ['persistent'] when omitted, and an unknown or empty list shows as no declaration. A new chatLaunchScopeLine adds a line to the trust prompt and the detail page: Chat keys start with {{keyPrefix}}. Memory: {{memoryModes}}. Each mode is named, and incognito and temporary say what they withhold.
format_permissions_summary adds chat keys start with '<prefix>'; memory: <modes>. That adds four strings in every locale, en-XA is regenerated, and i18n:check passes.
The screenshots in the body predate this line. The body says so.

@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 15, 2026
@KiroCrewCaptain

KiroCrewCaptain commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider thinks the change is probably fine but estimates a 14% chance that this change introduces a defect, above the 12% limit for approving on its own.

Approve. The PR adds a narrow, declared seam (permissions.chatLaunch plus useChatLauncher().createChat) so an app's page can open a person's chat through the ordinary POST /api/chat/slots, with an app_launch field that the gateway holds to the manifest. A body without app_launch follows exactly the path it did before. The only change outside the gate is the deferred-broadcast key-set check, which now ignores app_launch.

I checked the regression risk to Sage's built-in follow-up:

  • Agent: the descriptor agent can only be code-review-sage-reviewer or kirocrew. ReviewPool() is always constructed without an agent, so _resolve_review_agent picks one of the two.
  • Folder: _ensure_followup_folder adopts or creates a folder named exactly Sage Review.
  • Key: slot_key is sage-followup- plus 12 hex characters, so it is already in normalized form and is not reserved.
  • Mode: a chat slot's mode defaults to "", so reopening a live follow-up is not refused.
  • Body: the old createChatSlot call sent the same fields.
  • Enablement: built-ins are registered into apps_dir with an installed.json, so declared_chat_launch sees the declaration

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 74afc4dff5 · 1885 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 15, 2026
@bolichen97
bolichen97 force-pushed the feat/app-seam-app-chat-slot-create branch from 2448ffc to 74afc4d Compare November 15, 2026 06:31
@bolichen97

Copy link
Copy Markdown
Contributor Author

CI reds on 2448ffc, all handled in 74afc4d (rebased onto 4c530d0):

  • Frontend Lint & Type Check (and the Coverage Gate that fails closed behind it): the chat launcher's raw fetch('/api/chat/slots') in website/src/app-sdk/scopedApi.ts. The launcher now sends through sendScoped, the one wire the scoped client already used, so the session-expiry signal, the stale-owner signal and the AppApiError refusal shape come from one place.
  • SAST (Semgrep) kirocrew.test-autouse-shared-monkeypatch: the autouse _isolate fixture in test/test_app_chat_launch.py now uses _floor_monkeypatch.
  • macOS shard 7 test/test_state_parts_facade.py::test_only_the_facade_imports_an_owner: dashboard/app_chat_launch.py imported _normalize_slot_key from state_parts.slot_directory. It now imports it through the dashboard.state facade.
  • macOS shard 4 test/test_readonly_source_skill_install.py::TestBuiltinSyncFromReadonlySource (3 tests): a main defect, ledger Flaky: test_readonly_source_skill_install TestBuiltinSyncFromReadonlySource fails on a macOS shard #37391, fixed by fix(skills): let a read-only built-in skill source publish on macOS #37476. The old base did not have that fix and the new base does.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 15, 2026
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 15, 2026
@bolichen97
bolichen97 force-pushed the feat/app-seam-app-chat-slot-create branch from 74afc4d to 7bf4de0 Compare November 17, 2026 09:31
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 17, 2026
@bolichen97
bolichen97 force-pushed the feat/app-seam-app-chat-slot-create branch 2 times, most recently from 27f9a5b to cb85c2a Compare November 17, 2026 10:42
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 17, 2026
@bolichen97
bolichen97 force-pushed the feat/app-seam-app-chat-slot-create branch from cb85c2a to 8aabeef Compare November 17, 2026 11:26
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 17, 2026
Code Review Sage's review panel opens a follow-up chat with the
reviewer (its agent, a title, the Sage Review folder, persistent
memory) through the dashboard's POST /api/chat/slots. An adopted copy
reaches the host only through its scoped client, and declaring
/api/chat/slots would hand its page every slot route, which adoption
refuses as a widening. Owner ruling on #26967 (comment 6841699202)
asks for an app chat slot seam instead.

permissions.chatLaunch declares the one shape of chat a page opens: a
key prefix (never a core one), the agents, an optional folder and the
memory modes. useChatLauncher().createChat sends the ordinary create
through the host with app_launch naming the app, and the create
handler holds it to the declaration first: a person's request, an
enabled app whose prefix no other installed app overlaps, only the
launch fields, a key under the prefix, a declared agent, memory mode
and folder, and no app-owned or non-chat slot or transcript another
app owns or opened. Every refusal is one audited 403 that creates
nothing; what passes is the ordinary create, so the chat stays the
person's. The launcher shares the scoped client's one wire.

The declaration is shown on the trust prompt, the detail page, the
catalog disclosure and the install summary, and adoption refuses a
copy that declares more than the wheel copy. Sage's wheel manifest
declares its follow-up chat and its panel creates it through the
seam with the same key, agent, title, folder and memory mode. App Kit
seam level 10.
@bolichen97
bolichen97 force-pushed the feat/app-seam-app-chat-slot-create branch from 8aabeef to 18ed2be Compare November 17, 2026 12:28
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • fixed in 18ed2be: case-variant keys bypass live-slot isolation (GPT 6.1, app_chat_launch.py:62)

Class: the launch gate's live-slot check matched the key exactly, so a live slot whose key or transcript key differs only in letter case was missed. Both sites go through _live_slot_reason: the admission check in _shape_reason and the synchronous mint recheck live_slot_refusal. It now ends with slot_ownership.live_case_alias_reason(state, key, _history_key_for(key)), the check an app's own create already takes, so both sites refuse the alias with one audited 403 that creates nothing. The slot under exactly the key is still the person's own chat to reopen.
New handler tests: a live slot under the key in another letter case (owned by the launching app, by another app, or a person's chat) is refused and left untouched; an alias the app takes during the create's awaits is refused at the mint; a live person's chat under exactly the key is reopened. On the gate without the fix, the four refusal tests fail (the create mints a second slot and answers 200); with it, test/test_app_chat_launch.py passes 10 times at -n0 and at -n 4 --dist loadgroup --max-worker-restart=2.
Section 44's gate list, the module docstring and session.md say the same.

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

Reviewed head 18ed2be. A create without app_launch takes exactly the path it took before, and a create with it gets extra checks and nothing more: a person's request only, an enabled app that declares chatLaunch, no overlapping prefix from another installed app, only the launch fields, a declared key, agent, folder and memory mode, and a live-slot recheck before the mint. Code Review Sage's own follow-up always sends a key, agent, folder and memory mode its manifest declares, so it keeps working. The pin tool counts any chatLaunch declaration as a level-10 use, so a level-9 pin cannot rely on it, and the level-10 summaries in the spec, the API reference and both docstrings each name both seams. The launch, Sage parity, adoption-pin, seam-level mirror and slot-create folder tests pass on this head, and I found nothing that blocks.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 17, 2026
@bolichen97
bolichen97 merged commit 8647f91 into main Nov 17, 2026
103 of 107 checks passed
@bolichen97
bolichen97 deleted the feat/app-seam-app-chat-slot-create branch November 17, 2026 13:27
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 17, 2026
KiroCrewCaptain added a commit to KiroCrewCaptain/kirocrew-app-code-review-sage that referenced this pull request Nov 17, 2026
The built-in's review panel opens a follow-up session with the reviewer
(its agent, a title, the Sage Review folder, persistent memory) by
creating the named chat slot through the dashboard's own
POST /api/chat/slots. That path is outside this app's grant, so this
copy could only continue a follow-up that already existed and said a
new one could not be opened (PORTING.md gap 1).

kirodotdev/KiroCrew#37492 adds the seam, App Kit level 10: a manifest's
permissions.chatLaunch declares the one shape of chat a page opens, and
useChatLauncher().createChat sends the ordinary create through the host,
held to that declaration. It also declares the follow-up chat in the
built-in's own manifest. This copy now:

- declares the same permissions.chatLaunch (key prefix sage-followup-,
  both review agents, the Sage Review folder, persistent memory), so
  adoption is no widening; tests/test_manifest_chat_launch.py pins it to
  the follow-up's key derivation, agents, folder and memory mode with the
  host's own parser;
- creates or reopens the follow-up through createChat with the same key,
  agent, title, folder and memory mode the built-in sends (title and
  folder only on a new session), then opens the key it answers;
- feature-detects createChat on the launcher: on a host without it the
  panel offers only Continue, as before.

The test dependency moves to Kiro Crew main 1dfee9ace2, which carries
the seam's parser. On that host the redaction rule table masks a token
only in its published format (kirodotdev/KiroCrew#37408), so the tests
that plant a credential use the host's generated tokens, as the
built-in's tests do. The app itself redacts through the host's passes
and needs no change for it.

PORTING.md marks gap 1 closed and lists both under fixes since the
port.

Part of kirodotdev/KiroCrew#26967.

Co-authored-by: Bolin Chen <bolichen@amazon.com>
bolichen97 added a commit that referenced this pull request Nov 17, 2026
Code Review Sage now lives in its own repository under KiroCrewCaptain,
ported up to the current wheel copy, #37492's chat
launch included, with green CI on ubuntu, macOS and Windows. The row is
the output of scripts/adoption_pin.py compute and is added to
adoption-pins.json and the _SHIPPED_PINS table, so a host whose record
is builtin-owned moves onto the app's own tree at its next restart and
keeps data/, the app secret, the grants and enabled.

minAppSdkLevel is 10, the level of the permissions.chatLaunch the
repository declares exactly as the wheel copy does, so E9 holds nothing
back and a host without the seam keeps the wheel copy. The wheel
built-in app.json version moves to the pinned 0.9.5, since a
first-adoption pin must equal it (D12). The owning spec records the
adoption.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants