Skip to content

feat(spec-builder): keep the paste chip on the stored user message - #31799

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/21147-spec-builder-paste-chip
Nov 7, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/21147-spec-builder-paste-chip

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A long paste sent from Spec Builder's chat keeps its [ Paste #N · M lines ] chip in the stored user message, after a reload too.

Since #21100, the embedded chat collapses a long paste into a chip and hands the block to the host's onSend as meta.pastes. Spec Builder's composer sends through its own message endpoint, which took only { text }. So the bubble showed the chip while the send was in flight, then turned into the full multi-line text once the stored row landed, and stayed expanded after a reload.

Why it matters

Spec Builder is where people paste the long things: stack traces, logs, requirement drafts. Without the chip, one paste turns the spec's conversation into a wall of text, and the same message looks different in Spec Builder than in the main chat.

Not a goal

  • Forwarding meta.sendId or meta.files from Spec Builder's onSend. The issue asks for the paste chip only.
  • Any change to how the chip itself renders. The transcript already folds meta.pastes back into the chip.

What changed (motivation → approach → change)

The stored user row lacked the paste blocks, so the transcript had nothing to fold the expanded text back into a chip with.

Spec Builder now does what the main chat does: the page forwards the embed's collapsed pastes, and the endpoint keeps them on the user row.

Side Change
Page (spec-builder/api.ts, components/SpecDetail.tsx, components/ChatColumn.tsx) onSend's meta.pastes goes to POST /api/apps/spec-builder/specs/{name}/message as meta: { pastes }, the documented host shape. A send with no paste posts exactly the body it did before.
Endpoint (orchestration/messages.py, runtime.py) An ordinary message's non-empty meta.pastes list rides the turn's user row as meta.pastes, the way POST /api/chat stores it. A message sent while the spec's agent is still working carries the list on its queue entry, which the drain writes on the row. A message without one appends the same row it always did. Decision answers are unchanged.

Backwards compatibility

Compatible: meta is optional on the wire, so older clients and every send without a paste keep their exact request and stored row.

Removes nothing: the change only adds an optional field to one request and one row.

Tests

  • test_routes_coverage_lifecycle.py::TestHandleMessage::test_the_collapsed_pastes_ride_the_user_row: runs the real message handler and turn relay (the host chat runner stubbed). A message posted with meta.pastes stores those blocks on its user row; a message without one stores a row with no meta. The shared fake slot's append now keeps the meta it is given.
  • test_routes_coverage_workers.py::TestDispatchTurn::test_a_busy_slot_queues_the_message_meta_with_the_turn: a turn relayed to a busy slot queues its pastes on the entry's meta. It fails with the queued branch reverted (KeyError: 'pastes').
  • SpecBuilderSpecDetailCoverage.test.tsx: a chat send carrying pastes posts them as meta.pastes beside the text and the creation identity; the plain-send test asserts no meta is sent.

Proof: PROVEN src/kiro_crew/apps/builtins/spec_builder/tests/test_routes_coverage_lifecycle.py::TestHandleMessage::test_the_collapsed_pastes_ride_the_user_row[True] (head 19258737ebf1)

Determinism: the backend test 20/20 green at -n0 and 10/10 at -n 4 --dist loadgroup --max-worker-restart=2 beside test_routes_turn_lock.py and test_turn_provenance.py; all 77 ids of its file green in a shuffled order (seed 13383). The queued-entry test 20/20 green at -n0 and 10/10 at -n 4 --dist loadgroup --max-worker-restart=2 beside the rest of TestDispatchTurn; all 97 ids of its file green in a shuffled order (seed 21147). The frontend file 10/10 green, and green with --sequence.shuffle --sequence.seed=14730.

Ran: all of src/kiro_crew/apps/builtins/spec_builder/tests/, test/test_core_spec_builder_decoupling.py, test/test_transcript_derivation_seam.py, test/test_chat_follow_default_slot_kinds.py, test/test_channel_persist_agent_metadata.py (1161 passed, -n 4) and the flake-pattern ratchet (66 passed), and src/apps/spec-builder/ plus ChatEmbed.longPaste.test.tsx in vitest (241 passed). tsc -p tsconfig.app.json, mypy, flake8, isort, black, eslint and the diff-scoped gates are clean.

Manual verification

Captured with the real Spec Builder ChatColumn and specApi in a dev server, against a fetch stub that stores the user row the way each backend does (main: text only; this PR: text plus the posted meta.pastes). A 13-line paste was pasted, sent, and the page reloaded so the stored row was read back. The capture asserted the chip on this PR's row and the full text on main's.

Screenshots / video

The stored message after a reload, dark theme.

Before (main): the paste comes back as its full text.

Before: the stored message shows all 13 pasted lines

After: the stored message keeps the chip.

After: the stored message shows the Paste #1 chip

The composer before the send (same on both)

The composer holding the collapsed paste chip

Related Issues

Closes #21147

Refs #21100

Touches the same Spec Builder send seam as #23167 (it forwards meta.sendId); whichever lands second rebases.

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

Contributed under the project's Apache-2.0 license.

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 6, 2026 20:54
@bolichen97
bolichen97 enabled auto-merge (squash) November 6, 2026 21:13
@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 bae7f04342a02280630b983d96fb7968b1cc2312 — 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. Every item exists to close #21147, and the backend keeps only pastes, not the whole meta, so no second copy of the main chat's reserved-key filter is added.

What this change ships

Inventory (4 items) — 4 justified

Intent: a long paste sent from Spec Builder's chat keeps its chip after it is stored and after a reload. This is a FIX for a gap left by #21100, though it is titled feat.

  1. A Spec Builder chat message sent with a long paste is stored with its chip and reloads collapsed. — justified
  2. A paste sent while the spec's agent is still busy also keeps its chip once the queued message is stored. — justified
  3. The Spec Builder message request takes an optional meta.pastes, and a send without a paste posts the same body as before. — justified
  4. The approve-phase and send-all-comments paths still post text only. — justified

[FIRST-PRINCIPLES-REVIEWED] bae7f04

Description read

[DESCRIPTION-READ] a9a0f01309234a56dc6d64784726234314c45d624781067605650b1769a60212

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 bae7f04342a02280630b983d96fb7968b1cc2312 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level concerns: the change reuses the host's meta.pastes row shape and adds an optional field on both sides.

Notes

  • The queued-branch merge in runtime.py:_dispatch_turn applies to every caller. A queued decision delivery now also stores spec_decision_delivery_id on its row, which decision_outbox.py's already_relayed scan reads. That contradicts the description's "Decision answers are unchanged", so either say so in the description or limit the merge to pastes.

[DESIGN-REVIEWED] bae7f04

Description read

[DESCRIPTION-READ] 7629666126eff02f8b21bd8b5c0381badb9c6e5981cd1d48ee7c84b3adac9372

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

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

Nothing blocks. This PR only passes data through: it reuses the chat's existing paste chip, and the before and after screenshots show the stored message keeping that chip after a reload.

Notes

  • The paste chip (shot-02) isn't new, but the blind reader wasn't sure about it. They said "'Paste test: validate CI workflows on KiroCrew #1' sounds like a label the program made up" and could not tell what "13 lines" counts, because they saw 14 lines in shot-01. That's worth a follow-up issue against the shared ChatEmbed chip, outside this PR's goal.

[UX-REVIEWED] bae7f04

Description read

[DESCRIPTION-READ] 25df6d9c002f2458463012305a1bc58e1afcbe6e811f6ea98ce69ef7368e6ccb

That sha256 names everything this verdict read: the PR description, plus the 6 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 bae7f04342a02280630b983d96fb7968b1cc2312 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] bae7f04

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable bae7f04342a02280630b983d96fb7968b1cc2312 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 bae7f04342a02280630b983d96fb7968b1cc2312 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] bae7f04

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

@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Nov 6, 2026
Spec Builder's chat sends through its own message endpoint, which took
only the text. A long paste collapsed into a chip in the composer
showed as a chip while the send was in flight, then turned into its
full text once the stored row landed, and stayed that way after a
reload.

The page now forwards the embed's collapsed pastes as meta.pastes, and
the endpoint stores them on the user row the way POST /api/chat does,
so the transcript folds the text back into its chip. A message sent
while the spec's agent is still working carries them on its queue
entry, which the drain writes on the row. A message with no pastes
sends and stores exactly what it did before.

Closes #21147
@bolichen97
bolichen97 force-pushed the fix/21147-spec-builder-paste-chip branch from a324b26 to bae7f04 Compare November 7, 2026 01:17
@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 Nov 7, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=f6e3c4d69437 runtime.py:417: a message queued behind a running turn drops meta.pastes

fixed in bae7f04: the busy-slot branch of _dispatch_turn now queues {**(message_meta or {}), **containment_meta(state, slot)}, so the drain writes the pastes on the user row. The containment stamp is merged last, so the caller's meta cannot replace it. test_routes_coverage_workers.py::TestDispatchTurn::test_a_busy_slot_queues_the_message_meta_with_the_turn fails with the branch reverted (KeyError: 'pastes') and passes with it. The only other message_meta caller (the decision outbox) refuses a busy slot before it dispatches, so it never reaches this branch.

[operator: bolichen97]

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 7, 2026

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

Approved for the on-call. Review lanes pass on bae7f04, no conflict, no open change request.

@KiroCrewCaptain
KiroCrewCaptain merged commit 7801629 into main Nov 7, 2026
97 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/21147-spec-builder-paste-chip branch November 7, 2026 02:57
KiroCrewCaptain added a commit to KiroCrewCaptain/kirocrew-app-spec-builder that referenced this pull request Nov 15, 2026
Port every backend change the built-in took after the snapshot this
repository was ported from, so an adopted user runs them:

- put a popped worker slot back only onto a free key
  (kirodotdev/KiroCrew#31829)
- keep pasted blocks and the send id on the stored user row, queued or
  not, with the id checked by the host (kirodotdev/KiroCrew#31799,
  kirodotdev/KiroCrew#23167)
- find a decision answer folded into a merged queue-drain row by every
  folded id, so it is not dispatched twice (kirodotdev/KiroCrew#33324)
- refuse a name, slot key or hash ending in a newline
  (kirodotdev/KiroCrew#34740)
- deliver a restored note hold above the next turn's row on a gateway
  without the chat slot seam (kirodotdev/KiroCrew#36128)
- move the earlier decision record only as a regular file with one
  name, and settle an empty one when there is none, so a file planted
  at the old location later is never imported
  (kirodotdev/KiroCrew#33589)

The test dependency moves to Kiro Crew af94fac51f so the new host
names resolve where the suite runs; the tests the built-in added with
these changes come along.
KiroCrewCaptain added a commit to KiroCrewCaptain/kirocrew-app-spec-builder that referenced this pull request Nov 15, 2026
Port every backend change the built-in took after the snapshot this
repository was ported from, so an adopted user runs them:

- put a popped worker slot back only onto a free key
  (kirodotdev/KiroCrew#31829)
- keep pasted blocks and the send id on the stored user row, queued or
  not, with the id checked by the host (kirodotdev/KiroCrew#31799,
  kirodotdev/KiroCrew#23167)
- find a decision answer folded into a merged queue-drain row by every
  folded id, so it is not dispatched twice (kirodotdev/KiroCrew#33324)
- refuse a name, slot key or hash ending in a newline
  (kirodotdev/KiroCrew#34740)
- deliver a restored note hold above the next turn's row on a gateway
  without the chat slot seam (kirodotdev/KiroCrew#36128)
- move the earlier decision record only as a regular file with one
  name, and settle an empty one when there is none, so a file planted
  at the old location later is never imported
  (kirodotdev/KiroCrew#33589)

The test dependency moves to Kiro Crew af94fac51f so the new host
names resolve where the suite runs; the tests the built-in added with
these changes come along.

Co-authored-by: KiroCrewCaptain <312312717+KiroCrewCaptain@users.noreply.github.com>
KiroCrewCaptain added a commit to KiroCrewCaptain/kirocrew-app-spec-builder that referenced this pull request Nov 15, 2026
Port the page changes the built-in took after the snapshot this
repository was ported from:

- forward the chat embed's collapsed pastes and send id with a spec
  chat message, so the stored row keeps each paste chip and the embed
  reconciles a send by identity (kirodotdev/KiroCrew#31799,
  kirodotdev/KiroCrew#23167)
- keep every write button focusable while its own request runs: it
  reads aria-disabled and ignores the press instead of turning natively
  disabled (kirodotdev/KiroCrew#33001, kirodotdev/KiroCrew#33808)

The committed bundle is rebuilt from the source.

Co-authored-by: KiroCrewCaptain <312312717+KiroCrewCaptain@users.noreply.github.com>
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.

Spec Builder: keep the paste chip on the stored user message

2 participants