fix(dock): auto-close after short-lived processes (<125ms) - #100
Merged
Conversation
378-kaiabot
Bot
force-pushed
the
fix/dock-auto-close-short-lived
branch
from
August 22, 2026 14:33
974a73b to
f4dccd4
Compare
Set hasSeenRunningProcess synchronously in handleStarted (CHANNELS.STARTED) instead of only inside the throttled hardRefresh. A process that exits within the 125ms scheduleRefresh throttle window on a fresh session never reached the hardRefresh set-site (the process was already non-running by then), so the auto-close condition never fired and the dock stayed open. Closes #86
378-kaiabot
Bot
force-pushed
the
fix/dock-auto-close-short-lived
branch
from
August 22, 2026 14:52
f4dccd4 to
3673a75
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Automated pull request by Pi, model `radius/glm-5.2`. Implemented and validated empirically against
aliou/pi-processeson branchmain(published@aliou/pi-processes@0.10.9== cited commit550b2e9for thehasSeenRunningProcesslogic), using real Pi 0.84.2, an instrumented event-logger extension, and Herdr. See the local run log for the full investigation.Problem
The process dock does not auto-close after a very short-lived process (one that exits within the 125ms
scheduleRefreshthrottle window) on a fresh session.hasSeenRunningProcess— the session-lifetime flag that gates the auto-close condition inhardRefresh— was set only insidehardRefresh, which runs ~125ms afterCHANNELS.STARTEDdue to thescheduleRefreshthrottle, and only when a process is stillrunningat that moment. If the process exits before that firsthardRefreshruns, the flag is never set, so the close condition (hasSeenRunningProcess && processes.every(!LIVE_STATUSES)) is always false andstate.actions.close()never fires. The registry does not prune finished records, so theprocesses.length === 0branch doesn't help either — the dock stays open showing the finished process.true(9–110ms), fresh sessionvisiblehiddensleep 3(3014ms), fresh sessionA subtlety confirmed during validation: the bug only manifests on a fresh session with a sub-125ms first process. Once any process lives ≥125ms, the flag is set for the session and later short processes auto-close fine — which is why this is easy to miss in casual testing.
Fix
extensions/processes-dock/widget/setup.ts— sethasSeenRunningProcess = truesynchronously inhandleStarted(theCHANNELS.STARTEDhandler), before any throttle delay, in addition to the existing set-site inhardRefresh.handleStartedfires synchronously when a process starts, so the flag is set before the process can exit, letting the auto-close condition fire on the subsequent END refresh even for sub-125ms processes.Why not only set it in
handleStarted: keeping thehardRefreshset-site is harmless and defensive —hardRefreshalso runs fromrefresh()and the initial setup call, and there is no guarantee aSTARTEDevent is the only path to a running process appearing in the list.Verification
pnpm typecheck✅pnpm lint✅ (202 files, no fixes)pnpm test✅ (640 passed, 62 files — includes the newsetup.test.tsregression tests)pnpm check:changesets✅ (5 changesets)pnpm check:schema✅ (schema.json up to date)pnpm check:lockfile✅End-to-end (real Pi 0.84.2 + published
@aliou/pi-processes@0.10.9patched in-place + instrumented event-logger extension,dockDefaultState: "collapsed"):true(STARTED→ENDED = 9.2ms): dock auto-closed (stayedhidden;close()fired at the 125mshardRefresh). Before the fix, a 110.3mstrueleft the dock stuckvisiblewith 0 hidden transitions.sleep 3 && echo done(3014ms): dockhidden → visible (collapsed) → hidden— opens during the run, auto-closes after. No regression.Closes #86
Run host: `jovial-vis-telimus` · Session: `01a02935-00f6-7976-962a-1662ddf87923` · Model: `radius/glm-5.2`