Skip to content

fix: preserve playground instructions and stabilize diff startup - #4712

Merged
max-sixty merged 4 commits into
mainfrom
codex/ui-hill-climb
Oct 30, 2026
Merged

max-sixty merged 4 commits into
mainfrom
codex/ui-hill-climb

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Preserve instruction structure through playground display, copy and submission, keep keyboard-focused pane content clear of the floating panel, and reserve diff height before the syntax renderer loads. These repairs came from a six-hour campaign of matched runtime comparisons and independent Astra/Opus reviews. For example, one source-fed diff previously grew from 8 to 513 px during startup; it now reserves 513 px from the initial render.

The changes cover five UI repairs:

  • Preserve provider instruction newlines and use the provider's canonical string for copy/send.
  • Add says(element, {format: "lines"}) for authored instruction text, deriving block boundaries, table separators and preformatted whitespace through the shared passage traversal.
  • Give pane focus scrolling the existing end clearance for the floating panel.
  • Size inline file-view diffs from the selected file rather than the entire patch.
  • Deliver initial source data to parser-time renderers through tools.inputValue(name). The first authoritative state request and its ordering remain intact; initial data is released after admission. Static/offline delivery and Worker responses use the same data-version contract.

Supporting changes document these interfaces and existing code typography inputs, deduplicate reused native results in standard evaluation reports while retaining run aliases and changed grades, and restrict newly launched macOS sandboxed eval authors' signals to their own sandbox. Generated browser assets and focused regression tests are included. No protocol change.

Validation: rebuilt browser assets; pnpm run check (build, runtime and 88 Worker tests); all applicable pre-commit hooks; seven export/static-shell model tests after integrating current main; all 119 module URL delivery tests using a complete server-folded export state; both pre-runtime diff viewport cases at CPU throttle 6, with parser completion established before measuring; and campaign browser probes covering copy/send, Undo, keyboard focus, selected files, source updates and reloads. Independent Astra integration review found no actionable defects; its ten focused cases passed, including offline deferred diffs and five pane/workspace variants.

Limits: the source-fed diff repair reserves geometry; it does not make syntax-highlighted text available before the renderer. Deferred/unavailable data, metadata-only patches and later authored layout changes remain outside that guarantee. Matched public-site profiles added 655–675 encoded body bytes across three routes, including HTML, without increasing module counts. Both baseline and candidate full website verification timed out at the same root API-view activation boundary; this is not a full website activation pass. Fresh author comparisons were mixed and do not establish a general Leaf-versus-HTML quality improvement.

This was written by Codex on behalf of max-sixty

leaf-agent
leaf-agent previously approved these changes Oct 29, 2026

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] The expanded first-paint fixture races the HTML parser. test_an_inline_patch_first_paints_at_the_height_it_draws_at samples immediately after displayed(page), but that helper waits only for first contentful paint. On this head both viewport cases failed with the new relative-font element at 0 px before upgrade (213 px desktop / 562 px touch afterward). A diagnostic run at CPU throttle 6 caught the cause in the same measurement: document.readyState was still loading, and that element had neither its <pre> nor its initial sizing properties yet. This makes the regression check fail on incomplete input rather than a sizing regression.

Keep leaf.js held, but wait for parsing to finish before taking first in the test. A temporary page.wait_for_function("document.readyState !== 'loading'") at that point made both cases pass at the same throttle, preserving the pre-runtime height assertion. I restored the test after verification; I can push this mechanical repair if desired.

Reproduction

Run uv run pytest tests/browser/widgets/test_diffs.py -k inline_patch_first -q -n0 --cpu-throttle 6. The touch case reproduced the parser race with diagnostic logging; the initial unthrottled focused run failed both cases. displayed is defined in tests/render_harness.py and waits on the first-contentful-paint performance entry, which does not signal parser completion.

@max-sixty
max-sixty merged commit 73eb82f into main Oct 30, 2026
4 checks passed
@max-sixty
max-sixty deleted the codex/ui-hill-climb branch October 30, 2026 00:48
max-sixty added a commit that referenced this pull request Oct 30, 2026
Leaf currently maintains a separate initial widget renderer and hands
its output to the live renderer, while JavaScript also discovers and
allocates page layout. This change removes those parallel paths:
authored HTML stays readable during loading, ordinary Lit roots own
generated controls and subsequent updates, and native CSS lays out
explicitly authored flows, sidebars and notes.

The main deletions are in prepaint, initial-render producers/bundles,
the layout allocator and tests tied to those mechanisms. Packages render
from their native hosts; slots preserve authored children where a
generated shell needs a shadow root. The public module contract and
in-tree consumers move together. Portable motion and timeline retain
their light-DOM, plain-HTML behavior. Native drafts, focus, selection,
revision identity and frozen-message semantics remain separate
responsibilities.

This deliberately accepts one content-derived resize when shots, diffs
or timelines upgrade. Fixed control rows still reserve their space. In
particular, data-fed diffs give up the parser-time reservation added on
main in #4712: the following content moved 445–605 px in matched
inline-data probes when the first authoritative data arrived. Explicit
authored `data-height` eliminated the shift in Opus’s probe.
File-capture sources already shifted on main. Authored diff notes
likewise remain readable before upgrade, including notes in initially
collapsed files; moving or hiding them during upgrade adds to that
one-time resize. A matched collapsed-note fixture measured 221→37 px and
an upward 184 px paragraph shift, versus main’s constant 37 px. The
embedded initial-data bridge is removed end-to-end, while offline export
retains one full state/data payload. Authors now state layout structure
explicitly; a framed callout or `lf-ask` requests its own `data-width`,
rather than widening automatically around a wide child. The examples,
registry examples, author instructions and containment advice use that
same rule; grid children have different margin/float semantics, and
tally/worktree shadow boundaries limit page CSS reaching internal
elements. Selection understands slots, and some responsive CSS
arithmetic is less obvious than the larger JavaScript allocator it
replaces. No server-side JavaScript engine, hydration layer or
whole-page reveal wait is added.

Independent Opus review covered the full change and integration with
main. Its findings led to canonical runtime-attribute normalization for
revision snapshots, a site navigation width repair, migrated behavior
tests/eval fixtures, restored trace and deck control reservation,
consolidation of portable control markers and icon styling, and repairs
to startup-shift report serialization, nested sidebar width, standalone
flow tracks and generated view membership. The view APIs mark generated
holders from the registry before using the shared selection owner; no
separate observer or widget-specific marker setup is added. The final
review also narrowed the layout dependency guard and removed implicit
child-to-holder width propagation.

Validation includes the browser build and `pnpm run check` (708 runtime
and 88 Worker tests), formatting/lint/type gates, 158 focused
model/process tests, and focused real-browser checks for revisions,
cancellation, native layouts, standalone widgets, motion/timeline
controls, traces, activity and tally focus. A fresh main/candidate
comparison completed 24 loads without browser errors and confirmed
readable content with modules held on four pages. Initial HTML fell by
82–101 KB; one or two additional resource URLs are loaded before
presentation, with total body bytes lower on three pages and higher on
one. Host contention makes elapsed timings diagnostic only. Five paired
authoring probes scored 2/5 for this branch and 1/5 for the base:
candidate agents adopted the explicit track markup but still sometimes
duplicated layout CSS, so this does not establish reliable instruction
compliance. The complete pushed version passes PR CI and has
exact-commit reviewer approval. All 18 regenerated catalog previews were
visually inspected. Focused checks separately verify native fragment
focus clearance, contents-lens accuracy and workspace panel clearance;
Opus approved those assertions and the final main integration. A paired
run of all 19 decision-authoring cases scored 15/19 for the candidate
versus 13/19 for the base, with two improvements and no pass-to-fail
regressions. Restricting to the 16 matching cases with confirmed
exposure to each arm’s width guidance gives 12/16 versus 10/16. All
three candidate authored pages passed plain/render checks. This is one
stochastic run of complete branch snapshots; custom CSS remained common,
and the window-fit page still failed the judge’s shorter 1920×720
viewport despite fitting the requested 1600×1000. The result supports
the instruction repair without establishing universal width compliance.

> _This was written by Codex on behalf of max-sixty_
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