Repository navigation
feat(slack): code-channel worktree, diff view and context bar - #28305
Conversation
Sensitive Change ReviewSensitive files changed:
|
UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing the phone top bar's Slack mark and its new ⋯ menu link, the "Task done" and header-archived states, the "Replies paused" thread chip, and the "worktree is not ready" error card. No supplied screenshot shows any of them. Evidence gaps
Notes
[UX-REVIEWED] 53677fc Description read[DESCRIPTION-READ] 0c7bb7be8d55dfeea7b3dd87cab4b08440d49705702b89bd2b3068debc900513 That sha256 names everything this verdict read: the PR description, plus the 16 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 |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the feature is behind Notes
[DESIGN-REVIEWED] 53677fc Description read[DESCRIPTION-READ] 2e2f1ec5b832d4c3fdcc0545fe655894890486e6e7fe4f99b117c3b23a250916 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 Every item stays behind Notes
What this change shipsInventory (10 items) — 9 justifiedIntent: give each Slack code channel its own git worktree and diff/context view, and mark code-channel sessions in the dashboard. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 53677fc Description read[DESCRIPTION-READ] f1fdbe54559811c2835af8314fc0b0874114c386f736c4f2d09b57b85a2debb5 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] 53677fc 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: |
c00a7d5 to
5622600
Compare
1574eff to
68c383c
Compare
5622600 to
dbc4fa5
Compare
68c383c to
b0ecebd
Compare
dbc4fa5 to
221bbfd
Compare
f5a0afb to
8a5bc3a
Compare
c3bfd0c to
523a819
Compare
8a5bc3a to
24b200e
Compare
|
GPT findings on the previous head are fixed at 6b59d0b, now on #21410's new head.
|
|
Opus finding
|
|
The three upheld findings on 114a546 are fixed at 5337519, now rebased onto #21410's
|
|
Fixed at a32cdb9, rebased onto #21410's
|
|
GPT finding
|
|
Kyle: one First Principles note (non-blocking, PASS) on the worktree/diff PR that a product decision settles. Please post this as a plain PR comment if you agree; the override line below is held for the final head and is not to be posted yet. Rebuilding a lost workspace record from the remembered checkout ( Decision: keep the rebuild (owner decision). Override (only if the First Principles lane turns BLOCK on this item; for the final head, not now): Carried over from #21437 (merged into this branch), for the same plain comment: Keeping the The Slack-thread header link and Decision: keep both (owner decision). |
Sensitive change review
|
Sensitive change review
|
A Slack code channel bound to a session whose project is a git repo now runs in its own worktree, cut on a channel-derived branch from the repo's default branch through the follow-up card's worktree path. Before the channel's session is created it gets its own folder under the code channels folder whose project is that worktree, so the session and every worker a conductor files under it start there. After each turn of any session in that folder the channel's Code tab shows the diff against the base (committed, staged, unstaged and new files, capped at Slack's 1,000,000-byte view limit with a truncation note) and the context bar shows repo and branch, then PR and CI once a PR exists. PR state and CI come from the dashboard PR chip's own provider read. The workspace acts only when features.code_channels_enabled holds: the Slack Code toggle is on and the install can use code channels. A feature_disabled, missing_scope or not_allowed_token_type answer to a workspace write is reported to the feature's latch, which turns code channels off for the process. Non-git projects, missing projects, filter repos, hosts without a sandbox and gh missing or signed out degrade without an error. The worktree identity gate refuses a forged registration in the shared git dir and a directory swapped in at the destination. A lost workspace record is rebuilt from the checkout the binding remembers (repo_root), never from the worktree itself, and an unreadable store abandons a write instead of rewriting it empty. An untracked-only change whose files cannot be read by fd keeps the diff tab, omitted under the truncation note. Co-authored-by: pganapathy80 <26177755+pganapathy80@users.noreply.github.com>
* feat(slack): mark code-channel sessions in the dashboard
Sidebar row and session header show a Slack code channel chip with a link to the channel and its archived / wrapped-up state. The row chip keeps its Slack mark whole, yields width after the agent name, drops its link glyph before the channel name, and goes icon-only below a readable floor; the time never shrinks. Slack channel_archive / unarchive / rename events update the binding.
* feat(slack): code-channel row mark, header links, folded worker crews
Sidebar rows carry the Slack mark alone, a link named 'Open #channel in Slack'. The session header carries the full link (mark, #channel, state, link glyph); a session mirrored to a Slack thread gets a header link to its thread (paused state shown; hidden while code channels are still loading). In the folder view a code-channel conductor's direct workers fold under its row behind a persisted disclosure. The conductor's status line reports the crew worst-first (waiting on you > stuck/interrupted > working > done > idle) from slot data, and from the conductor slot's optional work_aggregate {state, label, counts} when published; a hidden worker's approval or unread result always surfaces on the conductor row.
A session started in a Slack thread is not slack_linked (its thread is
where it lives, not a mirror), so serialize_slot shipped empty
slack_channel/slack_thread_ts and SlackThreadLink drew nothing.
serialize_slot now also ships slack_origin_channel and
slack_origin_thread_ts for a genuine Slack-origin self-link, keeping
slack_linked False so sidebar, menu and mirror semantics are unchanged.
SlackThreadLink links those ids when the session is not mirrored and
reads paused from the origin row. While the code-channel store is
unread, rows carrying an origin thread are marked code_channel_pending
too, so a bound session never flashes the thread link.
Human judgment recorded@kyleseaman recorded a deferred release (class
This decision applies only to this commit. A new push requires a new judgment. |
Sensitive change review
|
Builds on #21410, merged into
mainon 2026-11-04. This PR's two commits: the worktree, diff view and context bar, then #21437's dashboard marking for code-channel sessions (merged into this branch by the owner on 2026-11-02).Why this is a separate PR. This code was part of #21410. It was split out at the owner's direction (2026-11-02) for one reason: #21410's diff had grown past 1 MB, and the AI review lanes refuse any diff over 1,000,000 bytes. It is the code first reviewed as #21412 and merged into #21410, together with the fixes it gained in review there. Nothing about the design changed in the split. #21437, stacked on this branch, was then merged into it, so this PR also carries the dashboard side of code channels.
Problem / Motivation
Goal: Each Slack code channel gets its own workspace, and its dashboard session is visibly a code channel. In a git project the channel's session runs in a per-channel worktree on its own branch, cut from the session's project folder (falling back to the project folder itself only when the worktree cannot be made), and the channel shows a Code-tab diff view and a context bar (repo, branch, PR, CI). A folder that is not a git project is used as it is. In the dashboard, a session that runs a code channel is marked as one in the sidebar and the session header, with a link that opens that channel, and its conductor's workers fold under it behind one line that says what the crew needs. Any session linked to a Slack thread, whether mirrored to one or started in one, gets a header link that opens that thread, whether or not code channels are on (the owner's build-9 ask: a session he started in Slack showed no Slack link).
Why it matters
Without the workspace, every code channel works on the shared checkout of its project, two channels on one repo step on each other, and nothing in Slack shows what a channel's work changed.
Slack Code is meant to be one session seen from two windows. If the dashboard side cannot tell a user which sessions are code channels, or take them to the channel, the dashboard half of the feature is invisible. And a crew should read as one task whose single line says what it needs, without hiding anything that needs the user.
Not a goal
wrapped_up_atstamp the wrap-up work sets.work_aggregate: that is feat(slack): conductor work board in code channels #21993's row model. This PR only renders it.What changed
Commit 1: worktree, diff view and context bar
workspace/git_ops.pycuts a worktree on a channel-derived branch (slack/<slug>-<hash>) from the repo's default branch through the follow-up card's worktree path (sandboxed git, config hooks disabled). Before the channel's session is created (workspace.core.plan_session, called fromrouting._bind_channel) the channel gets its own folder under the code channels folder whose project is that worktree, so the session and every worker a conductor files under it start there. A worktree deleted by hand while its branch is kept is checked out again at the same destination (refused for filter repos, as the first cut is). Non-git projects, missing projects, filter repos, hosts without a sandbox andghmissing or signed out degrade without an error..git/worktrees/<name>entry and a directory (or link) swapped in at the destination are refused. The agent switching branches or detaching HEAD inside its own tree keeps it verified.Binding.repo_root, copied fromworkspace.core.planned_rootat bind; a replacement keeps it). A lost workspace record is rebuilt from that root only when the gate still confirms the tree, never from the worktree itself, and a confirmed tree is adopted as it stands.slack-code-channel-workspaces.json) names the worktree the gateway reads outside any sandbox, so it sits in the data home's fencedroutingdirectory beside the code-channel store: refused to agent file tools, masked in every sandbox tier. A store that cannot be read abandons a write instead of rewriting it empty; display reads answer empty.features.code_channels_enabledholds. Afeature_disabled/missing_scope/not_allowed_token_typeanswer to a workspace write is reported to the feature's latch.Where it lives:
src/kiro_crew/slack/code_channels/workspace/(new), the install hook inslack/code_channels/__init__.py, the calls inrouting._bind_channel,_dispatch_directedand_deliver_first_turn, and the "Code-channel workspace" section ofdocs/system-specs/modules/slack-gateway.md.Prior art from pganapathy80's
slack-code-channels-previewbranch (#15175) is reused and credited in the commit.Commit 2: code-channel sessions in the dashboard (#21437)
slack/code_channels/dashboard_view.pyturns a binding intocode_channel{channel_name,status(archived > wrapped_up > active),web_url: Slack'sapp_redirectlink, empty unless the ids are well formed}. Only a person's views carry it: the bare list never does, anddashboard/ws_event_scope.pystrips it from app WebSocket rows. While the store is still loading, Slack-linked rows carrycode_channel_pendinginstead, so no thread link flashes before the badge. With the gate shut the store is never read.slack/code_channels/lifecycle.pyhandles channel archive, unarchive and rename (andgroup_*), subscribed inslack-manifest.yamlunder#@code_channels. Bound channels only, nothing while the gate is shut, one channel's events in order; a foreign workspace's event is refused, SEL-audited.#channel(truncated, full name in the tooltip), state words, link glyph. A session linked to a Slack thread gets a link toslack.com/archives/<C>/p<ts>(ids validated; "Replies paused" when paused). A session started in a Slack thread is not a mirror, sodashboard/state_parts/slots_frame.pyalso sends that thread asslack_origin_channel/slack_origin_thread_tsand the header links it the same way. On a phone, which draws no session header, the same link (code channel's, else the thread's) is a row in the top bar's ⋯ menu (MobileTopBar.tsx, sharedslackLinkTarget). No URL carries a dashboard credential.mc-sidebar-conductor-expanded). Nothing folds while a search or filter narrows the list; the open session or a pinned worker never folds. Open workers keep the sidebar's one content column (docs/decisions/2026-10-09-folder-glyph-sits-on-its-connector-line.md), marked by an out-of-flow rail. Display only; scoped to code-channel conductors. The row's crew marks live inpages/chat-sidebar/CodeChannelCrewRow.tsx, soSessionRow.tsxstays under the file-line cap.pages/chat-sidebar/codeChannelCrew.ts), worst first: waiting on you > stuck / interrupted > working > done > idle. Withwork_aggregatepresent (contract below) itsstate,labeland counts render as given; null or absent, the slot list's states. In both, a worker waiting on the user always takes the line and lights the attention dot. A tool approval reads in the worker row's own words ("Needs approval · approve git push"); a question card or sub-agent approval reads "Waiting on you". The conductor's own ask or stall keeps its own line.pluralKeys.json.work_aggregatecontractPublished by #21993 at cc01bfb; this PR consumes the same shape (
WorkAggregate,website/src/types/index.chat.ts). An optional field on the conductor's dashboard slot, delivered by the existing slot patch (no new poll),nullwhen there are no workers:A shape this build cannot read (unknown state, non-string label, missing counts) is treated as absent.
Backwards compatibility
Compatible: the workspace is behind the code-channels gate; with it shut nothing there runs. A code channel bound before this PR gets its worktree on its next turn start (or at the next gateway start). Its session moves there when the dashboard applies the project change; otherwise it keeps the shared checkout until an operator sets the session's project to the worktree (the spec section says how).
code_channelandcode_channel_pendingare new optional keys on slot rows (the dashboard also reads an optionalwork_aggregate, which nothing in this PR sets), and the new Slack events are subscribed only under thecode_channelsswitch.slack_origin_channelandslack_origin_thread_tsare new additive string keys on every serialized slot (empty unless the session was started in a Slack thread), ungated by thecode_channelsswitch on purpose: they carry the Slack-born session's thread for its header link. They reach exactly the audiences the existingslack_channel/slack_thread_tsalready reach, app tokens included, and carry the same kind of value (a channel id and a thread ts, no names, no message text, no credential).slack_linkedkeeps its meaning (False for a Slack-born session). A client that ignores the keys sees today's payload.Removes nothing: no field, route or event is deleted or tightened. Folding hides worker rows from the folder view's default display only; each stays one chevron away, on its session page, in search and in History.
Premise (for the maintainer override)
First Principles flags the Slack-thread header link (
SlackThreadLink,ChatTitleOverlay.tsx) and theslack_origin_*slot fields as reaching sessions outside the code-channel gate. That is intentional and owner-approved: the owner asked for it after build 9, when a session he started in Slack showed no Slack link in its header, and on 2026-10-23 ruled to keep it with this work rather than split it out. The link appears only for a session that is already linked to a Slack thread (mirrored or Slack-born), opens Slack's own permalink built from validated ids, and carries no dashboard credential. The fields are additive and back-compatible (see Backwards compatibility). The Goal above states this scope.First Principles also flags the
work_aggregatereader as having no producer in this tree. It is the dashboard half of a contract whose producer is #21993's work-board row model, still open on another branch. Both halves were built against one written shape so the stack can merge in either order. Until #21993 lands the field is absent: the sidebar falls back to slot data, and the "stuck" and "done" lines don't appear. The crew line ranks code-channel workers from slot data, whichlib/crewWorkers.ts(Crew Mode's ledger grouping) does not read, and Crew Mode roots are excluded from the fold.Tests
test_slack_code_channel_workspace.py: worktree cut and reuse, branch naming, diff assembly and the byte cap, untracked-file reads (symlinked root/parent, hard link, FIFO swap, descriptor leaks), the context bar's bounds and redaction, PR/CI lookup, refresh dedup and races, the latch, degraded hosts, the gateway-start sweep and preparation before a turn.test_slack_code_channel_workspace_rebuild.py: the identity gate (branch switch, detached HEAD, forged registration, swapped destination), rebuilding a lost record from the remembered checkout (feature worktree origin, hostilex/.gitsubmodule, unconfirmed root ignored, worktree never remembered), a deleted worktree whose branch is kept checked out again (and never in a filter repo, where git would run the filter), the lost folder recovered, the unreadable store never rewritten empty, and a refresh whose store write fails logs and returns with the lock released.test_slack_code_channels_store_fence.py: the workspace store sits in the routing directory and every sandbox tier masks it.test_slack_code_channels_routing.py: a reopened session keeps or refreshes the remembered root; an existing channel's workspace is prepared before routing.test_security_posture.py: the two workspace modules are registered redaction sinks.test_slack_thread_session_binding.py:serialize_sloton aslack:<ts>self-link shipsslack_linkedFalse plus the origin ids; a dashboard mirror, a Slack session mirroring another thread, an empty channel and a non-Slack origin ship none.test_slack_code_channels_dashboard.py: URL building rejects malformed ids; status precedence; view shape; gate shut never reads the store; an unread store is warmed off the loop and re-pushed; viewer scoping through HTTP and WebSocket (a member sees no other session's channel, an app caller never sees either key).test_slack_code_channels_lifecycle.py: archive/unarchive/rename, unbound channel, feature off, refused or mismatched workspace, per-channel ordering (mutation-checked).website/src/components/CodeChannelBadge.test.tsx,website/src/test/ChatPage.mobileTopBarActions.test.tsx,website/src/pages/chat-sidebar/codeChannelCrew.test.tsandwebsite/src/test/ChatSidebar.codeChannelCrew.test.tsx(real sidebar): the row mark and header link, the phone ⋯ menu row, the fold (collapsed by default, persisted, ordinary parents unchanged),work_aggregatein all five states with fallback, and the approval rule on line and dot. Mutation-checked.capture-slack-code-channel-row-fit.mjs,capture-slack-code-channel-crew.mjs,capture-slack-code-channel-badge.mjs.Manual verification
No live Slack Code pilot workspace is available; git behaviour is tested against real throwaway repositories, Slack against recorded payloads. The dashboard UI was checked in a real browser (Playwright) against the built SPA with canned slots shaped as the backend serializes them, by the three harnesses above, which assert the DOM before each shot.
Screenshots / video
The same Slack Code panel at this head: the Code channels description says what turning it on lets the app do, including the context bar and diff tab this PR adds, before the permission count. #21410 carries the rest of the panel's states (off, open pickers, folder modal, warnings). Rendered from this head's frontend with the Slack settings API stubbed (placeholder data only: example folder, agent and model names; no tokens, workspace ids or hosts).
Dashboard marking (from #21437; earlier before/after shots are in its evidence comment):
Fold opening and closing (260px, dark): fold open and close
Known gaps
Sensitive change
Scope: this PR adds 2 lines and removes none on a Sensitive Change Review path: two
_REDACTION_SINKSrows insecurity_posture_sinks_delivery.pyfor the workspace modules. They moved here from #21410 with the modules they name; their text is unchanged. Commit 2 (#21437) touches no Sensitive Change Review path. No protection list changes;exfil.pyis not touched.Related Issues
Part of #15175.
work_aggregatecontract: #21993 (cc01bfb). Includes #21437.Checklist