Repository navigation
fix(desktop): adopt a service-managed gateway running a distribution backend module - #15470
chenmingwei23 wants to merge 1 commit into
Conversation
UX Review (Fable 5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. [UX-REVIEWED] dedb2da Description read[DESCRIPTION-READ] b563371cc26ac66e64c6f846d55ec662fff002bfcdc21f97b2b3d378bcba8b14 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 |
Design Review (Fable 5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Shipped design contradicts the described one: the description claims an anchored prefix-family regex, but the code hardcodes WatchPublic core becomes a per-distribution name registry. The description says the fix "match[es] … a Suggestions
[DESIGN-REVIEWED] dedb2da Description read[DESCRIPTION-READ] 111509a41195ae6cc33b93722be172418f3e450f4d96ea6fd9c28492840367f3 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 |
First Principles Review (Fable 5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The description ships a different matcher than the diff: "a single anchored regex" accepting "a Not justified as shipped
What this change shipsInventory (3 items) — 2 justifiedIntent: FIX — let the desktop app adopt its own healthy service-managed gateway when a repackaged distribution runs the backend as a distribution-scoped module (issue #15390; added tests fail on base).
[FIRST-PRINCIPLES-REVIEWED] dedb2da Description read[DESCRIPTION-READ] 5e775c5cb513ddebfff091fc5aa7ed451beb02d45a2bebb99061e2ea280f4827 That sha256 names the PR description this verdict read. Recompute it with |
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 detailsPublic core hardcodes a downstream distribution's backend module name, bypassing the entry-point-derived seam the backend states as a rule. FINDING — website/electron/gateway-stop.js:27 — [OPUS-REVIEWED] dedb2da Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
…backend module classifyPortOwner rejects a healthy service-managed gateway whose backend runs as a distribution-scoped module (e.g. `-m kirocrew_amazon`) because isKirocrewCommand matches the `-m` module against the single open-source name `kiro_crew`. The Python child owns the LISTEN socket, so the exact-string check fails, classifyPortOwner returns foreign, and the foreign-holder gate refuses to reuse the port. Add the distribution backend module to an exact-name allowlist beside the existing KIROCREW_EXE_NAMES idiom, so both the canonical `kiro_crew` and the distribution module are recognised. An exact-name Set keeps the check O(1) and closed: an unrelated `-m http.server`, `-m evil`, or any unshipped `kirocrew`-prefixed module stays foreign.
b801731 to
dedb2da
Compare
|
Closing: #15355 (merged) already fixes this on main, and this branch adds nothing main lacks. |
Problem / Motivation
Goal: Let the desktop app adopt a healthy, service-managed gateway that a repackaged distribution runs as a distribution-scoped backend module, instead of refusing the port as foreign.
On 0.8.0.3 (macOS) a gateway installed as a launchd LaunchAgent with
KeepAliveruns the backend as a distribution module:The app refuses to use it and shows:
Why it matters
A distribution whose backend module is not named
kiro_crewcannot launch at all: every start races its own service-respawned gateway and loses, surfacing a permanent port-conflict error for a gateway that is in fact healthy and its own.Not a goal
python -m <module>processes. The module token stays an allowlist; only names in the Kiro Crew family are accepted.ppid == 1) reuse gate or the foreign-holder resolution flow (fix(electron): restore the in-app way back from the local-gateway opt-out #13344); this only fixes which processes are recognised as ours.What changed (motivation → approach → change)
isKirocrewCommand(website/electron/gateway-stop.js) matches thepython -mselector against the single open-source module name —tokens[index + 1] === "kiro_crew". A repackaged distribution runs-m kirocrew_amazon, so the Python child that owns the LISTEN socket fails the check;classifyPortOwnerreturnsforeign, andresolveGatewayConflictreturnsforeign-holder.kiro_crewor akirocrew-prefixed module — via a single anchored regex, instead of the one open-source name. The check still keys on the exact module token, so an unrelated-m http.serveror-m evilstays foreign; ownership widens only to modules already named for Kiro Crew, consistent with the existing basename trust on thekirocrew/kirocrew-backendexecutables.Backwards compatibility
Compatible: the change only adds accepted module names (the
kirocrew-prefixed family) to the existingkiro_crewmatch; nothing that classified as ours before stops doing so, and no non-Kiro-Crew process that was foreign becomes ours.Tests
website/electron/test/gateway-stop.test.js("classifyPortOwner and forceStopPort share one KiroCrew matcher"): added assertions thatpython -m kirocrew_amazon gatewayand the observed launchd form.../python3.12 -s -P -m kirocrew_amazon gateway --no-openare recognised as ours, whilepython -m http.server 5476andpython -m evil gatewaystay foreign. These fail against the pre-fix exact-string check and pass after it.Manual verification
N/A — unit coverage exercises the exact
classifyPortOwner/isKirocrewCommanddecision the bug lives in; the surrounding launchd/foreign-holder wiring is unchanged.Related Issues
Fixes #15390
Pattern harvest
Not generalizable: a single hardcoded open-source identifier (
kiro_crew) where a distribution-scoped variant is legitimate; the fix is to match the family rather than the one name, specific to the backend module allowlist.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)