Skip to content

fix(messaging): keep a '>' inside an angle-wrapped image path - #21565

Merged
bolichen97 merged 1 commit into
mainfrom
fix/md-image-dest-angle-close-10871
Oct 17, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/md-image-dest-angle-close-10871

Conversation

@bolichen97

@bolichen97 bolichen97 commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: a picture whose path holds a > is sent to Slack instead of being dropped.

The composer wraps an odd path in <...> and writes a > in it as \>. The outbound reader undid that escape first, then cut the path at the FIRST >. So ![x](</data/a\>b/uploads/x.png>) read as /data/a, and the picture was left out of the Slack reply.

Why it matters

A POSIX data home with > in a folder name loses every outbound picture, with no error. Rare, but silent.

Not a goal

What changed (motivation → approach → change)

The cause is that _walk_destination (src/kiro_crew/messaging/outbound_files.py) is the only step that sees \> vs a bare >, and it dropped that fact before _finish_destination looked for the wrap's close.

  • _walk_destination now records which characters of the destination arrived escaped and passes them to _finish_destination.
  • _finish_destination closes a <...> wrap at the first UNESCAPED >, as CommonMark does. No guess about titles or suffixes: a bare > after the wrap (</a.png> b>)) still closes at the first one, so every input without an escaped > reads exactly as before.
  • The transcript rewrite in src/kiro_crew/chat_attachments.py (_destination_span) cut the RAW markup at the first raw >, which is the \> itself. Once the scanner resolves such a path, persist_inline_images would copy the image and then replace only /data/a\, leaving >b/.../x.png> in the saved row (the Opus and GPT finding on the first head). It now finds the close with a new shared helper, outbound_files.angle_wrap_close, which uses the walk's own escape tokenisation, so the scanner and the rewrite close the wrap at the same >.

The ) that ends the markup does not move, so the shared end pinned by test/test_markdown_link_parentheses.py is unchanged.

Backwards compatibility

Compatible: a wrapped destination with no escaped > parses and rewrites the same as before. A path that holds an escaped > is now whole instead of cut. The upload gate still checks the resolved path.

Tests

test/test_image_artifacts.py (TestMarkdownDestinationParsing):

  • test_escaped_close_angle_in_wrapped_path_is_kept: \> in the path keeps the whole path.
  • test_escaped_close_angle_with_title_suffix: same, with a "title" that itself holds >.
  • test_single_quoted_title_after_wrap: a 'title' suffix.
  • test_wrap_followed_by_junk_closes_at_first_unescaped_angle: </tmp/a.png> junk) still reads /tmp/a.png.
  • test_bare_angle_after_the_wrap_does_not_move_the_close: </a.png> b>) still reads /a.png (pins the old first-> reading for a bare >).
  • test_escaped_angle_before_unrecognised_suffix_is_kept: </a\>b/x.png> junk) reads /a>b/x.png.

test/test_chat_attachments.py:

  • test_an_escaped_angle_in_a_wrapped_source_path_is_replaced_whole (POSIX only; > is not a legal Windows path character): a source under scr>atch/ is copied and the saved markup is exactly ![s](<stored>). Red with the old markup.find(">") in _destination_span (the row kept the source tail), green here.

Related suites (test_image_artifacts, test_chat_attachments, test_outbound_files, test_markdown_link_parentheses, test_chat_persistence_inline_attachments, test_history_inline_attachments): 1672 passed, 2 skipped. Determinism: the new tests ran 3 more times under -n 2 (xdist scheduling order varies) and once alone, all green; they use only tmp_path and pure strings. scripts/check_comment_history.py passes locally.

Manual verification

N/A: pure string parsing, covered by unit tests.

Screenshots / video

N/A: no UI change.

Issue link

Part of #10871

Pattern harvest

Not generalizable: one parser closed a wrap at the first delimiter after an earlier step had already removed the escapes that told delimiters apart; the fix keeps that information where it is known.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 2aff97596c892ac989301bf111d045eece4bf9d5 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

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

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] 2aff975

Description read

[DESCRIPTION-READ] fd5c24833d975c4950246e0ffcbe6f46683052548ea2b082a2a486856cf5b3cf

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 Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 2aff97596c892ac989301bf111d045eece4bf9d5 — 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

Check on POSIX that a real Slack reply now carries an image from a data home with > in a folder name. The proof here is unit-level only.

What this change ships

Inventory (3 items) — 3 justified

Intent: when a path contains >, the picture still goes out in the Slack reply instead of being silently dropped. This is a FIX.

  1. An outbound image whose wrapped path holds an escaped \> is read whole and sent, no longer cut at the first >. — justified
  2. The saved transcript row swaps the whole wrapped source path for the stored copy, so no >b/... tail is left behind. — justified
  3. New shared helper outbound_files.angle_wrap_close, which finds where a wrap closes in raw markup. — justified

[FIRST-PRINCIPLES-REVIEWED] 2aff975

Description read

[DESCRIPTION-READ] 9cd96534096dceb47c939258329cdf0f97d0a4b1ab2cd9872827dbb4266669e1

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 Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 2aff97596c892ac989301bf111d045eece4bf9d5 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 2aff975

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable 2aff97596c892ac989301bf111d045eece4bf9d5: <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 Oct 17, 2026
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 2aff97596c892ac989301bf111d045eece4bf9d5 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 2aff975

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

@bolichen97
bolichen97 enabled auto-merge (squash) October 17, 2026 09:05
@bolichen97
bolichen97 force-pushed the fix/md-image-dest-angle-close-10871 branch from 930cdac to 5417a11 Compare October 17, 2026 09:06
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 17, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Newly recognized image paths are corrupted during transcript persistence

fixed in 5417a11: chat_attachments._destination_span now closes the raw wrap with outbound_files.angle_wrap_close, which skips \> pairs with the walk's own _MD_ESCAPABLE tokenisation, so the rewrite replaces the whole destination.
regression test: test/test_chat_attachments.py::test_an_escaped_angle_in_a_wrapped_source_path_is_replaced_whole (red with the old markup.find(">"), green here).

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • the transcript rewrite still cuts at the first raw >

fixed in 5417a11: _destination_span uses the shared angle_wrap_close (skips \>), and its docstring names it. Same regression test as the GPT disposition: test_an_escaped_angle_in_a_wrapped_source_path_is_replaced_whole.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • The fix treats the symptom and adds a guess.

fixed in 5417a11: _walk_destination records which characters arrived escaped and _finish_destination closes the wrap at the first UNESCAPED > (CommonMark). _wrapped_destination_close and its fallback branch are deleted.
pinned: test_bare_angle_after_the_wrap_does_not_move_the_close (</a.png> b>) -> /a.png, the old reading).

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Item 1 -- symptom-level (and Item 2 rides along)

fixed in 5417a11: the subtraction as proposed. _wrapped_destination_close and the first-> fallback are gone; the close comes from the walk's escape information. </a\>b/x.png> junk) now reads /a>b/x.png (test_escaped_angle_before_unrecognised_suffix_is_kept).

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Both must keep treating every _MD_ESCAPABLE pair as one token.

rebutted (already holds): angle_wrap_close and _walk_destination both test ch == "\\" and next in _MD_ESCAPABLE against the one module constant, so they cannot diverge on the token set; test_an_escaped_angle_in_a_wrapped_source_path_is_replaced_whole runs the scanner and the rewrite on the same markup and fails if they close the wrap at different >.

The outbound reader undid the composer's \> escape and then closed the <...> wrap at the first '>', so a data home whose path holds '>' lost its outbound picture. The walk now records which characters arrived escaped and the wrap closes at the first unescaped '>', as in CommonMark. The transcript rewrite closes the raw wrap with the same tokenisation (angle_wrap_close), so a newly resolved path is replaced whole.

Part of #10871
@bolichen97
bolichen97 force-pushed the fix/md-image-dest-angle-close-10871 branch from 5417a11 to 2aff975 Compare October 17, 2026 11:56
@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 Oct 17, 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.

Tier 1 auto-approve: fix (4 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: an angle-wrapped image destination now closes at the first unescaped > in both the scanner and the raw-markup cut, so a path holding an escaped > stays whole; new tests cover the escaped and title cases.

@bolichen97
bolichen97 merged commit a27c68d into main Oct 17, 2026
104 checks passed
@bolichen97
bolichen97 deleted the fix/md-image-dest-angle-close-10871 branch October 17, 2026 13:04
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 17, 2026
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