Repository navigation
Make Escape come back the way the reader went in, by key or by click - #832
Conversation
…d stands on Escape had three unrelated answers — a command's return frame, the scene-read rung ladder, and a popover's own dismissal — and none of them knew about standing on a destination. So `t` from the page left the reader on a rail control they never stood on, a card in the panel could not be let go of without closing the panel, and the card the walk landed on painted a ground where every other keyboard target wears the ring. One rule now: the way out is as deep as the way in, counted in presses. Standing — a card in the list, an Ask or heading on the page — is a rung of its own, however the reader got there: a new inner STANDING scope lets go of it onto the layer's floor, the list or the body, ahead of the frames. A press that stood the reader there records a frame that holds the standing (`t`, `a`, `g T` carrying an inline thread); a frame whose press stood nobody says `standing: false` (`g T`, the trays, `w`), so `t` then `w` unwinds the narrowing before the walk. The walk from the page pushes one frame for the whole walk, as its own entry above the conversation view it opens, and dismisses that view on the way back; `a` opening the panel for a thread Ask closes it in one press, judged once its asynchronous arrival settles. The card or inline thread holding keyboard focus wears an inset ring over its quiet ground. Behavior that moved in the suite: Escape from a card reached by focus the entry never placed goes to the list before the panel closes; a walked-to card draws an outline where the invariant used to refuse one; the inline thread's paint now differs between a keyboard and a pointer arrival. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Walking from a heading through a margin-projected thread on to a thread a diff seats closes the view on the way; one Escape still hands the heading back rather than the rail control the view hung from. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The STANDING scope now sits right after the return frames, so a narrow line promotes its Escape chip the way it promotes a frame's; declared at the end of the page's scopes it fell off a 500px line while the card it named held focus. Two line assertions follow the standing-first order, and the reference test accepts either landing the covering panel gives after a displaced popover. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Max took the inset ring on a walked-to card, with the reservation that a 2px perimeter may be too strong on something that large. The TODO says the weight is tuned once, for every target that wears the ring, so the card and a button never drift apart again. Co-Authored-By: Claude Fable 5.1 <[email protected]>
# Conflicts: # skills/leaf/assets/runtime/margin-projection.js # tests/test_render_controls.py
Main's harness declaration (9e5e0d3) writes agent messages as author 'agent'; the two walk tests still seeded theirs as 'claude', so nothing awaited the reader and the panel's w narrowing had nothing to narrow to. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…it displaced A click on the Threads toggle or on a margin marker opened a layer with no record of where the reader came from, so the Escape that closed it landed wherever the close routine chose: the toggle the click had focused, ringed by the keypress and holding the reader's next Space; the marker the conversation view happened to hang from after a `t` walk. Max named both as the extra press and the wrong landing (focus-stack page, #2 and #3). The layer stack now hands out `pressOrigin()`, the place focus held at the last pointerdown, before the press moved it; a keyboard activation finds no press in flight and reads focus at the click, which is the control the reader stood on. The press is forgotten at its click, at a cancel, and at the next key, so a right-click or a drag that never clicked cannot lend its place to the keyboard activation that follows. The toggle, a margin marker or option, a page mark and its note all open through `invoke` with that origin, so their frames close the way `g T` and `t` do: the way out of a clicked-open panel or conversation view is the page the reader was reading, and the keyboard-opened one comes back to its control. A view already standing keeps the entry that opened it. Behaviour that moved in the suite: the panel's Escape after a pointer open lands on the page rather than ringing the toggle, which the rung test had recorded as the bill of the old design; a margin option pressed from inside a keyboard-unfolded cluster returns to the control the reader stood on there; and the card-ownership test reads ownership off the control's aria state instead of off where focus lands. Four tests are red at this commit, all one cause: a frame now stands over a pointer-opened panel, and the dispatcher answers Escape with the frame ahead of the narrowing and the reply box inside the panel, so Escape closes the panel around a reader who meant to clear a filter or leave a box. The next change lets state inside a frame's layer unwind before the frame. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…olds unwinds first Main moved the keyboard register (#815): each owner declares its own keys where its code is, page.js keeps only the page's parts, and Escape's fallback ladder is contributed rung by rung. This branch's standing scope and walk frames are re-homed onto that. page.js declares the "standing" scope through `declareStanding`, which the boot entry calls with the readings of the four owners it consults; the register places it right after the frames and drops the ladder's "standing" rung, whose foot now stands down while the let-go answers so the reference names one press. The thread walk's frame lives in navigation.js, the ask walk's in asks/view.js, and the `w` narrowing's `standing: false` in conversation/panel.js. With that in place, the four reds the last commit named are fixed at their cause rather than in the tests. A frame that stood the reader nowhere — `g T`, the Threads toggle, a tray — now answers Escape after the scope standing at the focus, so a box the reader entered by Tab or by pointer is left before the panel closes; a frame that holds the standing — `c` into its box, `r`, the walks — keeps its place, so one Escape still undoes the one press. And the panel's frame takes a narrowing off first and stays for the next press, the way the find box's frame does, shared by `g T` and the toggle through `leavePanel`. An independent review of the press-origin change found four defects, fixed here. A press that never became a click — a right-click, a drag released elsewhere — lent its place to the next keyboard activation; the press is now forgotten a task after its release, whatever it became, which also frees the mark door from the order the document's click listeners were added in, and the key listener the last commit added for this goes. The toggle carrying the view's thread into the panel captured the view's card as its origin and, unable to focus a hidden card, left the reader on the toggle; every origin now carries the reading block beside its control, and a control that cannot take focus back hands that block back. A mark press whose thread has no place on the page opened the panel with no frame; the door's one frame now reads which room its press opened. And the toggle's `standing` was a static boolean; it reads whether the reader is still on the carried card. Two cases join the press test: the mark pressed from a keyboard-held marker, and the carry-in. Behaviour that moved in the suite: the key-line test sees the walk's own frame in the reference where main listed the ladder's foot, and the let-go as the standing scope's row; the ring test earns the chrome's ring by opening Threads from the keyboard, since a pointer open now hands back the page. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The press record cleared itself a task after the pointer's release. A key pressed straight after a click reaches the page before that timeout does, so Enter on a margin marker right after a click on the view's close button read the close button's press as its origin, and Escape then handed the reader to a control inside the closed view; the restore fell through to the page and the marker walk that followed started from the body. test_the_margin_groups_meanings_at_one_destination_without_moving_the_page was red on it every run. A keyboard or scripted activation carries detail 0 on its click, the fact aim.js and the offer controls already read. That click forgets the record in the capture phase, ahead of every door, and nothing else clears it: a click that had a press always follows its own pointerdown, which has replaced the record. No timer and no key listener, which the register's own test forbids. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Main's fixtures now own and end the pages they lend, which dedented two conversation tests this branch had changed; the resolution keeps main's shape with this branch's assertions. Co-Authored-By: Claude Fable 5.1 <[email protected]>
A second independent review of the merge found that the frame a click on Threads now leaves outranked Escape steps that had nothing to do with the panel. Click Threads, select some words, click the comment bar, type, press Escape: the frame answered, closed Threads, and its restore pulled the focus out of the box the reader was typing in. A margin cluster unfolded by pointer lost its Escape the same way. `g T` had always had this; making the pointer door a frame brought it to the way the panel is usually opened. A frame that stood the reader nowhere now says which surface its press entered (`surface`), and `outsideCurrentFrame` is the one reading of what follows from that: a step rooted outside the surface, put on since the press, has no frame of its own and unwinds first. Since, and not merely outside: a target captured before `g T` is older than the panel, and the review-journey test caught the first version answering for it. Unframed state records no time, so the stack takes a census of the steps already answering Escape as each such press is made; the dispatcher installs the census, being the one that can name them, and the fallback ladder's one command names the rung it stands for. The dispatcher orders newer steps ahead of the frame, beside the scope standing at the focus, and the ladder stays live under the frame for exactly those steps. The trays' frames name their panels too. The panel's frame had been built by hand at three doors and had drifted: the words promised a close while the press showed every thread, and only the toggle read its standing live. `panelFrame` in thread-panel.js is now the one shape, used by the toggle, `g T`, and the page-thread door's panel half. Its close takes off a narrowing put on since the press and says false, its words follow that, and its standing reads whether the reader is still on the thread the press carried. A narrowing that stood before the press, or that the arrival chose so its thread would show, is part of what the press opened: the frame keeps the narrowing's intent as the press left it and compares by identity, as the narrowing's own holders do. `g T` pressed over an open panel closes it outright again: the mnemonic's close is not the frame's way out, and with a narrowing on it had stopped closing at all. The deferred half of `restoreReturnPlace` asks `retainReaderIntent` before it moves anyone, so a reader who pressed something else inside that frame keeps what they did; reader-intent.js joins the dispatcher's declared closure for it. Tests: a new case walks a selection and the clicked-open page composer made after the panel, `g T` over a narrowed panel, and the panel coming back onto that older narrowing, and fails at its first step with the surface reading disabled; the facets test reads the frame's words before and after its narrowing comes off. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
# Conflicts: # skills/leaf/assets/theme.css
leaf-agent
left a comment
There was a problem hiding this comment.
One thing to fix before merge, and one piece of evidence for a limit you named.
The scoped instruction file still describes the old Escape model
skills/leaf/assets/CLAUDE.md is what /developing-leaf routes the next agent to before they touch the browser runtime, and two statements under Runtime ownership are false as of this change:
- The
runtime/thread-panel.jsentry says its two rungs are what "the panel offers a reader who reached it without a keyboard entry". Now that the toggle's press enters throughinvoke, a pointer-opened panel has a frame too, and those rungs only answer for a panel no press opened.thread-panel.js's own header got exactly this correction in the diff — "a Tab into the list, or a panel that was open when the page arrived" — and the file that points an agent at the module kept the old sentence. - The
keyboard meaningrow of the Fact / Authority table still reads "inner Escape steps, an eligible causal return frame, then fallbacks".escapeOrdernow runs the fallbacks that are newer than a frame that stood the reader nowhere ahead of that frame, and standing left the ladder for an inner scope of its own.
Root CLAUDE.md's Working on the repository asks that the implementation and any owning reference stay aligned, and keyboard/CLAUDE.md and the glossary both got the treatment here — this one file didn't. The base merge moved lines around it without touching either sentence. Say the word and I'll push the two.
The nightly selection is green
You noted it wasn't run locally, and the PR gate skips these files, so I ran them: on 8ccaac0e's merged tree, test_render_navigation.py and test_render_conversations.py 234 passed, and test_render_controls.py, test_render_margin.py and test_render_projection.py 357 passed. After the base merge I re-ran this change's own cases and every -k ring case in test_render_controls.py, including the two new specimens — green, so the theme-to-shadow move carried the card ring across intact.
The one red in that first batch was test_a_stamped_live_draft_and_its_unstamped_view_keep_distinct_menu_rows timing out on a .lf-latest-chip click. It is untouched by this diff and passed alone and again on a full re-run of its file under the same parallelism, so I'm reading it as load-dependent rather than yours.
…e, and where the fallbacks stand The reviewer of #832 found two sentences under Runtime ownership still describing the model before this branch: the thread-panel entry offered its rungs to any reader without a keyboard entry, and the keyboard-meaning row ran the causal frame ahead of every fallback. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Both sentences are fixed in 03257af: the thread-panel entry now names the frame every press that opens the panel records and offers the rungs only to a panel no press opened, and the keyboard-meaning row runs what the reader put on since a nowhere-standing frame ahead of that frame, then the remaining fallbacks.
|
…its container The standing floor told a destination from one of Leaf's controls by asking whether the focused element sat inside `.lf-chrome`. A margin marker and a mark note are placed in the document beside the words they mark, outside that container, so the floor took them for destinations: a marker reached by Tab offered "let go" where the Threads toggle beside it, a control of the same standing, backs out onto the page. #832 named the unfolded cluster's case by hand through the Page Map's rung and left the folded marker wrong (focus-stack page, #4). The floor now asks what is held. The chrome container — banner, trays, panel head — holds nothing to let go of, as before. Out on the page, a thread — a card in the panel, a seat on the page — or an Ask is a destination, and so is anything inside one, including a card's own buttons and an Ask's picks, which wear the chrome face too. The Ask is the asks view's own reading, handed in through `declareStanding` like the modes and the Page Map's rung: it resolves a control hoisted into the margin to the Ask it serves, and an answered Ask is still one, so the word does not move under an unmoved focus when Space answers and the ring comes off. Outside those, `inUi` is the one reading of whether a node is Leaf's apparatus or the page's own content, which the margin's controls and the mark note already answer with `.lf-ui`; it is asked of the deepest focus, so a control staged in a shadow tree answers for itself. The Page Map's rung stays asked, for the reason the panel and the native layers are: it is a layer the reader is inside, not a chrome question. The walk destinations keep `inChrome`, whose question is the other one: whether an Ask or a heading is the page's own or a copy in the panel's frozen markup. `standingThreadOf` in conversation/focus.js is the thread reading on either side; `focusedThreadOf` stays the panel's, being the anchors module's question. `heldAsk` in asks/view.js is the floor's Ask reading beside `standingIn`, the walk's. Behaviour that moved in the suite: the key-line test read the release row on a Tab-focused mark note, and reads the ladder's back-out row there instead. A new case puts the toggle and a folded marker side by side and reads the same word off both; another reads "let go" off a pick before and after it answers. Leaf's apparatus outside any thread or Ask — a contents outline's links, a pressable option outside an Ask, a widget's own buttons — backs out onto the page now rather than letting go. Both land on the body from a bare page, and the order moves with the word: letting go is an inner step ahead of every frame, while backing out is the ladder's outermost rung, so with a pointer-opened panel behind the reader, Escape on one of these closes the panel first, as it does on the Threads toggle. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… event id off --section (#837) `publish-site` on `main` failed at the deploy gate's hosted-agent pass. The turn spent three commands failing to reach Leaf's reply interface, and the revision that did reach the page never carried the heading the ask named. This PR fixes the two dead ends those three commands hit: a refusal that offers no recourse when `--section` is handed an id from another namespace, and five printed command forms that omit their required `PAGE` argument. It does not make the failed run green — what the turn chose to publish is the model's, and the section below says why I did not reach for the gate's retry instead. ## What the run did The gate reported: ``` RuntimeError: https://leaf.page/examples/triage-board/ agent did not publish ‘Deployment de34a7d1 verified’; it reached revision 2 from 1 with the page reading listening; it replied: deployment verified ``` Workers Observability for that turn (event `56f596b2765bf1b5f1a6f40bc4232ab6`, turn `01a0b800-c8fd-7f72-a404-2316ffc1f704`) records the sequence: one `commandExecution` at exit 0, one `fileChange`, then three `commandExecution` items with status `failed` at exits 1, 2 and 1, then the final model message the host published as the reply. No publish command ran at all. The gate's own activity profile names the three that failed: ``` $LEAF reply --section 56f596b2… --quote 'deployment verified' "deployment verified" $LEAF reply . --section 56f596b2… "deployment verified" $LEAF reply . --section 56f596b2… --text "deployment verified" ``` One wrong belief runs through all three: that `--section` takes the delivered event id. It takes an element id. The first also drops the `PAGE` argument entirely, so `"deployment verified"` landed as the page directory. Revision 2 was not one of those three. `_capture_anchor` exits before `activate_checked_source` runs, so a reply refused on its section activates nothing; the turn's only other write was the host-bound final message, whose reply carries `validate_source=True` and so activated the edited `index.html`. What that revision actually held is the one thing the records do not say — no content is logged, by design — so whether the model wrote a different heading or the gate's fetch of the private revision never landed is not settled here. Either way the turn reached its reply through a route that never confirmed the edit. The 503s earlier in the same log are separate and already answered: the image rollout draining, absorbed by the workflow's own `until` loop, with #835 since landing the reading that names them. The commit under test (#832) changed only browser runtime modules and their tests, so it did not cause this. ## What changes **The refusal names the namespace.** Reproduced at the CLI, `leaf reply <page> --to <id> --section <that same id>` exits with `can't anchor in revision r1: no element id '…' in this version` and nothing else, sending an agent that holds a log id to look through the page's markup for something that was never there. `_foreign_id_recourse` in `conversation.py` reads the log, and when `--section`'s value is an event there the refusal continues: ``` ; <id> is a comment in this page's log — `leaf reply <page> --to <id>` answers a message and `--for <event-id>` addresses a delivered move, while `--section` takes an element id the page's markup declares ``` It sits at `_capture_anchor`, the one door both `leaf comment` and `leaf reply` reach `--section` through, and it stays silent unless the log actually holds the value, so the existing typo refusals are untouched. `--for` is named for every kind the log holds, not only for a message. A reader's press on a widget frozen into a reply is addressed through that action event's own id and nothing else — `current_responses` returns a reply obligation keyed on it, and `--to` names messages — so gating the pointer on a message kind would have left the one case where a single option is the only route without one. The article is derived rather than fixed, so `action`, `undo`, `edit`, and `unresolve` do not read as "a action". **Every printed command form carries its page.** `leaf comment --section <ask-id>` cannot run: `PAGE` is a required argument, so the next token is eaten as the page directory. It was printed that way in five places — `ANSWER_ASK_INSTRUCTION`, both `requires a page version` refusals in `cmd_reply`, and the `comment` and `reply` handling sentences in the layer registry, which is the vocabulary an agent reads for the exact event it is answering. The public reference in `references/conversation-threads.md` already writes every form with its page; these now agree with it. ## Why not the gate's retry The turn replied without doing the work, and `ask_until_answered` re-asks only on a `startup_failed` receipt, so that shape gets one ask. Widening it is where #791 went, and you closed that with "rather than adding retries / conditional retries, can we fix the underlying issue that's causing the need for retries?" — so I have left the gate alone and fixed what the turn actually ran into. What remains unaddressed is the model's own choice, which no change here reaches. ## Verification Two new cases in `tests/test_interact_anchors.py` — one for a message id handed to `--section`, one for a delivered widget press — each fail against the refusal they replace with exactly its production message, and pass with the fix. `uv run pytest tests/test_interact_anchors.py` is green (53 passed), as are `tests/test_interact_product.py` and `tests/test_interact_contract.py` (329 passed). <details><summary>Wider selection and its environment failures</summary> `uv run pytest tests/test_interact_session.py tests/test_interact_layer.py tests/test_interact_contract.py` ran 627 passed, 3 skipped, with 2 failures and 2 errors that belong to this sandbox rather than the change: three are `OSError: [Errno 30] Read-only file system` on `/tmp`, which the agent sandbox mounts read-only, and `test_staged_writes_honor_umask_without_copying_a_replaced_symlink_mode` reads the sandbox user's umask. None touch the anchor or conversation paths. </details> `publish-site` has since gone green on `main` twice, at `ce11d502` and `d21cd640`, so nothing is currently red and this is not urgent. Failed run: [35422088941](https://github.com/max-sixty/leaf/actions/runs/35422088941). --------- Co-authored-by: leaf-agent <[email protected]> Co-authored-by: leaf-agent <[email protected]>
Escape had three unrelated answers: a command's return frame, the scene-read rung ladder, and a popover's own dismissal. None knew about standing on a destination, and a layer opened by pointer had no record of where the reader came from. So
tfrom the page left the reader on a rail control they never stood on, a card in the Threads panel could not be let go of without closing the panel, a click on Threads cost an extra Escape and ended on a ringed toggle whose Space reopened the panel, and a clicked margin marker followed bytclosed onto the marker of whichever thread the walk reached.One rule now: the way out is as deep as the way in, counted in presses, whether the way in was a key or a click.
What changed
Standing is a rung of its own. A card in the panel, an Ask or a heading on the page: a STANDING scope lets go of it onto the layer's floor, the list or the body, ahead of the return frames. A press that stood the reader somewhere records a frame that holds the standing (
t,a,g Tcarrying an inline thread); a frame whose press stood nobody saysstanding: false. The scope sits right after the return frames, so a narrow shortcut bar promotes its Escape chip the way it promotes a frame's. The walked-to card wears the same inset ring every other keyboard target does;TODO.mdrecords that the ring's weight is tuned once for all of them.A pointer press that opens a layer is a stack entry.
pressOrigin()inkeyboard/layer-stack.jshands out the place focus held at the last pointerdown, before the press moved it. The Threads toggle, a margin marker or option, a page mark and its note all open throughinvokewith that origin, so a clicked-open panel or conversation view closes to the page the reader was reading, and the same control reached by keyboard and pressed with Enter comes back to that control. A keyboard or scripted activation is told apart by the click's owndetail === 0, read in the capture phase. A timer at pointerup lost to a key pressed straight after a click, and a key listener is what the register's own test forbids.What the reader put on since the press comes off first. A frame that stood the reader nowhere names the
surfaceits press entered.outsideCurrentFrameis the one reading of what follows: an Escape step rooted outside that surface, and not already answering when the press was made, unwinds ahead of the frame. Unframed state records no time, so the stack takes a census of the steps answering Escape as each such press is made; the dispatcher installs the census, and the fallback ladder's one command names the rung it stands for. That covers a selection, a comment box, a clicked reply box, or an unfolded margin cluster made after the panel opened, while a target captured beforeg Tstays behind the panel's Escape.The panel has one frame. It had been built by hand at three doors and had drifted: the words promised a close while the press showed every thread.
panelFrameinthread-panel.jsserves the toggle,g T, and the page-thread door's panel half. Its close takes off a narrowing put on since the press before it closes the panel, its words follow that ("show all", then "close threads"), and its standing reads live.g Tover an open panel closes it outright.Ported onto #815. The standing floor lives in
keyboard/page.jsbehinddeclareStanding, the ladder drops its "standing" rung, and thetandawalks carry their frames innavigation.jsandasks/view.js. The deferred half ofrestoreReturnPlaceasksretainReaderIntentbefore it moves anyone, soreader-intent.jsjoins the dispatcher's declared closure.skills/leaf/assets/CLAUDE.md's runtime-ownership entries for the panel and for keyboard meaning say the same order.Behaviour that moved in the suite
The panel's Escape after a pointer open lands on the page rather than ringing the toggle, which the rung test had recorded as the old design's cost. A margin option pressed from inside a keyboard-unfolded cluster returns to the control the reader stood on. The card-ownership test reads ownership off the control's aria state instead of off where focus lands. The facets test reads the frame's words before and after its narrowing comes off. New cases cover the press journeys, the mark and carry-in doors, and state put on after the panel; each fails with its fix disabled.
Known limits
The census compares steps by name, so a selection that replaces an older one still counts as the older one. A pointer close through the view's × or the panel's Close button still lands on the marker or the toggle, since the hand is there. Clicking Threads from inside a marker's view and pressing Escape reaches the page one frame after the panel closes. Browser tests ran in Chromium only. The reviewer ran the nightly selection on the merged tree and it was green.
Verification
The everyday suite: 1148 passed.
test_render_margin113,test_render_projection152, and the targeted navigation, conversations and controls cases passed after the last merge from main. dependency-cruiser and eslint clean.