Repository navigation
Let agent replies reattach threads - #317
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
One correctness finding, reproduced locally: leaf reply validates --markup against the revision that was active before the anchor capture activates the agent's edited index.html, so a reply that both moves the thread and carries a widget is checked against a stale page. leaf comment has the opposite order and gets it right. Reproduction and consequence are below; the two inline suggestions are one fix and need applying together.
Reproduction
Publish v1, open a thread, then write a revised index.html that adds <p id="moved-note">The retry lives here.</p> without stamping it — the exact shape the new conversation-threads.md workflow describes. Then:
leaf reply <page> --to <root> --quote "The retry lives here." \
--markup '<lf-ask id="moved-note">…</lf-ask>' --text "moved it"
Observed: exit 0, and the accepted event carries "revision": 2 alongside markup whose id is moved-note — an id revision 2, activated by this very command, already holds. leaf version check then refuses the page for good with ids already taken by widget markup in a reply: ['moved-note'], against an append-only log. leaf comment given the same input refuses up front with comment widget ids already taken by the page or an earlier message.
check_markup reads version_ids(page_dir) and list_revisions(page_dir)[-1], so every id, fragment-reference, and data-binding check it runs sees the pre-activation page; _current_anchor calls activate_source, which writes the new revision. Hoisting the capture above check_markup restores the cmd_comment order and closes it — with the hoist applied, the reply is refused and version check stays green. tests/test_interact_anchors.py and tests/test_interact_contract.py (305 tests) pass with the change.
Summary
Verification
uv run pre-commit run --all-filesuv run pytest tests(888 passed)