Skip to content

feat(threads): reply threads ship behind dashboard.crewmate_threads, off by default - #13162

Merged
iamwhatever merged 1 commit into
mainfrom
feat/reply-threads-flag
Sep 24, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
feat/reply-threads-flag

Conversation

@CrysisDeu

@CrysisDeu CrysisDeu commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Reply threads on crewmate chat messages (#12797, the API half of RFC screen 07 in docs/request-for-change/rfc-crewmates-launch.md) merged with no switch: the three /api/chat/threads routes and the chat.thread_reply frame are live for every install as soon as the frontend ships. The launch decision is that threads are a flagged feature, off by default, so an install that has not opted in exposes nothing of it.

Why it matters

A feature nobody turned on should not answer on the wire. Off, a caller must not even be able to tell it exists.

What changed (motivation → approach → change)

Piece What it does
dashboard.crewmate_threads new config bool, default False, label "Reply threads on crewmate chat messages"
chat_threads.threads_enabled() the live read every thread route makes first
ws.broadcast_thread_reply sends nothing while the flag is off

config/sections.py adds DashboardConfig.crewmate_threads with its metadata label and help; config/loader.py reads it (bool(...), default False). handlers/core.py lists dashboard.crewmate_threads in _EDITABLE_CONFIG as a bool, so the Settings toggle the frontend PR adds can PATCH it; without that entry the schema would publish a label for a setting whose write is refused.

dashboard/chat_threads.py: threads_enabled() reads the config watcher's snapshot (a plain attribute read) and falls back to a load off the loop only before the watcher has one, so a toggle takes effect on the next request with no restart. Each of the three handlers (api_chat_threads_summary, api_chat_thread_detail, api_chat_thread_reply) calls it before anything else and, off, answers _feature_off(): 404 {"error": "not found", "code": "slot_not_found"}, byte for byte the app-isolation refusal, so "threads are off" and "no such slot" are the same answer and the feature's presence is not enumerable. Nothing is read, stored or started.

dashboard/ws.py: broadcast_thread_reply returns before building a frame when the snapshot is absent or the flag is off. The routes already refuse before a turn starts; this covers the one turn that was running when the flag went off, whose frames are dropped while its stored reply stays in the sidecar and is served again once the flag is back on. The flag hides threads; it never deletes them.

Frontend half: #12815 draws the Reply in thread control and the panel only when the flag is on and carries the Settings toggle. Out of scope, named for the reader: there is no crewmate parent flag in config today (Crew Members is a client-side preview flag), so the toggle nests under a "Crewmates" heading in the settings UI rather than under a parent config key; whether crewmate features should share a parent flag is a separate decision.

Spec: a Flag paragraph in the reply-threads section of docs/system-specs/modules/history.md.

Backwards compatibility

Behaviour change by design: an install that never set the key now has threads OFF. Nothing ships the frontend yet, so no user loses a control they had. The sidecar file and the stored replies are unaffected; a key set to true restores everything as merged.

Tests

test/test_chat_threads.py: an autouse fixture primes the live snapshot with the flag ON (every existing test is about the feature when on); test_threads_off_hides_the_routes_and_sends_no_frame primes it OFF and checks all three routes answer the anti-enumeration 404 with the app refusal's exact body, no turn runs, nothing is stored, broadcast_thread_reply sends nothing, and turning it back on serves the same request and frame; test_the_flag_is_off_by_default_and_editable_from_the_dashboard pins the default and the _EDITABLE_CONFIG entry; config-baseline.json regenerated for the new key. test_a_failed_sidecar_staging_leaks_no_descriptor now counts only descriptors pointing at the .threads directory, not every descriptor in the process -- unrelated handles opening and closing in a shared xdist worker made it flake on shard 8.

Manual verification

N/A — API-only; the frontend PR carries the Settings toggle and its screenshots.

Known red not from this PR: Backend Tests (Windows) (4) fails on test/test_diag_procs.py CPU-rate timing (a different test each run: test_an_unchanged_process_still_gets_its_rate, test_the_gil_hint_can_fire_through_the_read_path), tracked in #13134; this PR touches no diag code.

Screenshots / video

N/A — no UI in this PR.

Related Issues

Follow-up to #12797; paired with #12815. CrewMates launch screen 07 (reply threads).

Checklist

  • Tests added or updated
  • Docs / system specs updated (history.md)
  • No CHANGELOG.md edit (release tooling owns it)

@CrysisDeu
CrysisDeu requested review from a team and patrigao September 23, 2026 19:46
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 23, 2026
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 8300f1b53e6d1bdbc164343941a789ae730f87ca — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify paired #12815 gates its thread calls on the flag: off, these routes answer slot_not_found, which an ungated panel would misread as a vanished slot.

[DESIGN-REVIEWED] 8300f1b

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 8300f1b53e6d1bdbc164343941a789ae730f87ca and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 8300f1b

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 8300f1b53e6d1bdbc164343941a789ae730f87ca: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — 🟡 CONCERNS

Premise-level review of 8300f1b53e6d1bdbc164343941a789ae730f87ca — 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/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The descriptor-leak test rewrite rides along on an unlinked flake claim, narrowing a process-wide pin to fds targeting .threads with no run or issue to point at.

Not justified as shipped

  • Item 6 — rides along: "unrelated handles opening and closing in a shared xdist worker made it flake on shard 8" is asserted only by the description — no linked issue or CI run (contrast the Windows red, which cites tests(windows): test_diag_procs second-read cpu rate reads the real clock, flakes on slow runners #13134) — while the hunk shrinks what test_a_failed_sidecar_staging_leaks_no_descriptor pins from every process descriptor to only those whose readlink target is the .threads directory.
    Subtraction: defer — split the test/test_chat_threads.py fd-counting hunk into its own PR carrying the flake evidence.
    Clears when: a linked CI run or tracking issue showing the shard-8 flake, or the hunk removed from this PR.

What this change ships

Inventory (7 items) — 6 justified

Intent: make the already-merged reply-threads API invisible until an operator opts in, per the crewmates-launch decision — an ADDITION (a gate around an existing feature).

  1. New Settings key "Reply threads on crewmate chat messages", default off — justified
  2. The three /api/chat/threads routes answer the anti-enumeration 404 while off (changed default: threads off unless chosen) — justified
  3. No chat.thread_reply frame is sent while off, including for a turn already running — justified
  4. The flag is editable from the dashboard (_EDITABLE_CONFIG entry) — justified
  5. history.md gains a Flag paragraph in the same commit — justified
  6. Descriptor-leak test counts only fds targeting .threads on Linux — rides along, flake asserted without a linked run or issue
  7. Tests pin the off-by-default, the byte-identical app-refusal body, and the on/off round-trip — justified

[FIRST-PRINCIPLES-REVIEWED] 8300f1b

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

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

Review details

Nothing blocks; two claims the diff adds describe behaviour the code does not have.

FINDING — src/kiro_crew/dashboard/handlers/core.py:2464 — the added comment states "the Settings toggle under Crewmates is the only dashboard door to it", but no such control exists: crewmate_threads/crewmateThreads appears nowhere under website/, settingsRegistry.gen.ts (generated from settings-panel JSX) has no entry, and no frontend code calls /api/chat/threads, so the only door is PATCH /api/config/kirocrew; the matching help sentence in sections.py:3148 ("the dashboard draws no Reply in thread control") implies a control that is likewise absent → Fix: say the flag has no dashboard control yet in the core.py comment and in the help string (schema + config-baseline.json + history.md copies).

FINDING — src/kiro_crew/dashboard/chat_threads.py:392 — _feature_off's comment claims "the feature's presence is not enumerable", but the gate runs before each handler's validation, so GET /api/chat/threads with no slot answers 400 missing_query_params when on vs 404 when off, and GET /api/chat/threads/zzz?slot=k answers 400 invalid_mid when on vs 404 when off — any authenticated caller, including an App Kit token, reads the flag's state off the status code → Fix: move each if not await threads_enabled() below that handler's _valid_mid/_resolve_slot checks, or drop the non-enumerability claim from the comment and history.md. (origin: validation)

[OPUS-REVIEWED] 8300f1b

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable 8300f1b53e6d1bdbc164343941a789ae730f87ca: <one-sentence reason>

CrysisDeu added a commit that referenced this pull request Sep 23, 2026
…'s base

Squash of feat/crewmate-chat-bubbles (3389aeb) and feat/reply-threads-flag
(0f708d3) on main 5c23469, so this PR's own commit is reviewed on top
of both. Also carries, ahead of #12923, the fix for its roster read racing a
message that lands mid-read (handlers/members.py, its test). Merge those PRs
first; this commit then disappears from the diff.
@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 Sep 23, 2026
@CrysisDeu
CrysisDeu force-pushed the feat/reply-threads-flag branch from 0f708d3 to 3bebc1a Compare September 23, 2026 21:31
@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 Sep 23, 2026
CrysisDeu added a commit that referenced this pull request Sep 23, 2026
…'s base

Squash of feat/crewmate-chat-bubbles (d51fad4) and feat/reply-threads-flag
(3bebc1a) on main a118ae7, so this PR's own commit is reviewed on top
of both. Also carries, ahead of #12923, the fix for its roster read racing a
message that lands mid-read (handlers/members.py, its test). Merge those PRs
first; this commit then disappears from the diff.
@CrysisDeu
CrysisDeu force-pushed the feat/reply-threads-flag branch from 3bebc1a to 52ea063 Compare September 23, 2026 22:06
@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 Sep 23, 2026
CrysisDeu added a commit that referenced this pull request Sep 24, 2026
…'s base

Squash of feat/crewmate-chat-bubbles (665b68d) and feat/reply-threads-flag
(52ea063) on main f1f891b, so this PR's own commit is reviewed on top
of both. Also restates one recency comment in history_projection.py (an Opus
finding on this PR, in #12923's code) until #12923 takes it. Merge those PRs
first; this commit then disappears from the diff.
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 24, 2026
@CrysisDeu
CrysisDeu force-pushed the feat/reply-threads-flag branch from 52ea063 to bb776fd Compare September 24, 2026 07:24
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for bb776fd3398cce74c8600dc153949199c8b03689; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt bb776fd3398cce74c8600dc153949199c8b03689: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision readiness: action required A blocking check or review needs attention labels Sep 24, 2026
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 24, 2026
…crewmate_threads, off by default

The three /api/chat/threads routes answer the anti-enumeration 404 and
ws.broadcast_thread_reply sends no chat.thread_reply frame while the flag
is off; read live from the config watcher's snapshot, so a toggle takes
effect on the next request. The key is PATCH-able from the dashboard so the
Settings switch in the frontend PR can write it.
@CrysisDeu
CrysisDeu force-pushed the feat/reply-threads-flag branch from bb776fd to 8300f1b Compare September 24, 2026 08:31
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 24, 2026
CrysisDeu added a commit that referenced this pull request Sep 24, 2026
…'s base

Squash of feat/crewmate-chat-bubbles (665b68d) and feat/reply-threads-flag
(52ea063) on main f1f891b, so this PR's own commit is reviewed on top
of both. Also restates one recency comment in history_projection.py (an Opus
finding on this PR, in #12923's code) until #12923 takes it. Merge those PRs
first; this commit then disappears from the diff.
@iamwhatever
iamwhatever enabled auto-merge (squash) September 24, 2026 16:57
@iamwhatever
iamwhatever merged commit 6c49457 into main Sep 24, 2026
139 of 140 checks passed
@iamwhatever
iamwhatever deleted the feat/reply-threads-flag branch September 24, 2026 16:58
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 24, 2026
CrysisDeu added a commit that referenced this pull request Sep 24, 2026
W4's feat/crewmate-chat-bubbles head 955d1f5, cherry-picked onto main
e183a46 with four additive conflicts kept both ways (feature-map row,
crew-mode section, ChatPane renderer options, transcriptRenderers option
types). #13162 (threads flag) is in main and is dropped from the carry.
Not this PR's review surface; merges with #12923.
iamwhatever pushed a commit that referenced this pull request Sep 24, 2026
* chore: carry #12923 (bubbles) as this stack's base

W4's feat/crewmate-chat-bubbles head 955d1f5, cherry-picked onto main
e183a46 with four additive conflicts kept both ways (feature-map row,
crew-mode section, ChatPane renderer options, transcriptRenderers option
types). #13162 (threads flag) is in main and is dropped from the carry.
Not this PR's review surface; merges with #12923.

* feat: reply threads on crewmate chat messages (ui)

Under a bubble that has replies, a footer: the faces of who took part,
"N replies" in accent, "Last reply 2h ago" muted. Every bubble's hover
action row, the user's included, gets "Reply in thread". Either opens
the thread in the right side panel: the parent quoted as one bubble, a
hairline reply count, the replies as small bubbles on the grouped-corner
rule (crewmate left, user right-aligned), a typing row while the
crewmate replies, and a one-line Reply composer. The main chat stays
visible beside it; closing hands the panel's tabs back.

Only a crewmate's chat offers threads: the Members page hands ChatPane a
ThreadHooks set the assistant and user rows read off the render context;
every other surface draws neither footer nor action. Stored replies and
the per-slot footer data are React Query reads; the reply in progress
streams through a small live store fed by chat.thread_reply frames.
wknight1 pushed a commit to wknight1/KiroCrew that referenced this pull request Oct 5, 2026
…crewmate_threads, off by default (kirodotdev#13162)

The three /api/chat/threads routes answer the anti-enumeration 404 and
ws.broadcast_thread_reply sends no chat.thread_reply frame while the flag
is off; read live from the config watcher's snapshot, so a toggle takes
effect on the next request. The key is PATCH-able from the dashboard so the
Settings switch in the frontend PR can write it.
wknight1 pushed a commit to wknight1/KiroCrew that referenced this pull request Oct 5, 2026
* chore: carry kirodotdev#12923 (bubbles) as this stack's base

W4's feat/crewmate-chat-bubbles head 955d1f5, cherry-picked onto main
e183a46 with four additive conflicts kept both ways (feature-map row,
crew-mode section, ChatPane renderer options, transcriptRenderers option
types). kirodotdev#13162 (threads flag) is in main and is dropped from the carry.
Not this PR's review surface; merges with kirodotdev#12923.

* feat: reply threads on crewmate chat messages (ui)

Under a bubble that has replies, a footer: the faces of who took part,
"N replies" in accent, "Last reply 2h ago" muted. Every bubble's hover
action row, the user's included, gets "Reply in thread". Either opens
the thread in the right side panel: the parent quoted as one bubble, a
hairline reply count, the replies as small bubbles on the grouped-corner
rule (crewmate left, user right-aligned), a typing row while the
crewmate replies, and a one-line Reply composer. The main chat stays
visible beside it; closing hands the panel's tabs back.

Only a crewmate's chat offers threads: the Members page hands ChatPane a
ThreadHooks set the assistant and user rows read off the render context;
every other surface draws neither footer nor action. Stored replies and
the per-slot footer data are React Query reads; the reply in progress
streams through a small live store fed by chat.thread_reply frames.
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.

2 participants