Repository navigation
fix(electron): backport composed-edition gateway reuse to release/0.8.0 - #15580
Conversation
… it (#15355) The desktop launcher decides who holds the gateway port from the holder's command line. `isKirocrewCommand` accepted a Python process only when its first `-m` operand was exactly `kiro_crew`. A composed edition boots the gateway from its companion's own top-level module (`-m kirocrew_<edition>`) so the composition root runs instead of the core CLI, so every such gateway classified as `foreign`, and the supervisor's reuse decision returned `foreign-holder` with no remote crew to name. The app then refused to start on a port its own edition was serving. The Python side already solved this in `port_resolution._gateway_module_roots()` by reading installed `kirocrew.plugins` entry points. The Electron process has no view of that Python environment, so it matches the naming convention the entry points follow instead: `kiro_crew`, or an exact top-level `kirocrew_<edition>` module. The core still learns no edition's name. The match stays on the first execution selector only, and a dotted submodule, a bare prefix, a hyphenated or mixed-case look-alike never authorize a kill. (cherry picked from commit c50c246)
Local test evidence on the release/0.8.0 tree (head
|
UX Review (Fable 5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. [UX-REVIEWED] 8a9fb23 |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify the cherry-pick matches c50c246 exactly ( [DESIGN-REVIEWED] 8a9fb23 |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Backend CI skips release-branch PRs, so the description's local pytest/node runs are the only backend evidence — spot-check them before merge. What this change shipsInventory (5 items) — 5 justifiedIntent: FIX — backport #15355 so a 0.8.0 desktop app reuses a composed edition's running gateway instead of refusing "port in use".
[FIRST-PRINCIPLES-REVIEWED] 8a9fb23 |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5 Review — ✅ no blocking findingsReviewed Review detailsNothing blocks; one advisory: the new companion-naming paragraph misdescribes the Python matcher it documents. FINDING — docs/system-specs/modules/platform-context.md:403 — the added paragraph states " [OPUS-REVIEWED] 8a9fb23 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
|
Byte-identity and combined-tree checks (the review lanes asked for these; they have no shell)
Combined check across all eight 0.8.0 backports (#15574 to #15581). They octopus-merge cleanly onto release/0.8.0 @ 556bf8e (merge
|
Problem / Motivation
Goal: On a 0.8.0.x build, the desktop app reuses a running gateway started by a composed edition instead of refusing to start.
This backports #15355 to
release/0.8.0; it is already merged onmain(c50c246). A composed edition boots the gateway from its companion's own top-level module (python -m kirocrew_<edition> gateway). On 0.8.0, the desktop launcher's port-owner matcher,isKirocrewCommandinwebsite/electron/gateway-stop.js, accepts a Python process only when its-moperand is exactlykiro_crew. The edition's own gateway then classifies asforeign, and the app refuses to start on a port its own edition is serving ("port in use"). Root cause and design are in #15355.Why it matters
0.8.0.x is on the stable channel. Every desktop user of a composed edition whose gateway is already up (a service unit, a launcher, a prior app run) is blocked at launch, because the holder is in fact their own gateway.
Not a goal
main.CHANGELOG.md.What changed (motivation → approach → change)
One commit,
git cherry-pick -x c50c2465c0(authorship kept), in the #11339 / #11645 / #15314 backport shape. It applied without conflict, and every line matches the source.website/electron/gateway-stop.js: a-moperand counts as ours when it matchesKIROCREW_MODULE_RE(kiro_crewor a composed edition'skirocrew_<edition>root) AND the first positional after it is a server subcommand (gateway,dashboard,start). Without that second check, the widened module name alone could authorize a SIGKILL of any process that merely imports akirocrew_*module on our port.test/test_cli.py:TestDesktopGatewayIdentityParitypins both Electron constants to their Python twins inport_resolution(the server subcommand set and the module roots).cli.mdandplatform-context.mdspecs document it.Dependencies: none.
gateway-stop.jsandgateway-stop.test.jsare byte-identical on this branch and on c50c246^.Backwards compatibility
Compatible for every gateway the app starts or reuses:
python -m kiro_crew gateway|dashboard|startclassifies as before, and a composed edition's own gateway is now ours too. The matcher is stricter in one case, on purpose: apython -m kiro_crew <non-server subcommand>process on the port is no longer treated as ours, so it is not a stop target. That is the same setkirocrew stopalready gates on (as in #15355).Tests
website/electron/test/gateway-stop.test.jsandtest/test_cli.py::TestDesktopGatewayIdentityParity(from #15355). Run on this branch:node --test test/gateway-stop.test.js: 39 passed, 1 skipped.pytest test/test_cli.py: 442 passed, 2 skipped.gateway-stop.jsreverted torelease/0.8.0: 2 Electron tests fail (classifyPortOwner: a composed edition's gateway classifies as ours, not foreign,isKirocrewCommand: a composed edition's -m kirocrew_<edition> gateway is ours), and 2 parity tests fail (test_server_subcommands_are_the_same_set,test_module_pattern_accepts_every_conventional_entry_point_root).Backend CI (
ci.yml) does not run on release-branch PRs, so these local runs are the backend evidence.Manual verification
N/A beyond #15355: the code is byte-identical to
main's fix, and the matcher is covered by unit tests on both runtimes.Screenshots / video
Why no screenshot: no rendered change. The fix is the launcher's port-owner classification in the Electron main process; no page, layout or style changes.
Related Issues
Backport of #15355 to
release/0.8.0.Pattern harvest
Rule candidate: lint
Pattern: the same identity constant copied into a second runtime with no cross-runtime test pinning the copies equal. (Harvested in #15355.)
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement