Skip to content

feat(composer): continue markdown lists on new line - #14754

Merged
bolichen97 merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:feat/composer-list-continuation
Sep 29, 2026
Merged

bolichen97 merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:feat/composer-list-continuation

Conversation

@Pearcekieser

@Pearcekieser Pearcekieser commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Pressing the new-line key on a markdown list line in the chat composer starts the next list item.

Today a new line after - item or 3. step starts empty. The user types every marker by hand, and ends a list by deleting a marker they just typed.

Why it matters

Lists are a common way to write multi-part requests to an agent: steps, checklists, files to touch. Retyping - or the next number on every line slows that down. A mistyped number also changes the order the agent reads.

Not a goal

  • Tab or Shift+Tab indentation of list items.
  • Rich list nodes in the editor. The stored prompt stays plain text.
  • The textarea fallback composer used when Lexical fails to load.

What changed (motivation → approach → change)

New line on Result
- item, * item, + item next line starts with the same bullet and indent
3. step, 3) step next line starts with 4. or 4) ; zero padding kept (09. then 10.)
- [x] done next line starts with - [ ]
- (empty item) marker removed, line left empty, list ended
caret mid-item tail moves to a new item
caret in marker, chip or mention, or a non-list line plain newline

Every new-line path in the composer reaches Lexical as INSERT_LINE_BREAK_COMMAND or INSERT_PARAGRAPH_COMMAND. That covers Shift+Enter, Enter in ctrl-enter mode, Ctrl+Enter in enter-ctrl-newline mode and WebKit's beforeinput. The send key is handled earlier and never dispatches either command. LexicalComposerInput.tsx registers a high-priority handler on both commands. It asks the new pure module composerListContinuation.ts for an edit and applies it in the same editor update, so the continuation is one undo step. When the module returns null, PlainTextPlugin inserts its usual line break.

The module reads only the caret's line. Mention detection reuses leadingMentionBoundary from utils/fileTokens.ts, so a mention starts a word, optionally after one opening wrapper. A marker needs a space or tab after it, so a line such as 2024. or - on its own is plain text and keeps its characters on Enter. The handler declines while an IME composition is active, and for the caret-stays-put break (selectStart).

Backwards compatibility

Compatible: only the new-line action on a list line changes. The send key, paste, history navigation and the stored plain-text prompt are unchanged.

Tests

  • website/src/test/composerListContinuation.test.ts covers the pure module: each bullet, both ordered delimiters, zero padding, the unsafe-integer repeat, task items, empty-item removal, mid-line splits, every plain-newline case (caret in the marker, non-list lines, mention tokens including wrapped ones such as (@file) and "$skill" while $PATH and a@b.com still continue, chip ranges), and a 200k-character unbroken run.
  • website/src/test/LexicalComposerInput.listContinuation.test.tsx drives the real editor in all three send modes. It checks that the send key still sends and leaves the text alone, empty-item removal with caret placement, a mid-line split, a trailing paste chip, one-step undo, the IME latch, the paragraph command and the selectStart break.

Manual verification

Typed lists with real keystrokes in Chromium against the real LexicalComposerInput, in dark and light themes. The recording below shows each case being typed.

Screenshots / video

Composer after typing lists with Shift+Enter, dark theme

Light theme

Composer after typing lists with Shift+Enter, light theme

demo.webm

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

Related Issues

Fixes #14753

@Pearcekieser
Pearcekieser requested a review from a team September 28, 2026 16:31
@Pearcekieser
Pearcekieser requested a review from a team as a code owner September 28, 2026 16:31
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Intent: A new line on a markdown list line in the chat composer continues the list, and a new line on an empty item ends it, so users can type lists without retyping markers.
Not a goal: Tab indentation, rich list nodes, the textarea fallback composer, or any change to what the send key does.

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 28, 2026
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of 5f88630216196ab0fd279304be1038bdad62a00b via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Manual verification was Chromium-only; confirm in real Safari that beforeinput actually reaches the INSERT_PARAGRAPH_COMMAND handler.

[DESIGN-REVIEWED] 5f88630

Description read

[DESCRIPTION-READ] 00cd84249e753b4662875c6e876096dcb98e1f70d907b3822b85af8ff2d9c617

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 Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5, fork) — 🟡 CONCERNS

UX-level review of 5f88630216196ab0fd279304be1038bdad62a00b via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

Splitting mid-item in a numbered list duplicates the next ordinal, silently producing the mis-ordered steps this PR's motivation warns about.

Watch

  • Duplicate number on mid-item split: the module reads only the caret's line, so breakAt('2. alpha |beta\n3. gamma') yields two 3. items (pinned in composerListContinuation.test.ts). The user splits a step, sends, and the agent reads an ambiguous order — the exact failure the description cites ("A mistyped number also changes the order the agent reads"). Low frequency × moderate impact (silent wrong order in the prompt) × every mid-list split. Smallest fix: renumber following same-level ordered items in the same edit, or name the limit under "Not a goal".
  • No blind reader has seen this behavior (fork lane); the screenshots and the attached recording cover every case in the description's table, so a human watching the recording before merge closes the loop. This cap, not an author gap, is what holds the verdict at CONCERNS.

[UX-REVIEWED] 5f88630

Description read

[DESCRIPTION-READ] af1949a807938546eab4fb1de8a9d442ded08964c9dd65d1abad0d8052e197d9

That sha256 names everything this verdict read: the PR description, plus the 5 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 Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed 5f88630216196ab0fd279304be1038bdad62a00b via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 5f88630

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — ✅ PASS

Premise-level review of 5f88630216196ab0fd279304be1038bdad62a00b via the fork AI-review pipeline — 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

Verify the WebKit claim on real Safari: "WebKit's beforeinput" → INSERT_PARAGRAPH_COMMAND is asserted, but manual verification was Chromium-only.

What this change ships

Inventory (8 items) — 8 justified

Intent: pressing the new-line key on a markdown list line in the chat composer starts the next list item — an ADDITION (Fixes #14753).

  1. New line on a bullet line starts the next line with the same bullet and indent — justified
  2. New line on a numbered item starts the next number, same delimiter, zero padding kept — justified
  3. New line on a task item starts an unchecked - [ ] — justified
  4. New line on an empty item removes its marker, ending the list — justified
  5. New line mid-item moves the tail onto the new item — justified
  6. Caret in the marker, a mention or chip, IME, or the caret-stays-put break: plain newline as before — justified
  7. WebKit's paragraph-command path gets the same continuation — justified
  8. New pure module composerListContinuation.ts other code may import — justified

Notes a human may want: the md-notebook helpers (carriedMarker/isEmptyListItem, website/src/apps/md-notebook/utils.ts, 1 consumer: BlockEditor.tsx) do this job for a plain textarea; the composer module is meaningfully different (protected chip ranges, mention tokens, single-edit undo contract), and reusing them would invert the apps→core dependency direction, so it is not a second spelling. docs/decisions/ records no composer newline decision; no test or comment pinning the old plain-newline behavior is deleted.

[FIRST-PRINCIPLES-REVIEWED] 5f88630

Description read

[DESCRIPTION-READ] b3620c259dd7634a1d3cebd41064c381e5cd75c2235c935f8491c3f26eb70d53

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.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • note (non-blocking): span=3a8896af2d78 duplicate of md-notebook list helpers

rebutted: the Notes helpers cannot serve the composer's grammar, which is the second arm of this item's clear condition.
LIST_MARKER_RE in website/src/apps/md-notebook/utils.ts is /^(\s*)(- \[[ x]\] |[-*] |(\d+)\. )/.
It has no + bullet, no N) delimiter, no [X], no task box after * or an ordered marker, and requires exactly one space.
carriedMarker drops zero padding (007. gives 8.) and has no safe-integer guard.
The composer also needs caret-in-marker, mention-token and chip-range refusal, which carriedMarker(before) has no input for.
Widening the Notes grammar would change Notes editor behaviour, which is outside this PR's intent; a shared grammar can come later with a Notes-owned PR.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • note (non-blocking): span=39f90fbc530f evidence unread by the blind fork reader

rebutted: no change needed in the diff; the item is a lane cap on fork PRs, not a behaviour defect.
The PR body carries dark and light stills and a typing recording as user-attachments URLs.
The behaviour is also pinned by LexicalComposerInput.listContinuation.test.tsx, which drives the real editor in all three send modes.
A maintainer who wants the blind read can push the branch to this repository.

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review (fork) — ✅ no blocking findings

Reviewed 5f88630216196ab0fd279304be1038bdad62a00b via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 5f88630

@Pearcekieser
Pearcekieser force-pushed the feat/composer-list-continuation branch from 8bff26b to 648bb41 Compare September 28, 2026 17:30
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • chore (non-blocking): span=423e111b1316 nextOrdinal export has no consumer

fixed: nextOrdinal is module-private; its cases now run through listLineBreakEdit in composerListContinuation.test.ts.
Landed in 648bb41.

@Pearcekieser

Pearcekieser commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: no
mechanism: backward character scan replacing an end-anchored regex search

  • issue (non-blocking): span=9ea862516cb3 quadratic word-start search in insideMentionToken

fixed in 648bb41: insideMentionToken walks back from the caret to the word's first character instead of search(/\S+$/), so the cost is linear in the caret's word.
The quadratic shape was a long unbroken run followed by whitespace and a later word; with the caret inside the run itself the old search matched at once.
Regression test checks the mention token in linear time on a long unbroken run covers both shapes on a 200k-character run with a loose 1 s bound.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): the two red Backend Tests (Windows) shards on 8bff26b fail in files this PR does not touch: test/test_pid_reader_ratchet.py (tree-scan count), test/test_crew_log_edge_concurrency.py and test/test_crew_log_edge_exhaustion.py. This PR changes only four files under website/src/, and every Linux backend shard passed on the same merge ref. New head 648bb41 is rebased on current main and folds in the two review fixes; CI re-runs on it.

@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 28, 2026
@Pearcekieser
Pearcekieser force-pushed the feat/composer-list-continuation branch from 648bb41 to 45a47ed Compare September 28, 2026 18:46
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

self-added: no
mechanism: sigil boundary inside the caret's word matches the backend's (?<![\w$]) rule

  • issue (non-blocking): span=5c18d1d1ccad wrapped mention start not recognized

fixed in 45a47ed: insideMentionToken scans the caret's whitespace-free word for @ or $ at the word start or after a non-word, non-$, non-@ character.
This mirrors _DOLLAR_SKILL_PATTERN in src/kiro_crew/skills.py, (?<![\w$])\$, so (@src/foo.ts) and "$skill" keep a plain newline.
a@b.com is not a mention and still splits the item; tests cover all three, and the scan stays linear in the word.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): 45a47ed is rebased on current main and folds in the fix for GPT span 5c18d1d1ccad. The rebase brings in #14778, which fixes the test/test_pid_reader_ratchet.py recorded count that turned Backend Tests (Windows) shards red on the previous head. The Code Review run on 648bb41 was cancelled by the runner, so this push also restarts Automated Rule Check, Inclusive Language, SAST and PR Hygiene.

@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 28, 2026
@Pearcekieser
Pearcekieser force-pushed the feat/composer-list-continuation branch from 45a47ed to 44885b3 Compare September 28, 2026 20:15
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: $ counts as a mention start only when followed by [a-z0-9], matching the backend skill grammar

  • issue (non-blocking): span=5c18d1d1ccad $PATH misread as a skill mention

fixed in 44885b3: insideMentionToken skips a $ whose next character is not [a-z0-9], mirroring _DOLLAR_SKILL_PATTERN (?<![\w$])\$([a-z0-9][a-z0-9/_-]*) in src/kiro_crew/skills.py.
- set $PA|TH now continues the list; $skill, "$skill" and (@src/foo.ts) keep a plain newline; @ handling is unchanged.
Test continues when a sigil does not start a mention token covers $PATH and a@b.com.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): 44885b3 is rebased on current main and folds in the $PATH fix for GPT span 5c18d1d1ccad. The one red check on 45a47ed was Backend Tests (Windows) (4) in test/test_diag_procs.py::test_a_read_refused_as_too_soon_does_not_restart_the_window, a Windows timing assertion ("0.8s apart is under the floor") in a file this PR does not touch; this push re-runs it.

@Pearcekieser
Pearcekieser force-pushed the feat/composer-list-continuation branch from 44885b3 to 727c133 Compare September 28, 2026 22:30
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): same diff, rebased on current main as 727c133 to re-run CI. On 44885b3 both AI review lanes passed and the only red was Backend Tests (3.12, 2) in test/test_remote_crew_chaining.py::TestLentHopReservation::test_a_dead_forwards_lent_port_is_held_not_counted_as_in_use, a port-reservation assertion in a file this PR does not touch. This PR changes only four files under website/src/, and the same shard passes on main's recent CI runs.

@Pearcekieser
Pearcekieser force-pushed the feat/composer-list-continuation branch from 727c133 to f566bab Compare September 29, 2026 00:15
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • suggestion (non-blocking): span=ccb6256eb38b reuse the mention boundary predicate

fixed in f566bab: insideMentionToken builds its start pattern from leadingMentionBoundary exported by website/src/utils/fileTokens.ts instead of a hand-written boundary class.
Only the $ slug-start rule ([a-z0-9], from the backend skill grammar) is added on top.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • issue (non-blocking): span=e157e0612a84 third spelling of the mention boundary

fixed in f566bab: the !/[\w$@]/ class is gone; MENTION_START_RE is derived from leadingMentionBoundary, so a mention starts a whitespace-free word, optionally after one opening wrapper.
New test: - see x(@src/fo|o continues the list, matching mention resolution.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • note (non-blocking): span=25e3ef4cd64f ending a list relies on convention

rebutted: no change needed; a new line on an empty - item removing the marker is the shared markdown-editor convention, and it is recoverable in one undo step.
The recording in the PR body shows it (- eggs, empty item, marker removed, typing continues), and LexicalComposerInput.listContinuation.test.tsx pins it with caret placement.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: removed the wall-clock bound; the scan is bounded by construction (backward walk to word start, then a 3-character slice)

  • issue (non-blocking): span=2959d37b2abb wall-clock bound in a shared CI shard

fixed in f566bab: the performance.now() assertion is removed; the 200k-character test keeps its three functional assertions.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note (non-blocking): f566bab folds in the four review items above. It is based on main at a5466a0 rather than the tip: main now carries .github/workflows changes (#14080, #14591) that a fork push without the workflow token scope cannot carry. The Windows (7) red on 727c133 was in test/test_queued_prompt_durability.py and test/test_spawn_approval_channel_governance_13491.py, files this PR does not touch; this push re-runs them.

@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 29, 2026
A new line on a bullet, numbered or task item starts the next item with
the same indent and marker (next number, same delimiter and padding;
tasks restart unchecked). A new line on an empty item removes the marker
to end the list. The send key is unchanged, IME commits and a caret
inside the marker or a mention token insert a plain newline, and undo
reverts the continuation in one step.
@Pearcekieser
Pearcekieser force-pushed the feat/composer-list-continuation branch from f566bab to 5f88630 Compare September 29, 2026 01:45
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (f54747d) as 5f88630. No code change; the diff is the same four files under website/src/.

The three red checks on f566bab were not caused by this PR:

  • Backend Tests (Windows) (4) failed in test_pid_reader_ratchet.py. Main fixed that recorded count in test: record the pid-reader site that #14510 added #14883, which this rebase picks up.
  • Backend Tests (3.12, 2) failed two TestLentHopReservation tests in test_remote_crew_chaining.py. All 25 tests in that class pass locally on both detached main f54747d and this branch, so I'm treating it as a flake.
  • Coverage Gate failed only because backend-test=failure; frontend-test and frontend-coverage-merge both succeeded.

Composer tests (65), tsc and eslint pass on the new head.

@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 Sep 29, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed on behalf of the maintainers (readiness sweep 2026-09-29): readiness passed, the required PR Readiness check is green on this head, no live CHANGES_REQUESTED, no open blocking review threads; where the PR's files also moved on main since its merge-base, the PR's own tests were run on the main+PR merge tree and passed. Approving and squash-merging.

@bolichen97
bolichen97 merged commit b212abe into kirodotdev:main Sep 29, 2026
100 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 29, 2026
@Pearcekieser
Pearcekieser deleted the feat/composer-list-continuation branch September 29, 2026 04:47
Pearcekieser added a commit to Pearcekieser/KiroCrew that referenced this pull request Oct 1, 2026
The list continuation from kirodotdev#14754 lived only in the opt-in Lexical editor,
which no production host enables, so the textarea every user types in never
continued a list: not on a mobile Return, not on desktop Shift+Enter.

The textarea now continues or ends the list item on its native beforeinput
insertLineBreak/insertParagraph, the one event every new-line path reaches,
including a mobile keyboard whose keydown is Unidentified/keyCode 229.
Ctrl+Enter in enter-ctrl-newline mode uses the same edit. The send key,
IME composition and paste chips are unchanged.
Pearcekieser added a commit to Pearcekieser/KiroCrew that referenced this pull request Oct 1, 2026
The list continuation from kirodotdev#14754 lived only in the opt-in Lexical editor,
which no production host enables, so the textarea every user types in never
continued a list: not on a mobile Return, not on desktop Shift+Enter.

The textarea now continues or ends the list item on its native beforeinput
insertLineBreak/insertParagraph, the one event every new-line path reaches,
including a mobile keyboard whose keydown is Unidentified/keyCode 229.
Ctrl+Enter in enter-ctrl-newline mode uses the same edit. The send key,
IME composition and paste chips are unchanged.
Pearcekieser added a commit to Pearcekieser/KiroCrew that referenced this pull request Oct 1, 2026
The list continuation from kirodotdev#14754 lived only in the opt-in Lexical editor,
which no production host enables, so the textarea every user types in never
continued a list: not on a mobile Return, not on desktop Shift+Enter.

The textarea now continues or ends the list item on its native beforeinput
insertLineBreak/insertParagraph, the one event every new-line path reaches,
including a mobile keyboard whose keydown is Unidentified/keyCode 229.
Ctrl+Enter in enter-ctrl-newline mode uses the same edit. The send key,
IME composition and paste chips are unchanged.
Pearcekieser added a commit to Pearcekieser/KiroCrew that referenced this pull request Oct 2, 2026
The list continuation from kirodotdev#14754 lived only in the opt-in Lexical editor,
which no production host enables, so the textarea every user types in never
continued a list: not on a mobile Return, not on desktop Shift+Enter.

The textarea now continues or ends the list item on its native beforeinput
insertLineBreak/insertParagraph, the one event every new-line path reaches,
including a mobile keyboard whose keydown is Unidentified/keyCode 229.
Ctrl+Enter in enter-ctrl-newline mode uses the same edit. The send key,
IME composition and paste chips are unchanged.
bolichen97 pushed a commit that referenced this pull request Oct 2, 2026
…5911)

The list continuation from #14754 lived only in the opt-in Lexical editor,
which no production host enables, so the textarea every user types in never
continued a list: not on a mobile Return, not on desktop Shift+Enter.

The textarea now continues or ends the list item on its native beforeinput
insertLineBreak/insertParagraph, the one event every new-line path reaches,
including a mobile keyboard whose keydown is Unidentified/keyCode 229.
Ctrl+Enter in enter-ctrl-newline mode uses the same edit. The send key,
IME composition and paste chips are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(composer): continue markdown lists on new line

2 participants