fix: keep ctx.ui originals across jiti reloads - #142
Conversation
#116 stored the pristine-originals WeakMap in module scope. Jiti cache invalidation created a new empty map, so the next session_start recaptured PromptBus wrappers as natives and ask self-cancelled in ~30ms. Store the map on process, matching BRIDGE_KEY.
Call#141 and #136 are the same recapture hole. This PR is the keeper. Does not fold into in-flight P0–P2 PRs (#137/#138/#139/#140/#143/#121). Those do not touch After merge, leftover on #136:
|
ReviewStrengths
IssuesImportant (do not block #141)
Minor
AssessmentReady to merge for #141. Process map + reload test close the reported 30ms self-cancel after a prior good capture in the same process. Do not close #136 until (1) is fixed. |
Summary
ctx.uioriginals WeakMap onprocess(__pi_dashboard_pristine_ui__), same survival trick asBRIDGE_KEY.askself-cancel in ~30ms after fix: stop ctx.ui re-patch nesting on session_start #116 and canRangeErrorthe TUI adapter (PromptBus TUI originals recaptured as wrappers after jiti reload → infinite onRequest cycle #136).vi.resetModules()+ recapture must still call the native select.Closes #141
Related: #136
Test plan
vitest run packages/extension/src/__tests__/ctx-ui-session-start-repatch-regression.test.ts~/.omp-dashboardfrom this branch and confirmaskstays open until answeredselect/input/batch must notRangeError