Repository navigation
fix(canvas): set_canvas reports whether the audience reaches the session that asked (#2577) - #2603
Conversation
…rove (#2577) Self-review of my own rule, before it shipped, and it was wrong in the direction the whole design exists to avoid. `_ROSTER_SIDE_TRIGGERS = {public, paid}` treated every `triggered_by="public"` turn as "the reader is on the Workspace page, which shows roster only". A Workspace turn carries that label too — it is told apart from a public link only by `source_channel="portal"` — and the two are NOT the same audience: client_portal/agent_page.py::canvas_audience_for(is_platform=True) -> None None means no narrowing, so a signed-in OPERATOR working in the Workspace reads every audience, `operator` included. The rule would have told them their own canvas was invisible and pushed them to republish it to the whole roster: the exact over-share the three-state verdict was built to prevent, on the most ordinary Workspace path there is. The row records the client's email, never whether that email is a platform principal, so the honest answer for a portal turn is no answer. The confident branch is now public-link and paid turns only — doors that render no canvas at all and cannot be the platform-principal case — and the set is renamed `_NO_OPERATOR_SURFACE_TRIGGERS` for what it actually means. The reported bug is a public-link turn, so it stays covered. The note stops asserting "the person who asked will not see it" in the abstract and says what is true of that door: a public link and a paid call render no canvas, and Agent Detail is not open to them. Tests: the portal exclusion is pinned both ways, plus a source guard that `visibility_for_canvas` actually threads `source_channel` through — the pure rule can be right while the glue silently re-opens the hole, and every pure test would still pass. Related to #2577
|
merge-train: ejected — the fix is a no-op. |
…es (#2577) Review of #2603 found the fix inert. `visibility_for_canvas` took its execution id from `canvas["execution_id"]`, a key no canvas dict has ever had: `db.upsert_agent_canvas`'s return and both read builders (`_row_to_summary`, `_row_to_full`) all name it `updated_by_execution_id`. So the wrapper returned `(None, None)` on every write and `set_canvas` answered exactly as it did before the feature. The 42 tests stayed green because they drive the pure rule (`canvas_visibility`) and a source guard — nothing put a stored row through the wrapper that joins them. Adds three that do: the stored shape reaching a real verdict, a rename guard that fails at the key rather than as a silent return to no-claim, and the no-execution-id row still making no claim. Related to #2577 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Bd71qsYbFodvofba8P69eP
|
merge-train (2026-09-09): not on this train — same finding as the 2026-09-08 eject, head |
|
You were right, and the diagnosis was exact — fixed in
The reason the 42 tests could not see it is worth stating, because it is the shape of the bug rather than a gap in coverage: they drive the pure rule (
Also noted on the ordering: this conflicts with #2619 in the canvas router/service, so it lands first and #2619 re-merges. #2619's own two blockers (the |
vybe
left a comment
There was a problem hiding this comment.
merge-train (2026-09-09): validated at lane B — /validate-pr + call-trace review clean (producer and consumer both use updated_by_execution_id), 45 new + 76 existing canvas tests pass, mcp-server tsc clean. Body patched to Fixes #2577. Below the train floor, so merged individually.
Summary
The bug is not the default — it is a success indistinguishable from one the user can see. An agent in a public-link session wrote with the default
operator, gotsuccess: truewith the canvas echoed back, saw it inlist_canvases, and the person who asked saw nothing. Neither side had the audience→surface mapping, because it appears nowhere in the tool contract.So the write answers the question.
PUT /{name}/canvas/{id}now returnsCanvasWriteResult—Canvasplusvisible_to_requesterandvisibility_note— resolved off the stored row (normalize_audiencedefaults closed, so a verdict about the requested value could describe a canvas that does not exist).list/getkeep the narrowerCanvas: they answer about a canvas, not about a requester.This is the issue's option (1), plus (3) as the note. Option (2) is deliberately not implemented — see below.
Two properties are load-bearing
rosterpublishes to everyone the agent is shared with, so a wrongfalsecosts an over-share and "could not tell" has to stay distinguishable from "no" (bug: Workspace roster lists agents with no container (DB-sourced roster vs Docker-as-truth) #2196). A write with noexecution_id, or one whose stamp does not resolve to this agent, answersnull—resolve_and_validate_executionis already fail-open, so an unverified stamp arrives as "no claim" for free.The narrowing that self-review forced
My first cut treated every
triggered_by="public"turn as "the reader is on the Workspace page, which shows roster only". A Workspace turn carries that same label — told apart from a public link only bysource_channel="portal"— and the two are not the same audience:A signed-in operator working in the Workspace reads every audience,
operatorincluded. The rule would have told them their own canvas was invisible and pushed them to republish it to the whole roster — the exact over-share property (1) exists to prevent, on the most ordinary Workspace path there is.The row records the client's email, never whether that email is a platform principal, so the honest answer for a portal turn is no answer. The confident branch is public-link and paid turns only.
Channel turns are silent too, for a different reason: no canvas renders inside Slack/Telegram/WhatsApp/VoIP, so
falsewould be true and would advise a widening that still does not put it in front of them.Why not option (2), the context-aware default
In a public-link session the requester is one anonymous visitor while
rosteris everyone the agent is shared with — defaulting there would publish to the whole roster because one visitor asked. That is the issue's own objection to the blanket default, surviving the narrowing. The agent widens explicitly, told exactly why, which keeps a real visibility change a decision someone makes rather than a default that happens.Tests
test_2577_canvas_visibility_hint.py(42) — the reported bug, the operator side, every refuse-to-guess arm, the portal exclusion both ways, and a source guard thatvisibility_for_canvasactually threadssource_channelthrough (the pure rule can be right while the glue silently re-opens the hole, and every pure test would still pass).Backend unit suite: 14411 passed; the 15 failures are the pre-existing
::ffff:IPv4-mapped class, reproduced byte-identically on cleanorigin/dev.Fixes #2577
🤖 Generated with Claude Code
https://claude.ai/code/session_01CdxGmvuKuqaWJZ6pKUgaUJ