Skip to content

Implement Lynx Milestone 7 main-thread worklets - #227

Merged
trueadm merged 1 commit into
mainfrom
codex/lynx-phase-7
Jul 22, 2026
Merged

trueadm merged 1 commit into
mainfrom
codex/lynx-phase-7

Conversation

@trueadm

@trueadm trueadm commented Jul 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • teach the universal compiler to lower main thread and background only functions with stable IDs, isolated captures, layer-specific dead-code/import removal, and source diagnostics
  • add Octane-owned Lynx worklet/ref registries, useMainThreadRef, direct main-thread:* host props, and root-scoped runOnMainThread / runOnBackground calls
  • harden adoption, cancellation, exact-once settlement, replay/fault handling, and asynchronous owner-ref publication; exercise the same authored source through production main/background graphs
  • update Lynx status/audit/migration documentation and add an octane patch changeset

Why

Milestone 6 established main-thread first paint and background adoption. Milestone 7 adds the native-capability boundary applications need after adoption without bringing ReactLynx, Preact, React Reconciler, or a copied worklet runtime into the bundle.

The acknowledgement-scoped publication protocol also prevents state-only main-thread refs from being collected between child-first mount calls, parent owner retention, and parent-first cleanup calls when ContextProxy delivery is asynchronous.

Validation

  • pnpm test — 1,274 files / 12,252 tests
  • pnpm typecheck
  • pnpm format:check
  • Lynx suite — 20 files / 208 tests
  • focused Lynx/compiler integration — 11 files / 313 tests
  • Rspeedy production build suite — 5 tests
  • Lynx crosswalk, bindings-status, changeset, and diff checks

Remaining native gates

This completes the private source/test/build implementation, not the formal native exit. Explorer, Android, and iOS still need to prove direct main-thread execution, adopted native ref identity, gesture/continuous-event behavior, and native latency/memory/cleanup budgets. Full runtime HMR and never-activated descriptor/module-removal invalidation remain Milestone 8 work.


Note

High Risk
Large cross-thread lifecycle and dual-graph adoption changes touch host commits, worklet/ref invalidation, and async call settlement; native behavior is still unproven despite extensive JS-host coverage.

Overview
Adds Lynx Milestone 7: opt-in thread-functions compiler support for 'main thread' / 'background only' directives (stable IDs, isolated captures, layer DCE, source diagnostics), plus Octane-owned runtime wiring without ReactLynx worklet imports.

Lynx host and transport now understand main-thread:* event props and main-thread:ref, with registries for worklet activation, ref lifetimes, collision checks against background handlers, and subtree activate/deactivate on connect/disconnect, visibility, and fault paths. First-screen adoption compares adoptable worklet snapshots (ignoring background _execId tokens) and transfers main-thread ref/event journals.

Background transport gains callMain / inbound call-background with clone-safe args/results, bounded pre-adoption queues, cancellation, stale-root rejection, and main-call-publication open/close around ACK-time draining so queued main calls and ref-owner retains stay ordered under async ContextProxy delivery. Client driver binds background function lifetimes into commit batches via prepareLynxClientWorkletBatch.

Docs, audit crosswalk, and changeset record private source/test completion; formal native exit (main-thread execution, ref identity, gestures) remains gated.

Reviewed by Cursor Bugbot for commit 8b1c0a2. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
octane-website Ready Ready Preview, Comment Jul 21, 2026 11:55pm
octane-website-mcp Ready Ready Preview, Comment Jul 21, 2026 11:55pm

Request Review

@vercel
vercel Bot temporarily deployed to Preview – octane-website July 21, 2026 23:55 Inactive
@trueadm
trueadm marked this pull request as ready for review July 21, 2026 23:56
@trueadm
trueadm merged commit a719b93 into main Jul 22, 2026
22 checks passed
@trueadm
trueadm deleted the codex/lynx-phase-7 branch July 22, 2026 00:08
mrdiyorbek-juraev added a commit to mrdiyorbek-juraev/octane that referenced this pull request Jul 22, 2026
Brings in 12 upstream commits, including the shared TSRX semantic analysis
across client/server/universal/Volar compilation (octanejs#230), the deferred
hydration fix (octanejs#229), Lynx Milestone 7 worklets (octanejs#227), template-free
production hydration (octanejs#218), and the dependency/TSRX toolchain refresh
(octanejs#223) with the release that followed it.

Two conflicts, both in generated files, resolved by taking upstream and
regenerating from the merged tree:

- docs/packages.md — 47 publishable packages upstream, 48 here. Verified
  as a strict superset: every package upstream lists is still present,
  and the only additions are `@octanejs/cmdk` and `packages/cmdk`.
- packages/octane-evals/.../manifest.jsonl — all 19 task ids match
  upstream, and a field-level comparison shows only
  environment.overlayLockfileHash and grader.graderDigest differ. No
  prompt, policy, reference or grader command changed, so task semantics
  are untouched; both fields derive from the lockfile, which necessarily
  moved.

pnpm install also rewrote pnpm-workspace.yaml as a side effect — it
flattened upstream's `*esrap_common` YAML anchor and appended
[email protected] to minimumReleaseAgeExclude. Both are reverted, so the file
differs from upstream by exactly one line: the `cmdk: 1.1.1` catalog pin
this package needs.

packages/cmdk is unchanged apart from one comparator re-wrapped by the
refreshed prettier; the whitespace-only diff is the entire delta.

Verified: 43/43 cmdk and cmdk-ssr against the new compiler, 48/48 evals
(including the corpus freshness gate), tsrx-tsc, tsgo, prettier, and all
five generated-artifact gates current.

This branch was previously deployed

2 inactive deployments
Preview – octane-website — 8b1c0a2e Deployed Jul 21, 2026 by vercel[bot]
Preview – octane-website-mcp — 8b1c0a2e Deployed Jul 21, 2026 by vercel[bot]
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.

1 participant