Repository navigation
Name a thread's identity its id in Python, so a torn thread is found by it - #1266
Merged
Merged
Conversation
…by it 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. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Sep 27, 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.
The runtime keys threads on the served
id(#1260), but Python still calledthat identity a root:
thread_roots,FrozenThreadReading.roots, and theroot/root_idlocals and parameters that carried it. For a thread whoseopening 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 meantdifferent 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_rootsbecomesthread_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 idas well as each message id, so
event_threadsreads a resolve naming thelost id by a plain lookup instead of searching the map's values.
FrozenThreadReading.rootsbecomesthread_by_name, besidethread_by_widget. Parameters and locals inread_state,history,agent_state,asks,delivery,transcript,projection,admissionand
threadthat held a thread id are renamed to say so.rootstays whereit means the opening message:
build_threads'root,seat_root, andcmd_reply's check that the opening comment survives and holds no commandgoal (now
opening, besidethread_id).What moved for a torn thread:
x-history) names the thread each row was made in. Itlooked the thread up through its opening comment, so every row in a torn
thread named none. It now reads the thread from the
build_threadsfold byid.
comment_ids, the namespacelf-suggestion'sresolvesanddata-specimen-threadsare checked against, held the comments in the logand left out a torn thread, whose id the page state serves. It becomes
thread_ids, the values ofthread_names, so a suggestion resolving a tornthread validates. The refusal now reads
names no thread in this document.specimen_eventsdrops its intersection with that set, which the membershipfilter below it already applied.
leaf thread reply --to <id>with a torn thread's id, the natural move foran 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 givesthe
--toof the first message it still holds.validation.mdandpage-authoring.mdsay thread ids where they said rootids.
Tests.
test_a_thread_whose_opening_message_was_torn_away_still_readsnow checks
thread_names, the history rows of the torn thread, and the--torefusal.test_suggestion_resolves_a_thread_whose_opening_comment_was_lostcovers the namespace. Each new assertion fails with its fix reverted. Three
tests follow the refusal's new wording.
🤖 Generated with Claude Code