Repository navigation
Read whose turn a thread is, and which thread a move is in, one way each - #1215
Conversation
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
left a comment
There was a problem hiding this comment.
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]>
[#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]>
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 inwork.pycomputed the same thing.events.unanswered_turnsis now the one rule: the response address (unanswered_agent_turn),awaits_agent, the thread workflows andleaf status --onread it, andthread_response_batchis deleted.One published turn reading. The browser read
awaitsUserfromattentionbutawaitsAgentfrom the rawawaits_agentfield. After the documented flow (reply withresponds, thenleaf status working --on <thread>), the card said Working while the "Waiting on: Agent" filter hid the thread.awaitsAgent(inthread/model.js) now reads unresolvedwaitingattention,awaits_agentis no longer served, and neither the pending-thread fold nor the publisher (scripts/browser/application.ts, bundle rebuilt) writesawaits_agent/awaits_userany 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_contentandhistory.pyderived which thread an event belongs to again instead of readingthread_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 readthread_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 readthread_memberships, which also files a move under threads it changes without naming them (a later decision that supersedes a suggestion's answer, anundo); those moves show the user nothing in the thread, so they are not read evidence. That settles the survey's question: a user'sundodoes not count as a read, and edits are agent-only, so there is no user edit to count.Stale docstrings.
events.pydocstrings that cited browser twins that no longer exist (reactionStanding, the browser's own thread walk,awaitsAgentoverseatRoot) 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_useron each thread and_apply_thread_attentionstill reads it, becausetests/test_interact_session.pyasserts 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 fromuser_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(awaitsAgentfollows local sends and recovery),test_the_answer_that_settles_a_thread_acknowledges_what_it_said, andapplication.test.mjsfixtures that no longer carry the raw fields.🤖 Generated with Claude Code