Skip to content

Lynx main-thread first screen silently drops render-phase state updates, forcing a mismatch repair on every launch #73

Closed as not planned

Description

@Huxpro

Found by an adversarial audit of the #58 L0–L3 equivalence claims.

This is a pre-existing defect, not a regression from the #59→#63→#64→#65 stack. It reproduces identically on base 6079a6804 (verified in a worktree). Filed because the audit surfaced it, not because it counts against any stack claim.

Root cause

The main-thread first-screen useState at packages/lynx/src/main-renderer.ts:1151-1157 returns [value, NOOP_UPDATE, () => value]. A render-phase update is therefore silently dropped on the main thread, while the background universal core converges the same component normally.

export const __useStateWithGetter = useState at :1159 is the identifier the compiler actually emits, so this is the live path, not a legacy alias.

Reproduction

Same authored component, both threads:

main thread  commits props { id: 'row', count: 0, getter: 0 }
background   commits props { id: 'row', count: 3, getter: 3 }

Why no existing test catches it

The repo's dual-thread parity oracle already exists — packages/lynx/tests/main-renderer.test.ts:346-355, it('emits the same initial host IDs, topology, props, and listener metadata as background') asserting expect(main.batch).toEqual(background). It passes only because its Scene fixture is stateless. No test in packages/lynx/tests/ runs that oracle over a component that updates state during render, so this corner of the dual-thread contract is untested.

Consumer impact

The first screen paints the un-converged value. Adoption then detects it — packages/lynx/src/core/host-driver.ts:3296-3299 returns mismatch(firstTree, 'snapshot.nodes[${id}].props', 'the host props differ.') — driving the repair path reported at packages/lynx/src/main-thread.ts:2163 as Octane Lynx repaired a first-screen mismatch. So every launch of an app containing a render-phase-updating component pays a first-screen repair, which is precisely the cost the L3 work is trying to remove.

Suggested direction

Either converge render-phase updates on the main thread the way the background core does, or make the divergence explicit rather than silent. Extending the existing parity test at main-renderer.test.ts:346 to a stateful fixture would pin whichever behavior is chosen.

Verification performed

Base-vs-head comparison performed by the finding agent in a 6079a6804 worktree and reported as identical, with the same - "count": 3 / + "count": 0 diff. I did not independently re-run this one; the finding rests on the agent's executed output plus the source read above, which is weaker evidence than the other issues from this audit. Adversarial refuter panel had not yet adjudicated it at time of filing.

Activity

  1. added
    bug
    on Aug 18, 2026
  2. Huxpro commented on Aug 18, 2026

    @Huxpro
    OwnerAuthor

    Withdrawing this — it is documented, intended, and already pinned green

    This report is wrong and I am closing it. An adversarial refuter took it apart and every point lands.

    The load-bearing premise is factually false

    I wrote that "no test in packages/lynx/tests/ runs the parity oracle over a stateful component, so this is an untested corner of the dual-thread contract."

    Fifty-eight lines below the oracle I cited, in the same describe block of the same file:

    • packages/lynx/tests/main-renderer.test.ts:404 — it('uses initial hook values and never publishes effects, refs, or updates') calls setCount(9) inside the component body (a render-phase update) and asserts the committed #text is 'private:2', the pre-convergence value.
    • packages/lynx/tests/main-renderer.test.ts:597 — it('accepts conditional initial hooks without retaining an update path') calls update('ignored') during render and asserts the commit carries 'initial'.

    Both green. The exact main-vs-background divergence I reported (main = ["private:2"] / background = ["private:9"]) is the divergence the repo deliberately pins.

    It is the documented public contract

    packages/lynx/README.md:98-103 describes the main-thread renderer as "a PrimJS-safe, one-shot @octanejs/lynx/main-renderer specialization which evaluates initial hooks and control flow, emits the first host batch, replaces ordinary first-screen handlers with event markers, and does not publish effects, refs, state ownership, or later updates." The module header at packages/lynx/src/main-renderer.ts:1-7 says the same.

    There is no render-phase convergence loop on the main thread by construction. NOOP_UPDATE is the intended lowering of that decision, not an oversight.

    The "consumer harm" is the declared handoff

    packages/lynx/README.md:153-154: "The background graph retains the complete Octane runtime and takes ownership by adopting a compatible snapshot or repairing a mismatch." The repair path I cited as the symptom is the mechanism.

    My mechanism description was also wrong

    I wrote that both threads compile the same source "with only the renderer module swapped." They do not. packages/lynx/src/config.runtime.js:219 gives the background target: 'universal'; :234 gives the main thread target: 'lynx'; :238 adds the main-thread-render-only capability, which drives isMainThreadRenderOnly (compile-universal.js:351) and erases effect arguments. The two threads compile differently on purpose.

    What went wrong on my side

    CLAUDE.md states plainly that React instincts are the main failure mode in this repo, and the bug-hunter skill exists partly to decide whether a mismatch is an intentional divergence. I filed an intentional, documented, test-pinned divergence as a defect, and I did so on an agent's executed output without re-running it myself — which I flagged at the time as this issue's weakness. That caveat was correct and I should have resolved it before filing rather than after.

    Closing as not-planned. No change is warranted.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-authoredbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions