Skip to content

feat(slack): read the plan canvas back and flag dropped comments - #39245

Merged
KiroCrewCaptain merged 8 commits into
mainfrom
slack/ensure-full-slack-code-canvas-usage-6c7abc4f
Nov 18, 2026
Merged

KiroCrewCaptain merged 8 commits into
mainfrom
slack/ensure-full-slack-code-canvas-usage-6c7abc4f

Conversation

@kyleseaman

@kyleseaman kyleseaman commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

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, then getCanvas, then setCanvasContent. Kiro Crew used getCanvas only to deliver comments, so after a restart or compaction the agent had lost its plan text. It also ignored has_more_comments and has_more_replies, so older comments were dropped without a word, and it ignored sections_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

  • No agent_content_hash in setView. It lets an agent detect human edits; the Plan tab is access_level: "comment", so only the agent edits the text and there is nothing to detect.
  • No plan-tab deep link in messages here. Tab deep links (rich_text channel element with tab_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)

  • New tool 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_replies become a note in that read and in each comment message the turn-end read or poll delivers.
  • set_canvas_content returns sections_changed_count; 0 makes code_channel_publish_plan_canvas say "unchanged". A missing count is never read as unchanged.
  • The read applies delivery's own rules: only authors who may use Kiro Crew (or the bot) are listed, none when the inbound gates refuse the channel, newest 100 by Slack ts.
  • The board header (Tabs: Plan · Workers · Code) and the wrap-up link the Plan tab with its recorded plan_view_id as the tab_id, on the tab-link helpers feat(slack): code-channel view tabs: PR tabs, tab deep links, Workers tab with Stop #38998 added.
  • Docs: 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 with has_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

  • A Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commits
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license.

… 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.
@kyleseaman
kyleseaman requested review from a team and KiroCrewCaptain as code owners November 18, 2026 20:23
@kyleseaman
kyleseaman requested a review from buluoray November 18, 2026 20:23
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 18, 2026
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 2fdc8b86a46c4376e8088b408d3df8c94e79c0cc touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 2fdc8b86a46c4376e8088b408d3df8c94e79c0cc — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. One out-of-goal rider: the Plan-tab deep links that the frozen ## Not a goal explicitly left out.

Notes

  • Item 4 — oversized: the frozen Goal says "No plan-tab deep link in messages here… a Plan link follows once it lands", yet the diff adds plan to render.Tabs/tab_links and plan_tab to wrapup.Facts/_tab_block. Subtraction: delete Tabs.plan, Facts.plan_tab, wrapup._plan_tab, the tabs_for plan= line and their three tests, and ship the Plan link in its own PR. Clears when: the mechanism is removed, or a human amends the Goal.

What this change ships

Inventory (5 items) — 4 justified

Intent: 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.

  1. New agent tool code_channel_read_plan_canvas returns the plan markdown, the title and admitted open comments — justified
  2. Comment messages and the read note when Slack dropped older threads or replies (has_more_*) — justified
  3. Republishing identical markdown now answers "unchanged" instead of "Updated" — justified
  4. The board header and the wrap-up now link the Plan tab first — oversized, excluded by ## Not a goal
  5. The comment-delivery inbound gate moved into a shared inbound_admitted that the read reuses — justified

[FIRST-PRINCIPLES-REVIEWED] 2fdc8b8

Description read

[DESCRIPTION-READ] b11076e7d5e7b437baaa660f774fc838c7a1db3d591ff4b1a82be2ee3c10d6c7

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 2fdc8b86a46c4376e8088b408d3df8c94e79c0cc — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • The description contradicts itself. "Not a goal" says "No plan-tab deep link in messages here", but "What changed" and the diff (render.py Tabs.plan, tabs_for plan=…plan_view_id) add one. Correct the description so the frozen goal matches what ships.
  • The description says the plan is "cut at 60,000 chars", but the code (MAX_PLAN_CHARS = 50_000) and the spec say 50,000. Readers of the description get the wrong limit.
  • ## Backwards compatibility has both a Compatible: line and a Removes nothing: line. Keep only the Removes nothing: line, as the template expects.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 2fdc8b86a46c4376e8088b408d3df8c94e79c0cc — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 2fdc8b8

Verdict parsed from the review's SHA-scoped output markers for commit 2fdc8b86a46c4376e8088b408d3df8c94e79c0cc.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 2fdc8b86a46c4376e8088b408d3df8c94e79c0cc false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 2fdc8b86a46c4376e8088b408d3df8c94e79c0cc and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 2fdc8b8

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 2fdc8b86a46c4376e8088b408d3df8c94e79c0cc false-positive: <reason, 20 to 500 characters>

Kyle Seaman added 5 commits November 18, 2026 20:33
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.
@kyleseaman

Copy link
Copy Markdown
Contributor Author

Scope note: the frozen Not-a-goal bullet about the Plan-tab link was written while #38998 (the tab-link helpers) was still open. #38998 has since merged, so gap (e) is closed here: the board header and wrap-up now link the Plan tab. The agent_content_hash bullet stands.

Kyle Seaman added 2 commits November 18, 2026 21:34
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.
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 18, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 18, 2026 23:59

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 goal bullet, 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 patches surface.workspace_admitted would 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.

@KiroCrewCaptain
KiroCrewCaptain merged commit d75b94a into main Nov 18, 2026
109 of 119 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the slack/ensure-full-slack-code-canvas-usage-6c7abc4f branch November 18, 2026 23:59
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants