Skip to content

feat(apps): pin code-review-sage for adoption - #38478

Merged
bolichen97 merged 1 commit into
mainfrom
feat/pin-code-review-sage
Nov 17, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
feat/pin-code-review-sage

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A host that has Code Review Sage as a built-in moves onto the app's own repository at its next restart, keeping its reviews, its repositories and settings, its follow-up chats, its grants and whether it was enabled.

Code Review Sage now lives in its own repository (KiroCrewCaptain/kirocrew-app-code-review-sage), ported from the current wheel copy, with green CI on ubuntu, macOS and Windows. Its last seam, #37492 (an app page opens the person's chat it declares: permissions.chatLaunch and useChatLauncher().createChat, App Kit level 10), has merged, and the repository now opens a new follow-up chat through it. The wheel's adoption pin table does not name Code Review Sage yet, so no host adopts it and every Sage fix keeps having to land twice.

Why it matters

Until a pin row exists, Code Review Sage cannot leave core: every host keeps running the wheel copy, and the removal of the built-ins in #26967 cannot start for it.

Not a goal

  • Changing the adoption machinery, the chat launch seam, the D12 equality rule, or the app's declared permissions.
  • Deleting the wheel copy (src/kiro_crew/apps/builtins/code_review_sage/, website/src/apps/code-review-sage/); only its app.json version moves.
  • Removing the core references that name the built-in (they go with the wheel copy).
  • Changing any other pin row.

What changed (motivation → approach → change)

Code Review Sage gets an adoption pin row, so at its next restart a host whose Sage is the built-in switches to the app's own repository at the pinned commit, keeping data/ (its runs, results, reports, learnings, repositories and settings), .app_secret, the approved grants and enabled. The row is the output of scripts/adoption_pin.py compute, copied into adoption-pins.json and the _SHIPPED_PINS table:

App Version Pinned commit minAppSdkLevel
code-review-sage 0.9.3 to 0.9.5 711261d196f5 10 (the permissions.chatLaunch declaration)

The wheel built-in app.json version moves to 0.9.5: a first-adoption pin must equal it (D12). The repository's app.json declares the same permissions as the wheel copy (its own namespace, /api/source/pull-request, network, storage and the chatLaunch of #37492), the same skills and no credentialMasks, so E9 holds nothing back. Its review panel sends the follow-up create the wheel copy sends through useChatLauncher().createChat, feature-detected, so a host without the seam keeps continuing existing follow-ups only; a follow-up the built-in opened is the person's chat under the declared prefix and reopens through the same create. The tree ships .kiro/ at its root, since a reviewed record keeps the review worker's .kiro/settings/ there and adoption would otherwise skip the swap. The owning spec, app-kit-platform.md § 44, records the adoption.

The pinned tree carries every change its wheel copy has on main 8826a22397. The repository was last ported up to af94fac51f (its #3 and #4); the one later non-test wheel-copy change, #37492 (the manifest's chatLaunch and the follow-up panel's create), is the repository's #5, and #6 released 0.9.5 as 711261d196f5. The later test-only wheel-copy changes are #37408 (generated tokens in their published formats, needed once the repository's test dependency moved to a host with the rule-table redactor, so carried by #5) and #38036, #38038 and #38039 (tmp_path homes, not carried). No later commit touched the page's catalogs or the store art.

Merge order: lands after #38443 (the agent-worlds and ops-mission-control pin PR), which also appends rows after md-notebook in both files; once it lands this branch is rebased onto it and this row follows its rows in both files.

App repo: KiroCrewCaptain/kirocrew-app-code-review-sage@711261d

Wheel-copy base: code-review-sage@8647f912727a93e7e94a9f309ea24349ef22769b

Backwards compatibility

Compatible: one row is added and one version moves up. A host whose record is builtin-owned adopts at the next restart and keeps data/, .app_secret, the grants and enabled; a host that cannot adopt (an SDK level below 10, a pending config review, a file beside app.json the tree does not ship) keeps the wheel copy unchanged. A follow-up chat the adopted copy opens carries the embed_app every app-launched chat carries (§ 44), where the built-in's create sent none; follow-ups opened before the swap keep their records.

Removes nothing: the wheel copy, its /code-review-sage route and every existing pin row stay.

Tests

test/test_builtin_adoption_pins.py::test_the_shipped_pin_file_validates_and_pins_exactly_the_shipped_table takes the new row and fails with the pin file of main; test_every_shipped_pin_matches_its_wheel_built_in_version holds the version bump.

Proof: PROVEN test/test_builtin_adoption_pins.py::test_the_shipped_pin_file_validates_and_pins_exactly_the_shipped_table (head 95ee9b8)

Determinism: no test logic changes, only the pinned data table. With this commit on main 8826a22397: every test/ file that names adoption_pin, adoption-pins, code_review_sage or code-review-sage (38 files, test_builtin_adoption_*.py, test_code_review_sage_permission_parity.py, test_core_code_review_sage_decoupling.py and test_adopted_wheel_copy_check.py among them), test_app_chat_launch.py, test_legacy_state_moves.py, test/integration/test_builtin_adoption_boot.py, test_flake_pattern_ratchet.py and the wheel copy's own tests/, run serially: 2999 passed, 5 skipped. Black, flake8, isort, mypy, subprocess-encoding, comment-history, brand-name, line-cap and harness-parity gates and scripts/docs-lint.sh pass. .github/scripts/adopted_wheel_copy_check.py passes on this body, and fails with the previous port base af94fac51f (naming app.json and ReviewChat.tsx). No frontend change; semgrep is not installed on this host.

Manual verification

scripts/adoption_pin.py compute at 711261d196f5 with --min-sdk-level 10 prints the committed row byte for byte, and refuses --min-sdk-level 9 naming app.json permissions.chatLaunch. Every shipped row measured over the network, one at a time since verify stops at its first refusal: fifteen rows ok, this one included. md-notebook's row, unchanged here, is refused: it was pinned at 8 one hour before #37459 made any credentialMasks a level-10 use. The pinned commit is the head of the repository's main, with every check run green on ubuntu, macOS and Windows.

Upgrade smoke on isolated loopback gateways (throwaway homes, the code-review-sage row as KIROCREW_HARNESS_ADOPTION_PINS, a real GitHub fetch). The model is Kiro Crew's fake ACP backend, wrapped to answer a Sage review prompt with a capability-bound envelope of two findings and to carry out a poster prompt; GitHub is the repository's capture gh stand-in plus a writable review store for the draft round trip. Each home was first booted on main 1dfee9ace2, before this change. Then this branch (on that main; the rebase onto 8826a22397 brings nothing under apps/, the chat launch or the App SDK) booted twice (STAGE, APPLY), once with Sage enabled at the upgrade and once with it disabled:

Check Enabled Disabled
Seed on the built-in: Sage enabled, two repositories, settings, two reviews (#42, #43) through the review pipeline, the #42 draft posted as a pending review, a follow-up chat opened from the page PASS PASS (then disabled)
The built-in page before the upgrade: report, Pull request tab (files, checks, description), publish bar on the pending draft, Open on #43, Continue on #42 PASS PASS
Boot 1 stages the pinned commit (git fetch, ledger staged); the record stays the built-in, data/ unchanged PASS PASS
Boot 2 adopts: origin: registry, sourceCommit 711261d196f5, version 0.9.5, enabled kept PASS PASS (enabled: false kept)
data/ byte-equal (18 files), approved grants equal, no app crons before or after (the fixture's two crons unchanged), trust written for this app, skills re-linked to the tree with the built-in's digests PASS PASS
The page loads from the adopted bundle (/apps/code-review-sage/ui/dist/index.mjs), both reviews listed, report and pending draft shown PASS PASS (after enable)
Pull request tab: files, checks and description of #42 PASS PASS
Publish bar: Submit as comment, confirmed, publishes the draft the built-in posted (the stand-in records a COMMENT on that review) PASS PASS
Continue on the built-in's follow-up: one POST /api/chat/slots with app_launch, no title or folder, 200, the same key; title, agent, folder and memory mode unchanged PASS PASS
Open a new follow-up on #43 through createChat: 200, a sage-followup- key, agent kirocrew, folder Sage Review, persistent memory, the pull request's title PASS PASS
A new review (#44) runs to a result on the adopted tree (its skills and worker scripts); settings, repositories and skills listed PASS PASS
Boot 3 is a no-op: ledger adopted, installed.json byte-equal, nothing fetched PASS PASS
Disable (the routes answer 404), enable (back), the page loads PASS PASS
Update from the store at the same commit (v0.9.5 -> v0.9.5), the page loads not run PASS
Uninstall keeps only data/; after a restart no built-in comes back PASS not run
Reinstall from the store (trust prompt, install at the catalog commit 711261d196f5, enable): data/ equal to before the uninstall plus the gateway's dependency lock; a restart shows one record PASS not run

No ERROR or traceback in any gateway's stderr. The stand-in's every review session has the same id, so its transcript is planted again before a follow-up is opened (opening one retires it). Update and reinstall ran against the published catalog with only code-review-sage's row switched to git at this commit (the KiroCrewApps PR below), served at official_catalog._open_catalog; with today's builtin row an adopted record has no install source until that PR lands, as for every earlier pin.

Related Issues

Part of #26967

Unblocked by #37492. Catalog row: the kirodotdev/KiroCrewApps PR linked in a comment below switches code-review-sage to git at the same commit. It is not auto-merged: the driver merges it right after this PR lands.

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

Contributed under the project's Apache-2.0 license.

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

Copy link
Copy Markdown
Contributor Author

Catalog row: kirodotdev/KiroCrewApps#87 switches code-review-sage to git at 711261d196f5ea4fa8027bbaa0e4991b11f3d402, the commit this PR pins. It is not auto-merged: the driver merges it right after this PR lands.

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

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 95ee9b85982084f8a1bb2329cfb4cc99cb141e7d touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

No design-level concerns: the change only adds a pin row through the existing adoption machinery and bumps the version to match it (D12). Nothing reads the old 0.9.3 version.

Notes

[DESIGN-REVIEWED] 95ee9b8

Description read

[DESCRIPTION-READ] e8a6c28f6956b13a29dc4f987f0d2a0052d5457ff73742f0bcc2decf6f68656a

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 95ee9b85982084f8a1bb2329cfb4cc99cb141e7d — 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

Nothing blocks. The row reuses the adoption-pin mechanism that already has 15 rows, and AGENTS.md's "No built-in apps" rule plus decision 2026-11-01 require Sage to leave core.

What this change ships

Inventory (6 items) — 6 justified

Intent: let hosts running the built-in Code Review Sage move to the app's own repository at restart without losing state. This is an ADDITION (a migration step under #26967).

  1. At the next restart, a host whose Code Review Sage is the built-in switches to the pinned commit of the app's own repository, keeping its data, secret, grants and enabled state. — justified
  2. The wheel copy's Code Review Sage version moves from 0.9.3 to 0.9.5. — justified
  3. After adoption, the sidebar still shows /code-review-sage with the ScanSearch icon. — justified
  4. A follow-up chat opened by the adopted copy carries embed_app, which the built-in's chats never did. — justified
  5. The spec section of app-kit-platform.md records the adoption and the App repo: rule for later wheel-copy fixes. — justified
  6. The shipped-pins test table gains the matching row. — justified

[FIRST-PRINCIPLES-REVIEWED] 95ee9b8

Description read

[DESCRIPTION-READ] c672cc31585c0d04fb9485119ad63abea788647d99655f65716a85304c5cd510

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 95ee9b85982084f8a1bb2329cfb4cc99cb141e7d — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 95ee9b8

Verdict parsed from the review's SHA-scoped output markers for commit 95ee9b85982084f8a1bb2329cfb4cc99cb141e7d.

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

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 95ee9b85982084f8a1bb2329cfb4cc99cb141e7d and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 95ee9b8

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

@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

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

This review checked head 95ee9b8 against the adoption code. The archive sha256 and the tree digest both match the codeload tarball for the pinned commit. The pinned tree's name and version (0.9.5) match the pin and the wheel app.json, as D12 requires. Its minAppSdkLevel 10 equals APP_SDK_LEVEL. It ships no build inputs, no overlays and no mcpServers. Its permissions, skills and chatLaunch are byte-identical to the wheel copy, so E9 holds. Each hunk has a test that fails if it is reverted: the exact, ordered pin table comparison and the wheel version equality test.

Well done: the port tightens the old silent pass-throughs. A missing redactor, link-safe reader, permission floor or SEL now makes it refuse or withhold.

Optional:

  • Follow-ups opened after adoption now carry embed_app, so an uninstall drops their resume pointer, which the built-in's follow-up never did. Consider one line saying so in the new app-kit-platform.md paragraph or under Backwards compatibility.
  • #38443 appends rows at the same array tail. Whichever PR lands second needs a rebase, and the ordered table test will catch a wrong row order.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Nov 17, 2026
@bolichen97
bolichen97 merged commit 758622b into main Nov 17, 2026
99 checks passed
@bolichen97
bolichen97 deleted the feat/pin-code-review-sage branch November 17, 2026 16:01
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 17, 2026
KiroCrewCaptain pushed a commit to kirodotdev/KiroCrewApps that referenced this pull request Nov 17, 2026
Flip code-review-sage from a builtin source to a git source in its own
KiroCrewCaptain repository, pinned at the commit Kiro Crew's adoption
pin table names for it in kirodotdev/KiroCrew#38478, with the note the
other adopted apps carry and the org author URL.
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