runtime(coro): add handle-free terminal executor close - #27
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements the ExecutorDriver (Phase 17/18) to manage executor and wait registries, enabling handle-free terminal close handoffs for the scheduler. Key changes include updating the P structure to support executor binding, modifying RequestSchedule and PollReady to integrate with the new driver, and adding robust lifecycle tests. Additionally, a CheckIndexRange function is implemented in the native e2e test drivers. I have one suggestion to improve test consistency by explicitly checking terminal.Handle in TestExecutorDriverTerminalCloseRequestRace.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
a5b568a to
3894e23
Compare
Summary
Exactly-once protocol
The first llvm.coro.destroy remains the only physical destroy. Once the core seals the executor it replaces P.action with ActionTerminalExecutorClose, whose Handle is nil. The driver stores only ActionDestroy or ActionPanicDestroy as a logical kind; it does not retain the freed LLVM handle, and g.root is cleared before the close marker is published.
After the target strongly unregisters and joins the complete ingress shim, ConfirmTerminalExecutorClose(driver) reconstructs P and G from stable scheduler state. It performs the post-join source scan, confirms and retires the executor generation, unbinds with executorMode last, and uses a core-private stable sentinel only for the synchronous terminal state commit. The only returned actions are ActionComplete or ActionPanicComplete.
Validation
Scope
This closes the empty-ready/wait last-G core transition. The production target join dispatcher and retained-doorbell backends are not wired yet; runtime/internal/runtime/coroRunActions recognizes the action and intentionally fails closed. Command-main return with ready children and fatal panic with peers still require the separate idle/generic executor-close teardown.
Stacked on #26.