Files
PaperClipAI/server
DottaandPaperclip 994d6edcdd Fix Markdown in provisional task titles (#15047)
## Thinking Path

> - Paperclip uses issues to organize work for AI agents.
> - Paperclip creates a provisional issue title from the issue
description.
> - A description can start with a Markdown image or other Markdown
syntax.
> - The old title logic truncated the raw Markdown source.
> - This pull request parses Markdown before it truncates the title.
> - The benefit is a short and readable provisional title.

## Linked Issues or Issue Description

**What happened?**

When an issue description started with a Markdown image, Paperclip used
the raw image syntax and URL in the provisional title. Other common
Markdown markers could also appear in the title.

**Expected behavior**

Paperclip must remove Markdown syntax before it creates the
120-character provisional title. It must keep useful text, such as link
labels and inline code content.

**Steps to reproduce**

1. Create an issue without an explicit title.
2. Start the issue description with a Markdown image.
3. Add Markdown text after the image.
4. Observe that the provisional title contains raw Markdown syntax or an
image URL.

**Paperclip version or commit**

The problem reproduces on `master` before this change.

**Deployment mode**

Local development with the embedded PGlite database.

## What Changed

- Parse the description and remove image nodes before title generation.
- Convert the remaining Markdown to plain text before the 120-character
limit.
- Keep link labels, inline code, and identifier punctuation.
- Use image alt text, or `Image`, for an image-only description.
- Fall back to a simple 120-character title if Markdown parsing or
conversion fails.
- Add regression tests for image and inline-code titles, parser
failures, and text-conversion failures.

## Verification

- `./node_modules/.bin/vitest run
server/src/__tests__/task-title-routes.test.ts`
- `./node_modules/.bin/tsc -p server/tsconfig.json --noEmit`
- Full GitHub CI matrix passed on commit
`663f3a0517c9e450f174b6c37970756457067ba5`.
- Greptile reviewed the latest commit with a 5/5 confidence score and no
unresolved findings.

## Risks

- Low risk. This change only affects generated provisional titles. It
does not change explicit titles or full issue descriptions.
- The implementation uses the Markdown parser and plain-text converter
that are already present in the server.

> This is a focused bug fix. It does not add planned core work from
`ROADMAP.md`.

## Model Used

- OpenAI Codex with GPT-5. The run used reasoning, tool use, code
execution, and repository access. The runtime did not expose the context
window size.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-10-03 21:19:55 -05:00
..