Repository navigation
Creator mode: a newly installed bundle can make the profile unstartable, and only Desktop has a way back #10403
Aceared0829
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
TL;DR
Creator mode (创造模式) can install a plugin bundle into the live profile, and
installBundledoes report activation — but the plugin it just wrote is only first executed inside the running Host. A bundle whoseapply()blocks the event loop, callsprocess.exit(), or throws during module evaluation takes the whole session down with it, and the person who would fix it is the one whose window just froze.On Desktop this is recoverable (there is a native recovery dialog and — after my own work on the fork — a boot journal), but on
dsh web/ headless there is nothing: the process is gone, and nothing outside it knows the profile is now unstartable.I am a Desktop user, so most of what follows is measured there. I have a working gate in my fork; this post is a request to consider owning the idea upstream, with the code I used so you can judge it.
What the current flow guarantees, and where it stops
Reading
packages/boot/plugin-manager/src/index.ts:installBundlerunspublishAndReload()(:646), which callsreload()→hmr.reconcileProfile(requiredIds)(:893). So a failed activation is reported throughapplication: 'failed'plus the entry diagnostic. That part works.reload()returns once the Loader entry started; nothing observes the event loop afterwards.sanitizeProfile()(packages/boot/app-boot/src/profile-sanitize.ts) exists and does exactly the right thing — it renamescordis.patch.ymlto.bak-<timestamp>and restores the shipped bundle set. But its only caller is the Desktop native recovery dialog.dsh web, headless, SDK and ACP have no equivalent path, so a profile that cannot boot stays unstartable until a human edits files by hand.references/verification.md) currently says "Verify in the available environment", which is honest but leaves the first run in the live profile.So the gap is not "installation does not verify". It is: the first execution of a freshly installed bundle happens in the only profile the user has, and the failure modes that matter are the ones that destroy the observer.
What I built in my fork (code, not a proposal)
Four pieces, all in
Aceared0829/deepseek-harnessand merged there.f85b02b0b1is the last commit identical to upstream, so a diff againstmastershows only these.1. A disposable-profile gate —
scripts/stage-verify.mjs(513 lines, +274 test)It creates a temporary
DSH_HOME, composes a profile from thewebtemplate, installs the bundle there, boots it on a free port, and requires HTTP reachability plus no FAILED fiber. The live profile is never written; a failing run keeps its staging directory and prints the log path. It catches what a syntax check cannot: a manifest pointing at a missing file, a BOM or U+FFFD in a written file, a Host entry that throws while loading, a Client bundle that fails to import, an entry that never activates.Usage:
node scripts/stage-verify.mjs <bundle-dir>. I use it as a hard gate before promoting anything, and it is what the skill would point at instead of "verify in the available environment".2. Profile snapshots —
scripts/profile-snapshot.mjs(318 lines, +118 test)Copies
package.json,cordis.patch.yml,cordis.yml,pnpm-lock.yaml,pnpm-workspace.yamlplus ameta.jsonwith a SHA-256 per file under$DSH_HOME/profile-backups/<profile>-<timestamp>/.restore --idputs them back and removes files the snapshot proves were absent. This is the manual rollback for "it installed cleanly but the app will not start".3. Boot journal + circuit breaker —
apps/desktop/src/boot-journal.ts(211 lines)Writes
boot-failures.jsonunder Electron userData (deliberately outside the profile, so a rollback cannot erase the record that authorizes it). Each launch that ends before readiness records:package.json/cordis.yml/cordis.patch.ymlhashed by content, absence included. Content rather than mtime, so any profile write starts a new streak and "fix it and retry" needs no special case;address-in-useorcomposition;Reaching readiness deletes the file. Three consecutive failures of the same composition make the next launch call the same
sanitizeProfilethe recovery dialog uses, before the Host starts. Three constraints keep recovery from becoming a second failure mode: a listener conflict never rolls back (no profile change fixesEADDRINUSE), one rollback per composition (a latch, so a still-unstartable profile reports instead of rewriting itself forever), and a failed rollback lets the launch fail with its own diagnostic rather than replacing it.4. Readiness deadline and liveness probe
DesktopHostProcess.start()armsHOST_READY_TIMEOUT_MS(default 120 s) and fails withDesktopHostReadyTimeoutErrorwhen a Host never reports readiness — previously it awaited areadyIPC message with no deadline, which is exactly what a plugin blocked in a synchronous loop produces. After readiness, a 30 s probe; three consecutive misses replace the Host through the installer handoff's restart path.apps/desktop-host/src/event-loop-delay.ts(82 lines) runsmonitorEventLoopDelayfor the Host's lifetime and attaches the distribution to every probe answer, so a stall report reads:A large
maxover a smallp50is one blocked stretch; a largep99across many samples is sustained pressure. That is the number that separates "this plugin is stuck" from "a request was slow".Why I am posting this instead of opening a PR
Your contribution page says external PRs are not accepted and points at Discussions, so: Ideas thread, not a PR. I am also not asking you to take my code as-is — Desktop-specific pieces (Electron userData paths,
nativeImage, the recovery dialog) belong where they are, and the upstream form would probably be:scripts/next to the other gates, referenced fromreferences/verification.mdin place of "verify in the available environment";sanitizeProfilereachable without Desktop — the function already exists and is exported fromapp-boot, only the caller is Desktop-only;dsh weband headless get them too.That last point is the one I most want to hear your stance on. Everything I built protects the Desktop user, because Desktop is the only deployment where the supervisor outlives the Host. A
dsh webuser has no supervisor at all: I could not find any code path outside Desktop that reacts to "the profile now cannot start". If that is a deliberate scope decision, saying so would still help — right now an author's answer to "what happens if my plugin makes the app unstartable on web?" is "edit the files by hand".Honest limits of what I have
dsh webor headless; every measurement above is Windows 11 + self-built Desktop at0.2.1-rc.2. Static reading ofplugin-managersuggests the same hole exists there, but I did not execute it.process.exit()case is only observed, not prevented — the boot journal then treats it as a composition failure and rolls back on the next launch. It still costs one crash and one restart.apps/desktop/src/duration-env.tsmakes all five values configurable (DSH_DESKTOP_HOST_READY_TIMEOUT_MS,..._LIVENESS_INTERVAL_MS,..._PROBE_TIMEOUT_MS,..._STALL_PROBES,..._STALL_RECOVERIES). It is a policy number, not a measurement, and I would rather it were argued than adopted.webtemplate. A bundle that only makes sense in aguiordesktopcomposition would need the template as a parameter.The ask
Not "merge this". Three smaller questions I would find useful answered:
scripts/referenced from the Creator skill be welcome as a contribution shape, given PRs are closed?If the answer to (1) is "accepted, by design", I will close the loop by documenting the hand-recovery steps in my own kit and stop asking. Happy to hand over any of the four pieces as a patch against a branch you name.
Fork, for reference:
https://github.com/Aceared0829/deepseek-harness(master;f85b02b0b1is the last commit shared with upstream).All reactions