Skip to content

upgrade: carry process-owned frame values (tty port, lifecycle options) across process.upgrade - #909

Merged
wolfy-j merged 2 commits into
mainfrom
fix/upgrade-keeps-process-values
Oct 4, 2026
Merged

wolfy-j merged 2 commits into
mainfrom
fix/upgrade-keeps-process-values

Conversation

@wolfy-j

@wolfy-j wolfy-j commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Cause

An in-place process.upgrade lost its non-inheritable terminal attachment and lifecycle options. Simply copying process values into another owning frame also closed borrowed resources twice and retained old incarnation frames.

Change

  • Use the same Key.Execution, ContinueFrameContext and ExecutionFrame foundation as feat(eval): supervised eval processes with ownership, limits and send capabilities #895, instead of introducing a competing Key.Process/ProcessPairs API.
  • PID, lifecycle options and terminal attachment belong to the execution. Upgrades retain them; children do not inherit the terminal.
  • Continuations borrow execution values without cloning them. Ownership is stored alongside each value in its atomic snapshot: owned replacements close with the continuation, and restoring an original borrowed handle restores borrowing.
  • Each upgrade forks the original execution frame. The scheduler releases previous and failed incarnation frames; the host releases its original execution frame.
  • Cross-source upgrades still update the visible source identity.

Verification

  • Context tests under race, 30 repetitions, including replace/restore and concurrent writes to the same execution key.
  • Affected context, Lua process, host and actor packages under race, 3 repetitions.
  • 300-upgrade chain, execution-resource ownership and failed Init cleanup tests under race, 30 repetitions.
  • Real Lua process + tty regression: the upgraded code can present into the existing viewport.
  • Full repository lint: zero issues.

This is a shared foundation for #895; landing this PR does not require enabling eval or tick preemption. No Lua API change is introduced.

Context keys gain a Process flag independent of Inherit. The scheduler upgrade
path copies every process pair (pid, lifecycle options, terminal port) onto the
replacement frame instead of special-casing the pid.
@wolfy-j
wolfy-j requested a review from skhaz October 4, 2026 00:35
@wolfy-j
wolfy-j merged commit 0ae41b4 into main Oct 4, 2026
13 checks passed
@wolfy-j
wolfy-j deleted the fix/upgrade-keeps-process-values branch October 4, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants