Repository navigation
Description
leaf thread create --part ID accepts any id that starts with a prefix the visual declares, whether or not the visual draws that part. An agent that mistypes an id gets the same success record as for a real part, and leaf page check --render afterwards reports nothing. On the page, the thread stands on the whole visual. A timeline shows its marker in the margin, level with the timeline's top and labelled "timeline · Deploy order · event:nope", so the user can't tell which event the question is about. In the trial behind #7006, both authors of a pipeline visual noticed that the command took a part their visual never draws. That visual marks its parts with data-lf-part, and the agent driving one of those pages saw no marker at all for such a thread (not rerun here).
Reproduction, from a checkout's root:
export XDG_STATE_HOME="$PWD/.tmp/part/state"
bin/leaf page init .tmp/part/page --package reading --package timeline
cat > .tmp/part/page/index.html <<'EOF'
<!doctype html>
<html lang="en">
<head>
<title>Deploy order</title>
<meta name="description" content="The order of last night's deploy, by job." />
</head>
<body>
<main>
<section id="order">
<h1>Last night's deploy</h1>
<lf-timeline id="deploy-order" aria-label="Deploy order">
<lf-lane label="Build">
<lf-event id="deploy-compile" at="0" end="4000" label="Compile"></lf-event>
<lf-event id="deploy-artifact" at="4000" label="Artifact ready"></lf-event>
</lf-lane>
<lf-lane label="Release">
<lf-event id="deploy-rollout" at="4500" end="9000" label="Roll out"></lf-event>
</lf-lane>
</lf-timeline>
</section>
</main>
</body>
</html>
EOF
# The timeline draws event:deploy-compile, event:deploy-artifact and event:deploy-rollout.
bin/leaf thread create .tmp/part/page --section deploy-order --part event:nope --text "Is this the slow step?"
bin/leaf thread create .tmp/part/page --section deploy-order --part step:nope --text "Is this the slow step?"
bin/leaf page check .tmp/part/page --render | jq -c '{status, findings: [.findings[].code]}'The first thread create prints a comment record with "anchor": {"section": "deploy-order", "visual": "event:nope"}. The second is refused: § deploy-order has no visual part 'step:nope'; ids starting with 'event:'. The check prints {"status":0,"findings":[]}.
What the page shows for that thread, read from a fresh build of the same page with the comment in its log:
cp .tmp/part/page/index.html .tmp/part/deploy.html
echo '{"kind":"comment","author":"agent","agent":"Claude","revision":1,"id":"undrawn","text":"Is this the slow step?","anchor":{"section":"deploy-order","visual":"event:nope"}}' > .tmp/part/log.jsonl
uv run leaf-dev probe .tmp/part/deploy.html --log .tmp/part/log.jsonl \
--js '() => [...document.querySelectorAll(".lf-margin-marker")].map((marker) => marker.getAttribute("aria-label"))' \
| jq -c .resultIt prints ["Thread, 1 unread, timeline · Deploy order · event:nope"].
Expected. The agent learns that event:nope names no part the timeline draws, at thread create or at the next check that draws the page, with the parts it does draw.
Ran on a34788414e, macOS 26.5: Chrome 158 for the check, Playwright 1.65.2's Chromium for the probe.
Cause, confirmed. registry.contract.VisualParts admits an id by its prefix alone, and its docstring says "Admission does not say a part is on screen; the browser resolves that." Only the visual's module knows the parts it draws, and nothing carries the browser's answer back to the agent. Root AGENTS.md says "Python never accepts an anchor the rendered page can't resolve."
Where the build met it. The trial in #7006, where twelve agents new to Leaf each built a package from the shipped references alone.
This was written by Claude Code on behalf of max-sixty
Activity
leaf-agent commentedon Nov 24, 2026
Confirmed from the code on
93ebc4dbef; no fix PR yet, because the repair needs a contract the runtime doesn't have, and it changes whatthread create --partcosts.Why nothing can answer today. A visual has no way to say "this id names none of my parts":
capture_anchorchecks the id against the visual's prefixes only (anchor_capture.py#L193), and no browser runs for--part.lfPartshasrevealorfind(drawsAbsentParts,anchor-resolution.js#L1033). The fallback can't tell "drawn in another step" from "never a part". That gives the timeline marker you saw. A visual with marks only (data-lf-part, noreveal/find) resolves the anchor to null, so the thread has no marker at all, which fits the pipeline report.page check --renderreads no logged anchor, so the check passes.The signal is already half there. Every
reveal/findvisual also giveslabel(id). The timeline's returns null for an unknown event (lf-timeline.js#L208), and so does the trace's (lf-trace.js#L725). The chart's builds words from the id string for anypoint:id, whether or not a datum matches (lf-chart.js#L252).Proposed rule. A visual's declared parts are the ones it draws now, plus, for a visual with
revealorfind, each id itslabel(id)names. An id outside that set doesn't resolve: the whole-visual fallback applies only to named ids. The chart'slabelthen returns null for an id that matches no datum. With that rule:thread create --partresolves the anchor in the browser before it admits the comment, ascmd_commentalready does for drawn markup (message_check, about a second). It refuses an id the page can't resolve and lists the parts the visual does draw. That meets rootAGENTS.md's "Python never accepts an anchor the rendered page can't resolve".The one call I'd leave to you is the cost: every
--partthread would pay a browser run at creation, where today it pays none. The alternative is to report unresolved visual anchors atpage check --render, which is cheaper per thread but tells the agent only at its next check, after the user may already have seen the thread. I'd take the first. If you agree, a follow-up run can build the rule, the chart'slabelchange and the--partresolution, with a regression test on the reproduction above.max-sixty commentedon Nov 25, 2026
Max chose how
thread create --partshould treat a part the visual didn't draw. It checks the id against the parts the page's last render reading drew, the listleaf page stateshows since #7109:lfPartshasrevealorfind, as a timeline's or trace's does): admitted, with a note saying the thread stands on the whole picture.--partputs the thread on the whole visual. So the agent can always post, and the page never gets a thread with no marker.thread create --quotenow does for words a page's script draws (Keep the turn-end check from asking a choice the agent holds, and let thread create quote words a script draws #7140). If no browser can draw it, the id passes as now, with a note saying it wasn't checked.He chose this over Tend's proposal above, refusing every
--partid in a browser through a newlabel(id)contract, which starts Chrome for every such thread, and over warning the agent and leaving it to wait for a background reading. The warning would arrive after the thread was posted, and the reading takes a median of 8.8 s against 1–3 s for drawing the page once.A PR implementing this follows.
Refuse a thread create --part the page would show nowhere (#7155)