Repository navigation
fix(slack): watch unfiled workers in a code channel's worktree - #31413
Conversation
The code-channel workspace watcher only counted sessions filed in the channel's folder subtree. A worker a conductor dispatches without a folder inherits the channel's worktree but was never watched: no Slack working status while it ran, and no diff or context-bar refresh when its turn ended. The watch scan now also matches live sessions whose project resolves to the channel's worktree (or a directory under it), whatever folder they are in, counting a session that matches both once. The slot snapshot is taken on the loop and the path resolution runs in a thread. Fixes #30481
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Small fix at the mechanism level, with a test that fails on base. One note: an optional parameter that its only caller always passes. Notes
What this change shipsInventory (4 items) — 3 justifiedIntent: the channel's Code tab should show work from conductor-dispatched workers that run in the channel's worktree but are not filed in its folder. FIX (#30481).
[FIRST-PRINCIPLES-REVIEWED] a3c7351 Description read[DESCRIPTION-READ] e1513297148c9d3df5ae71a1f2eb82d773f921964e92ab3cb8faf6e6daa878b2 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 change matches sessions by the worktree they run in, which is the same thing the diff and status describe, and it removes nothing. Notes
[DESIGN-REVIEWED] a3c7351 Description read[DESCRIPTION-READ] 612a59ea897ad8b76ec3744177c825ded8afe6860ab819bf606751599783fbf8 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: |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (3 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: bug fix: the code-channel watcher also tracks unfiled worker sessions running in the channel worktree.
Problem / Motivation
Goal: a worker dispatched into a Slack code channel's worktree without a folder shows the channel's Working status and refreshes its diff and context bar when it finishes.
The code-channel workspace watcher (
watch_tickinslack/code_channels/workspace/service.py) only watched sessions filed in the channel's sidebar folder subtree. A worker that a code-channel conductor dispatches without afolderinherits the channel's worktree as its project, but nothing watched it. While the conductor was idle, that worker's running turn set no Slack "Working" status, and its finished changes refreshed neither the diff nor the context bar. The Code tab stayed stale until another watched session finished a turn.Why it matters
Conductors routinely dispatch workers without filing them. Their work is the channel's work, so the channel should show it.
Not a goal
What changed (motivation → approach → change)
slot.folder_id in subtree.workspace/folders.py,workspace/service.py):live_slots(state)snapshots every live session (key, folder, project, running, generation) on the loop, with no disk access.sessions_in(rows, folder_ids, worktree)keeps a session that is filed in the subtree or whose project resolves (realpath) to the worktree or a directory under it. A session matching both is listed once.watch_tickrunssessions_inin a thread, since resolving paths can stall on a slow mount.Backwards compatibility
Compatible: every session the watcher saw before is still seen. The only addition is sessions running in a channel's worktree that are filed elsewhere or nowhere.
Tests
test_slack_code_channel_worker_status.py:Proof: PROVEN test/test_slack_code_channel_worker_status.py::test_an_unfiled_worker_on_the_worktree_is_watched (head a3c7351)
Also run (-n 2), all passing: every
test_slack_code_channel*andtest_slack_code_channels*file plustest_governance_profile_reprojection.py(565 tests). Gates are clean: flake8, isort, black ratchet, comment history, file-line cap, feature map, mypy and Semgrep. No Sensitive Change Review path is touched.Manual verification
N/A — unit coverage sufficient: the tests drive the real
WorkspaceService.watch_tickand Slack status driver over a fake dashboard and Slack client.Screenshots / video
N/A — no UI change; the fix is in the backend watcher.
Related Issues
Fixes #30481
Deferred from #28305 (GPT 6.1 finding on
service.py:853).Sibling sweep
Swept: git grep -nE "subtree_ids(|chat_folder_subtree_ids(" -- src/kiro_crew
Sibling: src/kiro_crew/slack/code_channels/workspace/service.py -- changed here --
watch_tickis the only code-channel callerSibling: src/kiro_crew/dashboard/handlers/artifacts_parts/library_reads.py -- not affected -- artifact library scoping by folder, not session watching
Pattern harvest
Not generalizable: membership in a code channel is defined by its worktree; no other folder-scoped scan has a working directory to match.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.