Skip to content

feat: reply threads on crewmate chat messages (api) - #12797

Merged
bolichen97 merged 1 commit into
mainfrom
feat/reply-threads-api
Sep 23, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
feat/reply-threads-api

Conversation

@CrysisDeu

@CrysisDeu CrysisDeu commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

A crewmate's chat is one flat list. When the user wants to ask about ONE thing the crewmate said ("what about the other 8?"), the question and its answers land in the main chat, between everything else. There is no way to discuss one message on its own, the way a Slack thread does.

Implements the accepted RFC: docs/request-for-change/rfc-crewmates-launch.md (screen 07, reply threads).

The CrewMates launch review decided screen 07: any bubble, yours or the crewmate's, can carry a reply thread that opens in the right side panel while the main chat stays visible. This PR is the backend half. The panel and the footer under a bubble come in a frontend PR on top of it.

Why it matters

Without threads, every follow-up question pushes the crewmate's real findings up and out of view. The main chat is meant to show only what the crewmate says to you; side questions do not belong in it.

What changed (motivation → approach → change)

Piece What it does
dashboard/chat_threads.py the thread store, three routes and the crewmate's thread turn
.threads/<key>.json sidecar replies live beside the slot's transcript, never in it
chat.thread_reply WS event the reply lands in the thread panel, owner-only
thread:<slot>:<mid> session the turn's own isolated session, stateless across restarts

A thread is the replies on one message of a crewmate's chat, addressed by its durable meta.mid. Replies live in a sidecar beside the transcript (ConversationLog.read_threads / append_thread_reply, history.py): the write runs under the lock, refuses a transcript that is gone or replaced under the same key (created_at captured at admission) and a parent row not yet on disk; a damaged sidecar is refused, never overwritten; a row is read back as the four reply fields only, held to the writer's shape and bounds (opened once, no link followed, 64 MiB ceiling the writer also stops at; id/role/ts and the m-+16-hex key in the writer's formats or the row is dropped; 64 KiB content, 500 rows per thread, 5 000 per file), history_projection.py deletes it with the transcript all-or-nothing (moved aside under a fresh name, never over a leftover); session_storage.py sizes, moves, restores and purges it with the transcript (a sidecar it cannot stat, or a linked .threads, stops the scan and the delete; the age scan judges each sidecar alone, an unstat-able one reads as fresh; restore publishes and rolls it back under the transcript's lock and refuses a sidecar whose chat was recreated; a linked .threads leaves the batch staged). Writer, delete_session and restore refuse a linked .threads and work on its pinned descriptor; the publish links the staged leaf itself, never a link's target. Nothing enters slot.messages.

Three routes in routes/chat.py: GET /api/chat/threads?slot= gives reply counts per message; GET /api/chat/threads/{mid} the parent and its replies; POST /api/chat/threads/{mid}/reply stores the reply, answers 202 and runs the crewmate's turn; a client reply_id makes it idempotent: a re-send after a lost response gets the stored row back, not a second (its turn re-runs if it sits unanswered, or behind only the "send it again" row). The turn is the side chat's shape without its steer/queue ledger: the slot's agent, an isolated thread:<slot>:<mid> session destroyed per reply (session.py, sel.py, messaging/link.py), an envelope with the parent, six messages of context and the thread so far (newest 40 replies plus a count; crewmate rows redacted before the cut), and the read-only posture. The answer is redacted, clipped at 64 000 characters, stored as an assistant reply (a user reply is admitted one seat below each cap) and streamed by ws.py; ws_event_scope.py and website/src/app-sdk/index.ts list the event as slot-scoped; security_posture.py the redaction sink. One reply at a time per thread: reserved before any await, released in one finally. The store write is shielded from cancellation; a committed reply gets a "not answered" row. Every failure sends a plain final frame; a crewmate that no longer resolves gets no substitute answer (the main chat's rule); a refused read-only spec is audited as a denied SEL access; a turn cancelled mid-stream keeps the partial answer under an interruption marker unless the final write committed; both notices say "Kiro Crew stopped". Threads do not travel with a fork, transfer or export (recorded decision).

The frontend half is #12815.

Spec: docs/system-specs/modules/history.md; a thread: note in session.md.

Backwards compatibility

Compatible: only new routes, a new sidecar file, a new WS event and a new session-key prefix. No existing route, file or event changes shape.

Tests

test/test_chat_threads.py: the summary shape; the sidecar lives beside the transcript and goes with it on delete; the store refuses to write beside a missing transcript or into a replacement chat; a delete takes the sidecar with the transcript or neither; a parent only disk holds is found; a damaged sidecar is refused and never overwritten, a row is read back as the four reply fields and nothing else, a row whose id, role, ts or key is not the writer's shape is dropped, content and counts are bounded at the read, an oversized or linked sidecar is refused on its descriptor and the writer refuses past the same ceiling, and every route answers 503 on it; slot/mid validation and the 400/404/409/413 codes (a lone surrogate in the text is a 400, not a 500); a user reply is refused when only the answer's seat is left; app callers get the anti-enumeration 404; a reply is stored, broadcast on the thread channel only and starts the turn with the parent and the chat before it; a second reply during a turn is refused; a re-sent reply id returns the stored reply (running the turn again only when it sits unanswered, or behind the not-answered row, with none active), a malformed one is a 400; a linked .threads or a sidecar that cannot be stat'ed refuses the delete, a leftover staged sidecar is never written over, and a failed staging closes its descriptor; a credential straddling the envelope's line cap is scrubbed, not cut; a nested-past-depth document is unreadable, not a 500; a link swapped in under the restore lock is refused, a planted link is never published as its target, a sidecar alone is not restored onto a recreated chat, one vanished sidecar costs no other session its freshness; a map of empty keys retains nothing; two replies racing through the store write run one turn; a full thread, a full sidecar, a chat before its first flush, a chat replaced between the parent lookup and the store write, a parent not yet flushed, and a store error no outcome names (OSError, answered 503) are refused and release the reservation; a handler cancelled mid-write drains the commit and writes the not-answered row; a caller with no identity is held to the parent's mid; the envelope, and a long thread travels as its tail plus a count; a sidecar that cannot be stat'ed stops the reclaim scan while an absent one is skipped; a linked .threads directory gets no write and a linked leaf is refused; test_session_storage.py: the sidecar appears only once the transcript lock is held, a lost race rolls it back under the lock, a link where .threads should be leaves the batch staged; the thread: key is a stateless, labelled dashboard surface; the turn runs read-only in its own session and lands in the thread while the main chat is untouched; the no-tools harness gets REJECT_ALL; an empty answer becomes the visible boundary line; a long answer is clipped before storage; a reply the store refuses is published as a failure; a refused spec sends a plain error and persists nothing, even when the audit itself raises; a crewmate that no longer resolves gets a plain error and no turn; a cancel landing on the committed answer writes no interruption row; a signed-out harness says so. The body-cap register, the warm-call-site label ratchet and the redaction-sink list each gain the module's row.

Manual verification

N/A — API-only; the frontend PR carries the screenshots of the footer and the open thread panel.

Screenshots / video

Why no screenshot: backend routes and store only; the one frontend line adds an event name to the app-sdk's slot-scoped list and renders nothing.

Related Issues

no linked issue: CrewMates launch screen 07 (reply threads), backend half; the frontend PR follows.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|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

@CrysisDeu
CrysisDeu requested review from a team and patrigao September 22, 2026 12:27
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Intent: Let the user discuss one message of a crewmate's chat in its own reply thread, stored beside the chat and answered by the crewmate, without anything landing in the main chat.
Not a goal: The thread UI (footer under a bubble, side-panel thread view), tool actions from inside a thread, injecting the crewmate's memory into a thread turn, or threads on ordinary (non-crewmate) chats.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 22, 2026
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — 🟡 CONCERNS

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

Design-Verdict: CONCERNS

Export and transfer silently strand primary, non-regenerable user data — thread replies stay behind with no user-visible warning.

Watch

The spec itself says replies "are primary data that cannot regenerate," yet "a fork, a transfer and an export copy the transcript and leave the sidecar behind." Cause: sidecar excluded from the copy paths → mechanism: a user transfers or exports a chat believing it complete → consequence: their thread discussions vanish with nothing telling them, discovered only after the original is gone. Disclosure to reviewers ("recorded decision") is not disclosure to the user.
Clears when: the export/transfer surface warns "reply threads are not included" (or a filed follow-up carries sidecars), before the frontend PR #12815 makes threads visible.

Suggestions

  • Nest the routes as /api/chat/slots/{slot}/threads/{mid} to match the existing /api/chat/slots/{slot}/... family — mid is only meaningful within a slot, and the top-level-plus-query shape becomes permanent public surface once feat: reply threads on crewmate chat messages (ui) #12815 ships against it.

[DESIGN-REVIEWED] 4744ba7

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ✅ PASS

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

UX-Verdict: PASS

Backend-only: verify frontend PR #12815 supplies the screenshots and blind read for these thread strings — nothing in this diff renders.

[UX-REVIEWED] 4744ba7

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 4744ba736848f6093f7525cc08e05ba141afa7fb — 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: PASS

Frontend PR #12815 is the sole consumer of the three routes and chat.thread_reply — verify it lands matching these shapes before a release freezes them.

What this change ships

Inventory (10 items) — 10 justified

Intent: let a user discuss one message of a crewmate's chat in its own reply thread, Slack-style (backend half of RFC screen 07) — ADDITION, covered by rfc-crewmates-launch.md (accepted on base; its §07 and PR index name #12797 as the API half).

  1. Any message of a crewmate chat can take replies; the crewmate answers in the thread (three routes, idempotent send) — justified
  2. Replies persist in a new .threads/<key>.json sidecar beside the transcript, never in the chat — justified
  3. Thread replies stream over a new owner-only, slot-scoped chat.thread_reply WS event — justified
  4. Each crewmate reply runs in its own throwaway thread:<slot>:<mid> session, never resumed — justified
  5. Thread turns are read-only (kiro harness) or tool-less elsewhere, and the prompt says so — justified (the panel has no approval card)
  6. Deleting a chat deletes its threads all-or-nothing; an uninspectable or linked sidecar refuses the delete — justified
  7. Reclaim, restore and size accounting move the sidecar with the transcript; a recently-threaded session stays young by the sidecar's mtime — justified
  8. Threads do not travel with fork, transfer or export — justified (declared decision; capability added beside old defaults)
  9. Full or oversized thread stores refuse new replies (500/5 000/64 MiB caps) with a plain next step — justified
  10. A turn interrupted by shutdown leaves a visible interrupted/"stored but not answered" row — justified

[FIRST-PRINCIPLES-REVIEWED] 4744ba7

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

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

Review details

Nothing blocks; one advisory finding on the re-send envelope.

FINDING — src/kiro_crew/dashboard/chat_threads.py:337 — prior = replies[:-1] if replies and replies[-1].get("role") == ROLE_USER else replies assumes the reply being answered is the last stored row, which is false on the exact path _awaits_answer was written for: after a restart leaves the _UNANSWERED_FALLBACK assistant row behind, a same-id re-send runs the turn with text = the stored user reply while replies[-1] is that assistant row, so prior keeps the user reply too and the envelope asks the same question twice (once inside [Thread so far], once as the trailing User: {text}) with "This reply was stored but not answered: Kiro Crew stopped. Send it again." presented as the crewmate's own prior turn → Fix: in build_thread_message, trim a trailing _UNANSWERED_FALLBACK assistant row before the replies[:-1] test so the reply being answered is excluded from prior on that path too.

[OPUS-REVIEWED] 4744ba7

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

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

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 4744ba736848f6093f7525cc08e05ba141afa7fb and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 4744ba7

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

@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 22, 2026
@CrysisDeu
CrysisDeu force-pushed the feat/reply-threads-api branch from bed2558 to d4e834a Compare September 22, 2026 13:18
@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 22, 2026
@CrysisDeu

CrysisDeu commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author
  • In-flight reservation occurs after suspension (span=d2196525dad2)

fixed in d4e834a: the reservation is added right after the in-flight check with no await between them; the store write now happens after the mark, and every refusal past it (full, missing transcript, unreadable, lock timeout) releases it. Pinned by test_two_replies_racing_through_the_store_write_run_one_turn.

@CrysisDeu

CrysisDeu commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author
  • A refused assistant write is published as successful (span=d2196525dad2)

fixed in d4e834a: append_thread_reply returns ok/full/missing; the turn publishes a final frame with is_error and no reply record on full ("This thread is full…") and on missing ("This chat is gone, so the reply was not kept."). Pinned by test_a_reply_the_store_refuses_is_published_as_a_failure.

@CrysisDeu

CrysisDeu commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Retained assistant content has no storage bound (span=d2196525dad2)

fixed in d4e834a: the crewmate's reply is clipped at _MAX_STORED_REPLY_CHARS (64 000) with a "[reply clipped]" marker before it is stored; the user's reply was already capped at 32 KiB and a thread at 500 replies. Pinned by test_a_long_answer_is_clipped_before_it_is_stored.

@CrysisDeu

CrysisDeu commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Thread writes bypass the transcript lifecycle lock (span=d2196525dad2)

fixed in d4e834a: the sidecar is now owned by ConversationLog.read_threads / append_thread_reply; the write runs under _locked(key), the same lock delete_session unlinks the sidecar under, and refuses ("missing") when the transcript is gone, so a late reply can never recreate a deleted chat's sidecar. Pinned by test_store_refuses_to_write_beside_a_missing_transcript and test_sidecar_lives_beside_the_transcript_and_is_removed_with_it.

@CrysisDeu

CrysisDeu commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Unreadable stores are overwritten as empty (origin: validation) (span=d2196525dad2)

fixed in d4e834a: read_threads raises ThreadStoreUnreadable on a document that is not a thread map instead of reading it as empty; the writer propagates it, so the damaged file is never replaced; the three routes answer 503 threads_unavailable and a turn publishes a plain failure. Pinned by test_unreadable_sidecar_is_refused_never_overwritten and test_unreadable_sidecar_answers_503_on_every_route.

@CrysisDeu

CrysisDeu commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author
  • the comment "No await between the in-flight check above and this mark" is false (span=d9f47990731d)

fixed in d4e834a: the mark now really follows the check with no await between them (the store write moved after it), and the comment describes that order. A double-click runs one turn: test_two_replies_racing_through_the_store_write_run_one_turn.

@CrysisDeu

CrysisDeu commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Items 1–4 — zero consumers (span=43f571362607)

accepted-and-deferred to the consuming PR, which is opening now: the frontend that reads /api/chat/threads*, posts replies and renders chat.thread_reply is committed on top of this branch and opens as its own PR against main (two commits until this one lands), so the counted consumer exists the moment it is open. The split keeps this PR reviewable as the storage/turn contract on its own.

@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 22, 2026
@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 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings (all downgraded on adjudication)

GPT 5.6 flagged blocking issues on d4e834a77af471971118690cb50f2d7eb0357055; Opus 4.8 adjudication downgraded every one of them to advisory. Adjudication downgraded all 1 blocking finding(s) to advisory: the remedy each one requires is disproportionate to the harm it prevents. Read them as advice, not as merge conditions.

This comment is updated in place on each push.

Review details

BLOCKING -- src/kiro_crew/history.py:2009 -- The per-thread cap leaves the sidecar globally unbounded
if len(replies) >= max_replies:
Successive threaded parent messages -> unlimited map entries -> every read/write parses an ever-growing sidecar until memory or storage exhaustion.
Anchor: a-bound-bounds-every-field-it-retains
Fix: Add a named total-reply cap across the complete sidecar.
[BLOCK-MERGE-DOWNGRADED] d4e834a
[GPT-REVIEWED] d4e834a

Adjudication (Opus 4.8) — is blocking on each finding proportionate?

F1 — HARM: LOW. Each sidecar map entry requires a real transcript message — chat_threads.py:439-444 _find_parent returns 404 (parent_not_found) when mid isn't in the transcript, so distinct threads ≤ distinct transcript messages, a bound already accepted for the transcript itself. Each reply is a human dashboard POST, size-capped (chat_threads.py:427-430) and per-thread capped (history.py:2009). Growth is human-paced, self-inflicted, proportional to conversation size — no independent unbounded axis. Recovery: the sidecar is unlinked on session delete (history.py:1957-1958 "the transcript delete removes it with the others"; delete_session at 2980). Real fix — a global cross-thread total cap — adds cross-thread counting on every read-modify-write, new "which thread refuses when the global cap hits" semantics, and permanent reader load, all to bound a store already bounded by transcript size. Cost exceeds the harm.

[ADJUDICATION] d4e834a total=1 uphold=0 downgrade=1
DOWNGRADE F1 src/kiro_crew/history.py:2009 reason=disproportionate-remedy
[GPT-ADJUDICATED] d4e834a

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

@CrysisDeu
CrysisDeu force-pushed the feat/reply-threads-api branch from d4e834a to 59aabde Compare September 22, 2026 13:35
@CrysisDeu
CrysisDeu force-pushed the feat/reply-threads-api branch from a10eddd to 32484ff Compare September 22, 2026 23:40
@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 22, 2026
@CrysisDeu
CrysisDeu force-pushed the feat/reply-threads-api branch from 32484ff to 0777a84 Compare September 23, 2026 00:52
@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
Not this PR's change: the two commits it sits on, squashed into one so the
PR stays at two commits. #12797 = feat/reply-threads-api 0777a84,
#12923 = feat/crewmate-chat-bubbles 9a20cb8. Dropped as each lands.
@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-api branch from 0777a84 to 7815783 Compare September 23, 2026 01:43
@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
Not this PR's change: the two commits it sits on, squashed into one so the
PR stays at two commits. #12797 = feat/reply-threads-api 7815783,
#12923 = feat/crewmate-chat-bubbles 90753b4. Dropped as each lands.
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Sep 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 78157839fa015f3fa3745040d93ac805319b01ff; 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 78157839fa015f3fa3745040d93ac805319b01ff: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 1e124f63e4a3653cc75425a407b0af29fc29817f; 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 1e124f63e4a3653cc75425a407b0af29fc29817f: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings (all downgraded on adjudication)

GPT 5.6 flagged blocking issues on 4d9f78c63b10b206026229aac41f9b079b035680; Opus 4.8 adjudication downgraded every one of them to advisory. Adjudication downgraded all 1 blocking finding(s) to advisory: the remedy each one requires is disproportionate to the harm it prevents. Read them as advice, not as merge conditions.

This comment is updated in place on each push.

Review details

BLOCKING -- src/kiro_crew/dashboard/chat_threads.py:633 -- Row-only reservation ignores the sidecar byte ceiling (origin: validation)
max_total=_MAX_REPLIES_PER_SIDECAR - 1
Near-64 MiB sidecar -> user append commits -> assistant/compensation append returns sidecar_full -> durable question remains unanswered and completed output is lost.
Anchor: a-refusal-is-not-a-commit
Fix: Reserve byte headroom for the assistant row when admitting the user reply and inspect the compensating append outcome.
[BLOCK-MERGE-DOWNGRADED] 4d9f78c
[GPT-REVIEWED] 4d9f78c

Adjudication (Opus 4.8) — is blocking on each finding proportionate?

I've examined the code path. F1 concerns _append_user_reply reserving one row (max_total - 1) for the assistant but not reserving bytes against the 64 MiB sidecar ceiling.

Evidence record (F1):

(a) Conditions:

  • Byte ceiling is a second sidecar_full trigger independent of the row cap — history.py:2184 (len(document.encode("utf-8")) > THREADS_SIDECAR_MAX_BYTES, 64 MiB per history.py:1203). Row reservation only reserves a row, not bytes — chat_threads.py:633-634.
  • User append commits: passes the byte check at history.py:2184 with the user reply added.
  • Assistant append returns sidecar_full: the ~64KB assistant row (_MAX_STORED_REPLY_CHARS = 64_000, chat_threads.py:854-855) pushes the document past the ceiling at history.py:2184 when written at chat_threads.py:863-868.

(b) Recovery: _final(_SIDECAR_FULL_FALLBACK, is_error=True) at chat_threads.py:884-885 — a visible live error to the user. It is not persisted, so on reopen the question shows no durable answer; the next attempt refuses at admission (sidecar full). No self-correction of the lost answer, but the state is loud, not silent, and honors "a refusal is not a commit" (the store correctly does not claim the answer landed).

(c) Harm rung: LOW. The required condition is a single chat's reply-thread sidecar within ~64KB of a 64 MiB ceiling — the extreme boundary of a per-chat cap. The consequence is the loss of one generated assistant answer (not user-entered data), with a visible error at the time; the user's question is preserved. Near any hard byte ceiling the last admitted turn loses its answer regardless — the proposed fix merely moves the refusal from the assistant row to user-reply admission. The remedy (reserve byte headroom, thread a new byte-reservation parameter through append_thread_reply and its callers, plus inspect the compensating append outcome) adds a permanent invariant on a boundary-only path whose maintenance load exceeds the one-off, visible, bounded degradation it prevents.

[ADJUDICATION] 4d9f78c63b10b206026229aac41f9b079b035680 total=1 uphold=0 downgrade=1
DOWNGRADE F1 src/kiro_crew/dashboard/chat_threads.py:633 reason=disproportionate-remedy
[GPT-ADJUDICATED] 4d9f78c63b10b206026229aac41f9b079b035680

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

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — 🔴 changes requested (blocking)

GPT 5.6 found at least one blocking issue that must be resolved before merging 48632319574f15fac3e683b9ed9f87c38f7ff8c7. Adjudication produced no [GPT-ADJUDICATED] marker for 4863231: the adjudication stage FAILED TO RUN (its raw output is in the Adjudication details block -- typically an API or setup error), so no proportionality review took place and GPT's blocking verdict stands unreviewed.

This comment is updated in place on each push.

BLOCKING -- src/kiro_crew/history_projection.py:1282 -- Linked .threads parent lets deletion escape the session store
if threads_path.exists(): ... os.replace(threads_path, threads_staged) / os.lstat(sidecar)
planted .threads symlink + matching transcript -> session delete/reclaim -> gateway moves and unlinks an external JSON file
Anchor: residual/security
Fix: Refuse linked parents and move/unlink relative to a pinned .threads directory descriptor.
[BLOCK-MERGE] 4863231
[GPT-REVIEWED] 4863231
False positive or not applicable? A repository writer can comment:
/ai-review override gpt 48632319574f15fac3e683b9ed9f87c38f7ff8c7: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for af69e8164f671bbb1a893e2683173bde62c11eba; 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 af69e8164f671bbb1a893e2683173bde62c11eba: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — 🔴 changes requested (blocking)

GPT 5.6 found at least one blocking issue that must be resolved before merging 64edc59988f2609f0a6760392ce3d82b12eb2792. Adjudication produced no [GPT-ADJUDICATED] marker for 64edc59: the adjudication stage FAILED TO RUN (its raw output is in the Adjudication details block -- typically an API or setup error), so no proportionality review took place and GPT's blocking verdict stands unreviewed.

This comment is updated in place on each push.

BLOCKING -- src/kiro_crew/session_storage.py:1444 -- Directory swap strands restored thread data
return _move_file_exclusive(src, dst, dst_dir_fd=dir_fd)
Swap .threads after it is opened -> the sidecar lands through the old descriptor, but path-based syncing succeeds on the replacement and removes the staged source -> restore reports success with replies missing.
Anchor: residual/crash-data-loss-corruption
Fix: Keep metadata, cleanup, and directory syncing descriptor-relative until the staged source is removed.
[BLOCK-MERGE] 64edc59
[GPT-REVIEWED] 64edc59
False positive or not applicable? A repository writer can comment:
/ai-review override gpt 64edc59988f2609f0a6760392ce3d82b12eb2792: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 23e462d64a938e517b7289b01788976ebafb662a; 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 23e462d64a938e517b7289b01788976ebafb662a: <one-sentence reason>

A thread is the set of replies attached to one message of a crewmate's
chat, addressed by that message's durable meta.mid. Replies live in a
sidecar beside the slot's transcript (.threads/<key>.json) and never
enter slot.messages, so the main chat keeps showing only what the
crewmate says to the user.

Three routes: a per-slot summary (reply counts, last reply, who took
part) for the footer under a bubble, one thread's parent + replies, and
a reply POST that stores the user's reply, answers 202 and runs the
crewmate's turn in an isolated thread:<slot>:<mid> session. The turn
carries the parent, the chat just before it and the thread so far, runs
under the side chat's read-only tool posture (no approval card in a
thread panel), and lands its answer in the thread over an owner-only
chat.thread_reply WS event.
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