Skip to content

[OPTIONS:] marker followed by same-line prose renders as text and loses its pills #11368

Closed

Description

@amadsalmon

Summary

When an [OPTIONS: …] marker has text after the closing ] on the same line, the marker is not rendered as buttons — the whole line shows as raw text and the turn loses its follow-up pills.

The screenshot above shows it: a steering turn, then the agent's reply glued directly onto the end of the options line, and the entire [OPTIONS: …]… line displayed as plain text instead of clickable choices.

See screenshot below.

Image

What triggers it

The bytes are "prose after the marker on the same line," but the model rarely writes that in one go. The concrete trigger is a mid-turn steering message. From the transcript (dashboard, 2026-09-16):

  1. The turn emitted its [OPTIONS: … now] block as the final line of its segment — correctly. (A sibling turn with the same block alone on its line rendered as buttons.)
  2. A steering message arrived mid-turn ("ok good. And about polly, reply that …").
  3. The agent's reply to that steer ("Anytime. PR #XXXXX is in good shape…") was appended into the same assistant message, right after the ], with no separating newline — giving …fix now]Anytime. PR #XXXXX….

So the options line was last when emitted; the steer reply is what landed text after it. This is the dominant real-world path into the bug and a special case of the general shape "prose emitted after an [OPTIONS:] line."

Where the concatenation happens

_steer_segment_cut in src/kiro_crew/dashboard/chat_runner.py should finalize the pre-steer text as its own segment (assistant_text = "") before the steer user-message persists, so the post-steer reply becomes a separate message. When that cut does not fire (or the two segments are merged on persist), _flush_segment appends pre-steer + post-steer together and the marker is no longer line-final.

Why the render layer then drops it

OPTION_MARKER_RE (website/src/app-sdk/protocol/optionMarker.ts) and its backend twin OPTIONS_RE_LINE (src/kiro_crew/constants.py) anchor the closing bracket to the end of its line (…\][ \t]*$ / …\Z). Any character after the ] on that line breaks the anchor, so no marker matches: stripOptionMarkers / extract_options leave the line visible and never extract the choices.

This is the same class of anchor-breaking tic the grammar already absorbs for a stray ](OPTIONS) link close and for Markdown wrappers (#9110/#9174). "Trailing prose glued after a line-leading marker" is simply not handled yet.

Reproduction

Frontend:

import { parseOptions } from 'website/src/app-sdk/protocol/options'
parseOptions('[OPTIONS: A | B | C]trailing text').options // => []  (expected ['A','B','C'])
parseOptions('[OPTIONS: A | B | C]').options              // => ['A','B','C']  (works)

Backend:

from kiro_crew.slack.format import extract_options
extract_options('[OPTIONS: A | B | C]trailing text')  # => (unchanged text, [])  — leaks, no choices

Constraint any fix must respect

The grammar deliberately declines "marker closed, then prose on the same line" for mid-line markers, because that case is undecidable (Use [OPTIONS: A | B] then check arr[0] — did the marker end at ], or does arr[0]'s ] terminate it?). Its guiding rule is to fail toward a visible marker, never deleted prose (#9284/#9341). A fix must not reintroduce that deletion hazard.

The safe signal: the canonical marker is always line-leading (^[ \t]*\[OPTION(S)?:). Recovery restricted to a line-leading complete marker whose trailing remainder is plain prose (no |, no bracket, no further head) leaves every mid-line and unbalanced shape untouched.

Fix layering

  • Source: stop a mid-turn steer reply from concatenating onto a segment whose tail is an [OPTIONS:] line without a separating newline (harden _steer_segment_cut / segment persistence). Higher blast radius on the steer lifecycle.
  • Render resilience (defense in depth, and the only thing that repairs already-stored transcripts): reflow a line-leading [OPTIONS: …] followed by plain trailing prose onto its own line before parsing — never deleting text. PR incoming (frontend + backend, scoped to line-leading markers with a plain-prose remainder guard).

Affected surfaces

Dashboard transcript (observed), and every backend renderer routing through extract_options (Slack / Discord / Telegram / Teams / …), which would lose the pills the same way.

Environment

Dashboard chat surface, 2026-09-16. Kiro Crew macOS app version v0.7.0.3.

Activity

  1. github-actions commented on Sep 16, 2026

    @github-actions
    Contributor

    Automated triage summary — generated from the issue text alone, before any maintainer has read it. Treat every line as a starting point, not a verdict.

    When a model emits an [OPTIONS: …] marker at the start of a line but glues prose directly after the closing bracket, the marker is neither parsed nor stripped: the dashboard transcript shows the raw text and the turn's follow-up option pills never appear. The reporter says the same loss applies to channel renderers that extract options server-side.

    Possibly already reported

    If one of these is the same problem, say so and we will close this as a duplicate.

    Posted by issue-summary.yml. The model had no access to the repository — it read only this issue and the titles of recent ones.

  2. amadsalmon commented on Sep 16, 2026

    @amadsalmon
    MemberAuthor

    Sharper root cause: mid-turn steer concatenation, not model authoring

    Transcript evidence (dashboard session, 2026-09-16) shows the glue does not come from the model authoring ]prose in one emission. The sequence was:

    1. The turn emitted its [OPTIONS: … now] block as the segment's final line (correct — a sibling turn with the same block, alone on its line, rendered as buttons fine).
    2. A mid-turn steering message arrived ("ok good. And about polly, reply that …").
    3. The agent's reply to that steer ("Anytime. PR fix(settings): refresh Transcribe consent gate on a profile or region change #11360 is in good shape…") was appended into the same assistant message content, directly after the ], with no newline — producing …fix now]Anytime. PR #11360….

    So the options line was last at emit time; the steer-reply concatenation put text after it.

    Where the concatenation happens

    _steer_segment_cut in src/kiro_crew/dashboard/chat_runner.py is supposed to finalize the pre-steer text as its own segment (assistant_text = "") right before the steer user-message persists, so the post-steer reply becomes a separate message. When that cut does not fire for a given steer (or persistence merges the two), _flush_segment appends pre-steer + post-steer text together, and the marker is no longer line-final.

    Fix layering

    • Upstream (source): ensure a mid-turn steer reply never concatenates onto a segment whose tail is an [OPTIONS:] line without a separating newline (harden the _steer_segment_cut seam / segment persistence). Higher blast radius on the steer lifecycle.
    • Render resilience (defense in depth, and the only thing that repairs already-stored transcripts): treat a line-leading [OPTIONS: …] followed by plain trailing prose as a glued marker and reflow it onto its own line before parsing — never deleting text, and staying out of the mid-line / unbalanced shapes the grammar deliberately declines.

    I have a render-resilience fix implemented and tested (frontend optionMarker.ts + backend constants.py/slack.format), scoped to line-leading markers with a plain-prose remainder guard so it cannot misfire on the declined shapes. PR incoming.

  3. added
    needs-investigationTriage: requires deep analysis before a fix
    and removed
    needs-triageAwaiting automated triage
    on Sep 16, 2026
  4. CrysisDeu commented on Sep 16, 2026

    @CrysisDeu
    Contributor

    🤖 Kiro Crew Auto-Pipeline [operator: CrysisDeu#0c98c3a2]: routing to needs-investigation.

    Checked against current main (1cd6811f). The steer cut the report names does exist and is wired: chat_runner._steer_segment_cut (~L6960) flushes the pre-steer text as its own segment (quiet_persist=True, interrupted=True) and resets assistant_text, and chat_delivery.py (~L515) calls it right before persisting the steer user row. So on main the expected transcript order is [assistant(pre-steer), user(steer), assistant(post-steer)], and the ]prose glue in the screenshot means one of these happened instead:

    1. slot._steer_segment_cut was None when the steer landed — the handle is bound only after the ACP client is attached (~L7974) and cleared at turn teardown (~L14012), so a steer accepted in the window before the binding, or via a route that does not pass through the chat_delivery tail, would skip the cut.
    2. The cut fired but the post-steer text was later merged back onto the pre-steer segment on persist or on the client's _collapse_wire_rows rebuild after chat_done.
    3. The reply to the steer was not a mid-turn injection at all (steer not consumed, requeued as the next prompt) — but that path produces a separate message, so it does not match the screenshot.

    Root cause cannot be stated from code alone; it needs the session's gateway.log around the steer (steer_push, steer segment cut failed, and whether a message/steered / consumption echo was recorded) plus the persisted history rows for that turn to tell 1 from 2.

    Agree with the report's constraint: widening OPTION_MARKER_RE / OPTIONS_RE_LINE to accept trailing prose after a line-leading marker would reopen the deleted-prose hazard (#9284/#9341); the fix belongs at the segment boundary, not in the grammar. For a human: reproduce with a steer sent while an [OPTIONS:] line is the last streamed text, then check which of the two mechanisms above produced the glued row.

  5. added a commit that references this issue on Sep 17, 2026
    e683299
  6. amadsalmon commented on Sep 18, 2026

    @amadsalmon
    MemberAuthor

    Fresh live recurrence (2026-09-18)

    Observed again in a live dashboard session today, confirming the steer-glue path is still reachable in the current runtime (the fix in #11371 is not yet merged/deployed). The persisted line was:

    [OPTIONS: Draft this as a design-level CR comment | Sketch the adapter/domain/orchestrator split | Just the failure-semantics question as a comment | Leave it, just wanted your read]You're right to separate those two.
    

    Shape: line-leading complete marker, closer directly abutting plain prose from a mid-turn steer reply — the exact …]<prose> case reflow_glued_option_marker targets. The trailing remainder is plain prose (no |, brackets, or wrapper glyphs), so it falls squarely inside the reflow's scope and would be recovered.

    Adds a second real-world occurrence alongside the customer transcript already cited in #11371, i.e. this is a recurring production shape, not a synthetic edge case.

  7. CrysisDeu commented on Nov 4, 2026

    @CrysisDeu
    Contributor

    Reproduced again on main @ 0a0f9aa (2026-11-03) during a bug bash, and re-verified on the same commit.

    an [OPTIONS: …] marker with prose glued after it types out as raw text while the reply streams

    Steps to reproduce

    1. Have the agent stream a reply like Pick one.\n\n[OPTIONS: Glue yes | Glue no]and this prose was glued after the bracket. in small chunks.
    2. Watch the reply bubble while it streams.

    Expected

    No raw [OPTIONS: text while streaming; at the end, choice chips plus the glued text on its own line.

    Actual

    While streaming the bubble types out [OPTIONS: Glu… character by character. The end state is right (chips "Glue yes" / "Glue no", the prose on its own labelled line). The other three marker shapes streamed the same way never showed raw text.

    Where in the code (at 0a0f9aa)

    website/src/app-sdk/protocol/optionMarker.ts:379-403 (stripPartialOptionMarker returns a closed marker followed by same-line text as prose); the backend repairs the same shape at persist (src/kiro_crew/constants.py:961 reflow_and_label_glued_option_marker, called from src/kiro_crew/dashboard/chat_turn/segment_flush.py:129,465), so frontend and backend disagree.

    Evidence

    Re-verify verdict: CONFIRMED. Runs: p1-03/20261104T122108Z-fake (repro yes, 3 of 3 glued streams), p1-03/20261104T122613Z-fake (repro yes, 3 of 3). The screenshots and logs are kept with the bug-bash run records (not attached); file names: p1-03/20261104T122613Z-fake/evidence/chat-121-glued-raw-while-streaming-2.png (bubble shows "Pick one." then "[OPTIONS: Glu" with the cursor), -1/-3 likewise, final chat-121-glued-done.png, counts in chat-121-raw-sightings.json ({"glued": 3}).

    Version

    main @ 0a0f9aa (2026-11-03). Linux test host, headless browser; real Kiro backend where the row needs it.

    Found in a bug bash and re-verified against the same commit. Bug-bash rows: chat-121 (p1-03). Suggested severity: P4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: channelsSlack, Discord, WeCom, notification routingarea: dashboardDashboard UI and its backend handlersbugSomething is not workingneeds-investigationTriage: requires deep analysis before a fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions