Repository navigation
Key threads on their id in the runtime, so a thread that lost its opening message takes replies - #1260
Merged
Conversation
leaf-agent
approved these changes
Sep 27, 2026
max-sixty
added a commit
that referenced
this pull request
Sep 27, 2026
The concept survey's drifted duplicates now each have one owner (#1214–#1221, #1223, #1228, #1231, #1235, #1244, #1245, #1247, #1250, #1251, #1254, #1260), so the survey note never lands. What it found and nobody has taken becomes `TODO.md` entries: - **Shared definitions** (new section under Next): re-addressing resource references in one pass instead of `http.py`'s regex scopers and three head composers; `tests/render_harness.py` `told()` beside `pageReadiness`'s `data` and `log` stages (#1250), which answer the same question; Python still naming a thread's identity a root (`thread_roots`, `FrozenThreadReading.roots`) now that the runtime keys threads on the served `id` (#1260). - **Requests**: the existing "Decide whether requests earn their weight" entry now says kept requests need one owner for seat availability, which four runtime modules restate. - **Implementation candidates**: the unresolved-gesture ledger as one state machine, deferred until a change has to touch it, since nothing there has drifted and it is the hottest race path. The survey's small undrifted items and its list of deliberate splits are dropped: none has drifted, and the splits are intended. 🤖 Generated with [Claude Code](https://claude.com/claude-code) > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Sep 27, 2026
…by it (#1266) The runtime keys threads on the served `id` (#1260), but Python still called that identity a root: `thread_roots`, `FrozenThreadReading.roots`, and the `root`/`root_id` locals and parameters that carried it. For a thread whose opening comment a torn line lost, the id is the lost comment's and the root (`build_threads`' `root`) is the surviving reply, so the two names meant different things. Three readings looked a thread up through its opening comment and so missed a torn thread. **One relation, named for what it maps.** `thread_roots` becomes `thread_names`: every name that reaches a thread, mapped to the thread's id. Like the runtime's `threadNames`, its keys now include a torn thread's own id as well as each message id, so `event_threads` reads a resolve naming the lost id by a plain lookup instead of searching the map's values. `FrozenThreadReading.roots` becomes `thread_by_name`, beside `thread_by_widget`. Parameters and locals in `read_state`, `history`, `agent_state`, `asks`, `delivery`, `transcript`, `projection`, `admission` and `thread` that held a thread id are renamed to say so. `root` stays where it means the opening message: `build_threads`' `root`, `seat_root`, and `cmd_reply`'s check that the opening comment survives and holds no command goal (now `opening`, beside `thread_id`). **What moved for a torn thread:** - The history feed (`x-history`) names the thread each row was made in. It looked the thread up through its opening comment, so every row in a torn thread named none. It now reads the thread from the `build_threads` fold by id. - `comment_ids`, the namespace `lf-suggestion`'s `resolves` and `data-specimen-threads` are checked against, held the comments in the log and left out a torn thread, whose id the page state serves. It becomes `thread_ids`, the values of `thread_names`, so a suggestion resolving a torn thread validates. The refusal now reads `names no thread in this document`. `specimen_events` drops its intersection with that set, which the membership filter below it already applied. - `leaf thread reply --to <id>` with a torn thread's id, the natural move for an agent holding a thread id, was refused as an unknown comment id. The refusal (`logged_id`) now says the thread lost its opening message and gives the `--to` of the first message it still holds. `validation.md` and `page-authoring.md` say thread ids where they said root ids. **Tests.** `test_a_thread_whose_opening_message_was_torn_away_still_reads` now checks `thread_names`, the history rows of the torn thread, and the `--to` refusal. `test_suggestion_resolves_a_thread_whose_opening_comment_was_lost` covers the namespace. Each new assertion fails with its fix reverted. Three tests follow the refusal's new wording. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 (1M context) <[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.
A thread's
idis now its one identity in the runtime, and itsrootis a real message. Before this, the user could not reply to or resolve a thread whose opening log line was torn: the append door refused both withunknown parent.The bug. When a torn line loses a thread's opening comment,
build_threadskeeps the thread under the lost id. #1237 made the thread read correctly by giving the surviving reply a copy of the lost id as its root ({**reply, "id": parent}inevents.py, and the same fallback inthread/model.js). The runtime keyed threads onroot.id, so that made attention and the card id line up. But the root is also what a reply or resolve addresses as itsparent, and the lost id names no message. So the panel drew the thread, and then the append door answered 400 to every reply and resolve in it.test_a_panel_reads_a_log_that_lost_the_message_a_reply_answersnow replies and resolves in such a thread and checks that both land withparent: "tv-kept". On main the reply is refused.One identity.
build_threadsgives each thread anidfield. For a torn thread,rootis the surviving reply under its own id, the same record asmsgs[0]. The served state now carriesidfrom the fold instead of adding it separately, andthread_digestreads it.thread.id: placement and marks (anchor-paint,drawing-paint,placement,surfaces,thread-list), travel and reveal (anchor-travel,narrowing,margin-projection), attention and workflows (application.ts,thread/model.js), news (semantic-news), frozen message documents (state-application), holds (presentation,heldBy), and card ids.root.idis read only where a message is meant: theparentof a reply or settlement, and a thread's turns.threadNamesinthread/model.jsmaps every name that reaches a thread to it: its id, each message's id, and each pending id this tab sent.foldThreadsuses it to attach pending replies and settlements. The publisher uses it to find which thread a local or refused reply belongs to. That replacesmessage.parentused as a thread id, and the separatePENDING + root.attemptlookup for recovery.root(the message that replies and settlements address) besideid.wireReplytakes the draft key and aparentreader instead of a stand-in thread object, andsettleThreadtakesparent.Selectors.
thread/selectors.jsnow exportsTHREAD(.lf-thread, .lf-page-thread), andSAYS_INis built from it.thread/replies.js,thread/landing.jsandthread/focus.jsspelled those selectors out; they now import them.Contract.
references/packages.mdnow saysopenThreadtakes the Thread'sid, thatheldByis a Thread id, and thatrootcan differ fromid. The Thread-filter widget test from #1257 opens threads bythread.id.Tests. Thread fixtures in
application.test.mjsandtests/runtime/now carry the servedid. A new publisher test covers a torn thread: its Ask attention, the subject of a pending reply's workflow, and recovery after a refused reply, all under the lost id. WiththreadOfreverted tomessage.parent, that test fails. The Python torn-thread test checks thatidis the lost id androotismsgs[0]. Helpers that looked up served threads byroot.id(model_folds.threads,test_read_state,test_interact_session,test_render_pages) now useid.For every thread whose opening message survives,
id == root.id, so nothing moves outside the torn case.🤖 Generated with Claude Code