Repository navigation
Description
Problem Description
sanitize_text in src/devops_cli/roadmap/refine.py, merged in #2507 for #2478, does not stop all the links and cross-repository references that GitHub makes from the model's text. In some cases it makes a new link from text that GitHub did not link before.
- It does not put an
owner/repo#Nreference in a code span when the reference is in underscore emphasis (_cli/cli#1_,__cli/cli#1__), at the end of an italic phrase (_Depends on cli/cli#1_), or after a slash (x/cli/cli#1). GitHub links each one and records a backlink on the issue of the other repository. - It adds backticks inside a code span that holds other text. The added backtick closes the span early, so a
www.link, a reference, a handle or a URL that was code becomes text that GitHub links. Thewww.and reference patterns are new in fix(roadmap): a refine round leaves an outside account issue to a person, and refine neutralizes comment openers, www links and cross-repository references #2507; the handle and URL patterns have the same defect. - It does not wrap a
www.link after>(a block quote) or at the start of a table cell, and it does not wrap a URL with a scheme in capitals. GitHub links all of them. - A wrapped link pairs with a lone backtick of the model's text, and the link is then outside code.
The < that refine writes for <! inside a code span stays: split_record finds the record block, and refine finds its markers, in the raw text, which knows no code span. A reviewer of #2507 reported it; it is the trade-off that the design of #2478 records.
Reproduction Steps
On main at e6230dc, run:
uv run python -c "from devops_cli.roadmap.refine import sanitize_text as s; print([s(t, set()) for t in ['A _cli/cli#1_ B', 'C x/cli/cli#1 D __cli/cli#1__ E', 'Run \`curl www.example.com\` here', 'Run \`see other/repo#1 now\` here', 'Ask \`ping @alice now\`', '>www.example.com', '|www.example.com|', 'Read HTTPS://example.com/a', 'A \`b www.example.com c']])"
Render each output with uv run devops gh api -X POST markdown -f mode=gfm -f context=dan-petty/devops-cli -f text='<output>'.
Expected vs Actual Behavior
Expected: GitHub shows each link, handle and reference as code, and text that was code stays as it is.
Actual:
A _cli/cli#1_ Bstays as it is; GitHub renders<em><a class="issue-link ...">cli/cli#1</a></em>. The same occurs for__cli/cli#1__,_Depends on cli/cli#1_andx/cli/cli#1.Run `curl www.example.com` herebecomesRun `curl `www.example.com`` here, which renders as<code>curl </code>www.example.com`` here, so GitHub linkswww.example.com.Run `see other/repo#1 now` herebecomesRun `see `other/repo#1` now` here, which renders the reference outside code.>www.example.com,|www.example.com|andRead HTTPS://example.com/astay as they are, and GitHub links each of them.A `b www.example.com cbecomesA `b `www.example.com` c: the first two backticks make a code span, andwww.example.comis outside code.
Environment Diagnostics
devops-cli 0.10.1, Python 3.14.10, Linux 6.18 (WSL2), markdown-it-py 4.2.0.
Logs, Traces, or Terminal Output
'A _cli/cli#1_ B' -> 'A _cli/cli#1_ B'
'C x/cli/cli#1 D __cli/cli#1__ E' -> 'C x/cli/cli#1 D __cli/cli#1__ E'
'Run `curl www.example.com` here' -> 'Run `curl `www.example.com`` here'
'Run `see other/repo#1 now` here' -> 'Run `see `other/repo#1` now` here'
'Ask `ping @alice now`' -> 'Ask `ping `@alice` now`'
'>www.example.com' -> '>www.example.com'
'|www.example.com|' -> '|www.example.com|'
'Read HTTPS://example.com/a' -> 'Read HTTPS://example.com/a'
'A `b www.example.com c' -> 'A `b `www.example.com` c'
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Source: #2507
Activity
dan-petty commentedon Oct 28, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The sanitization logic has multiple defects that produce incorrect output.The bugs cause GitHub to render unintended links and break code spans, but they do not expose credentials or allow remote code execution.Users see broken markdown and unintended live links in roadmap issues, which undermines trust in the rendered output.Multiple pattern cases need fixing in one function, but the scope is contained to sanitize_text.Both concern sanitizing model text in refine.py, but #2478 asks for the sanitization feature while the candidate reports bugs in its implementation.chore(main): release 0.11.3 (#2539)