Repository navigation
feat(slack): code-channel view tabs: PR tabs, tab deep links, Workers tab with Stop - #38998
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The Workers-tab Stop reuses the channel Stop's authorization and its single-helper stop path, and the tab budget has a clear eviction order. Notes
[DESIGN-REVIEWED] 702cf27 Description read[DESCRIPTION-READ] dd44c54bfc2101c48294921934b4c7534478f2048a6a0773448899b19d462de2 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: the base RFC Notes
What this change shipsInventory (10 items) — 9 justifiedIntent: let a person in a Slack code channel open its PRs and tabs from the messages that name them, and stop one helper agent without going to the dashboard. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 702cf27 Description read[DESCRIPTION-READ] 1b0c09145a59e18221c8d4dbcb5daf1702b89832c4e04b0e2b80af953fe79da8 That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review — ✅ human override acceptedHuman judgment by @kyleseaman overrides the GPT 6.1 finding for [GPT-OVERRIDE] 702cf27 This comment is updated in place on each push. The model was not re-run because an authorized human decision supersedes it. False positive or not applicable? A repository writer can comment: |
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: |
… tab with Stop A code channel gets the tabs Slack's agent channels offer, inside the five-tab budget views.py already keeps: - native pull_request tabs (pr-<n>, named "PR #<n>") for the channel's own PR and the board's worker PRs, open or draft and forge-confirmed, the newest two by number (MAX_PR_TABS = 2). A tab is removed by its recorded view id only when its PR is seen merged or closed, or two newer open PRs are seen; a pass whose board or forge read failed removes nothing; - the interactive Workers block_kit tab, from the board's own snapshot: per worker the title, a status line, its PR (linked to its PR tab) with CI, Open in dashboard, and Stop while it works. Settled workers fold into one line each; - deep links (rich_text channel elements with tab_id) from the board's "Tabs: Workers · Code" line, from each board task's PR, and from the wrap-up to the Code tab and the open PR tabs (a worker's only while the board's scope admits the channel). Each is resent without the links if Slack refuses them. The budget has three tiers: Plan, Code and Workers are never removed to make room; then PR tabs; then the agent's own tabs, which give way first. A PR tab never makes room for another PR tab or for an agent tab. A PR tab removed to make room re-renders the board and the Workers tab without it. The Workers tab's Stop (worker_stop.py) passes the context bar's gates (actions.admit), checks that the click came from this channel's recorded Workers view, applies the channel Stop's rule (actions._may_stop), resolves the button's item id on this channel's own board, then asks a synchronous final gate right before it stops that one helper: its turn, pinned to the turn the gate admitted, and the sub-agents it started, as the channel's Stop (stop_helpers) leaves a helper. Nothing holds it stopped. The stop shows as "Stopped by @user · HH:MM" on the board and the tab until the worker's next turn. Every tab write and removal re-checks the archive, Stop and channels fences, and the board's scope at the client's commit point (surface.send_fence). Tab records follow what Slack did even when the call is cancelled after Slack answered, and a tab whose answer was lost (or whose record a restart cut off) is removed by its key once its PR settles or the board empties.
A PR-tab write or removal Slack held back (a 429, a full channel), a PR tab still held when a refresh comes early, and a full channel holding back the Workers tab now arm the channel's refresh on the board's timer for when the hold ends, with or without a work board. A permanent refusal arms nothing, and repeated holds share the one timer per channel.
0cc7dcb to
702cf27
Compare
Code change approver recommendation: A person should decideWhy: the decider raised 1 possible problem and estimates a 50% chance that this change introduces a defect; a person should check it. The code is carefully built, but the central new action (Stop from the Workers tab) depends on a Slack payload field ( Things to check (possible problems the decider raised; at this confidence many turn out to be fine):
Tier: 2, held for a person: reviewer-finding. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Thanks for this. The Stop path reuses the channel Stop's own checks, and the final gate sits right before the stop, which is solid work. One item still blocks merge on this head.
src/kiro_crew/slack/code_channels/worker_stop.py:102(parse(), lines 92 to 102). A person presses Stop in a real code channel's Workers tab.parse()reads the channel only frompayload.channel,container.channel_idorcontainer.channel, and the view only fromcontainer.view_id. If Slack puts either field anywhere else, every Stop is refused. It fails closed, so nothing unsafe happens, but the main interactive path of the Goal does nothing. All the Stop tests build their click from_stop_payload()intest/slack_code_channel_view_tabs_helpers.py, which supplies both fields itself, so they cannot catch this. The body says the payload is "Not yet captured from a live workspace" and lists a live press as "Still to do before merge". The body also has no## Real-machine verificationsection, which testing-conventions.md requires for a change to what runs. Smallest fix: press Stop once in a live test code channel. Paste theworkers tab containerkey line from_log_shapeinto the body. Add a## Real-machine verificationsection with Before, After and Cleanup lines. If the real payload differs, fixparse()and_stop_payload()so the tests match what Slack actually sends.
Optional:
- If the channel id is missing, the refusal is silent:
admit()finds no binding, and_respondreturns early onnot (click.channel and click.user)(around line 361). Consider giving the presser some reply in that case. - The "Stopped by" overlay in
board/stops.py(and its readers in model.py, render.py, publisher.py and tabs.py) goes further than the Goal and the RFC's Workers-tab text, which asks only for the audit record. The presser already gets a private reply. Consider dropping it, or say why it is needed. - The Screenshots section names
.logs/r2/shots/r81.png, which is not attached. Please attach the render so reviewers can see the Workers tab.
|
Thanks for the review. All four points are addressed in the description at The live payload (blocking). I pressed Stop once on a working helper in a live test code channel built from this head. The gateway logged:
That is the shape Optional: no reply when the click names no channel. Kept as is, because a real Workers-tab click carries Optional: the "Stopped by" overlay. Kept, and the description now says why. It is the one place the other members of the channel see that a person stopped a helper, and when. The private reply reaches only the presser, and the audit row only the operator. You're right that it goes beyond the RFC's Workers-tab text. Its three known races each have a test: a press while a stop is already in flight credits nobody, a queued turn that starts after the stop is never marked stopped, and a label gone stale during a send is written again. Optional: the screenshot. It is now attached in the Screenshots section, rendered from this head's blocks. |
The blocking point is answered: one live Stop press on this head, with the log line, in the description (Real-machine verification) and in #38998 (comment).
|
/ai-review override gpt 702cf27 false-positive: Both findings are in main's files, not this PR's. The review diffed the stale base fb81cec against the merge ref, so it read main's commits as this PR. AUTOSDE.yaml and the docs/decisions entry (from #36888, decided by a maintainer) are not among this PR's 35 files, and it changes nothing under website/. |
Human judgment recorded@kyleseaman recorded a false-positive release (class
This decision applies only to this commit. A new push requires a new judgment. |
Problem / Motivation
Goal: code channels use Slack's view tabs: native tabs for the channel's pull requests, deep links to the channel's own tabs, and a live Workers tab where a person can stop one helper agent.
Today a code channel publishes the Code tab (diff), the Plan canvas and whatever html/block_kit tab the agent writes. Pull requests are GitHub links only, nothing in the channel links to a tab, and the board is read-only: stopping one runaway helper means opening the dashboard.
code_channel_set_viewalso told the agent thatpull_requestviews are "published from the worktree automatically", which was false.The design was reviewed in #22928 (merged into
feat/slack-code-channel-api-gaps, notmain). This PR brings it tomain, on top of #22370 (merged), the worker PR fields of #38181 and the channel Stop of #38243, and follows the RFC amendment in #38124 (§3 "Tabs").Why it matters
A person working in a code channel can't open the channel's pull requests or its own tabs from the messages that name them, and can't stop one helper agent without leaving Slack for the dashboard, while the conductor and the other helpers keep running. The agent was also told something false about
pull_requestviews.Not a goal
cspis sent for html views (unchanged).context_bar_itemstake only aurl, notab_id.agents.conversations.setView/listViews/removeViewusecode_channels:manage, and the Workers buttons arrive over the existing interactivity endpoint.What changed
tabs.py,views.py).setView type=pull_requestwithpr_url, upserted underpr-<n>and namedPR #<n>, for the channel's own PR (its workspace record) and the board's worker PRs (feat(slack): per-row PR and CI, the combined Code tab and wrap-up outcomes on the work board #38181's fields), open or draft and forge-confirmed, the newest two by number. A tab is removed by the view id recorded when it opened, and only on evidence: its PR seen merged or closed, or two newer open PRs seen. A pass whose board or forge read failed removes nothing.views.py). Three tiers. Plan, Code and Workers are never removed to make room. Then the PR tabs, at mostMAX_PR_TABS = 2. Then the agent's own html/block_kit tabs, which give way first (least recently written). A PR tab gives way, oldest first, only to fit Plan, Code or Workers, never another PR tab or an agent tab. With Plan, Code, Workers and two PR tabs open, a new agent view is refused withtoo_many_views, and the tool says so.code_channel_set_viewrefuses the reserved keysplan,workers,diff,pr-<digits>andtype=pull_request.board/render.py,board/publisher.py,wrapup.py). Arich_textchannelelement whosetab_idis thesetViewview_id(the Code tab's staticcode), built only from ids recorded as ours and shaped like Slack ids. The board gets aTabs: Workers · Codeline and each task'sPR #nopens its PR tab (GitHub when it has none). The wrap-up links the Code tab and the open PR tabs (a worker's only while the board's scope admits the channel). A board or wrap-up Slack refuses because of the links is resent without them.tabs.py,board/render.py). Ablock_kitview (workers) rendered from the board's own snapshot, so it carries the board's redaction, de-pinging and host scrubbing. Per worker: the title, a status line, its PR (linked to its tab) with the CI count, Open in dashboard (a url button), and Stop (outlined, behind a confirm dialog) while it works. Up to 14 open workers, then+N more. Settled workers fold intoDone: <title> · PR #N · CI x/ylines. Written only when what it shows changed, or every 5 minutes for elapsed times, and at most every 15 s.board/stops.py). After a Workers-tab Stop, the row reads "Stopped by @user · HH:MM" on the board and the tab, without a Stop button, until that worker's next turn. The refresh the Stop arms skips both edit gaps once. It is kept because it is the one place the other members of the channel see that a person stopped a helper, and when: the private reply reaches only the presser, and the audit row (slack.code_channel.stop) only the operator. It goes beyond the RFC's Workers-tab text, which asks only for the audit record. Its three known races each have a test: a press while a stop is already in flight credits nobody (test_a_press_while_a_stop_is_already_in_flight_credits_nobody), a queued turn that starts after the stop is never marked stopped (test_a_queued_turn_that_starts_after_the_stop_is_never_marked_stopped), and a label gone stale while the tab or the board is sent is written again (test_a_stopped_worker_whose_next_turn_starts_during_the_write_is_written_again,test_a_stopped_worker_whose_next_turn_starts_during_the_board_send_is_edited_again).channelsfences, and the board's scope at the client's commit point (surface.send_fence), the retry after making room included. Writes after an await go throughsurface.commit_if_not_stopped;tabs.pyandworker_stop.pyare intest_slack_code_channel_commit_point.py's scan. Tab records follow what Slack did even when the call is cancelled after Slack answered, and a tab whose answer was lost (or whose record a restart cut off) is removed by its key once its PR settles or the board empties, with a backoff and a refresh armed when Slack refuses for now.The Workers-tab Stop: authorization path (for the maintainer)
This is a new path from Slack interactivity to cancelling a session. It adds no new permission rule: it uses the channel Stop's.
interactions.pyrouteskc_cc_worker_stoptoworker_stop.handle_stop_click;kc_cc_worker_openis a no-op. Neither can fall through to another handler.actions.admit(...): the context-bar buttons' own gates, unchanged: one clicking user, admitted workspace,channelspolicy, a bound channel.container.view_idmust equal this channel's recorded Workers view. Noview_id, or another view, is refused. Nothing is guessed.actions._may_stop(...): the channel Stop's rule for who may stop (session_events.handle_stoppedthenrouting.stop_from_channel, which the context bar's Stop goes through too).board.source.read_board(the scope-checked conductor-ledger read). A session key in the payload is never read.channelspolicy is asked again as the last await, then a synchronous final gate runs with nothing between it and the stop: code channels on, workspace admitted, the binding still the admitted one (same session and anchor, not archived), the view still the recorded Workers tab,_may_stopagain, the slot neither the conductor's nor another conductor's worker (an unreadable lineage refuses), the session its sub-agents are swept from (effective_session_key) the slot's own and not the conductor's, and the cancel target (turn_stop._cancel_target) resolving back to that worker's slot.worker_stop.stop_one_workerstops that one helper through the channel Stop's own path for one helper,stop_helpers.stop_one_helper(feat(slack): a code channel's Stop also stops its helper agents #38243): its turn (stop_slot_turn(..., escalate=False, cancel_key=...), started with no await after the final gate, so a queued turn is never the one stopped), then its sub-agents (cancel_for_parent). It ends in the state the channel's Stop leaves a helper in. The confirm dialog says so: "This stops this helper agent and the agents it started." A double click never escalates to a kill, and the conductor keeps going. A worker whose turn has already ended at the final gate is answered "isn't running", and the agents it started are still swept, as the channel's Stop (whose "Nothing is running." check on main counts live sub-agents) sweeps them. Known limit, the same one the channel's Stop has on main:stop_one_helperstops the pinned turn first and sweeps the helper's sub-agents after, by session, so a person's new message to that helper during the stop's await can start a sub-agent that the sweep then cancels. A turn-scoped cancel is a separate change.stop_helpers.pychanges by 23 added and 3 removed lines:_stop_onetakesescalateandcancel_key(defaults as before, so the channel's Stop is unchanged) and returns its answer, andstop_one_helperis the new one-helper entry.Every decision is audited as
slack.code_channel.stop(with the sub-agent count); refusals are ephemeral; a repeat within 5 s is answered, not re-sent. The id check, delivery dedupe and payload-shape logging areactions' own (_id,_first_delivery(scope=...),_log_shape).The
block_actionspayloadCaptured from a live workspace (see Real-machine verification). The gateway's first Workers-tab click logged the container's key names (
actions._log_shape, names only, never values):20:05:00 INFO kiro_crew.slack.code_channels.actions [PID 21775]: workers tab container keys: ['channel_id', 'type', 'view_id']parse()reads the view fromcontainer.view_idand the channel frompayload.channel, elsecontainer.channel_id(worker_stop.py:92-102). The container carriedchannel_idandview_id, the view id matched the channel's recorded Workers view (the stop passed both view checks,worker_stop.py:165and:444), and_stop_payload()in the tests builds the same container shape, so neither changed.The second commit: a refresh after every finite tab backoff
CI's GPT lane upheld one finding on the first head: a PR-tab write Slack rate-limited on a channel with no work board armed no refresh, so the tab stayed missing after the cooldown. The same held for a removal's backoff and for a full channel holding back the Workers tab. The second commit fixes the class: each finite hold now arms the channel's refresh on the board's timer, and a permanent refusal arms nothing.
Retry delays in the tab code: every site
Invariant: every finite retry delay that a tab write, a tab removal or a Workers refusal produces ends as an armed refresh no earlier than that delay, on a channel with or without a work board. A permanent refusal arms nothing. Refreshes are armed on the board's timer (
board.retry_later/board._schedule(delay=...)->_arm_timer): one per channel, the earliest wins, and it runs the workspace refresh with or without a board.Line numbers are
src/kiro_crew/slack/code_channels/tabs.pyon this head unless named. Test file:test/test_slack_code_channel_view_tabs_fences.pyunless named._refusal:222,invalid_view_typetype:<view type>held for ever, returns 0test_a_pr_tab_slack_refuses_for_good_arms_no_refresh[invalid_view_type]_refusal,invalid_pr_url/not_view_owner..._refuses_for_good_arms_no_refresh[invalid_pr_url / not_view_owner]_refusal,too_many_viewsFULL_RETRY_SECS, now returned (was 0)test_a_pr_tab_slack_holds_back_arms_a_refresh_after_its_hold[full],test_a_full_channel_holding_back_the_workers_tab_retries_after_the_window_refusal, any other code (429 included)_backoff, at least Slack's Retry-After..._arms_a_refresh_after_its_hold[write]_open_pr_tab:521, Slack refusal_refusal's delay_retry_after_hold(new; arms only0 < delay < inf)test_a_rate_limited_own_pr_tab_on_a_channel_with_no_board_comes_back(the finding's trigger, throughWorkspaceService._publish_pr_tabswith no board),..._hold[write],..._hold[full]_open_pr_tab:524, refused locally (CodeChannelError)test_a_pr_tab_slack_will_not_take_is_logged_once_and_not_asked_again(view_tabs.py)sync_pr_tabs:440, a removal Slack refused_backoff, at least Retry-After_retry_after_hold(new)..._hold[removal]sync_pr_tabs:416, a removal still held when a refresh comes early_retry_after_hold(new)..._hold[removal](second pass, 10 s in)sync_pr_tabs:452, the PR view type heldinvalid_view_typeonly)_retry_after_hold, which ignoresinf..._refuses_for_good_arms_no_refresh[invalid_view_type]sync_pr_tabs:471, a PR tab still held when a refresh comes early_retry_after_hold(new;infarms nothing)..._hold[write],..._hold[full](second pass)_sweep:335 / :346 (unrecorded tab removed by key)_backoffboard.retry_later(unchanged)test_a_sweep_slack_refuses_for_now_arms_a_refresh_after_its_backoff_publish_workers:615,type:block_kitheld"held")invalid_view_typesets it_publish_workers:618, Workers tab held for ever (not_view_owner,invalid_pr_url, a local refusal)"held", no_retry_at(was"backoff"with an infinite timer)test_a_workers_tab_slack_refuses_for_good_arms_no_refresh_publish_workers:620, Workers tab still held (a finite backoff)_retry_attake_retry->board/__init__.py:592_schedule(delay=min)test_a_rate_limited_workers_write_waits_out_slacks_retry_after(view_tabs.py)_publish_workers:655, the 15 s edit gap_retry_attest_the_workers_tab_is_written_only_when_it_changed_and_at_most_once_a_gap(view_tabs.py)_publish_workers:687, Slack refusal_refusal's delay ->_retry_at,"failed"(too_many_viewswas 0 ->"held", never retried)test_a_full_channel_holding_back_the_workers_tab_retries_after_the_window; 429: existing..._workers_write_waits_out_slacks_retry_after_publish_workers:693, refused locally_publish_workers:710, a write that removed a PR tab to fit, or a stopped worker started a turn mid-writeWORKERS_MIN_GAP_SECS->_retry_attest_a_stopped_worker_whose_next_turn_starts_during_the_write_is_written_again_publish_workerslinks refused (around :595), resent withouttest_a_workers_tab_refused_for_its_tab_links_goes_out_without_them_arm_timer: one timer per channel, earliest winstest_repeated_rate_limits_keep_one_timer_per_channel(real timer: 5 passes, 1 Slack call, 1 timer, due > 30 s out)Not in scope: the agent's own html/block_kit views (
tools.pycode_channel_set_view) answer the agent with Slack's error and arm nothing by design; they are not refreshed by the board.Test isolation: the
envfixture cancels and clearsboard._timersbefore and after each test (test/slack_code_channel_view_tabs_helpers.py), so a hold armed by one test never decides another's timer.Backwards compatibility
Compatible. Without a new tab the board, view and wrap-up paths render as before (
test_without_tabs_the_board_is_what_it_was_…).code_channel_set_viewalso refusesworkers,diff,pr-<digits>; nothing in the repo or the prompts writes those keys. Surface-recordviewsentries gain an optionalurlandorigin; old entries read the same.Tests
test/test_slack_code_channel_view_tabs.py,_stop.py,_fences.py(164 test functions). Each review fix has a test that fails without it, among them:stop_helpers.stop_one_helper(pin test: it fails when the stop is routed around that path), stops the helper's sub-agents too, and never stops a queued turn that became runnable as the final gate passed;SurfaceClient's own policy read gets no Workers-tab write and no worker-PR-tab removal;channelspolicy, or the channel set to Off or Review) while its facts are read posts nothing; one sent without its tab links is retired without them;Head commit:
702cf2760084a0a90cf5577d8ca7f0540a75e8b3(commit 1a1e66c9dc785e27e7a195800162156b26ef44326, commit 2 on top), on mainfb81cec80f492a5a897a9537334cf1524e8ec993.Both commits are unchanged (
git range-diff=) from0b567acc1018cc3f432306890b15e56eafb74111on main54b60f24a906362d5bd533f0b453a904d8c28198, and main's commits since touch none of this PR's files; the static gates were run again on this head. Run locally on0b567acc1018cc3f432306890b15e56eafb74111: all 25 steps of Fast Gate's Source Gates, Static Ratchet Gate and Flake Pattern Ratchet jobs, Semgrep (CI's configs, diff only) andcheck_agent_sdk_boundary.py, all passing; the static prepush gates (lint, types, line cap); everytest/test_slack*.py: 7,700 passed; the changed test files three times: 1,048 passed each run; every ratchet and tree-scan test file withGITHUB_BASE_REF=mainand the PR base: 24,479 passed, 30 failed, alltest/test_kas_bundle.pyon this host's glibc 2.26 (KasHostUnsupported). Commit 1 is unchanged from the one below (git range-diff=), which was also run on maindb76983f2b:test/test_slack*.py(198 files): 7,696 passed;check_agent_sdk_boundary.py: all pass;GITHUB_BASE_REF=mainand the PR base: 3,097 passed (the code-channel, facade, fence and ratchet files); the wider 429-file set on an earlier tree of this round: 24,479 passed, 30 failed, alltest_kas_bundle.pyon this host's glibc 2.26;code_channels/routing.py1,912 andslack/events.py1,965 lines (neither touched here);website/file changes; no short fixed waits in the new tests.Real-machine verification
Machine: the author's dev host (Amazon Linux 2, x86_64, 16 vCPU / 61 GiB); test copy /home/kseam/repos/KiroCrew-wt-tabs-stop-press at the head, gateway PID 21775 on 127.0.0.1:6797 with its own data home; a test Slack workspace with a new app made from that copy's manifest (the code_channel_action event deleted by hand), Agent sessions on, the channel's approval mode Trust.
Before (main fb81cec): the base has no
src/kiro_crew/slack/code_channels/worker_stop.py(git ls-tree fb81cec80f src/kiro_crew/slack/code_channels/lists none), so a code channel has no Workers tab and no Stop to press.After (head 702cf27): pressed Stop on the working helper's row in the channel's Workers tab at 20:05:00Z and confirmed. The gateway logged:
20:05:00 INFO kiro_crew.slack.code_channels.actions [PID 21775]: workers tab container keys: ['channel_id', 'type', 'view_id']Result: audit
slack.code_channel.stopallowed for the presser,action=worker-stop item=it_e9d8f3ec slot=chat-4-1795032246 result=stopping subagents=0; the gateway logged a cooperative cancel for that worker slot,stop_turn outcome=soft-acked ... elapsed=0.24sandTurn cancelled by user; the channel's own session was not stopped. Slack showed the presser only: "Stopping Run sleep 600 in the shell, then report done. The conductor keeps going." The Workers tab was rewritten at 20:05:13Z (its recorded write time).Cleanup: not yet: the test gateway (PID 21775) and the test Slack app are still up; Kyle stops the gateway, deletes the app (which revokes its tokens) and removes the test worktree after this review.
Screenshots
Slack-like render of the real blocks (not Slack's renderer), from a sample snapshot, rendered from the head's blocks (Workers tab with each worker's PR tab link and CI count, Stop on the working row; the board's
Tabs: Workers · Codeline).Related
After #22370. Builds on #38181 (worker PR fields) and #38243 (the channel Stop). RFC: #38124. Earlier review: #22928.