Skip to content

feat(app-kit): let built-in shell code step aside for the window host - #37454

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
feat/app-seam-desktop-host-serve
Nov 17, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
feat/app-seam-desktop-host-serve

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A desktop app served by the window host shows exactly one set of windows, and keeps showing from the crew the user chose for it after its copy on this computer is switched off, as Mochi's built-in pet does today.

Two gaps stand between the built-in desktop apps and their adopted copies (#26967):

  • The built-in shell code under website/electron/mochi/ and website/electron/crew-companion/ reads its /api/apps row by name alone. An adopted record that declares a manifest desktop block would get both the built-in windows and the window host's.
  • Mochi's pet keeps showing a remote crew's Mochi while the local Mochi is disabled (mochi.md, "A non-answer never creates a pet"). The window host serves only apps enabled on the local gateway, so an adopted Mochi would lose that.

Why it matters

Mochi and Crew Companion cannot be adopted while either gap stands: every desktop user with them on would see a doubled pet, and a user who runs Mochi on a remote crew with the local copy off would lose the pet on the first start after adoption.

Not a goal

  • Adopting Mochi or Crew Companion, changing adoption-pins.json or the catalog, or deleting any built-in.
  • Shortcuts or per-machine prefs, including the reservation a stood-down built-in keeps for its configured chords (lane desktop-host-prefs).
  • Any change to the manifest grammar, the gateway or the window bridge.

What changed (motivation → approach → change)

Approach: two generic rules in the shell's window host, keyed on the gateway's record and naming no app. The built-ins' own shell code calls the first one, so nothing app-specific moves into the host.

  • app-window-host-rules.js: hostOwnsAppWindows(rows, name) answers true when that gateway's record for the app has a manifest desktop block, on or off, even one this shell's rules refuse, and null for a body it cannot read. desktopDeclarations takes {disabledToo} and marks each declaration enabledHere.
  • Mochi: the local probe answers hosted (read by instanceGate.localMochiState) and the reconcile takes its full teardown, a remote pet included. A remote whose record the host owns is a definite no for the built-in pet. Crew Companion's probe reads such a record as released, beside its check of a non-builtin origin, and closes its windows on or off.
  • app-window-host.js: servedDeclarations serves an app that is off here only from the crew its gatewayChoice points at, while that crew answers that the app is on there. A non-answer keeps the windows still open, or a background page waiting to be reopened, and holds the app for that tick, so createWindow creates none of its windows (no openOnEnable window, shortcut press, open() or background reopen). The tick that answers yes reopens a waiting background page; a definite no closes the windows and drops it. Without gatewayChoice declared and approved here, nothing is served.
  • Specs: app-kit-platform §35 (new "Off here, served by its crew" and "Built-in shell code stands down" paragraphs, with the shell/gateway version matrix), mochi.md, website/electron/README.md. App-author docs: docs/app-kit/manifest-reference.md and the apps/desktop_capabilities.py docstring now say that an app switched off here keeps the windows, shortcuts and capabilities a chosen crew still serves it.

Backwards compatibility

Compatible: built-in records declare no desktop block, so both built-ins serve their apps exactly as on main, and an app that is enabled here is served as before. Old shell with new gateway: a stable shell before this one has no window host, so it never draws both. A 0.13.0 pre-release shell has the host and could, so adopting a built-in that has shell code waits for the release carrying this rule. New shell with old gateway: such a gateway sends no desktop block, so the built-in serves as before. APP_SDK_LEVEL and the bridge level are unchanged: no grammar, gateway or bridge call is added.

Removes nothing: no window, route, key or handler is removed. A built-in only stands down for a record that does not exist for any user today.

Tests

  • test/app-window-host.test.js: an app off here gets its windows from its chosen crew while the app is on there, and they close on a definite no. A non-answer keeps an open window and never creates one, nor brings one back once it has closed. With one of three windows still open, a non-answer from the crew or from core's check of a reused target opens no other openOnEnable window, and a shortcut press, open() or background reopen opens none either. Once the crew answers, both come back from it. A background page that is the app's last window and dies during a silent tick survives a second silent tick, comes back once the crew answers yes, and stays gone after a no. A local switch-off keeps a crew's windows, and choosing this computer closes them. NEGATIVE: an app off here whose gatewayChoice is undeclared, staged or missing from the grant gets nothing, and no crew is even asked. One with no desktop block, or one skipped at boot, gets nothing either.
  • test/app-window-host-rules.test.js: hostOwnsAppWindows (on/off/refused block true, no block or no row false, unreadable null). disabledToo lists only off apps with a valid block.
  • mochi/test/instanceGate.test.js, mochi/test/instanceSwitchRules.test.js, crew-companion/test/hostStandDown.test.js: a host-owned record stands each built-in down. localMochiState answers hosted for this computer's record, on or off, even with a refused block. The built-in record keeps its states.
  • test/app-window-host-independence.test.js: every app-owned shell directory asks hostOwnsAppWindows.
  • With the production hunks reverted, the off-here host tests and each stand-down test fail. With only the respawnDue clause in servedDeclarations reverted, the background-page test fails. Each of these mutations fails a test too: dropping the confirm-path non-answer mark, the hold in createWindow, the held background reopen, and the hosted branch of localMochiState.
  • Full Electron suite (node --test over test/, mochi/test/, crew-companion/test/): 3862 pass, 0 fail on the first head. This head, run on a host without node_modules: the host, rules, span, Mochi and companion files give 441 pass and 1 fail, mochi/test/petOverlays.test.js (Cannot find module 'electron'), which this diff does not touch. No sleep or port, and one injected clock: hosts are driven tick by tick with injected fetch. app-window-host.test.js and hostStandDown.test.js ran 10 times in a row, 0 fail; Node 22's runner has no shuffle flag, so the new test also ran alone (--test-name-pattern), green.
  • The only Python change is a docstring. test_flake_pattern_ratchet.py, test_app_manifest_desktop.py, test_app_desktop_capabilities.py and the tests that read manifest-reference.md pass.

Proof: not provable -- frontend test (prove.py runs Python only)

Manual verification

N/A — not run against a live desktop here. The host, the Mochi gate and the companion probe are pure or are driven through their exported functions with Electron stubbed, as the existing suites do.

Screenshots / video

N/A — no rendered surface changes. The diff touches shell window lifecycle only, with no watched website/src/ path.

Related Issues

Part of #26967

Authority: owner ruling #26967 (comment) (desktop-shell seam; no app code in the Electron main process; users' normal use unaffected), building on ruling item 5 of #26967 (comment) (the desktop window host).

Overlaps:

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

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

Copy link
Copy Markdown
Contributor Author

Seam lane desktop-host-serve of #26967, under owner ruling #26967 (comment).

Decisions taken in this lane, for the reviewer:

  • The stand-down key is the record's desktop block (present, on or off, even one this shell refuses), not origin. The host serves exactly the records that declare one, so this is the key that matches "whenever the host serves X". feat(desktop): hand the companion's windows to its installed copy #37430 keys Crew Companion on origin. Both checks agree for an adopted copy that declares windows, and whichever PR lands second keeps both.
  • A remote crew whose Mochi record the host owns counts as a definite no for the built-in pet, so the pet falls back to this computer. That mirrors the host's own refusal of a crew that cannot serve its windows.
  • An app that is off here is served only from a crew, with gatewayChoice declared and approved HERE, and only while that crew answers that the app is on there. A non-answer keeps an open window and never creates one. This matches hostDisabledMeansTeardown and "a non-answer never creates a pet".
  • No APP_SDK_LEVEL or bridge-level change: no grammar, gateway or bridge call is added.
  • Out of lane: the stood-down built-in's chord reservation (desktop-host-prefs).
  • For the adoption PRs: a 0.13.0 pre-release shell has the window host but not this rule, so adopting Mochi or Crew Companion waits for the release that carries this rule. Stable shells before it have no host and are unaffected.

@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

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

Nothing to check. The diff adds no control, label or string a user sees. It only changes when the desktop shell opens or closes app windows, and only for adopted app records that no user has yet. So the missing screenshots leave no gap.

[UX-REVIEWED] d6c20f3

Description read

[DESCRIPTION-READ] 5345b43066372634e41bdf850a160f3bfd75be363354fbe8a0e1ee635080ad1a

That sha256 names everything this verdict read: the PR description, plus the 3 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

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: both stand-down rules key on the gateway record rather than an app name, and no record in production has a desktop block yet, so the built-ins behave as they do on main.

Notes

  • When local Mochi is hosted, the built-in pet tears down "a remote's pet included", and the host serves an app that is off here only through an approved gatewayChoice. Mochi's adoption PR has to grant gatewayChoice and say how a remote crew still running the built-in record keeps its pet. Without that, a user whose local Mochi is off loses the remote pet.
  • "Manual verification: N/A" is acceptable here only because the stand-down branch can't be reached until adoption. The adoption PR should carry a live desktop run.

[DESIGN-REVIEWED] d6c20f3

Description read

[DESCRIPTION-READ] 9bb0f00c8efc4a72cc6a0ad13cb5804a9a71b802914831b1f73fac0ca83876d1

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 d6c20f3f5e96edc520466a5eb1dc992e26eb78bb — 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, but one item reverses the documented rule that an app's window closes when the app is disabled, and it does so for every host-served app. Today no app in the repo reaches that path.

Notes

  • Item 4 — inherited: it rests on "as Mochi's built-in pet does today", and the diff rewrites "The window is closed when the app is disabled" and "only to a window of an enabled app" for every app that holds gatewayChoice. Built-in records declare no desktop block, so 0 in-repo apps reach this path until an adoption that this PR rules out of scope. Subtraction: defer the disabledToo/servedDeclarations off-here path until the adoption PR that needs it.
  • Item 8 — zero consumers: windowHostOwnsMochi is exported, but its only callers outside instanceGate.js are 3 lines in instanceGate.test.js. Subtraction: inline it into localMochiState/parseMochiEnabled and drop the export.

What this change ships

Inventory (8 items) — 6 justified

Intent: let built-in Mochi and Crew Companion be adopted without doubled windows, and keep a remote crew's pet once the local copy is off. ADDITION.

  1. Mochi's built-in pet stands down entirely (hosted) when this computer's record declares a desktop block — justified
  2. A remote crew whose Mochi record declares one counts as a definite no for the built-in pet — justified
  3. Crew Companion's windows close for a record that declares a desktop block, on or off — justified
  4. An app switched off here keeps its windows, shortcuts, screenCapture and localFiles while its chosen crew has it on — inherited, 0 current consumers
  5. A crew that does not answer keeps open windows but opens none; a dead background page waits for a definite answer — justified
  6. The independence test requires every app-owned shell directory to call hostOwnsAppWindows — justified
  7. Specs, manifest reference, README and docstring describe both rules — justified
  8. New export windowHostOwnsMochi — zero consumers outside tests

[FIRST-PRINCIPLES-REVIEWED] d6c20f3

Description read

[DESCRIPTION-READ] e528641e82fba15a4d8ec8f723b55b88e48ce98ae690a9fad8912e19411704ff

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

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] d6c20f3

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

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] d6c20f3

False positive or not applicable? A repository writer can comment:
/ai-review override gpt d6c20f3f5e96edc520466a5eb1dc992e26eb78bb 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
@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 15% chance that this change introduces a defect, above the 12% limit for approving on its own.

I'm approving this PR. Nothing blocks it.

The stand-down rule (hostOwnsAppWindows) is safe for every user today:

  • It only fires when an app's record has a non-null manifest desktop block.
  • The gateway sends desktop only when windows are declared (DesktopConfig.to_dict returns {} when empty, and manifest.py adds the key only when it is non-empty).
  • No built-in manifest declares a desktop block, so the built-in Mochi and Crew Companion behave exactly as on main.
  • Mochi's new hosted answer goes to the existing full teardown, which returns RECONCILE_IDLE. Every other reader of the probe state still handles enabled, disabled and unknown.
  • Crew Companion's released path already existed (feat(desktop): hand the companion's windows to its installed copy #37430) and closes all its windows.

Serving an app that is switched off here is limited the way the PR says:

  • Pointed at this computer: such an app gets nothing. The target's empty baseUrl is falsy in servedDeclarations, and without gatewayChoice approved here the target is always this computer.
  • Crew silent: when the crew does not answer, the app is held. createWindow returns null for a held app, and every caller copes with that, including the span c

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

@bolichen97
bolichen97 force-pushed the feat/app-seam-desktop-host-serve branch from 46808b3 to 17e9c90 Compare November 15, 2026 04:20
@bolichen97

Copy link
Copy Markdown
Contributor Author

Replies to the four review findings, all on head 17e9c90 (rebased on main, still one commit).

1. Docs still promised enabled-only serving: fixed.
docs/app-kit/manifest-reference.md (the desktopCapabilities row, openOnEnable, "The window is closed when the app is disabled", and the gatewayChoice row) and the apps/desktop_capabilities.py docstring now give the shipped contract. An app switched off on this computer keeps the windows, shortcuts and local∩crew capabilities that a gateway chosen with gatewayChoice still serves it. screenCapture and localFiles keep acting on this computer. To stop them, choose "self" or switch the app off on that gateway as well. §35 "Off here" says the same, and the leftover "while the app is enabled" in §35's window-messaging paragraph now reads "while the app is served".

2. A non-answer could still open the other openOnEnable windows: fixed.
servedDeclarations now also returns a holding set. That set is the apps that are off here, whose crew did not answer this tick, and that still have a live window. apply() stores it as keepOnly, and createWindow refuses every app in it. So a non-answer creates nothing: no openOnEnable window, shortcut press, open() or display copy. A background page that dies during that tick waits in respawnDue (the immediate respawn and the tick loop both defer it) until a tick can tell. The new test off here: a non-answer keeps only the windows still open; none is created until the crew answers is the reported probe with three windows. Panel b is closed and the crew errors with at = 0: nothing is created. The press, the open() and the background crash create nothing either. Once the crew answers, b and bg come back from localhost:7778.

3. Untested branches: fixed.

  • Mochi's local probe now gets its answer from a pure instanceGate.localMochiState(apps). Its behaviour test covers hosted on and off, a refused block, the built-in record, desktop: null, another app's block, and Mochi absent. The source guard now only checks that mochiEnabledState resolves that answer.
  • The confirm-path non-answer mark is covered by the same new host test: a fresh at on an injected clock, with core's /api/instances throwing.
  • These mutations each fail a test now: deleting if (!check.known) untold.add(app);, if (keepOnly.has(app)) return null; in createWindow, the held background respawn, the respawnDue skip, holding.add(app), and if (windowHostOwnsMochi(apps)) return "hosted"; in localMochiState. Changing the probe's resolve(state) also fails one.

4. The stood-down Mochi keeps its chord reservation: deferred to #37457 (desktop-host-prefs lane), not changed here.
This PR's "Not a goal" puts the stood-down built-in's chord reservation in that lane, and #37457 already owns the fix. It marks Mochi's reservation { app: true } (shell-shortcut-reservations.js), so the host serving that same app id may bind those chords while every other app is still refused them. It also imports the user's rebinds through desktop.legacyMachinePrefs. That is stricter than releasing the reservation from here, which would let any app take Mochi's chords. I tried that release on this branch and dropped it, so the two lanes do not conflict in mochi/shortcuts.js. Until #37457 lands nobody is affected: no shipped record declares a desktop block, so hosted never occurs. The spec sentence at §35 stays accurate for this head. The PR body's Overlaps line now names #37457 and the files the two PRs share.

Gates on this head: check_black_formatting, check_subprocess_encoding, isort, flake8, mypy (the changed module), check_comment_history, check_brand_name, check_file_line_cap, docs-lint.sh, test_flake_pattern_ratchet.py and the Python tests that read the changed docs all pass. Electron: the host, rules, span, Mochi and companion files give 432 pass. The 1 failure is mochi/test/petOverlays.test.js, which is untouched and fails with Cannot find module 'electron' because this host has no node_modules. A full-suite comparison against a pristine copy of the previous head showed the same environmental failure set: missing electron, electron-updater and app-builder-lib.

@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
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge 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-desktop-host-serve branch from 17e9c90 to 0b8f804 Compare November 15, 2026 06:18
@bolichen97

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: servedDeclarations keeps a crew-held, off-here app across a non-answer

  • Preserve pending background respawns when the last window dies span=425976e6ecb7

fixed in 0b8f804: servedDeclarations (website/electron/app-window-host.js) now keeps an off-here, crew-held app on a non-answer while a window is live OR a respawnDue key of that app waits, so apply() no longer drops the pending reopen.
A yes tick takes the app out of holding, and apply()'s respawnDue loop reopens the background page; a no or a removal leaves it unserved, and the same loop drops the key without opening anything.
Class sweep: this is the one site that decides whether a held app is kept; no other liveness check gates holding.
Regression test: "off here: a background page that dies while the crew is silent comes back when it answers, and not after a no" fails with the clause reverted, passes with it.

@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 15, 2026
bolichen97 added a commit that referenced this pull request Nov 15, 2026
The desktop window host gave an app fixed manifest accelerators and no
per-machine state, so a desktop pet could not move onto it: its users
rebind its global shortcuts, its defaults differ per platform, its
shell code reserves its chords even while disabled, and the crew it
shows plus the rebinds live in a shell store a window page cannot read
(#36349 left the shortcut gap under "Not a goal").

Generically, with the app id as data:

- desktop.shortcuts[].platformAccelerators: a per-platform default,
  held to the same chord rules (gateway and shell); seam level 8.
- The host binds the user's chord per app per machine, and a page's
  shortcuts() / setShortcut() (bridge level 3) lists and rebinds only
  the app's declared shortcuts, only right after a press in that
  window, and onto a chord other than the declared default only when
  the user pressed that chord there. The new chord is registered
  before the binding moves, so a refused rebind or reset keeps the
  chord the app held and never frees it for another app.
- A shell owner that is an app's own shell code may reserve
  { app: true } so the host serving that app id may bind those chords.
  Mochi keeps a plain reservation until its built-in steps aside
  (#37454), so the two never register the same chords. One binding is
  one chord whatever its spelling, so a respelled rebind keeps the
  chord with its holder.

For Mochi, its own shell code (mochi/hostHandOff.js, called from
initMochi before the host is created) copies the crew the pet shows
and the user's rebinds from mochi-machine.json into the host's gateway
choice and bindings for mochi, recording what it copied. It copies
again only while the host still holds that value, so a change in the
built-in before adoption carries over and a choice made through the
host is never overwritten. It leaves core with Mochi's shell code.

Built-ins behave as before: no built-in declares a desktop block, so
the host serves none of them yet.

Part of #26967
@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 added a commit that referenced this pull request Nov 15, 2026
The desktop window host gave an app fixed manifest accelerators and no
per-machine state, so a desktop pet could not move onto it: its users
rebind its global shortcuts, its defaults differ per platform, its
shell code reserves its chords even while disabled, and the crew it
shows plus the rebinds live in a shell store a window page cannot read
(#36349 left the shortcut gap under "Not a goal").

Generically, with the app id as data:

- desktop.shortcuts[].platformAccelerators: a per-platform default,
  held to the same chord rules (gateway and shell); seam level 8.
- The host binds the user's chord per app per machine, and a page's
  shortcuts() / setShortcut() (bridge level 3) lists and rebinds only
  the app's declared shortcuts, only right after a press in that
  window, and onto a chord other than the declared default only when
  the user pressed that chord there. The new chord is registered
  before the binding moves, so a refused rebind or reset keeps the
  chord the app held and never frees it for another app.
- A shell owner that is an app's own shell code may reserve
  { app: true } so the host serving that app id may bind those chords.
  Mochi keeps a plain reservation until its built-in steps aside
  (#37454), so the two never register the same chords. One binding is
  one chord whatever its spelling, so a respelled rebind keeps the
  chord with its holder.

For Mochi, its own shell code (mochi/hostHandOff.js, called from
initMochi before the host is created) copies the crew the pet shows
and the user's rebinds from mochi-machine.json into the host's gateway
choice and bindings for mochi, recording what it copied. It copies
again only while the host still holds that value, so a change in the
built-in before adoption carries over and a choice made through the
host is never overwritten. It leaves core with Mochi's shell code.

Built-ins behave as before: no built-in declares a desktop block, so
the host serves none of them yet.

Part of #26967
bolichen97 added a commit that referenced this pull request Nov 15, 2026
The desktop window host gave an app fixed manifest accelerators and no
per-machine state, so a desktop pet could not move onto it: its users
rebind its global shortcuts, its defaults differ per platform, its
shell code reserves its chords even while disabled, and the crew it
shows plus the rebinds live in a shell store a window page cannot read
(#36349 left the shortcut gap under "Not a goal").

Generically, with the app id as data:

- desktop.shortcuts[].platformAccelerators: a per-platform default,
  held to the same chord rules (gateway and shell); seam level 8.
- The host binds the user's chord per app per machine, and a page's
  shortcuts() / setShortcut() (bridge level 3) lists and rebinds only
  the app's declared shortcuts, only right after a press in that
  window, and onto a chord other than the declared default only when
  the user pressed that chord there. The new chord is registered
  before the binding moves, so a refused rebind or reset keeps the
  chord the app held and never frees it for another app.
- A shell owner that is an app's own shell code may reserve
  { app: true } so the host serving that app id may bind those chords.
  Mochi keeps a plain reservation until its built-in steps aside
  (#37454), so the two never register the same chords. One binding is
  one chord whatever its spelling, so a respelled rebind keeps the
  chord with its holder.

For Mochi, its own shell code (mochi/hostHandOff.js, called from
initMochi before the host is created) copies the crew the pet shows
and the user's rebinds from mochi-machine.json into the host's gateway
choice and bindings for mochi, recording what it copied. It copies
again only while the host still holds that value, so a change in the
built-in before adoption carries over and a choice made through the
host is never overwritten. It leaves core with Mochi's shell code.

Built-ins behave as before: no built-in declares a desktop block, so
the host serves none of them yet.

Part of #26967
@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
The desktop window host served only apps enabled on this computer's
gateway, while Mochi's built-in pet keeps showing a remote crew's Mochi
after the local copy is switched off. And the built-in shell code read
its /api/apps row by name alone, so an adopted record declaring a
`desktop` block would have drawn both the built-in windows and the
host's.

Two generic rules, naming no app:

- hostOwnsAppWindows(rows, name) answers whether a gateway's record
  for an app carries a manifest `desktop` block. Mochi's and Crew
  Companion's shell code ask it and stand down on true (Mochi takes
  its full teardown, a remote pet included). Built-in records declare
  no block, so nothing changes for a current user.
- The host lists apps switched off here too and serves one only from
  the crew its gatewayChoice points at, while that crew answers that
  the app is on there. A non-answer keeps the windows still open and
  holds the app for that tick, so none of its windows is created; a
  definite no closes them. An app without gatewayChoice declared and
  approved here is served nothing.

Specs: app-kit-platform section 35, mochi.md, electron README, the
app-author manifest reference and the desktop_capabilities docstring.

Part of #26967
@bolichen97
bolichen97 force-pushed the feat/app-seam-desktop-host-serve branch from 0b8f804 to d6c20f3 Compare November 17, 2026 09:31
@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: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge 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.

I reviewed head d6c20f3. I read the stand-down rule (hostOwnsAppWindows) and its callers in the Mochi and Crew Companion shell code. I also checked the off-here serving path in the window host: servedDeclarations, the holding set, the createWindow refusal and the deferred background respawn. The window host and rules tests, the Mochi gate tests and the companion stand-down tests all pass. Removing the createWindow hold or the holding mark fails the new off-here tests, so they exercise the new code. An app that is off here is served only from a chosen crew where it is enabled, with that crew's approvals intersected with this computer's, and no shipped record carries a desktop block yet. Nothing blocks.

@KiroCrewCaptain
KiroCrewCaptain merged commit 433d99b into main Nov 17, 2026
99 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the feat/app-seam-desktop-host-serve branch November 17, 2026 10:49
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 17, 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