Repository navigation
Serve lf-activity a history reading instead of folding the log in the browser - #1078
Merged
Merged
Conversation
… browser
lf-activity folded the raw `watchHistory` log in the browser. It walked
`parent` to find thread roots, collected `undo.undoes`, read titles from
`conversation_title`, and worded widget gestures from the live DOM
(`getElementById(event.widget)` and its x-state). Python already owns each
of these readings: `build_threads`/`thread_roots`, `taken_back`, and
`GestureWords`, which reads a gesture's ids in the gesture's own document.
Because the widget read the live DOM, a later version changed what a past
gesture said. Reproduced on main: pick "Fast path", then stamp a revision
that rewords the option (`restated`), and the row reads "chose “Quick
route”". Remove the question and the row reads "recorded “choose” on
route".
`leaf/history.py` now derives one served row per move, newest 50 first.
Each row carries the actor, its thread with the thread's current title,
whether a later undo withdrew it, and for a widget gesture the record form
and names from the gesture's own document. `GestureWords` gains `name`
(`x-name`, else the leading summary/heading/strong, else the words),
`declaration`, and `operation` (a request's offered child), and reads
revisions through a reader, so `browser_state` can serve it from the
documents it already holds. lf-activity words the rows it receives and
names on the live page only the places it links to.
The reading costs payload only on pages that render it. A new registry key,
`x-history`, gates it: `browser_state` serves `history` only when a served
document holds a widget declaring it. `lf-activity` declares it.
The transcript already reads `GestureWords` and `taken_back` directly and
prints every edit with its raw detail. Switching it to the 50-row feed
would drop rows and remove no parallel derivation, so it keeps its own
readings.
Behavior that moved:
- `watchHistory` delivers the served history rows, not raw events. A page
with no `x-history` widget gets an empty feed.
- An action row keeps the words from the version the user acted on, and a
retired widget's pick keeps its verb form ("chose …" rather than
"recorded “choose” on …").
- A request or receipt row names its operation from the request's own
document, so it survives removing the holder.
- New tests: a browser case for the reword/remove sequence and a fold test
for the undone row and the `x-history` gate. docs/registry.html is
regenerated for the new key.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Sep 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
lf-activity folded the raw
watchHistorylog in the browser. It walkedparentto find thread roots, collectedundo.undoes, read titles fromconversation_title, and worded widget gestures from the live DOM(
getElementById(event.widget)and its x-state). Python already owns eachof these readings:
build_threads/thread_roots,taken_back, andGestureWords, which reads a gesture's ids in the gesture's own document.Because the widget read the live DOM, a later version changed what a past
gesture said. Reproduced on main: pick "Fast path", then stamp a revision
that rewords the option (
restated), and the row reads "chose “Quickroute”". Remove the question and the row reads "recorded “choose” on
route".
leaf/history.pynow derives one served row per move, newest 50 first.Each row carries the actor, its thread with the thread's current title,
whether a later undo withdrew it, and for a widget gesture the record form
and names from the gesture's own document.
GestureWordsgainsname(
x-name, else the leading summary/heading/strong, else the words),declaration, andoperation(a request's offered child), and readsrevisions through a reader, so
browser_statecan serve it from thedocuments it already holds. lf-activity words the rows it receives and
names on the live page only the places it links to.
The reading costs payload only on pages that render it. A new registry key,
x-history, gates it:browser_stateserveshistoryonly when a serveddocument holds a widget declaring it.
lf-activitydeclares it.The transcript already reads
GestureWordsandtaken_backdirectly andprints every edit with its raw detail. Switching it to the 50-row feed
would drop rows and remove no parallel derivation, so it keeps its own
readings.
Behavior that moved:
watchHistorydelivers the served history rows, not raw events. A pagewith no
x-historywidget gets an empty feed.retired widget's pick keeps its verb form ("chose …" rather than
"recorded “choose” on …").
document, so it survives removing the holder.
for the undone row and the
x-historygate. docs/registry.html isregenerated for the new key.
Tests:
uv run pytest tests1355 passed;npm run test:runtimegreen.🤖 Generated with Claude Code