Skip to content

fix(chat): restore file pills across message edits - #357

Merged
Harry19081 merged 1 commit into
developfrom
fix/chat-edit-pill-roundtrip
Jul 15, 2026
Merged

fix(chat): restore file pills across message edits#357
Harry19081 merged 1 commit into
developfrom
fix/chat-edit-pill-roundtrip

Conversation

@beruro

@beruro beruro commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • restore serialized file references as a single composer pill instead of duplicated filename text plus pill UI
  • make pill-syntax detection stateless so leaving and re-entering sent-message edit mode consistently reparses the reference
  • preserve adjacent CJK prose while removing only the serialized file label

Root cause

PILL_REGEX is global, so calling .test() mutated lastIndex. Repeated checks of the same message alternated between matching and not matching, which made the second edit entry render raw displayName [file:path] text.

For file pills without whitespace before the serialized label, the parser also preserved the basename as normal text while creating a pill for the same file.

Verification

  • vitest run src/engines/ChatPanel/InputArea/utils/__tests__/pillContentParser.test.ts — 16 tests passed
  • ESLint on both changed files — passed
  • tsc --noEmit --pretty false — passed
  • pre-commit scoped TypeScript check — passed
  • git diff --check origin/develop...HEAD — passed

Audit

  • swept src for stateful global-RegExp .test() usage; PILL_REGEX.test() was the only matching instance in this problem class
  • confirmed both sent-message edit restore and persisted draft restore use applyParsedContent
  • confirmed no upstream changes to the parser files and no wire-format changes
  • PR is isolated to the parser and its regression tests

@Harry19081
Harry19081 merged commit 246e5eb into develop Jul 15, 2026
Neonforge98 pushed a commit that referenced this pull request Jul 30, 2026
fix(chat): restore file pills across message edits
@Harry19081
Harry19081 self-requested a review July 30, 2026 08:46
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