Repository navigation
Serve the readings the browser recomputed, keeping only its local-send overlay - #2480
Merged
Merged
Conversation
The server selects what is on the user, on the agent, and done (served_state.queues) in each browser view, and page state prints the same lists. The publisher places this tab's sends against them (localQueues): a Done or approval moves an item, prose sent in a thread takes its Question off the user, and a pending or refused send adds its answer or retry. queues.js no longer selects the queues a second time. A task's running start is the start that holds it: one gone quiet past the working grace holds nothing, so the Questions panel no longer shows a live line the thread card calls Task open (T1). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The browser read which thread a logged event belongs to again in JavaScript, and a pending move on a page widget stood in no thread, so accepting a suggestion that closes a thread left that thread's held news held (T4). Each browser state now serves event_threads, the log's own reading (thread_context.event_threads), and each view serves closes: the thread an answer on each widget would close (questions.closed_thread, which admission also reads). The publisher's gestured threads add the thread a pending move would close, and an undo concerns the threads its target did, from the ledger or the log. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A Question's prompt came from the server's reading of the authored heading, while the browser named the same elements by their visible words, which include a gloss's tip, and read x-name after the heading where the server read it first. One Questions panel mixed the two (P1). gesture_words.element_name is the server's rule (x-name, else the leading title, in authored words), and questions read it. addressableName reads the wrote reading. tests/name_cases.json holds both runtimes to the same cases; the browser keeps its reader because it names any live element, including ones the server never parses. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The banner listed the awaiting step kinds a second time beside activity's AWAITING_KINDS. Activity now serves awaiting with observed_kind, and the banner reads it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ntent version Three readings the browser restated now come from the server: - Each view serves approval_blocking, the Questions approving it waits on, by questions.approval_blocking, the rule the append door refuses a sign-off by. approvalBlockingQuestions selects those records. - Each served workflow carries at_work (working or replying), which thread/workflow.js listed again as atWork. - Each served message carries content_version (read_state.content_version), which messages.js and read.js derived from edited.id. A pending message or rewrite names its own, and a rewrite's base is the version it is written over. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…one shape The browser rebuilt the server's state-definition machinery (registry-contract.js mirrored registry.contract) to filter the served projection again and to stamp its pending moves. The served projection was already folded under each view's registry, so the browser now draws it as served, and each view serves state_definitions, the definition of each verb the user writes. A pending move carries that definition and stops drawing once a revision defines the verb differently; the browser only compares two definitions. state_definition_cases.json now holds the Python reading alone. An attribute record's value took three shapes: the server's sorted list, the browser's space-joined string, and the authored list. It is a sorted list everywhere, so the browser uses the served value instead of recomputing it, and version comparison compares lists. An x-exhibit element quotes what stands inside it, not itself, in the browser as in questions.quoted_in. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/scripts/leaf/agent_state.py
…on close nothing Review findings on the served readings: - A refused follow-up stood on the agent's queue and hid the answer its thread was owed; only a forward send still in flight stands for that answer. - A pending rejection of a suggestion counted as acting in the thread it would close. Each view's closes now carries the verbs that answer and the outcome that withdraws the request, so the browser files a pending move as event_threads will. - A frozen widget's state definition came from the shown version's registry; the thread serves its own, under the active registry its projection reads. - The browser's comparison of served definitions runs the shared state_definition_cases again, each built by the server. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…a queue item is in hand Further review findings: - A move replacing a thread-closing answer reopens that thread, but the browser did not count it as acting there. event_threads now serves thread_memberships, every thread whose history an event changes, and a pending move concerns the threads the logged move it replaces did. closes names the thread by the exact id build_threads closes. - Two pending sends in one thread counted two answers; a thread is owed one. - A stalled move's queue row drew as live. Each served queue item says whether the agent has it in hand now (live): a task a start holds, or a move at work whose work has not gone quiet or stopped. - agent_state's header and semantic-news.test.mjs named the old homes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/assets/runtime/registry-contract.js # skills/leaf/assets/runtime/thread/held-news.js # skills/leaf/assets/runtime/thread/workflow.js # skills/leaf/scripts/leaf/activity.py # skills/leaf/scripts/leaf/agent_state.py # skills/leaf/scripts/leaf/served_state/browser.py
…cabulary The browser state's event_threads carried thread_memberships, so it takes that name. An item the user ends locally is no longer in hand. New prose says action and update where it said move, as the glossary now does. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # build/browser/application.test.mjs # build/browser/application.ts # skills/leaf/assets/runtime/queues.js # skills/leaf/assets/runtime/registry-contract.js # skills/leaf/assets/runtime/version.js # skills/leaf/assets/vendor/browser-runtime/application.js # skills/leaf/scripts/leaf/agent_state.py # skills/leaf/scripts/leaf/questions.py # tests/runtime/queues.test.mjs # tests/runtime/registry-contract.test.mjs # tests/test_questions.py
A held message kept the words it was drawn with but took the rewrite's content version, so the notice counted an edit as a new reply, and the words held back would have been marked read as the rewrite. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/assets/runtime/anchor-resolution.js # tests/runtime/addressable-name.test.mjs
`questions.quoted_in`, the browser's `quoted` and the descriptor's staged `quoted` flag each read whether a widget stands strictly inside an x-exhibit. tests/exhibit_cases.json now holds all three to the same cases; counting the exhibit itself as quoted fails every case. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
previously approved these changes
Oct 12, 2026
…d copy of the rule The browser placed an action it had not sent yet in the thread it would close by a served `closes` map: the widget's thread, its answering verbs and its withdraw outcome. That restated admission's answer rule without each verb's own condition, and the replaced-action lookup needed a local projection a pending action may lack. A thread an answer closes changes only in the reading that logs the answer, so the gesture needs to concern it from that reading on, and that reading carries the log's own filing (`thread_memberships`). `thread.gestured` now reads an entry's memberships once a reading holds its event, and before that only the thread it stands in, or for an undo its target's threads. `closes`, `questions.closed_thread` and the replaced lookup are gone. Behavior change: held news in a thread an accepted suggestion closes now shows with the reading that closes it rather than at the press, which is when the thread first changes. Also corrects declared-words.js, which still said quoted() counts the exhibit itself. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…emberships `thread_memberships` filed every later action at a coordinate under each thread an earlier answer there had closed, even after that answer was undone or a version note retracted what it rested on. A revised suggestion that resolves another thread then counted as acting in the first thread too: wait delivery handed it to that thread's waiters, and the browser, which now reads these memberships for held news, released the first thread's held news when the user accepted the revision. The relation now keeps, per coordinate, only the answers still standing: an undo takes its target out and a restating note takes out the answers it retracts. A note no longer names a thread whose answer was already taken back. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… settles by The previous commit pruned undone and retracted answers from a per-coordinate list, which still disagreed with the fold in two ways review found: an old tab's answer admitted after a version had already retracted what it rested on was kept, and a note retracting a superseding action left out the thread its predecessor settles again. Rather than track answers beside the fold, the relation now reads, for each action, undo and restating note, which action wins each coordinate it touches before and after it, by the fold's own test (not taken back, not `action_retracted`), and files the event under the threads the old and new winners answer. A randomized test holds every change `build_threads` makes between consecutive prefixes of a log to the event's membership; main's relation and the previous commit's both fail it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…nners Reading winners before and after each event matched `build_threads` but dropped provenance that sample selection replays (a note retracting an answer a later action had superseded, which an undo of that action brings back), and rescanned retired actions on every search, taking seconds on a log of a few thousand events. The pruning relation from faff579 keeps that provenance in linear time. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
An action from a tab still showing an older version can be admitted after a later version retracted what it rests on. The fold never settles a thread on it, so a later action at its coordinate changes nothing there; the relation now reads the retraction floors the log has reached before holding an answer. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
reviewed
Oct 12, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The unfiltered thread projection can break a pinned earlier revision. Thread decisions are classified under the active registry, while the pinned document can lack a verb added later. normalizedProjection now includes that decision anyway; when its provenance is read against the pinned document, projectionOrigins throws Missing authored state for choice/pick. I reproduced this with a newer pick decision served to a revision whose widget only defines its earlier verb. Keep entries whose operation the shown document can draw, either at the server boundary or in this projection join. #2482 overlaps this path and includes a test for the case, so the two changes need to be reconciled before either lands.
Main's #2484 folded the browser's exhibit reading into the widget descriptor (`quoted` in widget-descriptors.js) and counted the exhibit itself as quoted; the merge keeps that one home and this branch's strict rule, which `questions.quoted_in` and tests/exhibit_cases.json hold. The version comparison's state half takes main's publisher-based reading, and the served projection entries key their coordinate with `stateCoordinate`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Main's #2482 stamps each verb's writer and admitted definition into the registry's `$states`, which the browser already holds. That is now the one home: the per-view and thread `state_definitions` this branch served are deleted, and the browser's pending-action and projection checks read the stamped definition, keeping main's filter for a pinned revision's thread entries. Served projection values stay as served (attribute records are already sorted lists in both runtimes). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 12, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 12, 2026
#2480 moved the queues to the server and laid this tab's sends over them in localQueues, which reads each Question's next actor from its record. The owed overlay stays in questionAttention, which feeds it; the widget-Question set main kept in derive is the server's `after` reading here. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 12, 2026
…gesture's turn Since #2480 the browser places its sends against the served lists rather than selecting Questions itself, and those lists held a resolved thread's ask nowhere: not on Questions, since no one owes it, and not in done, since it is still open. A pending reply or reopen put the ask back on the user's record, but no Questions row followed until the POST returned. The server now serves those asks as `held`, and localQueues places one whose record the pending gesture gives the user, as it places every other served item. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 12, 2026
…s as their log leaves them (#2515) Two follow-ups from #2480, both bugs that were already on main. **A version note that brings back a superseded answer is filed under that answer's thread.** When a note retracts only the action that had replaced an answer on a widget, the answer wins again and `build_threads` closes its thread again. `thread_memberships`, which wait delivery and the browser's held news read, never filed the note under that thread, so neither saw it. Memberships now track every standing action per widget coordinate and, when a note retracts the winner, file the note under the thread the restored winner answers. Standing answers are counted per thread, so an action joins the distinct threads at its coordinate in constant time: 16k actions at one coordinate fold in about 20 ms, against about 3.5 s on main. **A sampled child page starts with its threads as the source log leaves them.** `sample_events` copies selected threads into a child page with one revision, and got that wrong three ways: - It passed `SourceDocument.within` (id → the record of the `lf-*` element holding it) where `action_rests_on` expects enclosing ids, so an action's declared dependencies never counted. The attribute is now `holders`; `InitialPageView.within` had the same mix-up and now reads `enclosing_ids` too. - It rewrote every copied event to revision 1, notes included, so nothing a later version retracted stayed retracted in the child. Retractions are now applied before copying: retracted actions, notes, and undos of anything left behind stay out. - It copied only events filed under a selected thread, so an action that answered nothing but wins again once the answer superseding it is retracted was lost. Every surviving action at a coordinate a selected thread acted at is now copied. No shipped sample log holds a restating note, and the regenerated corpus is unchanged. Tests: a restored-answer case in `test_a_gesture_at_a_coordinate_reaches_only_the_answers_still_standing_there`, and `test_a_sampled_thread_starts_as_its_source_log_leaves_it`; each fails with its part of the fix reverted. > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
added a commit
that referenced
this pull request
Oct 12, 2026
Undoing a rejection restores the earlier acceptance, which resolves the question's thread. Since #2480, the browser associates the undo with that thread through the log's membership. The old test expected a held news notice in Open; the user's own undo instead folds that resolved card out of Open. This test now checks that the card leaves Open and remains available with `data-resolved="true"` in the Resolved view. The event-log assertion still verifies that no separate resolve event was written. The [failed main run](https://github.com/max-sixty/leaf/actions/runs/38211557350) timed out waiting for the obsolete notice. The focused test failed before this change and passed afterward: `uv run pytest tests/test_render_startup.py::test_the_thread_follows_the_decision_that_still_stands -q -n0 --tb=short`. Co-authored-by: leaf-agent <[email protected]>
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.
The browser used to work out several readings again from the served state, each a second copy of a Python rule (the duplicate-logic sweep, workstream #7). This PR moves those readings to Python. The browser now draws what the server sends and adds only its own unsent updates on top.
Three of the copies were already wrong in ways a user could see:
activity._canonical_tasksclearsrunningonce the start goes quiet, and queue items carry a servedliveflag.lf-suggestionthat resolves a thread left that thread's news held. Held news now files each update under the threads the log files it in (thread_memberships) from the reading that logs it, which is the reading that resolves the thread. Before that, an update concerns only the thread it stands in, so the browser no longer restates which actions answer.thread_membershipsalso stops filing a later action under a thread whose earlier answer at that widget was undone or retracted by a newer version.lf-glosswas named with its tip text in some places. Both runtimes now name an element from the author's own text (gesture_words.element_name, andaddressableNamereadingwrote).What the server now serves
served_state/queues.pybuilds the On you, On agent and Done lists for each view, andpage stateprints the same lists.localQueuesinapplication.tsplaces the tab's unsent Done, approval, undo, reply and refused-send updates against them. The browser no longer selects queue items itself:selectQueuesandselectDoneare deleted.approval_blocking,at_workon each workflow,awaitingon activity, andcontent_versionon each message. Verb definitions come from the registry's$states, which main's Stamp verb writers and definitions into $states, and give passage constants one home #2482 stamps.x-exhibit, in both runtimes; main had counted the exhibit itself in the browser.Copies kept on purpose
Each one that stays has a case file that both runtimes run:
tests/name_cases.jsonfor element names. The browser names live elements the server never parses.tests/exhibit_cases.jsonfor exhibit containment.Contract changes
/api/stategains the fields above.live.runningis null once its start goes quiet.server_rowsactivity needsawaiting, so a row written by an older Leaf reads as absent.Testing
The T1, T4 and P1 tests each fail with their fix reverted. Most new tests adopt states the server builds (
tests/served_records.py) rather than hand-built ones.