Repository navigation
refactor(desktop): share the dev userData profile across worktrees - #3359
Conversation
hqhq1025
left a comment
There was a problem hiding this comment.
Reviewed the current revision across the TCC bootstrap, the plain Desktop and repository CLI profile contracts, and runtime cache invalidation. The shared Maka Dev data root now matches the other development entry points while the worktree-scoped bundle identity remains unchanged; the previous marker is invalidated by the new burned-in path. The script syntax and focused marker/bootstrap assertions passed, and the required CI check is green.
Codex-assisted review performed under the maintainer-approved review workflow.
jackwener
left a comment
There was a problem hiding this comment.
Automated Codex review — blocking finding on exact head c17e155f47d8ff5cae02cb20a41f5a9f91950b01.
P2: the shared profile invalidates the launcher's worktree-local stale-owner recovery. resolveMacosDevelopmentLaunch() still calls ensureNoRunningDevelopmentApp(), but that function probes and kills only this worktree's DEV_EXECUTABLE. After this PR, a TCC app from worktree A and a launch from worktree B use the same Maka Dev single-instance lock while having different executable paths. If A is still running—or was orphaned after its terminal/Vite process died—B cannot see or stop it. B's Electron instance is absorbed by A's lock and exits, while B's monitor only watches B's path and eventually reports never-started. This is the same stale-window failure the ownership step's comment says it prevents, now moved to the cross-worktree case.
The README partly exposes the mismatch: it says another worktree's app survives and holds the shared lock, then says a launch reclaims an app left by a hard-killed session. The latter is no longer true across worktrees.
Before merge, make launch ownership profile-scoped as well as userData profile-scoped (or fail immediately with an explicit current-owner contract), and add a two-worktree regression that proves a stale owner cannot absorb the new launch. Keep DEV_BUNDLE_ID worktree-scoped for TCC as this PR already does.
Required conclusions:
- Optimal for the actual problem: not yet; the data-root correction is sound, but ownership follows the old isolation boundary.
- Production code to delete: none identified.
- Tests to delete/replace: none; current marker smoke coverage misses the cross-worktree lock behavior.
- Deeper refactor: no; align the existing stale-owner recovery with the new shared-profile boundary.
- Ready to merge: no, despite green
testand a current-head committer approval. - Residual risk/gaps: stale/other-worktree app absorption and 30-second false
never-startedfailure.
This is a developer-workflow behavior change; the existing independent human review remains necessary under CONTRIBUTING.md after the blocker is resolved.
jackwener
left a comment
There was a problem hiding this comment.
Re-review of unchanged exact head c17e155f47d8ff5cae02cb20a41f5a9f91950b01 against current main@d62857a8357e9160926726a2a13096bc2dc2b91d. Converting the existing blocking automated comment into an explicit changes-requested gate because the head has not changed.
P2 — shared userData leaves stale-owner recovery worktree-local. resolveMacosDevelopmentLaunch() still asks ensureNoRunningDevelopmentApp() to find/kill only this worktree's DEV_EXECUTABLE. After the PR, worktree A and B use one Maka Dev single-instance lock but retain different executable paths. A running or orphaned app from A is invisible to B's recovery; B is absorbed by A's lock, exits, and its own-path monitor eventually reports never-started. Make launch ownership profile-scoped too, or fail immediately with an explicit current-owner contract, and add a two-worktree regression.
Required conclusions remain:
- Optimal: not yet; data ownership and process ownership use different boundaries.
- Production code to delete: none identified.
- Tests to delete/replace: none; add cross-worktree ownership coverage.
- Deeper refactor: no; align the existing recovery seam with the shared profile.
- Ready to merge: no, despite green
testand the earlier human approval. - Residual risks/gaps: stale-window absorption and a false 30-second
never-startedfailure; developer-workflow behavior needs fresh independent human review after repair.
c17e155 to
21e165b
Compare
|
Pushed a fix for the blocking finding — new head @jackwener your P2 was right: sharing the We took the second of the two options you offered — fail immediately with an explicit current-owner contract — rather than making the kill profile-scoped. The reason: a profile-scoped kill would mean worktree B's launch script terminates a window someone may be actively using in worktree A. Sharing a data root does not confer disposal rights over another worktree's process, so naming the owner and stopping is both smaller and more honest than expanding what we are willing to kill. What changed:
The two-worktree regression you asked for is in
One note on the diff you will see: the branch's merge base predated the ASF header sweep, so the rebase onto current This work was AI-assisted. The finding was reproduced and the fix verified against the exact head above; please push back where we got it wrong. |
P2 is addressed on 21e165b: assertNoCrossWorktreeOwner fails fast when another worktree holds the shared Maka Dev lock, with tests for foreign vs own paths. Dismissing the stale CHANGES_REQUESTED.
jackwener
left a comment
There was a problem hiding this comment.
Independent review of 21e165b87. Did not treat Astro-Han authorship as evidence.
-
Problem. TCC dev
userDatawasMaka Dev-<worktreeHash>while CLI and plainnpm run devuseMaka Dev. Enabling TCC silently switched the database and broke attaching to the same host. -
Solution. Share
~/Library/Application Support/Maka Dev. KeepDEV_BUNDLE_IDworktree-scoped for TCC. BurnuserDataDirinto the runtime marker so old cached apps rebuild. -
The earlier P2 (worktree-local stale-owner recovery vs shared lock) is fixed:
assertNoCrossWorktreeOwnerpgrep's everyMaka Dev.appElectron, treats a non-own path as owner, and fails immediately instead of being absorbed. Own-path prefix is not confused with a sibling suffix. Tests cover that. Own-worktree leftovers still go throughensureNoRunningDevelopmentApp.
Approve. Merge stays with the author.
jackwener
left a comment
There was a problem hiding this comment.
Follow-up after independently checking Darwin pgrep on macOS 26. My earlier APPROVE was too early.
pgrep -af on Darwin is not Linux procps. Here -a means include ancestors, and without -l stdout is PIDs only. -f -l is what prints PID + full argv. The production probe therefore returns bare PIDs, startsWith(ownExecutable) never matches, and this worktree's leftover TCC app is treated as a foreign owner — fail-fast runs before ensureNoRunningDevelopmentApp(). That is a real P1 on this head.
Second P1: the probe only matches Maka Dev.app/.../Electron. Plain npm run dev is Electron.app/.../Electron with app.setName('Maka Dev'), which still holds the shared profile lock. That process is invisible to the new owner check, so the original absorption/never-started hole is not actually closed.
P2: --user-data-dir is applied after the owner probe, so an isolated launch can be blocked by an unrelated default-profile owner.
The shared Maka Dev root and worktree-scoped DEV_BUNDLE_ID are still the right data-plane cut. The process-owner probe has to key on the profile, with Darwin pgrep -fl, not on one bundle suffix.
Not converting this to REQUEST_CHANGES (comment-only). I no longer consider this head merge-ready.
Darwin pgrep -af does not print argv; own leftover TCC app is misclassified as foreign owner, and plain Electron.app npm-run-dev is invisible to the probe. Independent re-check with kabi-sol. Dismissing this APPROVE; head 21e165b is not merge-ready.
jackwener
left a comment
There was a problem hiding this comment.
Independent re-review of 459995ac. The pgrep-then-ps split is the right Darwin fix (I reproduced pgrep -f PIDs + ps -p pid -o command= on this Mac; BSD -a is not involved). The owner judgment still has two P1s. Do not merge this head. GitHub APPROVED is a leftover hqhq1025 review on c17e155f, not a current GO.
P1: worktreeFromCommandLine splits on whitespace. Paths contain spaces. This file already documents ~/Dropbox (Personal) as a pgrep-regex case. On that command line the /apps/desktop and /node_modules/ markers no longer start with /, so the function returns undefined. The owner then does not recognise self and ?? DEV_USER_DATA_DIR treats the process as a foreign holder of the shared lock — self-blocking, same shape as pgrep -af. Maka Dev.app still parses only because /apps/desktop appears before that space; that is luck. Scan the raw string for the marker, then walk left to a / (space+slash) argv boundary; do not tokenise.
P1: the scan is any npm Electron, not Maka Dev. The rough filter matches node_modules/.bin/electron and Electron.app/Contents/MacOS/Electron. Another repo's Electron recovers a worktree, has no maka dev-env.json, and is attributed to the shared Maka Dev profile. Launching then fail-fasts as a cross-worktree owner. Missing env file ≠ "uses the Maka default profile". Only Maka Dev.app, or a worktree that actually published a maka env file, should participate in the lock judgment.
Tests still use synthetic argv and say real Darwin pgrep/ps samples are "still being collected". That is the same self-proving fixture failure as the previous startsWith(node_modules/.bin/electron) head. Cover a space-containing root and an unrelated node_modules/electron process.
jackwener
left a comment
There was a problem hiding this comment.
Integration pass on cbdd2cc2 (not an approve).
TCC and plain both hit assertNoCrossWorktreeOwner then ensureNoRunningDevelopmentApp. Data-root drop of WORKTREE_ID plus the legacy-dir warn matches the README shutdown/owner text. CI runs test:dist, which includes the new script tests.
P1: Linux startDevelopmentApp now probes this worktree's node_modules/.bin/electron shim, but quitMacosDevelopmentApp still no-ops off darwin. A leftover same-worktree npm run dev therefore throws could not be stopped. On main, liveness only looked at the Darwin bundle path, so this path did not fail-closed. Either teach quit to signal the Linux shim, or keep shim/real reclaim Darwin-only.
GitHub APPROVED is still the stale hqhq1025 review on an older head.
jackwener
left a comment
There was a problem hiding this comment.
Integration re-review of 4f6e838d (not an approve).
P1: post-spawn recheck on appeared → exited and plain child exit 0 conflates absorption with a normal session end. Cmd-Q of a TCC app takes the appeared-then-exited path; a finished npm run dev takes exit-0. recheckAfterAbsence then reports any remaining foreign/false-positive holder as "absorbed this launch". That is only valid when this launch never became the lock owner (never-started, or an immediate second-instance exit). After the app has appeared, the lock was ours; a later process is not this launch being absorbed.
Tests currently require the appeared→exited path to print the conflict. That encodes the false positive.
Fix: recheck only on never-started (TCC) and on a short-lived exit-0 (plain). Do not recheck after a session that actually ran.
9e8646f to
8d3e52f
Compare
|
Heads-up: this branch was force-pushed twice just now, so anyone with a local copy will need to re-fetch. Current head is What changed in the code. The launcher's pre-flight owner probe is gone. It tried to answer "which worktree currently owns this dev data directory?" by matching Two smaller fixes went in with it: the monitor's Some context on the rejected approach is in #3539, including what we verified about Chromium's Why the second force-push. Twenty-eight of the thirty commits were authored as @hqhq1025 — sorry for the churn. Your approval is on |
Astro-Han
left a comment
There was a problem hiding this comment.
Independent re-review at exact head 8d3e52f70bfb4e3dd74ad77d5dff078a987e066c. All three check-runs (audit, test, package) are completed / success on that SHA.
Disclosure first, because it changes how you should read this. This PR is authored under the Astro-Han account, which is the same shared account our review line publishes from — so we are the responsible party here and cannot approve our own work. This review was therefore run as a separate, blind line: the reviewer reached a provisional judgment on the head before reading any of the existing GitHub review threads, and only then reconciled against them. It is posted as a comment, not an approval, by design.
Every earlier finding is closed, and closed properly. The last outstanding [P1] — the post-spawn owner recheck reporting false absorption on appeared→exited and on any exit-0 — is gone because the heuristic itself was removed. The launch now consumes a real loser marker / exit 42 from the main process, so the finding's precondition no longer exists rather than being papered over. The same is true for the Darwin pgrep -af tokenization, the space-in-path problem, foreign-Electron misidentification, and the Linux plain-reclaim conflict: the roughly 480 lines of heuristic ownership probing that carried them are deleted. Removing a second source of truth rather than patching it is the right shape, and it is worth saying so plainly.
The audit was run across the whole range from the previously reviewed tree 4f6e838d, not just the last commit — which is what surfaced the split below.
Three [P2]s and one [P3]. Of these, only Finding 1 arrived with the replacement loser-contract; Findings 2 and 3 predate the earlier review and were missed by it. They are marked as such rather than presented as regressions, because the distinction matters when you decide what to fix and where.
Two candidates were deliberately withdrawn rather than left in: splitDevelopmentCliArgs preserving a canonical flag (only reachable if an unsupported caller deliberately substitutes the contract value; every production caller omits the override), and the core-constants import failure (it fails toward the native dialog, and plain's original non-zero exit code survives — not a silent success).
This review is AI-assisted. Under CONTRIBUTING.md §Review it does not count as the required independent human review; and since the PR is authored from the same shared account, an approval from this line would not be meaningful here regardless.
There was a problem hiding this comment.
Technical review of exact head e9f1232170d594355ae646c5fa8f0ede17017b61. I found one development-only P2 below, so the implementation is not yet GO: an unclassified TCC invocation can still terminate the existing same-worktree lock owner before proving ownership. Exact-head hosted audit, test, and package checks are terminal green; the focused launcher suite passes 19/19, core passes 606/606, and the current-main merge-tree is clean.
中文
本次技术审查绑定精确 head e9f1232170d594355ae646c5fa8f0ede17017b61。当前实现仍有下方 1 个仅开发态的 P2,因此暂未达到 GO:尚未完成归类的 TCC invocation 在证明所有权前,仍可能终止同一 worktree 中已经持有锁的实例。精确 head 的 audit、test、package 均终态绿;launcher 聚焦测试 19/19、core 606/606 通过,且与当前 main 的 merge-tree 干净。
jackwener
left a comment
There was a problem hiding this comment.
Independent incremental review of exact head e9f1232170d594355ae646c5fa8f0ede17017b61, performed by the prior Kabi reviewer with the new-commit judgment sealed before reading current review conclusions. Acting on behalf of @WAWQAQ under the standing Kabi review/action authorization; Kabi holds the publisher seat for this head.
Conclusion: COMMENT — one P2 remains, plus one P3. No APPROVE.
The previous findings are properly closed or moot on this head: executable-path ownership probing, the shared launch log, the plain-start legacy warning gap, and the Linux preflight reclaim path were removed or moved to the correct authority boundary. The selected product contract is also implemented consistently: both development entry points use the shared Maka Dev profile.
[P2] An unclassified TCC launcher can still terminate the existing lock owner before proving that this invocation owns the bundle.
apps/desktop/scripts/start-dev-app.mjs:25-52 and apps/desktop/scripts/dev.mjs:156-185 send signals and non-zero open exits through the default stop path. That calls app.stop() with terminateApp unset; apps/desktop/scripts/dev-app-runtime.mjs:445-448 therefore calls quitMacosDevelopmentApp(), whose pkill -f match is the worktree bundle executable path, not this launch identity. Only the already-classified absorbed path passes terminateApp: false.
Reachable reproduction: keep the same-worktree TCC bundle running on the shared profile, start another TCC launcher, then interrupt that launcher before its private log reports the loser marker (or make the LaunchServices handoff fail). The second invocation has no positive ownership evidence, yet its teardown kills the existing owner. This corroborates the exact-head inline finding already posted by M4n5ter; it was independently traced after provisional sealing rather than independently discovered.
The clean fix is to make termination depend on positive ownership tied to this invocation (winner marker/PID/nonce) and fail closed while ownership is unknown. Add signal and non-zero-handoff production-seam tests with a pre-existing owner.
[P3] Per-launch logs can accumulate after abnormal launcher death.
apps/desktop/scripts/dev-app-runtime.mjs:162-169 creates a UUID log under tmpdir()/maka-dev-launches; cleanup exists only in stop() at :448. SIGKILL, a crash, or power loss bypasses cleanup and leaves the full session output indefinitely until OS temp cleanup. Add bounded startup cleanup (age-based at minimum; launcher-PID ownership is cleaner). This remains non-blocking because it is Darwin-only, explicitly opt-in, and has OS temp cleanup as a fallback.
Fresh gate immediately before publication: OPEN, non-draft, MERGEABLE/CLEAN; exact-head hosted audit, test, and package are all completed/success. GitHub's aggregate APPROVED includes stale/other-account history and does not override this live P2. No merge action was taken. This Agent-executed review does not claim to satisfy the unresolved ASF required-human-review wording.
9032549 to
18539a8
Compare
M4n5ter
left a comment
There was a problem hiding this comment.
English
Independent re-review of exact head 18539a8cf13b3c66b5dd82883c81f423edfe9b1e: COMMENT — one P2 remains.
[P2] apps/desktop/scripts/dev-app-runtime.mjs:207-216 trusts the last winner-marker-shaped substring in the app's mixed stdout log as the PID to terminate.
The new per-launch log separates launches, but it is still the complete stdout/stderr stream of the winning Electron app. devLogWinnerPid() uses lastIndexOf(DEV_WINNER_LOG_MARKER) and accepts the following positive integer from anywhere in that stream. Supported application data can contain the same bytes later: for example, Runtime Host profile names reject control characters but allow a name such as [dev] single-instance winner: 222; an unavailable profile is logged verbatim by runtime-host-profile-service.ts:826.
Reproduction: a private launch log containing the legitimate first line ... winner: 111, followed by [runtime-host] ... winner: 222 is unavailable, makes stopDevelopmentLaunch() send both TERM and KILL to PID 222. PID 111 — the app this launcher actually won — remains running. The current test covers only one uncontested marker, so file permissions and per-launch uniqueness do not block this path.
Please keep the ownership result outside the mixed application log (for example, a dedicated one-shot result file/pipe), or at minimum accept only the first exact, line-anchored winner record emitted before full boot and ignore/reject later marker-shaped output.
The earlier bundle-wide pkill -f finding is otherwise genuinely fixed: an unclassified launch no longer terminates another worktree, and the normal classified path targets a PID rather than a bundle pattern. Exact-head audit, test, and package are all completed/success; the focused launcher suite passed 18/18 after rebuilding Core. No other new P0–P3 was found in the incremental surface.
中文
对 exact head 18539a8cf13b3c66b5dd82883c81f423edfe9b1e 的独立增量复核结论:COMMENT——仍有一条 P2。
[P2] apps/desktop/scripts/dev-app-runtime.mjs:207-216 把应用混合 stdout 日志中最后一个形似 winner marker 的子串当成要终止的 PID。
新的每次启动独立日志隔离了不同 launcher,但它仍承载获胜 Electron 应用的全部 stdout/stderr。devLogWinnerPid() 使用 lastIndexOf(DEV_WINNER_LOG_MARKER),并接受该子串后任意位置的正整数。受支持的应用数据可以在启动后再次产生同样字节:例如 Runtime Host profile 名只禁止控制字符,允许命名为 [dev] single-instance winner: 222;profile 不可用时,runtime-host-profile-service.ts:826 会把名称原样写入日志。
复现:私有 launch log 第一行是真实的 ... winner: 111,之后出现 [runtime-host] ... winner: 222 is unavailable,stopDevelopmentLaunch() 会向 PID 222 同时发送 TERM 与 KILL;launcher 实际拥有的 PID 111 继续运行。现有测试只覆盖单个无争议 marker,因此文件权限与每次启动唯一日志都拦不住该路径。
请把 ownership 结果移出混合应用日志(例如使用专用的一次性结果文件/pipe);最低限度也应只接受 full boot 前写入的第一条、整行锚定的 winner 记录,并忽略或拒绝之后形似 marker 的输出。
除此之外,上一轮 bundle-wide pkill -f finding 已真正关闭:未分类 launch 不再终止其他 worktree,正常已分类路径也改为按 PID 而非 bundle pattern 终止。exact-head audit、test、package 均 completed/success;重建 Core 后定向 launcher 测试 18/18。增量范围内未发现其他新 P0–P3。
jackwener
left a comment
There was a problem hiding this comment.
Independent incremental review of exact head 18539a8cf13b3c66b5dd82883c81f423edfe9b1e, performed by the prior Kabi reviewer with the new-commit judgment sealed before reading current reviewer conclusions. Acting on behalf of @WAWQAQ under the standing Kabi review/action authorization; Kabi holds the publisher seat for this head.
Conclusion: COMMENT — one P2 remains, plus one P3. No APPROVE.
The prior P2 is genuinely closed at the mechanism level: bundle-wide pkill -f termination is deleted; an unclassified launch sends no signal; a classified winner targets only the PID recorded in its private launch result. Old executable-path ownership heuristics remain deleted, and the selected shared Maka Dev AppProfile contract is implemented consistently.
[P2] Mixed application logs can override the winner PID used for termination.
apps/desktop/scripts/dev-app-runtime.mjs:207-218 uses lastIndexOf(DEV_WINNER_LOG_MARKER) over the entire per-launch stdout/stderr log. A supported Runtime Host profile name may contain printable text such as [dev] single-instance winner: 222 (packages/runtime-host/src/client/host-profile.ts:697-705), and an unavailable startup profile is logged verbatim to stderr after the real winner marker (apps/desktop/src/main/runtime-host-profile-service.ts:819-827). Because open redirects both stdout and stderr into the same file, stopDevelopmentLaunch() then reads PID 222, sends TERM and later KILL to it, and leaves the actual owner PID 111 running. If PID 222 is not signalable, the teardown can instead throw EPERM.
This reachability candidate first appeared in the same-head review already published by M4n5ter after the Kabi provisional was sealed; Kabi independently traced and confirmed it. It is corroborated evidence, not an independent discovery.
Minimum lift: accept only the first exact, line-anchored winner record emitted before boot; add a production-seam log containing a legitimate winner line followed by the marker bytes inside an unavailable profile name, and assert only the real PID receives signals. Clean lift: move ownership data out of mixed stdout/stderr into a dedicated one-shot PID/result file or pipe. Treat EPERM as “not owned / do not signal,” not an unhandled teardown error.
[P3] Per-launch logs still accumulate after abnormal launcher death.
apps/desktop/scripts/dev-app-runtime.mjs:464 removes the UUID log only from normal stop(). SIGKILL, crash, or power loss leaves full-session output under tmpdir()/maka-dev-launches until OS cleanup. Add bounded startup scavenging; a launcher-PID-owned cleanup record is cleaner than age alone.
Fresh gate before publication: head unchanged, OPEN/non-draft/MERGEABLE/CLEAN; exact-head audit, test, and package are all completed/success. GitHub's aggregate APPROVED comes from hqhq1025@c17e155f, not this head, and does not override the live P2 hold. No merge action was taken. This Agent review does not claim to satisfy the unresolved ASF required-human-review wording.
18539a8 to
221985a
Compare
|
Addressed at exact head We did not tighten the mixed-log marker parser. The marker protocol has been removed entirely. Electron remains the sole single-instance authority and now publishes exactly one structured The previous Verification on this exact head: local Desktop |
|
Re-reviewed at exact head The previously-raised P2 is genuinely closed, and closed well. One new finding on the cancellation path.
|
|
Two
|
221985a to
9369509
Compare
|
Automated follow-up from Codex on behalf of AstroHan, at exact head The cancellation P2 and bare-PID P3 shared one architectural cause: the detached TCC launcher was still treated as an owner of the Electron process. This head removes that ownership instead of adding another cancellation state machine.
This closes the failure paths in the cancellation P2 and the PID-reuse P3 by removing their preconditions. The temp-file scavenging P3 remains a nonblocking, separate observation; this change does not add a scavenger state machine for it. Local verification on this head: Core 639/639, Desktop 1265/1265, launcher 16/16, Desktop typecheck, and repository format check. Hosted CI is still running; this note does not claim it is green. |
jackwener
left a comment
There was a problem hiding this comment.
Technical review of exact head 93695090fef9f6f6d50b049788199b4306636442, acting on behalf of @WAWQAQ under the standing Kabi review/publisher authorization.
Conclusion: COMMENT — one P2 remains, plus the acknowledged nonblocking P3. No APPROVE and no merge.
The two requested historical candidates are mostly closed. start-dev-app.mjs now installs signal handlers only after its launch handle exists, and the detached TCC path has deleted winner PID reporting, PID liveness polling, and the fixed TERM→KILL sequence entirely. The private one-shot result file is the sole lock-verdict channel; ordinary logs carry no authority.
[P2] npm run dev can still create launcher resources and Electron after cancellation
apps/desktop/scripts/dev.mjs:158-177 retains the old one-shot shape: shutdown() sets shuttingDown = true, calls app?.stop() while app may still be null, then closes Vite; the concurrent app = await startDevelopmentApp(...) is not cancelled or joined. startDevelopmentApp() has real asynchronous boundaries before it returns the handle (apps/desktop/scripts/dev-app-runtime.mjs:100-108,376-416): both launch modes lazily import the Core contract, and the TCC mode prepares the bundle first. After those awaits it can still spawn plain Electron, or tail plus open, and only then return the cleanup handle.
Reachable path: run npm run dev, deliver SIGINT while the lazy contract import/start preparation is pending, and let that start finish before Vite's asynchronous close finishes. The first shutdown() skips app.stop() because app === null; the launch then creates its child/resources and assigns app, but every later cleanup request returns at if (shuttingDown) return. The process can therefore start Electron after the user cancelled, and the TCC path can leave the log follower plus launch files uncleaned; its app is pointed at the Vite server that cancellation just closed. The plain child is likewise never terminated by the launcher.
The current guard does not cover this: moving handlers below the await fixed npm start, not npm run dev, and the 16 launcher tests exercise exported helpers but not either top-level signal coupler. Join cancellation to the in-flight launch (or pass an AbortSignal) so shutdown awaits/adopts the eventual handle and runs stop() exactly once before closing/exiting. Add a seam test with a deferred startDevelopmentApp() that resolves after the signal and assert its returned handle is stopped.
[P3] Abnormal launcher death still leaves per-launch output
apps/desktop/scripts/dev-app-runtime.mjs:176-185,430-433 creates UUID log/result paths and removes them only through normal handle cleanup. SIGKILL, crash, or power loss still leaves full-session logs under the temp directory until OS cleanup. This remains nonblocking; bounded startup scavenging would close it.
Validation: Core 639/639, Desktop main 1265/1265, launcher 16/16; worktree clean. Fresh machine state before publication: OPEN, non-draft, MERGEABLE/CLEAN; exact-head audit, test, and package are all completed/success. GitHub's aggregate APPROVED is only stale old-head history, not a current-head GO.
|
Automated architecture decision note from Codex on behalf of AstroHan, at exact head The repeated P3 about abnormal-death leftovers is accepted and deliberately deferred for this PR. Current scope and impact:
Why this PR does not add a scavenger:
Therefore this remains a nonblocking P3, not an unimplemented merge requirement. It should be reconsidered if there is evidence of material disk growth, sensitive log retention outside the existing private permissions, or inadequate OS cleanup in supported development environments. Unless one of those premises changes, repeating the same observation on later heads will not change the decision. Separately, the new |
9369509 to
dbd84a6
Compare
jackwener
left a comment
There was a problem hiding this comment.
Technical incremental review of exact head dbd84a6ac7d2a9263890f61e5c1abeca31d5cdec, acting on behalf of @WAWQAQ under the standing Kabi review/publisher authorization.
Conclusion: COMMENT — one P2 remains. No APPROVE and no merge.
The runtime fix itself closes the prior cancellation P2: apps/desktop/scripts/dev.mjs:158-185 makes the in-flight launch promise the ownership boundary, aborts before joining it, and passes the same signal into startDevelopmentApp(). apps/desktop/scripts/dev-app-runtime.mjs:370-428 checks that signal after each real asynchronous preparation boundary and before any spawn. The two TCC spawns have no await between them, and once the handle is published shutdown() joins that same promise before calling stop(). I found no reachable post-spawn orphan window in this implementation.
[P2] The new regression tests do not cross the top-level signal coupling they are meant to protect
apps/desktop/scripts/dev-app-runtime.test.mjs:22-70 calls startDevelopmentApp({ signal }) directly. It proves the helper honors a signal already supplied by its caller, but it never exercises dev.mjs creating the controller, passing launchController.signal, receiving a real signal, joining the launch promise, and stopping the eventual handle.
This is load-bearing rather than merely missing extra coverage: deleting the single signal: launchController.signal line at apps/desktop/scripts/dev.mjs:185 reintroduces the exact old failure — shutdown closes Vite while the uncancelled helper can later spawn Electron — yet both newly-added cancellation tests still pass 2/2. The tests therefore cannot distinguish this fixed head from the broken wiring they were added to prevent.
Please add a regression that crosses the dev.mjs top-level coupler with a deferred launch and real signal timing, asserting that cancellation prevents any later spawn and that an already-published handle is stopped exactly once. The mutation criterion is simple: remove the signal: wiring and that regression must fail.
Local validation: launcher/runtime suite 18/18 and Core build passed; the two new tests remained 2/2 green under the wiring-deletion mutation, then the worktree was restored clean. A full Desktop pretest on this checkout was blocked by untouched UI build/type skew after npm ci --ignore-scripts; this does not affect the focused result. Exact-head hosted audit, test, and package are all completed/success; fresh state is OPEN, non-draft, MERGEABLE/CLEAN. GitHub's aggregate APPROVED is stale old-head history and does not override this live P2. The previously accepted abnormal-death temp-file P3 remains nonblocking and unchanged.
Use one Maka Dev profile for plain and TCC development while keeping the TCC bundle identity worktree-scoped. Electron's single-instance lock remains the sole app-instance authority, and a detached TCC launcher consumes only its private one-shot lock verdict. The launcher owns its log, result file, and Vite server, but never the Electron process: Ctrl-C stops launcher resources while the TCC app remains open until the user quits it. Remove winner PID reporting, PID liveness supervision, and TERM/KILL teardown. Preserve legacy profile data with an upgrade warning and fail clearly when another development instance owns the shared profile. Generated-by: Codex
dbd84a6 to
19061b5
Compare
jackwener
left a comment
There was a problem hiding this comment.
Incremental technical re-review of exact head 19061b50c0a03901c8565539961db61ae250bf27, executed by the Kabi review agent on behalf of @WAWQAQ under the standing Kabi review/publisher authorization.
GO — no live P0–P2; the previously accepted abnormal-death temp-file P3 remains unchanged. APPROVE; no merge action.
The real increment from reviewed head dbd84a6ac is 3 files (+126/-38). It moves the top-level AbortController, launch-promise ownership, signal handlers, join/adopt/stop sequence, server close, and exit latch from dev.mjs into createDevelopmentLaunchSession() without changing the production ownership order.
The old P2 test gap is closed with mutation evidence. Baseline launcher/core/main focused tests passed 24/24. Deleting only signal: controller.signal from the new production coupler made the launcher suite 19/20: the sole failure was a launcher signal cancels preparation before Electron can spawn, and execution crossed the deferred preparation boundary into the forbidden launch-file creation. The regression therefore guards the exact top-level coupling that was previously untested.
The shared Maka Dev profile and Electron single-instance contract were already present on the reviewed old head and are unchanged in this increment. Current loser paths exit before store or Runtime Host boot: the plain child exit and the TCC private one-shot verdict each close only their launcher/Vite resources, while the winning Electron process remains the sole shared-profile lock owner. No new cross-worktree write or lock competition was found beyond the documented existing Chromium timeout and stale per-worktree dev-env limitations.
Three discussion endpoints were reconciled after provisional sealing; no current-head P0–P2 remains. Fresh action gate: OPEN, non-draft, MERGEABLE/CLEAN; exact-head hosted audit, test, and package are all completed/success. This Agent-executed approval does not claim to satisfy any separate unresolved human-review wording.
Sync vendored third-party/nsh from 3f8ecd8b3 (0.7.0) through a901baa2e (0.7.2 + post-0.7.2 fixes): - Remove superseded local patches now provided upstream and migrate consumers to upstream canonical APIs: - nsh-engine / ios-shell: HostCall::sender() -> HostSender (#3357) - nsh-ios-host / nsh-platform-ios: AppOptions::host (#3354) and touch.rs gesture cancel fix (#3420) - TextView renderImage(image, context) & terminal images (#3359, #3260, #3372, #3290) - nsh-bundler / nsh-cli / ui-build: default unresolved-import errors (#3425) - nsh-core: list display: none retention (#3193) and touch-selection (#3380) - nsh-platform-macos: file_drop (#3385) and mount (#3386) cleanups - nsh-platform-windows: richedit.rs window-specific IME association (#3411) - Preserve upstream RichEditor onReadonlyInput behavior (#3371) with opt-in readonly_sink for Maka's embedded composer. - Fix a Windows RichEdit caret-alignment regression introduced with follow-on-draw (#3411): translate the cached caret when the client rectangle shifts (with a regression unit test). - Update third-party/nsh provenance (upstream.json, SOURCE.md), Cargo.lock files, LICENSE, and CLI dependency notices. Generated-by: Maka (Gemini)
Sync vendored third-party/nsh from 3f8ecd8b3 (0.7.0) through a901baa2e (0.7.2 + post-0.7.2 fixes): - Remove superseded local patches now provided upstream and migrate consumers to upstream canonical APIs: - nsh-engine / ios-shell: HostCall::sender() -> HostSender (#3357) - nsh-ios-host / nsh-platform-ios: AppOptions::host (#3354) and touch.rs gesture cancel fix (#3420) - TextView renderImage(image, context) & terminal images (#3359, #3260, #3372, #3290) - nsh-bundler / nsh-cli / ui-build: default unresolved-import errors (#3425) - nsh-core: list display: none retention (#3193) and touch-selection (#3380) - nsh-platform-macos: file_drop (#3385) and mount (#3386) cleanups - nsh-platform-windows: richedit.rs window-specific IME association (#3411) - Preserve upstream RichEditor onReadonlyInput behavior (#3371) with opt-in readonly_sink for Maka's embedded composer. - Fix a Windows RichEdit caret-alignment regression introduced with follow-on-draw (#3411): translate the cached caret when the client rectangle shifts (with a regression unit test). - Update third-party/nsh provenance (upstream.json, SOURCE.md), Cargo.lock files, LICENSE, and CLI dependency notices. Generated-by: Maka (Gemini)
Summary
Use one
Maka DevAppProfile for plain and TCC development across worktrees. Released Maka keeps its separate profile, and the Runtime Host state root remains independent from the AppProfile.Electron's
requestSingleInstanceLock()is the sole authority for which development client may use the shared profile. Plain Electron consumes its child exit code; the LaunchServices-detached TCC launcher consumes a private one-shot winner/loser verdict. No command-line process scan participates in the decision.The TCC app and its launcher now have deliberately separate lifecycles. The launcher owns only its Vite server, log follower, and per-launch files. Ctrl-C stops those resources but does not quit the TCC Electron app; the user quits that app with Cmd-Q. Accordingly, the verdict carries no PID, and the launcher performs no PID liveness polling or TERM/KILL teardown.
The launch attempt is one cancellable ownership boundary. A tested launch session owns signal registration, aborts the attempt, and joins its eventual result; all asynchronous preparation finishes before launch files or processes are created, so cancellation cannot be followed by a late Electron spawn or leaked launch files.
The TCC bundle identity remains worktree-scoped because macOS permissions are tied to that signed bundle identity. Existing per-worktree profile data is not deleted; the launcher warns when it finds the legacy location.
Refs #3539
Verification
npm --workspace @maka/core test— 639/639 passednpm --workspace @maka/desktop test— 1265/1265 passednode --test apps/desktop/scripts/dev-app-runtime.test.mjs— 20/20 passednpm --workspace @maka/desktop run typecheck— passednpm run format:check— passedMigration
Previous TCC data remains under
~/Library/Application Support/Maka Dev-<WORKTREE_ID>. The app now reads~/Library/Application Support/Maka Devunless--user-data-diris supplied. No data is copied or removed automatically.AI use
Select exactly one:
Tool(s) and scope: Codex contributed architecture analysis, implementation, tests, documentation, and review remediation. The commit retains a
Generated-by: Codextrailer.Checklist
Does this PR entail a change in behavior?