Skip to content

fix(slack): watch unfiled workers in a code channel's worktree - #31413

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/slack-code-watch-unfiled-workers
Nov 6, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/slack-code-watch-unfiled-workers

Conversation

@kyleseaman

@kyleseaman kyleseaman commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

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_tick in slack/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 a folder inherits 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

  • Changing how the bound session's own turns drive the status or refresh: they still go through the core's turn hooks.
  • Watching sessions by descent from the bound session (the issue's alternative). Matching by project directory covers every session that edits the worktree, which is what the diff and status describe.

What changed (motivation → approach → change)

  • Symptom: an unfiled worker on the channel's worktree is invisible to the watcher.
  • Root cause: the scan's only membership test was slot.folder_id in subtree.
  • Change (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_tick runs sessions_in in 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:

  • an unfiled worker on the worktree sets the working status while it runs, and its finished turn schedules the diff refresh (fails before the fix);
  • a session both filed in the folder and on the worktree is counted once;
  • a session on a different directory is still ignored.

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* and test_slack_code_channels* file plus test_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_tick and 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_tick is the only code-channel caller
Sibling: 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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • 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.

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
@kyleseaman
kyleseaman requested review from a team and KiroCrewCaptain as code owners November 6, 2026 12:36
@kyleseaman
kyleseaman requested a review from Zedmor November 6, 2026 12:36
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision a3c7351546c8d81e069fab2dccef0cb543c8cca5 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 6, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of a3c7351546c8d81e069fab2dccef0cb543c8cca5 — 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

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

  • Item 3 — one consumer, generalized: sessions_in(..., worktree: str = "") has a default, but the only caller (watch_tick, service.py:865) always passes record.worktree, which is non-empty there because of the if not record.worktree ... continue guard. Subtraction: drop the = "" default and the if worktree else "" branch, and make worktree required.

What this change ships

Inventory (4 items) — 3 justified

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

  1. An unfiled worker running in the channel's worktree now sets Slack's "Working" status while its turn runs — justified
  2. That worker's finished turn now refreshes the diff and context bar — justified
  3. The watcher now counts a session as the channel's work when its project resolves to the worktree or a directory under it, not only when it is filed in the folder — one consumer, generalized
  4. The per-tick membership scan now runs in a thread, because resolving paths can block — justified

[FIRST-PRINCIPLES-REVIEWED] a3c7351

Description read

[DESCRIPTION-READ] e1513297148c9d3df5ae71a1f2eb82d773f921964e92ab3cb8faf6e6daa878b2

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 6, 2026

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

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

  • Matching "the worktree or a directory under it" assumes no channel's worktree sits inside another's. If one ever did, the outer channel would also watch the inner channel's sessions, which means extra refreshes and a misleading "crowded" warning.

[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 .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 6, 2026

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] a3c7351

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

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

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] a3c7351

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

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision labels Nov 6, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 6, 2026 14:09

@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.

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.

@KiroCrewCaptain
KiroCrewCaptain merged commit 8cd1230 into main Nov 6, 2026
120 of 127 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/slack-code-watch-unfiled-workers branch November 6, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: passed Eligible automated validation passed for the current revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slack code channels: workspace watcher misses unfiled workers using the channel worktree

2 participants