Repository navigation
feat(slack): read the plan canvas back and flag dropped comments - #39245
Conversation
… no-op revisions The agent had no way to read its plan canvas after a restart or compaction. Add code_channel_read_plan_canvas (getCanvas, pinned to the caller's own channel, redacted, framed as data), note has_more_comments and has_more_replies in comment messages, and report a setCanvasContent with sections_changed_count 0 as unchanged.
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. One out-of-goal rider: the Plan-tab deep links that the frozen Notes
What this change shipsInventory (5 items) — 4 justifiedIntent: let a code channel's agent re-read its own plan canvas and know when Slack hid comments or ignored a no-op edit — ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 2fdc8b8 Description read[DESCRIPTION-READ] b11076e7d5e7b437baaa660f774fc838c7a1db3d591ff4b1a82be2ee3c10d6c7 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the read-back reuses delivery's own inbound and sender gates, and every change adds to what exists without removing anything. Notes
[DESIGN-REVIEWED] 2fdc8b8 Description read[DESCRIPTION-READ] d1326328dafdfbd9d433fb512192a07657c69b62e48dfd29910501b76b9cff70 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
The read tool listed every open comment. Delivery refuses authors who may not use Kiro Crew and channels the inbound policy refuses, so the read now applies the same rule (shared inbound_admitted). A deleted canvas message moves from the shared error text into the read tool.
The read listed comments thread by thread, so cutting to the newest 100 could drop the newest reply under an old thread. Sort by Slack ts first.
The shared inbound gate in comments.py named the channel through binding.channel_id, which the every-inbound-gate-asks-the-channel scan did not recognise as the paired form. Name it channel, as the other gates do.
Slack routes a rich_text channel element's tab_id to a view. The board header linked Workers and Code, and the wrap-up Code and PR tabs, but never the Plan canvas tab, though its view id is recorded. Link it first.
A 60,000-character plan plus 100 long comments could pass the 100,000 character MCP cap, which cuts the newest comments and the dropped-item note. Budget the plan (50,000) and the comment lines (35,000, newest first) so the whole answer fits and the omission count stays exact.
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
This review checked head 2fdc8b8. The new code_channel_read_plan_canvas tool goes through run_tool's existing gates and runs under the send fence. Comments in the read follow delivery's own rules: the owner-or-self sender filter, plus the workspace, channels and per-channel inbound gates through the shared comments.inbound_admitted. The plan is redacted before it is cut, and a test pins the whole response under the 100,000-char MCP cap. A missing sections_changed_count is never read as "unchanged". The tests are deterministic (recorded payloads, fixed ts values, no sleeps or ports), and PR Readiness is green on this head.
Security: the new read brings channel canvas text and comments into the agent's context, so it reuses delivery's own admission instead of adding a second copy. The inbound workspace, channels and per-channel gate moved unchanged into the shared comments.inbound_admitted, which stays deny-by-default, and the sender filter keeps only the owner's own comments. The plan text is redacted before it is cut, and the whole response stays under the MCP size cap. Nothing delivery refuses can reach the model through this read.
Done well: the read reuses delivery's gates instead of adding a second copy, so nothing delivery refuses can reach the model through the read.
Optional:
- The Plan-tab links in the board header and the wrap-up go past the
## Not a goalbullet, which is still unchanged. A maintainer could amend that bullet in a comment, or the links could move to a follow-up PR. The body also says 60,000 chars, but the code says 50,000, and the 35,000-char comment budget is not mentioned. - No tool-level test fails if the workspace gate is dropped from the read path (
tools.py:1049). A refused-side case that patchessurface.workspace_admittedwould pin it. Distinct comment texts in the budget test would also pin that the newest comments are the ones kept. - A reply is printed as
Reply by ...and does not say which comment it answers, so it can read as an answer to the comment just above it. Printing the parent would fix that.
Problem / Motivation
Goal: A code channel's agent can read its plan canvas back and is told when Slack hid comments or ignored a no-op revision.
Slack's plan-canvas loop is
setView canvas/comment, thengetCanvas, thensetCanvasContent. Kiro Crew usedgetCanvasonly to deliver comments, so after a restart or compaction the agent had lost its plan text. It also ignoredhas_more_commentsandhas_more_replies, so older comments were dropped without a word, and it ignoredsections_changed_count, so a revision that changed nothing read as an edit.Why it matters
An agent that cannot see its own plan rewrites it from memory and can drop what people commented on. Comments Slack hides are never answered.
Not a goal
agent_content_hashinsetView. It lets an agent detect human edits; the Plan tab isaccess_level: "comment", so only the agent edits the text and there is nothing to detect.rich_textchannelelement withtab_id) do not exist on main for any tab; they are in open feat(slack): code-channel view tabs: PR tabs, tab deep links, Workers tab with Stop #38998. That PR owns the helper, and a Plan link follows once it lands.What changed (motivation → approach → change)
code_channel_read_plan_canvas: no arguments, reads the channel's own recorded canvas id, returns the markdown (cut at 60,000 chars), the title and the newest 100 open comments. Output is redacted like channel text and framed as content to read, not instructions. A channel or canvas id argument is refused before Slack.has_more_comments/has_more_repliesbecome a note in that read and in each comment message the turn-end read or poll delivers.set_canvas_contentreturnssections_changed_count; 0 makescode_channel_publish_plan_canvassay "unchanged". A missing count is never read as unchanged.Tabs: Plan · Workers · Code) and the wrap-up link the Plan tab with its recordedplan_view_idas thetab_id, on the tab-link helpers feat(slack): code-channel view tabs: PR tabs, tab deep links, Workers tab with Stop #38998 added.slack-gateway.md, the RFC,mcp.md,slack-integration.md.Backwards compatibility
Compatible: one new tool and extra note lines; no existing argument, schema or message is rejected or renamed.
Removes nothing: only additions.
Tests
test/test_slack_code_channel_plan_canvas.py(17 tests). Nearby inputs: no canvas yet,canvas_not_found, no comments, 100 threads withhas_more_comments,has_more_replies, 150 comments and an oversize plan, a secret and<!channel>in plan, title and comment, a channel or canvas id named, a count of 0, 2 and none.Run against main's source, 10 of the 11 fail (the eleventh guards that no note appears when nothing was dropped). Related suites: 419 pass (
api_gaps,agent_surface,remote_session_local_only_tools,mcp_tool_registry, the new file).mypy --platform linux, flake8, black, isort, comment-history, brand and flake-ratchet checks pass locally.Manual verification
N/A: no Slack workspace with Code channels was reachable; Slack's documented request and response shapes are recorded in the tests.
Real-machine verification
N/A -- no Slack workspace with the Code channels feature was reachable from this machine, so the Slack calls could not run live.
Related Issues
None.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commitsContribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.