Repository navigation
feat(desktop): hand the companion's windows to its installed copy - #37430
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The diff adds and changes no visible control, label or string. It only closes the built-in companion's windows once its installed copy takes over, and passes the remembered display to that copy. [UX-REVIEWED] e65f46a Description read[DESCRIPTION-READ] 158544b510852fe363eff022b96eaec00547564abf0822f25ddb2d2467d41940 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 (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level concerns: the built-in shuts its own windows when the row's Notes
[DESIGN-REVIEWED] e65f46a Description read[DESCRIPTION-READ] e65f69fb9f06ef70c2a633d153cdb63a9d819858ebaf17d672f346e0cdf9d947 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 (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Each item removes a named duplication or misplacement harm that is reachable at adoption. One shell with the same root cause is left unfixed, and the description already defers it. Notes
What this change shipsInventory (4 items) — 2 justifiedIntent: after Crew Companion's repository copy is adopted, a desktop user sees one avatar, gets each reminder once, and finds the avatar on the display they left it on. This is an ADDITION (adoption groundwork).
[FIRST-PRINCIPLES-REVIEWED] e65f46a Description read[DESCRIPTION-READ] f6d1b687b84e208ab028fde48a3188804f2a494d9d2ef86981a47fdd2398b7cd That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 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: |
Code change approver recommendation: ApproveWhy: the decider estimates a 12% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. The built-in companion's reconcile now returns 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 |
1907d25 to
fb84713
Compare
|
self-added: yes
|
|
self-added: yes
|
Once Crew Companion's own repository copy is adopted, the desktop window host draws its avatar, notification owner, panel and gallery from that copy's manifest. The built-in's shell code keyed only on the app name and its enabled flag, so it would keep drawing a second avatar and run a second notification owner, firing every reminder twice. Its reconcile now reads a row whose origin is not builtin as released and closes its windows; a row without origin is the built-in's, as before. Before the window host starts, main.js copies the display the built-in avatar last lived on into the host's display memory for the copy's avatar window, only while the host has none, so a multi-display user finds the avatar where it was. Part of #26967
fb84713 to
e65f46a
Compare
|
self-added: yes
|
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving. On this head the review checked four things:
- The stand-down reads
originfrom the /api/apps row. Built-in rows stay "builtin" because the app.json has noui.entry, and a row with nooriginkeeps main's behaviour. - The hand-off key and value match the host's
spanKeyshape and the display id that petOverlay saves. The seeding runs beforecreateAppWindowHost. - Every failure path writes nothing, and the new file is in the packaged files list.
- Reverting each new branch turns its test red.
Done well: one record tells a display the built-in copied apart from one the host chose. A move made before adoption still reaches the host, and a move made after adoption is never overwritten.
Optional:
- Add a source-order test that pins main.js passing
userDataDiranddisplayMemoryPathtoinitCrewCompanionbeforecreateAppWindowHost(. Today the suite stays green if that hunk is dropped. - In one hand-off test, read the seeded file back through the host's own
createDisplayMemory(...).get(spanKey("crew-companion", "pet")), not throughHOST_KEY. - #37454 adds a second stand-down check at the same
probeEnabledline. Whichever PR lands second could keep one predicate instead of both, and say which one in its body.
Problem / Motivation
Goal: Once Crew Companion's own repository copy is adopted, a desktop user sees one avatar and gets each reminder once, on the display they left the avatar on.
The built-in's desktop shell code (
website/electron/crew-companion/index.js) opens its avatar overlays and its hidden notification owner whenever the gateway's/api/appsrow namedcrew-companionis enabled. It never reads who owns the row. After adoption (#26967) the row is a registry record of the same name, still enabled, and the desktop window host (#36338) opens the copy's own declared windows for it. Both would run: two avatars, two notification owners, every reminder and session alert twice.The window host also remembers the avatar's display under
<app>/<window id>inapp-window-displays.json, while the built-in remembers it in its owncrew-companion-pet-position.json. With nothing in the host's file, the copy's avatar opens on the display under the cursor.Why it matters
Crew Companion cannot be pinned for adoption while this stands: every existing desktop user who has it enabled would get a duplicated companion on their first start after adoption. The display change hits every multi-display user once.
Not a goal
website/electron/crew-companion/: the built-in keeps its windows until its copy is adopted, and the directory leaves with the wheel copy.What changed (motivation → approach → change)
Goal: the built-in shell stands down exactly when its copy takes over, and hands the copy its display. Approach: keep both in the built-in's own shell directory (which leaves with it) rather than teach the generic host about one app.
crew-companion/index.js:probeEnabledanswers a new state,released, for a row whoseoriginis a string other thanbuiltin; the reconcile closes the avatar, panel and gallery for it exactly as fordisabled, whatever the row'senabledsays. A row withoutorigin(a gateway older than the field) is the built-in's, as before. One log line says why the windows closed.crew-companion/displayHandOff.js(new):seedHostDisplayMemory(userDataDir, hostFile)copies the built-in's remembereddisplayIdinto the host's memory undercrew-companion/pet(the avatar window the app's repository declares) and records the value copied increw-companion-display-handoff.json. At a later start it copies again only while the host's entry still holds that recorded value: before adoption the built-in avatar is the one the user moves, so a newer display reaches the host; once the host has written a display of its own (the adopted avatar was moved), it is never overwritten. Never over an unreadable host file; files it writes are 0600.initCrewCompanionruns it, synchronously, beforemain.jsgoes on tocreateAppWindowHost, because the host reads its file once, on first use.main.jsonly passes the userData directory and the host's file path into the existinginitCrewCompanioncall, so it imports and calls nothing new of the built-in.package.json: the new module joins the packaged file list.app-kit-platform.md§35 "What still runs in the shell".Backwards compatibility
Compatible: for every row the gateway marks
origin: "builtin", and for a row withoutorigin, the companion behaves as on main. A seeded display entry is read only for an installed app of this name declaring a spanning windowpet.Removes nothing: the built-in keeps every window and IPC handler; only a row that is not its own closes them.
Tests
website/electron/crew-companion/test/adoptedStandDown.test.js(new): an adopted row closes the avatar, panel and gallery and an enabled adopted row never reopens them; an adopted row opens nothing on a fresh start; a row withoutoriginopens as before;probeEnabledanswersreleasedfor a non-builtin row whether enabled or not; the built-in's display seeds the host's memory beside another app's entry; a host file the hand-off creates is owner-only; a display the host chose itself is never overwritten; a move of the built-in avatar after the first start reaches the host on the next; after adoption the host's own move survives every later start; no built-in display, a non-numeric one, or an unreadable host file writes nothing;initCrewCompanionwrites the host's file before it returns, andmain.jsnames nothing of the hand-off.index.jsreverted to main (the hand-off module kept), the four stand-down cases fail; with the first round's copy-once hand-off, the move-after-the-first-start case fails.npm testinwebsite/electron): 3861 pass, 0 fail.setImmediatesettling, temporary directories per test.Proof: not provable -- frontend test (prove.py runs Python only)
Manual verification
The shell was not run against a live desktop here; the reconcile and the hand-off are driven through their exported functions with Electron stubbed, as the existing companion tests do.
Related Issues
Part of #26967
A generic stand-aside rule for every built-in desktop shell is being built separately (branch
feat/app-seam-desktop-host-serve); this PR keeps the companion's own check in its own directory and adds no shared helper.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.