Skip to content

fix(card): show ───── dividers between options in kb-mode box-frame path#136

Merged
Time4Mind merged 1 commit into
mainfrom
fix/kb-mode-option-dividers
Jun 17, 2026
Merged

fix(card): show ───── dividers between options in kb-mode box-frame path#136
Time4Mind merged 1 commit into
mainfrom
fix/kb-mode-option-dividers

Conversation

@Time4Mind

Copy link
Copy Markdown
Owner

Problem

#133/#134 added archive-style ───── dividers between numbered options in kb-mode — but they never appear for real prompts. Root cause: _render_card gates the divider logic behind the box-frame check.

if _BOX_FRAME_RE.search(raw):          # real AskUserQuestion panes ALWAYS match
    body = _sanitize_prompt_block(raw)
    prompt_part = body if "```" in body else f"```\n{body}\n```"   # fenced, NO dividers
else:
    prompt_part = _format_kb_prompt(raw)   # the #134 divider code — never runs for real panes

Claude Code frames each option's preview in box-drawing glyphs (│ ┌ ├), so _BOX_FRAME_RE.search(raw) is always true → rendering takes the code-fence branch, which emitted the de-framed body as one monospace block with no dividers. _format_kb_prompt (the whole #134 feature) only ran for frameless panes, which real panes never are.

The #133/#134 tests stayed green because they call _format_kb_prompt directly or feed frameless prompts, and one integration test (test_box_frame_path_unaffected) actively asserted the divider was absent in the fenced path. It's not a Telegram/parser issue — the same ───── renders fine in /archive (handlers/archive.py).

Fix

Splice literal ───── rule lines between numbered options inside the fenced path too (new _rule_between_options). Inside the fence they render as plain monospace dividers — the same visible separation, without dropping the fence.

Keeping the fence matters: it's what prevents telegramify's blockquote-collapse (the "✂ N lines hidden" artifact) and MarkdownV2 escaping on the long boxed region. Dropping it to reuse the frameless markup dividers would regress that. So the dividers go in the fence instead.

Each option keeps its trailing preview/description lines (they ride with the option until the next numbered row); pre-existing source rule lines are absorbed so separators never double up.

Tests

  • test_box_frame_path_unaffectedtest_box_frame_path_no_hard_breaks: still asserts the CommonMark hard-break trick ( \n) stays out of the fence, but no longer forbids dividers (which are now intended).
  • new test_options_separated_by_divider: a real BOXED_PROMPT renders exactly two ───── rules — before options 2 and 3, none before option 1 or splitting option 1 from its preview.

Full suite green (737 passed), pyright (strict, src/ccbot) + ruff clean.

🤖 Generated with Claude Code

The #134 archive-style option dividers only ran in _render_card's frameless
branch. But real AskUserQuestion panes frame each option's preview in
box-drawing glyphs (│ ┌ ├), so _BOX_FRAME_RE always matched and rendering
took the code-fence branch — which emitted the sanitized body as one
monospace block with NO dividers. The feature never fired for the panes
users actually see (the frameless tests passed because they call
_format_kb_prompt directly or feed frameless prompts).

Splice literal ───── rule lines between numbered options inside the fenced
path too (new _rule_between_options). Inside the fence they render as plain
monospace dividers — same visible separation without dropping the fence,
which still prevents telegramify's blockquote-collapse ("✂ N lines hidden")
and MarkdownV2 escaping on the long boxed region. Each option keeps its
trailing preview lines; existing source rules are absorbed so separators
never double up.

Updates test_box_frame_path_unaffected -> test_box_frame_path_no_hard_breaks
(hard-break trick still excluded; dividers now expected) and adds
test_options_separated_by_divider.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Time4Mind Time4Mind merged commit c4a1e5e into main Jun 17, 2026
4 checks passed
@Time4Mind Time4Mind deleted the fix/kb-mode-option-dividers branch June 17, 2026 06:50
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.

1 participant