Skip to content

Read whose turn a thread is, and which thread a move is in, one way each - #1215

Merged
max-sixty merged 3 commits into
mainfrom
consolidate-thread-turn
Sep 26, 2026
Merged

max-sixty merged 3 commits into
mainfrom
consolidate-thread-turn

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Whose turn a thread is, and which thread an event belongs to, each had several definitions that had drifted apart. This gives each one owner and cuts the callers over.

One turn rule. events.unanswered_agent_turn, workflows.thread_response_batch (equal to it on 200,000 random threads) and an inline copy in work.py computed the same thing. events.unanswered_turns is now the one rule: the response address (unanswered_agent_turn), awaits_agent, the thread workflows and leaf status --on read it, and thread_response_batch is deleted.

One published turn reading. The browser read awaitsUser from attention but awaitsAgent from the raw awaits_agent field. After the documented flow (reply with responds, then leaf status working --on <thread>), the card said Working while the "Waiting on: Agent" filter hid the thread. awaitsAgent (in thread/model.js) now reads unresolved waiting attention, awaits_agent is no longer served, and neither the pending-thread fold nor the publisher (scripts/browser/application.ts, bundle rebuilt) writes awaits_agent/awaits_user any more. A thread that needs the user and also has agent work running now appears only under "Waiting on: User", matching its card.

One thread relation. read_state.unread_content and history.py derived which thread an event belongs to again instead of reading thread_context, and neither counted an action that answers a thread. So accepting the suggestion a thread asked for resolved the thread while the agent's reply stayed unread. Both now read thread_context.event_threads, the thread a move names: a message, a resolve, a move on a widget the thread carries, or an action whose admitted answer closes the thread. They do not read thread_memberships, which also files a move under threads it changes without naming them (a later decision that supersedes a suggestion's answer, an undo); those moves show the user nothing in the thread, so they are not read evidence. That settles the survey's question: a user's undo does not count as a read, and edits are agent-only, so there is no user edit to count.

Stale docstrings. events.py docstrings that cited browser twins that no longer exist (reactionStanding, the browser's own thread walk, awaitsAgent over seatRoot) now name the current readers. passages.py:603 (restsOn) is left for the session holding that file.

Left on the old path: the server still serves awaits_user on each thread and _apply_thread_attention still reads it, because tests/test_interact_session.py asserts the field and another session has unmerged work in that file. No browser code reads it. The follow-up is to drop the field, feed attention from user_prompt, and remove those three assertions and the fixture key.

Behaviour that moved, by test: thread-reading.test.mjs (the Agent filter counts a claimed thread whose raw turn was settled), thread-workflow.test.mjs (awaitsAgent follows local sends and recovery), test_the_answer_that_settles_a_thread_acknowledges_what_it_said, and application.test.mjs fixtures that no longer carry the raw fields.

This was written by Claude Code on behalf of max-sixty

🤖 Generated with Claude Code

max-sixty and others added 2 commits September 26, 2026 09:16
Whose turn a thread is had three definitions: `events.unanswered_agent_turn`, `workflows.thread_response_batch` (equal to it on 200,000 random threads), and an inline copy in `work.py`. `events.unanswered_turns` is now the one rule; the response address, `awaits_agent`, the thread workflows and `leaf status --on` all read it, and `thread_response_batch` is gone.

The browser read the turn two ways: `awaitsUser` from `attention`, `awaitsAgent` from the raw `awaits_agent` field. After the documented flow (reply with `responds`, then `leaf status working --on <thread>`) the card said Working while the "Waiting on: Agent" filter hid the thread. `awaitsAgent` now reads unresolved `waiting` attention, `awaits_agent` is no longer served, and the thread model's pending fold and the publisher stop writing `awaits_agent`/`awaits_user`.

Read state and the history feed derived thread membership again instead of reading `thread_context.thread_memberships`, and missed an answering action: deciding the suggestion a thread asked for resolved it while the agent's reply stayed unread. Both now read the memberships. A user's `undo` is not a read: it withdraws a gesture, often from the page's undo walk with the thread closed, and counting it would restore the evidence the withdrawn move lost. Edits are agent-only, so no user edit exists to count.

Docstrings in `events.py` that cited browser twins that no longer exist (`reactionStanding`, the browser's thread walk, `awaitsAgent` over `seatRoot`) now name the current readers.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

read_state.unread_content now treats every thread_memberships edge as evidence that the user read the thread's latest agent text. That membership also includes a later page-widget action solely because it supersedes an earlier answer at the same coordinate (thread_context.thread_memberships, settled_by_coordinate). In an admitted sequence of comment → agent reply → suggestion decision → agent edit of that reply → changed suggestion decision, the edit is unread after the edit but becomes read after the final page action. That action does not show the edited reply to the user, so its unread marker should remain. The read-evidence rule needs to distinguish a direct thread move or explicit answer from a consequential membership used for delivery.

Review found that `thread_memberships` also files a move under threads it changes without naming them: a later decision that supersedes a suggestion's answer joins that thread by coordinate, so after comment, reply, accept, an agent edit of the reply, and a changed decision, the edit read as read although the user never saw it. Read state and the history feed now read `thread_context.event_threads`, the direct relation: a message, resolve, carried-widget move, or an action whose admitted answer closes the thread. An `undo` names no thread there, so it needs no special case, and `browser_thread` no longer takes a containment it only needed for note memberships.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 8690830 into main Sep 26, 2026
5 checks passed
@max-sixty
max-sixty deleted the consolidate-thread-turn branch September 26, 2026 16:44
max-sixty added a commit that referenced this pull request Sep 26, 2026
[#1215](#1215) made `attention`
the browser's one reading of whose turn a thread is, but left
`awaits_user` on each served thread because
`tests/test_interact_session.py` asserted it and another change held
that file. No browser code read the field.

The server no longer serves `awaits_user`. `_apply_thread_attention` now
takes the user's turn from the thread's open Asks or its `user_prompt`.
`user_prompt` is set exactly when the old flag was true outside an open
Ask, and an open Ask is already the first clause, so attention is
unchanged. The session tests assert `user_prompt` and `attention`
instead of the dropped field, and the attention fixture carries
`user_prompt`.

> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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