Skip to content

Name a thread's identity its id in Python, so a torn thread is found by it - #1266

Merged
max-sixty merged 1 commit into
mainfrom
thread-identity-id
Sep 27, 2026
Merged

max-sixty merged 1 commit into
mainfrom
thread-identity-id

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

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

…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]>
@max-sixty
max-sixty merged commit 21c2b67 into main Sep 27, 2026
5 checks passed
@max-sixty
max-sixty deleted the thread-identity-id branch September 27, 2026 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants