Repository navigation
Derive frozen-thread widget moves through the page-move rule - #1012
Conversation
A card moved on a board the agent sent in a reply was delivered to the agent but had no workflow: no Sent / Picked up receipt, and `leaf delivery claim` found no outstanding move. `canonical_workflows` derived page moves and frozen-thread moves in two loops, and the frozen loop kept only moves that answer an answered Ask. #1005 gave page moves that owe nothing a receipt with a null answer; the frozen loop never got the same rule. Both documents now go through one loop that decides handover (answered Ask) and obligation (`answers_ask`) once. They differ only in settlement and in which operation answers an owed move: - page: markup records it, or a later version supersedes it; owed answer is `markup`; - frozen thread: a reply addressed to an owed move, or for a move that owes nothing any agent turn in that thread after it; owed answer is `reply`. Thread attention now waits on the agent only while a workflow there owes an answer or is Working. A frozen move that owes nothing shows its receipt on the message carrying the widget without making the thread the agent's turn, matching "a null answer holds nobody". Behavior that moved: a frozen-thread move that answers no Ask gains a delivery receipt (answer null) and never enters Stop, idle or counts. Non-user actions no longer take part in the newest-move-per-unit pick on the page, as they already did not in threads. events.md no longer says interim moves before an Ask's completion get receipts; since #1005 they have none. Tests: a Python case for receipt, null answer, claim, attention and settlement; a nightly browser case for the reader-visible receipt on the reply and the thread status. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
thread_move settles a move that owes nothing on any agent message in the thread, but thread["msgs"] is not the thread's turns. Two kinds in that list are not an agent turn, and each silently drops the receipt this PR just gave the reader:
- A failure reply.
write_failure_receiptinworker/server.pyis the deployed site's one giving-up writer — rate limiter, a dispatch that threw, a turn that went nowhere — and it writes a reply carryingfailureinto the conversation. Addressed to some other input in that thread, it now settles the frozen move too. Reader moves a card on a frozen board, comments, the host fails the comment:page statereturns a workflow for the failed comment and none for the move. The receipt says the agent took the move in at the moment the host said no answer is coming. - A reaction.
spoken_turnsexists for exactly this distinction and says so — "A reaction is a mark on a message rather than a turn in the conversation, so readings of who spoke last … walk this list rather thanmsgs." An agent mark after the move currently clears the receipt with nobody having spoken.
build_threads already treats both kinds as not resuming a conversation (if "token" not in e and "failure" not in e), so the fold this settlement reads against disagrees with it. The inline suggestion routes through spoken_turns and excludes a failure — which is also what workflows.py's own docstring asks for, since a failure "leave[s] the move a workflow answered with a failed response" rather than no workflow at all. Both failures above reproduce on this head and go away with it; the two new tests here and the test_interact_*, test_read_state, test_model_folds selection stay green.
Second: in browser.py the new guard decides that a move owing nothing does not make the thread the agent's turn, and then max(candidates, key=priority) picks the thread's attention from every candidate, including the ones it just excluded. priority ranks by delivery stage, so a non-owed move outranks an owed reply that is merely Sent. The thread card's status is workflowLabel of exactly that workflow (threadAttention in runtime/conversation/workflow.js), and margin-projection.js passes it to workflowReceipt the same way, so a thread waiting on a reply the agent has not looked at reports the moved card's stage instead. Reproduced with an owed reply at Sent and a later frozen move: attention.workflow names the move.
Third, smaller, but the symptom the PR is against: thread_move returns no workflow when the thread is resolved, so a move on a frozen widget in a resolved thread is still delivered — requires_agent_attention admits it, reading only author and kind — with no receipt behind it and nothing in delivery claim. The carve-out predates this change, but afterwards it is the only handed-over frozen move with no workflow, and session-lifetime.md's new sentence ("until the agent's next turn in that thread") does not mention it. Either resolution takes the move in or it does not and the receipt stands; the code says neither. Happy to push the first two fixes if you'd rather not apply them by hand.
Candidates checked and dropped
replyingis absent from the newanswer is not None or stage == "working"guard, but unreachable for a move owing nothing:_bind_replybinds only a reply naming the input, andcmd_reply's--forgate refuses an idcurrent_responsesholds no answer for.page.registryin the unified loop would raise withpage=Noneand a conversation, but both callers passingpage=None(served_state/page.py,work.py) passconversation=Nonetoo.- Keying the unified loop on
source["widget"]rather than the page loop's oldcoordinate[0]is equivalent:event_meaning.state_meaningbuilds the coordinate as[owner, unit, facet]withowner = event["widget"]. record is Nonein the unified loop cannot fire —projection.actionsis built from the sameby_id— andpage_action_unsettled's ownsource["author"] != "user"check is now dead. Both harmless.- The new
author != "user"filter reaching page actions changes the newest-move-per-unit pick, which the description states and the comment overnewestalready said ("the reader's newest move"). events.md's new claim that interim actions carry no receipt is right: an owed move whose Ask is unanswered hits thecontinueabove it and mints nothing.
…waits Review of #1012 found three gaps in the frozen-thread settlement: - A reaction or a host failure reply counted as the agent's next turn and silently dropped a receipt. Settlement now reads `spoken_turns` and skips failure replies. A failure reply addressed to an owed frozen move hands it back to the reader as a failed workflow, the same way a failed pickup hands back a page move. Before, it settled the move with no record. - Thread attention picked its status from every candidate, including moves that owe nothing. It now picks from the workflows the thread is waiting on. - A move made after the thread resolved was delivered with no workflow. Resolution now settles only the moves it follows. A later move keeps its receipt. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
The new waiting filter in _apply_thread_attention admits stage == "working" but not "replying", so a thread stops reporting a reply the agent is streaming as soon as a newer reader input arrives in it.
_bind_reply binds the live stream reply to the exact input it names and sets that workflow's stage to replying. A later reader input in the same thread becomes the response address and takes the answer, so the replying workflow drops to answer: None. It is then outside waiting, and max(waiting, key=priority) names the newly sent input instead. threadAttention feeds that to workflowLabel, so the thread card reads "Sent" while the agent is mid-reply — and a stream that has gone stale loses its reason: "uncertain" the same way.
Reproduced on 00e4a264 against the merge base, one reader comment with an active stream reply bound to it, then a second reader reply in the thread:
base ee2f3ff1 attention: {'kind': 'waiting', 'reason': 'workflow', 'workflow': '<first input, replying>'}
head 00e4a264 attention: {'kind': 'waiting', 'reason': 'workflow', 'workflow': '<second input, sent>'}
Nothing in the suite catches it: test_a_durable_reply_completes_an_empty_stream_placeholder in test_render_conversations.py is the one case that asserts a "Replying" thread status, and it has a single input, so the replying workflow still owns the answer there.
The omission is mine — my earlier suggestion carried that predicate over verbatim from the any(...) guard it replaced, and you applied it as written. The reason it slipped is worth more than the line: "the agent is at work on this" is already written three times in the tree, and the guard is a fourth spelling that kept half of it. priority, in this same function, groups {"working", "replying"} into its one at-work category; activity.py selects active_moves with item["stage"] in {"working", "replying"}; the runtime's isLiveWorkflow in runtime/conversation/workflow.js lists the same pair. The inline suggestion just restores the pair here, but the durable version is for the guard to read the predicate priority already encodes rather than restate it — worth doing here or filing, since this is the site that has now disagreed once.
Review of #1012 found that the waiting filter admitted Working but not Replying. So a reply streaming to an input that a newer input covers dropped out, and the thread card read the newer input's Sent. A covered input's pickup dropped out the same way. `holds_thread` now states what keeps a thread the agent's turn: every input and claim of the thread itself, plus a frozen widget move while it is owed or the agent is at work on it. `at_work` is one predicate that both the filter and `priority` read. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Follow-up to #1012's review. The move loop in `canonical_workflows` guarded `record is None`, and `page_action_unsettled` re-checked that the source was a reader move. Neither can fire: `projection.actions` admits only actions whose widget the markup holds and whose tag declares the verb, and the loop filters to reader moves before it asks about settlement. The loop now indexes `by_id` and the registry directly, so a break in that contract raises instead of silently dropping a move. No behavior moves. `test_interact_*` and `test_website_server.py` pass (992). > _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]>
A card moved on a board the agent sent in a reply now gets the same delivery receipt a moved card on the page gets, and like it owes the agent nothing.
What was wrong
canonical_workflowsderived widget moves in two loops, one per document. The frozen-thread loop kept only moves in an answered Ask. #1005 gave page moves that owe nothing a receipt with a nullanswer, but the second loop never picked up that rule. So a moved card or draft edit in thread markup was delivered to the agent (requires_agent_attentionadmits it) with no workflow behind it: it had no Sent / Picked up receipt, andleaf delivery claimreported no outstanding move.The change
answers_ask). The page and a frozen thread differ only in what settles a move and which operation answers an owed one:markup.reply. A reaction is not a turn, and a host's failure reply does not settle the move: it hands an owed frozen move back to the reader as a failed workflow, the way a failed pickup hands back a page move. Before, a failure reply settled such a move and left no record.holds_threadstates what keeps a thread the agent's turn: every input and claim of the thread itself, plus a frozen widget move while it is owed or the agent is at work on it (Working or Replying). The thread's status comes from those workflows. A frozen move that owes nothing shows its receipt on the message that carries the widget. It does not make the thread the agent's turn or set the thread's status.at_workis now one predicate that both the filter andpriorityread.workflows.py,session-lifetime.md, andevents.mdstate the rule for both documents.events.mdno longer says that interim moves before an Ask's completion get receipts; they have had none since Keep delivery receipts for moves that owe nothing #1005.Decision
The code has no product statement on whether a reader's move on a frozen widget that answers no Ask owes the agent anything. I applied the page rule: it owes nothing (
answer: null), it keeps a delivery receipt, it leaves Stop,idle, and counts alone, and it does not make the thread wait on the agent. The frozen widget's state lives in the log for the page's whole lifetime, so nothing is lost if the agent never answers, which is the page rule's premise too. Before #983 every frozen move was owed a reply. #983 dropped the ones that owe nothing entirely, receipt included.A resolved thread settles the moves made before its resolution, including the Ask answer that resolved it. A move made after the resolution is delivered like any other and keeps its receipt. Before, it was delivered with no workflow.
Behavior that moved
stagereports delivery,answeris null.attention.Coverage for moved cards and draft edits on the page (task A)
#1006 already restored browser coverage at the real boundary. The Page Map arrival test covers two moved cards reaching Picked up and Working. The shipped-board margin test covers the moved card's margin status. The export test covers a draft edit's receipt being dropped from a copy. No new page test was needed. The browser test added here covers the frozen-thread case.
Tests
test_interact_session.py::test_a_frozen_move_that_answers_no_ask_keeps_a_receipt_and_owes_nothing: a Sent receipt with a null answer, no obligation, no thread attention, and noobligationin the delivery.delivery claimmakes it Working and the thread waits. An agent reaction leaves the receipt standing, and the agent's next spoken turn settles it. A move made after the thread resolves keeps its receipt.test_frozen_widget_workflow_contributes_to_its_thread_attentionnow also covers a failure reply that hands the owed move back to the reader.test_thread_attention_names_the_workflow_the_thread_waits_on: an input covered by a newer one keeps the thread's status while a reply streams to it or after it is picked up, and a frozen move that owes nothing never supplies the status.test_render_conversations.py::test_a_card_moved_on_a_board_in_a_reply_reports_delivery_on_that_reply(nightly): the reply carrying the board reads Sent, then Picked up, while the thread status stays empty. The receipt leaves after the agent's next turn.workflows.pyfails both new tests (no receipt), and revertingserved_state/browser.pyfails both on the thread status. Settling onmsgsinstead ofspoken_turnsfails on the reaction, and dropping the failure-reply lookup fails the failure case.ee2f3ff1: thetest_interact_*files andtest_website_server.pypass. With--run-nightly,test_render_conversations.py,test_render_projection.py,test_render_margin.py,test_render_application_boundary.py,test_render_semantic_news.py, andtest_render_startup.pypass (502). Pre-commit passes on the changed files. No runtime JS changed.🤖 Generated with Claude Code