Skip to content

feat(apps): pin mochi for adoption - #39043

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
feat/pin-mochi
Nov 18, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
feat/pin-mochi

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A host that has Mochi as a built-in moves onto the app's own repository at its next restart, keeping its pet, its watch list, its plan, its pins, its memories, its settings, its grants and whether it was enabled, while every desktop app keeps showing exactly one pet with its shortcuts.

Mochi now lives in its own repository (KiroCrewCaptain/kirocrew-app-mochi), ported from the current wheel copy, with green CI on ubuntu, macOS and Windows. It is the last built-in of #26967 without an adoption pin row, so no host adopts it and every Mochi fix keeps having to land twice.

Why it matters

Until a pin row exists, Mochi cannot leave core: every host keeps running the wheel copy, and the removal of the built-ins in #26967 cannot finish.

Not a goal

  • Changing the adoption machinery, the window host, the D12 equality rule, scripts/adoption_pin.py, or the app's declared permissions.
  • Moving Mochi's windows onto the desktop window host (its repository declares no desktop block; see below).
  • Deleting the wheel copy (src/kiro_crew/apps/builtins/mochi/, website/src/apps/mochi/, website/electron/mochi/); only its app.json version moves.
  • Changing any other pin row, or the catalog (that is the KiroCrewApps PR below).

What changed (motivation → approach → change)

Mochi gets an adoption pin row, so at its next restart a host whose Mochi is the built-in switches to the app's own repository at the pinned commit, keeping data/ (the watch list, the plan, the pinned files, the stats, the settings with their colour maps, the imported packs), the approved grants (the three desktop capabilities included) 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
mochi 0.1.0 to 0.1.1 5db17b967894 7 (permissions.desktopCapabilities, kept from the wheel copy)

compute refuses --min-sdk-level 6 for this tree ("App Kit seam level 7, which the pinned tree uses (app.json permissions.desktopCapabilities)") and accepts 7, so 7 is the lowest level it takes. The tree declares no desktop.windows, which the compute scan does not read, so nothing in the window grammar (app-kit-platform § 35, "Levelling") raises it. The wheel built-in app.json version moves to 0.1.1, since a first-adoption pin must equal it (D12); no wheel test pins the version. The repository declares the same permissions, agents, skills and mochi MCP server name as the wheel copy (the server started from the tree, python3 backend/mcp_launch.py, the E10 shape), no credentialMasks, no cron jobs and no desktop block, so E9 holds nothing back. The owning specs, app-kit-platform § 35 and mochi.md, record the adoption.

App repo: KiroCrewCaptain/kirocrew-app-mochi@5db17b9

Wheel-copy base: mochi@5ec3b8167727fa2193a2de56c40ee20449469687

The repository was ported from main 5ec3b81677 (its #1); no change has touched the wheel copy since, up to this PR's base. Its #2 makes the MCP launcher name the installed record's data home when the MCP host starts it without the gateway's environment (the built-in's launch pinned KIROCREW_HOME; found by the smoke below), and #3 released 0.1.1 as 5db17b967894.

Why the adopted copy declares no desktop block

A pin row ships in the wheel, so it reaches hosts in the next release, but a gateway installed separately, run as a service or reached over a tunnel follows its own updates, so a newer gateway can meet any desktop app a user still has. I loaded each desktop app's real website/electron/mochi/index.js reconcile and, where it has one, its real app-window-host.js, in Node with Electron stubbed, against a loopback stand-in that answers /api/apps with the rows a gateway sends (the built-in record captured from a real gateway, and the adopted record with and without a desktop block of the windows the app would declare), on the Linux and macOS code paths:

Desktop app Built-in record, on Adopted, no desktop (this pin), on Adopted, with desktop, on
0.12.0, 0.12.1, 0.12.2 (no window host) built-in pet, panel, 3 shortcuts built-in pet, panel, 3 shortcuts built-in pet, panel, 3 shortcuts
0.13.0-rc.1 built-in pet, panel, 3 shortcuts built-in pet, panel, 3 shortcuts; host hosts nothing full block: host refuses displays/gutter, so the same; a block without them: two pets
0.13.0-rc.2, rc.3, release/0.13.0 tip built-in pet, panel, 3 shortcuts built-in pet, panel, 3 shortcuts; host hosts nothing two pets (the host's and the built-in's, which reads only enabled)
main (with #37454) built-in pet, panel, 3 shortcuts built-in pet, panel, 3 shortcuts; host hosts nothing host's pet only and no shortcuts: the built-in stands down but keeps its chords reserved as a plain shell owner, so the host refuses them

With the app off, no desktop app draws anything in any column. A pin of a copy that declares desktop is therefore not safe until a released shell carries #37454 and Mochi's reservation is handed over with { app: true }; the copy pinned here declares none, and every shell draws exactly what it draws for the built-in record, from the window pages the wheel still ships at /app-windows/mochi/, over the adopted routes, which are the wheel copy's table. The middle column was re-run against the real /api/apps rows of the smoke gateway below (adopted on, adopted off) with the same result. What the later release needs is in the repository's PORTING.md and in § 35.

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/, the grants and enabled; a host that cannot adopt (an SDK level below 7, a pending config review, a file beside app.json the tree does not ship) keeps the wheel copy unchanged. Every desktop app shows one pet with its shortcuts, as the table above shows.

One difference a user can see, the one every adopted former built-in has: while Mochi is off, /mochi shows the dashboard's "Enable this app from Apps to use it" card for a disabled installed app instead of Mochi's own "Mochi is sleeping" landing (the dashboard mounts an installed app's page only while it is on).

Removes nothing: the wheel copy, its window pages at /app-windows/mochi/, its shell code, its /mochi 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 70320fb)

Determinism: no test logic changes, only the pinned data table. With this commit on main 1b6093307544 (rebased since onto 37911daad0, which brings nothing under apps/, the window host or Mochi's shell code), run serially with an isolated --basetemp: every test/ file and wheel-copy test that names mochi, adoption_pin or adoption-pins (90 files: test_builtin_adoption_*.py, test_adopted_wheel_copy_check.py, test_adopted_apps_core_imports.py, test_app_agent_tools_adopted.py, test_mochi_*.py and integration/test_builtin_adoption_boot.py among them), test_legacy_state_moves.py, test_builtin_permission_parity.py and test_flake_pattern_ratchet.py: 4553 passed, 14 skipped. Black, isort, flake8, 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. website/electron: node --test test/app-window-*.test.js mochi/test/*.test.js test/mochi-session-token.test.js test/shell-shortcut-reservations.test.js: 432 pass, 0 fail.

Manual verification

scripts/adoption_pin.py compute at 5db17b967894 with --min-sdk-level 7 prints the committed row byte for byte, and with --min-sdk-level 6 refuses it. scripts/adoption_pin.py verify over the network: all twenty rows ok, this one included. 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 HOME and KIROCREW_HOME, the mochi row as KIROCREW_HARNESS_ADOPTION_PINS, a real GitHub fetch, Kiro Crew's fake ACP backend). Each home was first booted on main 1b6093307544 with the built-in, then this branch booted three times (STAGE, APPLY, no-op), once with Mochi enabled at the upgrade and once with it disabled:

Check Enabled Disabled
Seed on the built-in: enabled; settings (pet name, activity tier, a colour map); two watch items; a gallery pack; chat, screenshot and walk counters; a pet state event; a 30-minute quiet window; a file pinned through the built-in's own pin_file tool PASS PASS (then disabled)
Boot 1 stages the pinned commit (ledger staged); the record stays the built-in PASS PASS
Boot 2 adopts: origin: registry, ledger adopted, version 0.1.1, enabled kept PASS PASS (enabled: false kept; routes 404 while off)
Approved grants and desktopCapabilitiesGrant equal; no app crons before or after; no desktop block on the row; legacy nav /mochi with the Cat glyph PASS PASS
data/: every file kept; disabled at the upgrade: byte-equal to the seed PASS PASS
The routes answer the seeded settings, watch list, pin and packs, and the stats keep the seeded counters; /stats, /pet-state, /plan, /activity, /soul, /bg-usage answer PASS PASS (after enable)
/mochi, the five window pages /app-windows/mochi/{pet,panel,settings,avatar,snip}.html and the adopted page bundle load PASS PASS
An owner write; an unauthenticated write is refused (403) PASS PASS
The adopted backend's mochi:* events reach a dashboard socket as app_event for mochi (what the built-in windows read) PASS PASS
Agents and MCP: mochi--mochi, mochi--mochi-bg and the default agent mount mochi:mochi from the adopted tree's launcher; that launch, run with no gateway environment as an MCP host may, serves the eight tools and get_watchlist answers the seeded items PASS PASS
Boot 3 is a no-op: installed.json and the ledger byte-equal, nothing re-staged PASS PASS
Disable (the routes answer 404), enable (back, same watch list) PASS PASS
Uninstall keeps only data/ (the owner loop's shutdown flush rewrites stats.json, and the gateway rewrites its dependency lock); after a restart no built-in comes back PASS not run
Reinstall from the store (catalog row switched to git at this commit, the KiroCrewApps PR below, served in place of the catalog fetch): trust bound to the listed repository, install at the pinned commit (201), enable; data/ equal to before the uninstall bar the reach policy the enable re-derives; the watch list is back; a restart shows one record PASS not run

No ERROR or traceback in any gateway's stderr. Not exercised headless: a real Electron desktop app drawing the pet over the adopted record (the shell's unit tests and the matrix above cover its decisions with Electron stubbed), and a real model behind Mochi's agents (the fake ACP backend runs no planner or watch check, so no plan was written).

Real-machine verification

Machine: author's Linux workstation, Amazon Linux 2023 x86_64, 32 vCPU / 123 GiB (no EC2 instance; the upgrade smoke above is the command)
Before (main 1b60933): seed a built-in Mochi (enabled) on a throwaway home, then boot the tree twice with the mochi rows of its own adoption-pins.json as the pin table -> shipped mochi rows on this tree: 0, boot 1: origin=builtin ledger=None, boot 2: origin=builtin ledger=None
After (head 70320fb): the same command on the head -> shipped mochi rows on this tree: 1, the seed boot stages the pinned commit over a real GitHub fetch, boot 1: origin=registry ledger=adopted, boot 2: origin=registry ledger=adopted; the upgrade smoke above, every check PASS
Cleanup: own computer; every throwaway home, worktree and scratch directory deleted

Screenshots / video

N/A: the diff changes no website/ file and no rendered surface; the page a user sees after adoption is the pinned repository's, whose README carries the captured screenshots.

Related Issues

Part of #26967

Catalog row: the kirodotdev/KiroCrewApps PR linked in a comment below switches mochi to git at the same commit. It is not auto-merged: it lands right after this 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

Contributed under the project's Apache-2.0 license.

Mochi now lives in its own repository under KiroCrewCaptain, ported
from the current wheel copy 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 grants and enabled.

minAppSdkLevel is 7, the level of the desktopCapabilities the manifest
keeps from the wheel copy. The adopted copy declares no desktop block:
every desktop shell, the 0.13.0 release candidates included, keeps
drawing the pet from the wheel's window pages over the adopted routes,
so no shell draws two pets or loses a shortcut. The wheel app.json
version moves to the pinned 0.1.1 (D12), and the owning specs record
the adoption.
@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 18, 2026 08:25
@bolichen97
bolichen97 enabled auto-merge (squash) November 18, 2026 08:26
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 18, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Catalog row: kirodotdev/KiroCrewApps#92 switches mochi to git at 5db17b967894c411621ea6dcfba294da262d4173, the commit this PR pins. It is not auto-merged: it lands right after this PR.

@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 70320fbbfc852ac1d966a4e5ee3af38937da9324 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 70320fbbfc852ac1d966a4e5ee3af38937da9324 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

This adds one pin row the same way the existing pins do. It removes nothing from the code, and the visible change while Mochi is off is listed under compatibility as accepted.

Notes

[DESIGN-REVIEWED] 70320fb

Description read

[DESCRIPTION-READ] 080bddef38f3cad0fa6b848bcd5105a2c82127ec5eda4b0aeffa9dad37ea87de

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 70320fbbfc852ac1d966a4e5ee3af38937da9324 — 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

This adds the pin row that AGENTS.md requires for moving built-ins out of core (#26967), through the existing adoption mechanism. The version bump is what D12 requires, and the description states the one change a user can see.

What this change ships

Inventory (5 items) — 5 justified

Intent: let hosts running the wheel copy of Mochi switch at restart to the app's own repository, so Mochi can leave core (an ADDITION, required by the documented no-built-in-apps migration).

  1. At the next restart, a host whose Mochi is the built-in copy switches to KiroCrewCaptain/kirocrew-app-mochi@5db17b96, keeping its data, grants and enabled state — justified
  2. The wheel copy of Mochi now reports version 0.1.1 instead of 0.1.0 (D12 equality) — justified
  3. While Mochi is off, /mochi shows the generic "Enable this app" card instead of the "Mochi is sleeping" page — justified
  4. The test table of shipped pins gains the Mochi row — justified
  5. app-kit-platform § 35 and mochi.md record the adoption and why there is no desktop block — justified

[FIRST-PRINCIPLES-REVIEWED] 70320fb

Description read

[DESCRIPTION-READ] e6f88294fc871a6be41f1556f359a9522085998b2f8a257563ff130d82fe168a

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 70320fbbfc852ac1d966a4e5ee3af38937da9324 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 70320fb

Verdict parsed from the review's SHA-scoped output markers for commit 70320fbbfc852ac1d966a4e5ee3af38937da9324.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 70320fbbfc852ac1d966a4e5ee3af38937da9324 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 70320fbbfc852ac1d966a4e5ee3af38937da9324 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 70320fb

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 70320fbbfc852ac1d966a4e5ee3af38937da9324 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 18, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider estimates an 8% chance that this change introduces a defect, within the 12% limit for approving on its own, but it is held at tier pending: being reviewed.

Adds data only: a Mochi adoption pin row in adoption-pins.json and the matching test table entry, with the same shape as the 19 existing rows, plus the wheel copy's version bump to 0.1.1 that D12 requires (no test or code expects 0.1.0 for Mochi). Specs are updated in the same commit. The existing adoption machinery handles the state that matters: the per-session identity launch for built-in MCP servers is limited to records the built-in still owns, so core won't override the adopted copy's server launch; E10 accepts the tree's python launcher; the desktop shell reads only name and enabled, and with no desktop block hostOwnsAppWindows returns false, so every shell keeps exactly one pet and its shortcuts. CI and the review lanes are all green. The commit and the two SHA-256 values can't be checked offline, but the adoption gate re-checks the digests when it stages and applies the pin, so bad values would leave hosts on the wheel copy rather than corrupt anything.

Tier: pending: being reviewed.

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 70320fbbfc · 65 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@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 70320fb. Recomputing the pin with the adoption pin tool at the pinned app commit gives the committed row byte for byte. Level 6 is refused and 7 is accepted, and the wheel copy's version now equals the pinned 0.1.1 (D12). The pinned manifest declares exactly the wheel copy's permissions, events, agents, skills and mochi MCP server name, with no cron, credential masks or desktop block, so E9 holds. Its backend route table matches the wheel's route for route. Every shipped shell from 0.12.x through the 0.13.0 candidates, the release branch and main reads only the record's name and enabled flag, or ignores a record with no desktop block, so each one keeps drawing a single built-in pet, panel and shortcuts. The adoption, Mochi and permission parity tests pass on this head, and I found no code error.

@KiroCrewCaptain
KiroCrewCaptain merged commit d80be9d into main Nov 18, 2026
97 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the feat/pin-mochi branch November 18, 2026 09:31
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 18, 2026
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