Skip to content

fix(slack): clear early-exit working indicators through the turn helper - #25538

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/slack-early-exit-indicators-24947
Oct 29, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/slack-early-exit-indicators-24947

Conversation

@CrysisDeu

@CrysisDeu CrysisDeu commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Every exit _run_turn takes before the stream opens takes down the "…is working" status and the Stop block through turn.clear_working_indicators().

_run_turn has four early exits that clear the indicators by hand: cancelled before the LLM call, stopped before a compaction replay, the turn ceiling, and the gateway shutting down (SessionClosingError). Their copies differ from the helper and from each other:

  • The status clear is not guarded, so a Slack error there skips the Stop-block delete.
  • The cancelled-before-LLM and shutdown exits never delete the Stop block, so its live Stop button stays in the thread.
  • None of them sets _indicators_cleared.

Why it matters

A message cancelled before its LLM call, or dropped because the gateway is shutting down, leaves a "Working…" block with a Stop button for a turn that never ran.

Not a goal

Intended? / Repro

Intended? No. clear_working_indicators is documented as the one place that takes down the status and the Stop block (slack/handler_runtime/turn.py, added in #20353). The turn-ceiling exit's own comment says the Stop block must be deleted on the way out because the turn never opened; the same holds for the cancelled and shutdown exits, which skip the delete.

Repro (code path on main 76685f225e):

  1. A threaded Slack message posts the Stop block (_run_turn, post_blocks).
  2. sessions.is_cancelled(...) is True before the LLM call: the exit calls set_thread_status(..., "") and returns. The Stop block is never deleted.
  3. Same for SessionClosingError from the turn gate.

What changed (motivation → approach → change)

Symptom (Stop block left behind, unguarded clears) → cause (four hand-written copies of the clear) → change: each of the four exits calls await turn.clear_working_indicators(). turn._working_ts holds the same Stop block id as the local at each exit, so the helper deletes the right message. The helper's comment now names these exits among its callers.

Backwards compatibility

Compatible: the same status clear runs on each exit. Two exits now also delete their Stop block, and a Slack error on the status clear no longer escapes _run_turn; it is logged at debug, as in the helper's other callers.

Removes nothing a user relies on: the Stop block it now deletes belongs to a turn that never ran.

Tests

TestEarlyExitsClearBothIndicators in test/test_slack_handler_working_indicators.py:

  • Cancelled before the LLM call: status cleared and Stop block deleted.
  • Gateway shutting down (begin_turn raises SessionClosingError): both cleared.
  • A failing status clear still deletes the Stop block.

The native-handler golden digests for cancelled_messages and turn_ceiling_and_shutdown record what reaches Slack, so they change with the added Stop-block deletes. They are updated from this PR's CI run.

Proof: not provable -- other: this host runs no tests locally; CI runs the new tests

Manual verification

N/A. No UI code changes; the tests drive the real handle_message against the mock Slack client.

Related Issues

Fixes #24947

Follow-up to #20353 (merged), which added clear_working_indicators.

Sibling sweep

Swept: git grep -n 'set_thread_status(.*"")' -- src/kiro_crew/slack/
Sibling: src/kiro_crew/slack/handler_runtime/turn.py -- changed here (the four early exits)
Sibling: src/kiro_crew/slack/handler_runtime/turn.py -- not affected -- clear_working_indicators itself
Sibling: src/kiro_crew/slack/handler_runtime/delivery.py -- not affected -- already calls the helper (#20353)

Pattern harvest

Not generalizable: the helper's comment names every caller, and no inline status clear is left in handler_runtime/.

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.

@CrysisDeu
CrysisDeu requested review from a team and KiroCrewCaptain as code owners October 29, 2026 02:15
@CrysisDeu
CrysisDeu requested review from mbriones98 and removed request for a team October 29, 2026 02:15
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 5067b8c24e17357eedf227946a208e2188609359 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 Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 5067b8c24e17357eedf227946a208e2188609359 — 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. The fix sends the four hand-written clears through the existing helper, so the cause is gone and no copy is left in handler_runtime/. The issue (#24947) and the new tests show the defect.

What this change ships

Inventory (5 items) — 5 justified

Intent: when a Slack turn ends before it runs, take down its "Working…" status and its Stop button. FIX.

  1. A message cancelled before its LLM call no longer leaves the Stop block with its live Stop button in the thread — justified
  2. A message dropped because the gateway is shutting down no longer leaves the Stop block behind — justified
  3. A Slack error while clearing the status on the four early exits no longer skips the Stop-block delete or escapes _run_turn — justified
  4. The compaction-replay-stopped exit and the turn-ceiling exit clear through the shared helper and also set _indicators_cleared, with the same Slack-visible result — justified
  5. The ceiling-branch pin in test_turn_ceiling.py now also accepts turn.clear_working_indicators(), which deletes the same block — justified

[FIRST-PRINCIPLES-REVIEWED] 5067b8c

Description read

[DESCRIPTION-READ] 974572c97841edaba02af964e97fa4218e089f0a2f7187aa538ff82cc2177e96

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 Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the four early exits now share the one clear helper. The local _working_ts and turn._working_ts are the same block at each exit, because it is published at turn.py:427 before any of them.

[DESIGN-REVIEWED] 5067b8c

Description read

[DESCRIPTION-READ] 1daec55267d06b04287a282742c4fffba686f5d708a959a25a52e3d7d4144f16

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 Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 5067b8c

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

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

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 5067b8c

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

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 29, 2026
@CrysisDeu
CrysisDeu force-pushed the fix/11448-cancelled-working-indicator-leak branch from b2b65d7 to f2df761 Compare October 29, 2026 02:57
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 29, 2026
@CrysisDeu
CrysisDeu force-pushed the fix/slack-early-exit-indicators-24947 branch from 997cb18 to f793936 Compare October 29, 2026 03:09
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 29, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD (base) at f793936.

This PR targets fix/11448-cancelled-working-indicator-leak (stacked on #20353), not main. Only 21 checks ran, and the main-targeted backend lanes have not run. The description says the cancelled_messages and turn_ceiling_and_shutdown golden digests will change once they do.

The change itself is small and looks right: the four early exits in _run_turn now call turn.clear_working_indicators() (turn.py#L805-L861), so the Stop block is deleted and a Slack error on the status clear no longer escapes.

To clear: merge #20353, retarget this PR to main, update the golden digests in that same push, and let full CI run. A new head needs a fresh review.

— crew-pr-reviewer (r134)

Base automatically changed from fix/11448-cancelled-working-indicator-leak to main October 29, 2026 07:09
@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Oct 29, 2026
@CrysisDeu
CrysisDeu force-pushed the fix/slack-early-exit-indicators-24947 branch from f793936 to 0d18f4c Compare October 29, 2026 08:06
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 29, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 29, 2026
@CrysisDeu
CrysisDeu force-pushed the fix/slack-early-exit-indicators-24947 branch from 0d18f4c to 23a8cb9 Compare October 29, 2026 09:44
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 29, 2026
_run_turn's four exits before the stream opens cleared the thread
status and the Stop block by hand. Two never deleted the Stop block,
the status clear was unguarded, and none set _indicators_cleared. Each
now calls turn.clear_working_indicators().

Fixes #24947
@CrysisDeu
CrysisDeu force-pushed the fix/slack-early-exit-indicators-24947 branch from 23a8cb9 to 5067b8c Compare October 29, 2026 11:27
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 29, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) October 29, 2026 13:06

@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 (4 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: the Slack turn's early exits (cancel, stop before replay, turn ceiling, shutdown) now call the shared clear_working_indicators helper, so the Stop block is deleted as well as the status; tests added.

@KiroCrewCaptain
KiroCrewCaptain merged commit a29bae7 into main Oct 29, 2026
94 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/slack-early-exit-indicators-24947 branch October 29, 2026 13:09
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 29, 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.

Slack _run_turn early exits clear the working indicators by hand instead of clear_working_indicators

3 participants