Repository navigation
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
The new native move path leaves the thread list's rollback visibly unstable. In test_a_failed_list_candidate_restores_its_complete_committed_reading, a retained .lf-thread-summary moves upward 34 px without input while the failed candidate is restored; the browser shift watcher reports the same movement in all four variants. Those variants pass on the merge commit's main parent (86d17996) and fail on this PR's merged tree, including a focused local rerun. The CI test job is red for that reason. The list presentation needs to keep the committed reading in place through candidate failure and rollback, or the shift watcher needs a demonstrated reason to treat this move as intentional.
CI failed: four thread-list rollback variants report a passive 34 px shift on the reviewed head.
Both Lit builds paint the same 34px shift when an open thread is withdrawn at scroll zero. Ordinary insertion suppresses Chrome shift admission; native moves expose it. Keep the shared Leaf and Sortable foundation, and record why Lit adoption is skipped rather than weakening the stability gate. The browser regression now directly protects retained-node ordering, fallback focus restoration, and named form controls.
Keep the expanded Lit facade and live binding guidance from item 2 alongside the move primitive. Main added scroll and standing readers; use native root lookups at those seams too. A real scrolling form with a named getRootNode field reproduces the failure and verifies both readings. Focused browser integration: 9 passed; runtime: 324 passed; framework/build: 95 passed.
The module-authoring reference now states which renderer fits Leaf's timing contract: public `render()` for a paint that must land in the current turn, `LitElement` only for runtime faces that permit a microtask delay. Package widgets remain `HTMLElement` consumers of `widgetController` rather than keeping a reactive semantic-state copy. The same section owns template container and native-node retention guidance, and runtime maintainer instructions point to it. Survey item #6. Runtime implementation is unchanged. The restriction on `repeat` rows holding iframes or editors remains: sibling [#2324](#2324) landed Leaf and Sortable native moves but explicitly skipped the Lit adaptation after stability failures. Lit still uses ordinary insertion; the guidance describes that current boundary. Measured source lines: - skills/leaf/references/module-authoring.md: 1,295 → 1,307 - skills/leaf/assets/AGENTS.md: 558 → 562 - evals/widget-list-keeps-focus/case.yaml: 54 → 56 Validation: paired Codex authoring evaluation of an immediate receipt after list removal passed on both base and candidate (one sample per arm). Both traces loaded module-authoring.md and both answers used synchronous public render with keyed focus recovery. This validates the documented route; it does not establish an improvement in agent success rate. The existing eval now grades that receipt and drops a stale file-read assertion whose referenced helper no longer exists, consistent with the evals' behavior-only contract. Focused instruction and eval checks passed; independent review found no remaining issues. > _This was written by Codex on behalf of max-sixty_
#2387) When another actor withdrew the selected thread, the list pulled its neighbors up and opened a fallback conversation. The 34px jump was present before this change, but Lit's detach/reinsert moves hid it from Chrome's shift reporting. This fixes that presentation owner and completes the Lit portion of survey item #1, deferred in [#2324](#2324). The list keeps the withdrawn thread's measured space while removing it would disturb the reader, replaces its disconnected controls with “Thread withdrawn” and Dismiss, and keeps semantic counts and navigation current. Dismiss, choosing another conversation, changing the view, or leaving that reading releases the space. A selected notice prevents an unsolicited fallback conversation from opening. Complete-list rollback restores the committed native cards and editors. Frozen-message preparation now reads projected threads, so historical withdrawn markup no longer has to find an absent thread owner. The locked lit-html keyed, child-part and root-marker insertion sites use the shared move primitive. Chrome retains focus, caret, edited values and iframe documents during reorders; named form fields cannot shadow the native methods. The focus-holding render wrapper remains for engines without moveBefore, where insertion can still reload frames. Measured handwritten production sources (build script, dom-children, state-application, thread-list/view and source chrome stylesheet): **3,659 → 3,841 lines (+182)**. Generated assets, tests and documentation are excluded. This adds the withdrawal lifecycle needed to safely adopt native Lit moves; it is not a line-count reduction. Validation: native/fallback × Leaf/Lit browser proof; withdrawal with selected and closed cards, a scrolled conversation with a frozen widget and saved draft, and a scaled panel; Dismiss, keyboard navigation and narrowing; complete-list failure/rollback and neighboring thread journeys. 335 runtime tests and 95 framework tests pass; pre-commit passes. Independent code review and a fresh user-task review completed. The paired startup probe made 242 requests in each version with no errors or initial shifts; candidate transfer grew by about 5.6KB for the required presentation behavior. > _This was written by Codex on behalf of max-sixty_
Leaf and Sortable currently call moveBefore unconditionally, so their retained-node reorder fails when that API is absent. Group A, survey item 1 now gives those moves one runtime primitive: native moveBefore inside a shared composed root when available, insertBefore otherwise. Authored revisions, renderer child reconciliation, board placement, and Sortable use it. The Sortable adaptation fails if its pinned upstream seams change.
The requested lit-html adaptation is skipped in this PR. Its Chrome experiment preserved focus and iframe documents, but the full CI run exposed four rollback-journey stability failures. Frame traces with both patched and original Lit show the same pre-existing 34px jump: passive withdrawal of an open thread removes its title allocation, opens the fallback, and moves a surviving closed card while the list is already at scroll zero. Ordinary insertion hides that jump from Chrome's layout-shift reporting. Preserving nodes makes it observable. A coherent policy for departed thread allocations is needed before adopting native Lit moves; a fold, negative-scroll compensation, or a weaker stability check would not fix the reading. The browser-support review #22 entry records the evidence and the remaining limit.
The focus-holding render wrapper stays because Lit still uses ordinary insertion. The retained-move browser test exercises named form controls, retained-node ordering, and direct placement. Native moves preserve focus, backward caret, typed text, and iframe document identity without a blur. The fallback demonstrates a real blur followed by explicit focus/caret restoration. WebKit 26.6 reorders through the fallback. Platform methods are read through prototypes so form controls named moveBefore, getRootNode and insertBefore cannot shadow them; startup, focus retention, traversal and text selection use native root lookups as well. A shadow-form regression also covers native scroll delivery and standing/selection readings after integrating the landed lifecycle changes.
Measured handwritten production/build source (ten changed source files, including the new primitive, excluding generated bundles, tests and documentation): 6,596 → 6,630 lines (+34). This foundation consolidates eligibility and fallback rules rather than reducing total source lines. The served triage-board comparison adds one JavaScript request and 1,070 JavaScript bytes before upgrade/presentation. This synchronous dependency provides state-preserving placement during initial renders.
Validation: Chrome native/fallback editor and frame tests; all four complete-list rollback variants; board keyboard/drag/undo and authored iframe revision tests; WebKit fallback probe; all 327 runtime tests; all 95 framework/build tests; prepared-install and offline-export integration; scoped pre-commit checks. Required PR jobs run the full suite and delivery builds.