Repository navigation
Description
Problem
The job block writers find their markers with a plain text search. extract_section_and_outside (src/devops_cli/roadmap/body_hash.py line 24) and _with_block (src/devops_cli/roadmap/alternatives.py line 1089) call body.find(marker). They find a marker anywhere in the body, also in a code span or a code block of a person's text. The refine block (the default markers) and the alternatives block use these functions.
When a person quotes the start marker and the end marker of a block, the writer takes the text between them as its block. It replaces that text and puts its block inside the code span of the person.
Evidence: #6613. The body that intake filed on 2026-11-21 quoted the two markers of the alternatives block in code spans, with the word "to" between them. The alternatives check of 2026-11-21T10:35Z replaced " to " with its block. The person's sentence lost a word, and the block is now inside a code span, so it is not an HTML block in CommonMark. PR #6624 (#6613) ends a section only at a marker that is an HTML block, so it does not see this block.
The readers that remove a block (without_alternatives, the refine body hash, repair.py lines 159 and 209) use the same search. They also remove the person's text between two quoted markers.
Expected
- The writers and the readers find a marker only where it is an HTML block of its own, not in a code span, a code block or a paragraph. markdown-it-py, which
refine.pyalready uses, gives thehtml_blocktokens and their line map. - When the body has no such marker, the writer appends its block at the end and keeps the person's text as it is.
Acceptance criteria
- Test first: a body that quotes both markers in code spans and has no block keeps all its text after a write, and the new block is at the end. The test fails on the base.
- Test first:
without_alternativesandextract_section_and_outsidekeep a quoted marker pair and the text between them. - A test: a real block (each marker on its own line) is replaced as before.
Dependencies
None.
Related
- fix(roadmap): an alternatives block names no blocker of an item #6613 and PR fix(roadmap): an alternatives block names no blocker of an item #6624 end a body section at a marker that is an HTML block.
- refactor(roadmap): One job-comment writer with a marker registry #6200 is about job comments, not body blocks.
Source
Source: #6624
Alternatives check of 2026-11-21: in-use.
The repository already uses this tool.
Tool: markdown-it-py (https://pypi.org/project/markdown-it-py), MIT License, last activity 2026-11-10, maintained.
Reason: markdown-it-py, which the body says refine.py already uses, parses a body into CommonMark tokens and exposes html_block tokens with line maps, so a marker in a code span, code block or paragraph is not matched; only the project's own splice logic remains.
Covers:
- html_block tokens mark a marker on its own line
- Token line maps locate each marker's lines
- Inline code and fenced code yield separate tokens
- CommonMark parsing matches how GitHub renders the body
Lacks:
- No project marker names or comment syntax
- No splice, replace or append logic for job blocks
- No rule for duplicate or nested markers
Proposed design
Problem statement
The job block writers and readers find block markers with a plain text search. A marker that a person quotes in a code span, a code block or a paragraph is treated as a real block, so a write replaces the person's text and puts the block inside a code span, and a read removes that text. The alternatives check's unpaired-marker guard also reads the raw text, so a body that quotes both markers is refused instead of receiving a block at the end. The change finds a marker only as an HTML block with markdown-it-py, appends the block when no such marker exists, and keeps the person's text.
Acceptance criteria
Requirement: Quoted markers keep the person's text
A job block writer SHALL treat a marker as a block boundary only when CommonMark parses it as an HTML block of its own.
Scenario: The alternatives writer sees quoted markers
- WHEN A body quotes the alternatives start marker and end marker in code spans, with the word to between them, and holds no alternatives block.
- THEN The check writes the new alternatives block at the end of the body, and the test asserts that the quoted sentence still reads the start marker, to, and the end marker in code spans; the same test fails on the base because the quoted word is replaced and the block is inside the code span.
Requirement: Readers keep a quoted marker pair
The readers without_alternatives and extract_section_and_outside SHALL keep a marker that is not an HTML block, and the text between two such markers.
Scenario: A quoted marker pair is read
- WHEN A body quotes the alternatives start marker and end marker in code spans with text between them, and quotes the refine start marker and end marker in code spans.
- THEN without_alternatives returns the body unchanged, extract_section_and_outside returns the body as the outside text and None as the section, and the test asserts that both quoted pairs and the text between them remain.
Requirement: The refine writer keeps quoted refine markers
The refine writer SHALL append its section at the end of a body whose refine markers are not HTML blocks.
Scenario: Refine sees quoted refine markers
- WHEN A body quotes the refine start marker and end marker in code spans with text between them, and holds no refine section.
- THEN Refine's write appends its section at the end, and the test asserts that the quoted pair and the text between them remain unchanged; the same test fails on the base.
Requirement: An unpaired HTML-block marker still stops the write
The alternatives check SHALL write no block when an HTML-block marker has no partner.
Scenario: A real start marker has no end marker
- WHEN A body holds the alternatives start marker as an HTML block on a line of its own and no end marker.
- THEN The check is skipped with the marker reason, writes no block, and the test asserts that the person's text is unchanged.
Requirement: A real block is replaced
A writer SHALL replace a block whose start marker and end marker are each an HTML block on a line of its own.
Scenario: A real alternatives block
- WHEN A body holds an alternatives block with the start marker and the end marker each on a line of its own.
- THEN The writer replaces the block and the test asserts that all text outside it is unchanged.
Existing Tool Considered
markdown-it-py (https://pypi.org/project/markdown-it-py), MIT, maintained, in-use in refine.py and the store; the alternatives block of the issue body records what it lacks. The change adds only the project's marker set and the block splice and append logic.
Key questions
- Which tool parses a body into HTML blocks for the marker rule?: markdown-it-py, pinned at 4.3.0 in uv.lock and already imported by refine.py. Its CommonMark preset gives an html_block token whose map gives the block's lines, and the repository already reads that token and map. The alternatives check in the issue body records the verdict in-use. [sources: src/devops_cli/roadmap/refine/refine.py:1179, src/devops_cli/roadmap/stores/store.py:952, uv.lock:2509, https://pypi.org/project/markdown-it-py]
- Where should the marker detection live?: In one helper in src/devops_cli/roadmap/body_hash.py. It parses the body with MarkdownIt("commonmark") and returns the character span of each marker that is the whole content of an html_block token. extract_section_and_outside, _with_block and _marker_problem call it. Move the existing _JOB_BLOCK_MARKERS frozenset from refine.py into body_hash.py and import it in refine.py, so refine's _ends_section and the block functions use one marker set. (best practice) [sources: src/devops_cli/roadmap/body_hash.py:24, src/devops_cli/roadmap/alternatives.py:1089, src/devops_cli/roadmap/refine/refine.py:1163, src/devops_cli/roadmap/stores/store.py:947]
- Chosen: One helper in body_hash that shares the existing marker set. body_hash is imported by both refine and alternatives, and the marker set already exists in refine.py; moving it there gives one rule for section ending, block writing and block reading.
- Rejected: One helper in body_hash with its own copy of the markers. Two copies of the marker set can drift, and the writer and the readers would disagree.
- Rejected: A separate parser in each module. It duplicates the CommonMark rule and lets the writer and the readers disagree.
- Rejected: A regular expression on the body. It cannot tell a code span, a fenced code block or a paragraph from an HTML block.
- How does the unpaired-marker guard treat a quoted pair?: It counts only markers that are HTML blocks, as refine.py's _ends_section does. A body that quotes both markers in code spans has no HTML-block marker, so the guard passes and the writer appends its block; a real HTML-block marker with no partner still refuses the write. (best practice) [sources: src/devops_cli/roadmap/alternatives.py:1077, openspec/changes/archive/2026-11-21-6613-an-alternatives-block-names-no-blocker/design.md:5, openspec/specs/roadmap-alternatives/spec.md:113]
- Chosen: Count only HTML-block markers. It follows the recorded rule of fix(roadmap): an alternatives block names no blocker of an item #6613 that only an HTML block counts, so a quoted pair is the person's text and the check appends its block.
- Rejected: Keep the plain text search. A quoted pair would be refused as an unpaired marker, and the issue's expected append would not happen.
- Rejected: Remove the guard. A real start marker with no end marker would let a write replace the person's text.
- What does a writer do when no marker is an HTML block?: Append its block at the end of the body and keep the person's text unchanged. (best practice) [sources: openspec/specs/roadmap-alternatives/spec.md:111, src/devops_cli/roadmap/refine/refine.py:3723, src/devops_cli/roadmap/alternatives.py:1094]
- Chosen: Append at the end. The alternatives spec says replace the block or add it at the end, and refine already builds its new body as the outside text plus its section at the end.
- Rejected: Insert at the first quoted marker. It writes inside a person's code span and repeats the defect.
- Rejected: Write no block. It leaves the item with no result from the job.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 21, 2026
The bug corrupts user text in issue bodies when a person quotes block markers in code spans.Both deal with the alternatives block and HTML-block detection, but #6613 fixes the reader (body_dependencies) while this candidate fixes the writer and reader marker search in body_hash.py and alternatives.py.devops-cli-service commentedon Nov 21, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (4)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 21, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
devops-cli-service commentedon Nov 21, 2026
Plan state: branch
fix/6627-find-a-job-block-marker-only, draft pull request #6659. The pull request plans the item and closes no issue. The stage job and the step fix-plan edit this comment, and a comment of each run tells what the run did.The task groups, with the tokens of the inputs of each step, for a budget of 64000 tokens:
A model review of the plan found these points. They stop no draft, and a person judges them:
false_premiseat tasks (4): Group 4's test claims thatrequirement_linesreturns the criterion that sits between two quoted refine markers, butrequirement_linesleaves out every item of the acceptance-criteria list (if not acceptance_level:), so the assertion cannot pass as written. Evidence: "acceptance_criteriaandrequirement_linesreturn the criterion that sits between two quoted refine markers"devops-cli-service commentedon Nov 21, 2026
The stage job staged the plan of draft pull request #6659. The plan state comment of #6659 holds the branch, the task groups and the findings.
The runs of the planner and the review made 89 model request(s), and used 8823391 input tokens and 222664 output tokens. The tool calls, in order:
read_file({"path":"src/devops_cli/roadmap/body_hash.py"})read_file({"path":"src/devops_cli/roadmap/alternatives.py","start_line":1040,"end_line":1180})read_file({"path":"src/devops_cli/roadmap/refine/refine.py","start_line":1130,"end_line":1230})read_file({"path":"src/devops_cli/roadmap/refine/refine.py","start_line":3690,"end_line":3760})read_file({"path":"src/devops_cli/roadmap/repair.py","start_line":140,"end_line":225})read_file({"path":"src/devops_cli/roadmap/stores/store.py","start_line":920,"end_line":990})search_code({"text":"MarkdownIt("})read_file({"path":"src/devops_cli/roadmap/refine/refine.py","start_line":1,"end_line":120})search_code({"text":"CONST_ROADMAP_ALTERNATIVES_START_MARKER"})read_file({"path":"openspec/specs/roadmap-alternatives/spec.md","start_line":90,"end_line":140})search_code({"text":"body_hash import"})read_file({"path":"tests/roadmap/test_roadmap_alternatives.py","start_line":1960,"end_line":2120})search_code({"text":"_LINE_BREAK"})read_file({"path":"src/devops_cli/roadmap/refine/refine.py","start_line":620,"end_line":680})read_file({"end_line":800,"path":"src/devops_cli/roadmap/alternatives.py","start_line":770})read_file({"end_line":80,"path":"tests/roadmap/test_roadmap_alternatives.py","start_line":1})read_file({"end_line":470,"path":"tests/roadmap/test_roadmap_alternatives.py","start_line":390})read_file({"end_line":980,"path":"tests/roadmap/test_roadmap_alternatives.py","start_line":900})read_file({"end_line":1480,"path":"tests/roadmap/test_roadmap_alternatives.py","start_line":1380})read_file({"end_line":1760,"path":"tests/roadmap/test_roadmap_alternatives.py","start_line":1620})read_spec({"capability":"roadmap-refine/writes"})read_spec({"capability":"roadmap-alternatives","requirement":"A check writes a comment, a block and a record"})read_spec({"capability":"roadmap-refine/writes","requirement":"The hash of the body leaves out the job's block"})read_spec({"capability":"roadmap-refine/waits","requirement":"A job block marker ends the Dependencies section"})search_code({"text":"CONST_ROADMAP_REFINE_START_MARKER"})read_file({"path":"src/devops_cli/roadmap/stage/stage_criteria.py","start_line":190,"end_line":255})read_file({"end_line":140,"path":"src/devops_cli/roadmap/stage/stage_criteria.py","start_line":100})references({"name":"_without_refine_block"})list_files({"directory":"tests/roadmap/stage"})list_files({"directory":"tests/roadmap"})search_code({"text":"_refine_block"})read_file({"end_line":400,"path":"tests/roadmap/test_roadmap_repair.py","start_line":330})search_code({"text":"extract_section_and_outside("})references({"name":"devops-roadmap-refine:start"})read_file({"end_line":2430,"path":"src/devops_cli/roadmap/refine/refine.py","start_line":2400})read_file({"end_line":3790,"path":"src/devops_cli/roadmap/refine/refine.py","start_line":3760})read_spec({"capability":"roadmap-stage/criteria"})read_file({"end_line":80,"path":"tests/roadmap/stage/test_roadmap_stage_criteria.py","start_line":1})read_spec({"capability":"roadmap-stage/criteria","requirement":"Refine design kept in stage plan"})read_file({"end_line":300,"path":"src/devops_cli/roadmap/stage/stage_criteria.py","start_line":255})read_spec({"capability":"roadmap-alternatives","requirement":"A check writes a comment, a block and a record"})read_spec({"capability":"roadmap-refine/writes","requirement":"The hash of the body leaves out the job's block"})read_file({"path":"src/devops_cli/roadmap/alternatives.py","start_line":1055,"end_line":1115})read_file({"path":"src/devops_cli/roadmap/body_hash.py","start_line":18,"end_line":45})read_file({"end_line":215,"path":"src/devops_cli/roadmap/repair.py","start_line":150})read_file({"end_line":1185,"path":"src/devops_cli/roadmap/refine/refine.py","start_line":1155})read_file({"end_line":140,"path":"src/devops_cli/roadmap/stage/stage_criteria.py","start_line":95})read_file({"end_line":960,"path":"src/devops_cli/roadmap/stores/store.py","start_line":940})read_file({"end_line":3730,"path":"src/devops_cli/roadmap/refine/refine.py","start_line":3712})search_code({"text":"eval stage"})search_code({"text":"CONST_ROADMAP_ALTERNATIVES_START_MARKER: Final"})search_code({"text":"_BODY_MARKDOWN ="})search_code({"text":"_BODY_MARKDOWN"})search_code({"text":"CONST_ROADMAP_REFINE_START_MARKER: Final"})list_files({"directory":"tests/roadmap"})list_files({"directory":"tests/roadmap/stage"})references({"name":"_JOB_BLOCK_MARKERS"})read_issue({"number":6624})read_issue({"number":6613})search_code({"text":"job_block_bounds"})search_code({"text":"block_marker_spans"})file_symbols({"path":"src/devops_cli/roadmap/stage/stage_criteria.py"})read_file({"path":"src/devops_cli/roadmap/body_hash.py","start_line":20,"end_line":48})read_file({"path":"src/devops_cli/roadmap/alternatives.py","start_line":1070,"end_line":1105})read_file({"path":"src/devops_cli/roadmap/repair.py","start_line":150,"end_line":215})read_file({"path":"src/devops_cli/roadmap/body_hash.py","start_line":20,"end_line":60})read_file({"path":"src/devops_cli/roadmap/alternatives.py","start_line":1070,"end_line":1110})read_file({"path":"src/devops_cli/roadmap/repair.py","start_line":150,"end_line":215})search_code({"text":"holds a statement"})search_code({"text":"gives no code span"})read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":2840,"end_line":2975})search_code({"text":"def _is_source_module"})search_code({"text":"_CITATION_MIN_CHARS"})search_code({"text":"def _claim_lines"})read_file({"end_line":2835,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":2760})read_file({"end_line":1420,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1380})search_code({"text":"def code_spans"})search_code({"text":"def _squash"})read_file({"end_line":140,"path":"src/devops_cli/roadmap/step_files.py","start_line":80})read_file({"end_line":1625,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":1595})read_file({"path":"src/devops_cli/roadmap/refine/refine.py","start_line":1160,"end_line":1185})read_file({"path":"src/devops_cli/roadmap/body_hash.py"})read_file({"path":"src/devops_cli/roadmap/stage/stage_criteria.py","start_line":80,"end_line":160})list_files({"directory":"tests/roadmap"})file_symbols({"path":"src/devops_cli/roadmap/stage/stage_criteria.py"})read_file({"path":"src/devops_cli/roadmap/stage/stage_criteria.py","start_line":1,"end_line":80})read_file({"path":"src/devops_cli/roadmap/stage/stage_criteria.py","start_line":213,"end_line":280})read_file({"path":"src/devops_cli/roadmap/alternatives.py","start_line":1060,"end_line":1130})read_file({"path":"src/devops_cli/roadmap/refine/refine.py","start_line":1150,"end_line":1200})read_file({"path":"src/devops_cli/roadmap/refine/refine.py","start_line":3700,"end_line":3740})read_spec({"capability":"roadmap-alternatives"})read_spec({"capability":"roadmap-refine/writes"})read_spec({"capability":"roadmap-stage/criteria"})read_spec({"capability":"roadmap-refine/writes","requirement":"The hash of the body leaves out the job's block"})read_spec({"capability":"roadmap-alternatives","requirement":"A check writes a comment, a block and a record"})search_code({"text":"source_line"})read_file({"path":"tests/roadmap/stage/test_roadmap_stage_criteria.py","start_line":1,"end_line":80})read_file({"path":"tests/roadmap/stage/test_roadmap_stage_requirements.py","start_line":1,"end_line":100})search_code({"text":"ci test"})references({"name":"_JOB_BLOCK_MARKERS"})search_code({"text":"CONST_ROADMAP_REFINE_START_MARKER"})read_file({"path":"tests/roadmap/refine/test_roadmap_refine_selection.py","start_line":195,"end_line":275})search_code({"text":"def check_person_edits"})search_code({"text":"def extract_section_and_outside"})read_file({"path":"src/devops_cli/roadmap/refine/refine.py","start_line":3300,"end_line":3350})read_file({"path":"tests/roadmap/test_roadmap_alternatives.py","start_line":1390,"end_line":1460})search_code({"text":"CONST_ROADMAP_ALTERNATIVES_START_MARKER"})read_file({"path":"tests/roadmap/test_roadmap_alternatives.py","start_line":1960,"end_line":2120})read_file({"path":"src/devops_cli/roadmap/stores/store.py","start_line":900,"end_line":990})read_file({"path":"src/devops_cli/roadmap/repair.py","start_line":150,"end_line":215})read_file({"path":"src/devops_cli/roadmap/refine/refine.py","start_line":1225,"end_line":1250})read_file({"path":"src/devops_cli/roadmap/refine/refine.py","start_line":160,"end_line":210})search_code({"text":"body_hash"})read_spec({"capability":"roadmap-stage/criteria","requirement":"Refine design kept in stage plan"})read_spec({"capability":"roadmap-alternatives","requirement":"The block holds the result of the check"})read_file({"path":"src/devops_cli/roadmap/alternatives.py","start_line":640,"end_line":670})read_file({"path":"src/devops_cli/roadmap/alternatives.py","start_line":770,"end_line":800})read_file({"path":"tests/roadmap/test_roadmap_alternatives.py","start_line":1630,"end_line":1740})read_file({"path":"tests/roadmap/test_roadmap_alternatives.py","start_line":270,"end_line":300})read_file({"path":"tests/roadmap/test_roadmap_alternatives.py","start_line":400,"end_line":440})read_file({"path":"tests/roadmap/test_roadmap_alternatives.py","start_line":915,"end_line":960})search_code({"text":"code span"})search_code({"text":"eval stage"})search_code({"text":"--replay"})read_file({"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":200,"end_line":300})search_code({"text":"stage_criteria"})list_files({"directory":"tests/roadmap/stage"})list_files({"directory":"tests/roadmap/implement"})search_code({"text":"module_test"})search_code({"text":"MISSING_TEST"})search_code({"text":"_marker_problem("})read_file({"path":"src/devops_cli/roadmap/alternatives.py","start_line":1130,"end_line":1200})search_code({"text":"name = \"markdown-it-py\""})read_file({"path":"uv.lock","start_line":2500,"end_line":2520})read_file({"path":"tests/support/roadmap_refine.py","start_line":495,"end_line":525})read_file({"path":"tests/roadmap/test_roadmap_trust.py","start_line":145,"end_line":170})search_code({"text":"from devops_cli.roadmap.body_hash import"})search_code({"text":"stage_criteria.py"})search_code({"text":"roadmap.stage"})read_file({"path":"tests/roadmap/stage/test_roadmap_stage_criteria.py","start_line":80,"end_line":220})search_code({"text":"alternatives:start"})read_file({"path":"src/devops_cli/roadmap/stage/stage_criteria.py"})file_symbols({"path":"src/devops_cli/roadmap/body_hash.py"})read_file({"path":"src/devops_cli/roadmap/stage/stage_criteria.py","start_line":159,"end_line":330})read_file({"path":"src/devops_cli/roadmap/alternatives.py","start_line":1070,"end_line":1105})read_file({"path":"src/devops_cli/roadmap/stage/stage_criteria.py","start_line":100,"end_line":260})read_file({"path":"src/devops_cli/roadmap/body_hash.py","start_line":1,"end_line":60})read_file({"end_line":60,"path":"src/devops_cli/roadmap/stage/stage_criteria.py","start_line":1})read_file({"end_line":340,"path":"src/devops_cli/roadmap/stage/stage_criteria.py","start_line":260})search_code({"text":"CONST_ROADMAP_REFINE_START_MARKER"})list_files({"directory":"tests/roadmap/stage"})search_code({"text":"devops-roadmap-refine:start"})read_file({"path":"src/devops_cli/roadmap/refine/refine.py","start_line":1150,"end_line":1200})read_file({"path":"tests/roadmap/stage/test_roadmap_stage_criteria.py","start_line":1,"end_line":120})search_code({"text":"eval stage"})read_spec({"capability":"roadmap-stage/criteria"})read_file({"path":"tests/roadmap/refine/test_roadmap_refine_sanitize.py","start_line":50,"end_line":95})read_spec({"capability":"roadmap-stage/criteria","requirement":"Refine design kept in stage plan"})read_spec({"capability":"roadmap-stage/criteria","requirement":"Criteria mapping in the stage reply"})list_files({"directory":"tests/fixtures/roadmap_eval/staged"})search_code({"text":"devops-roadmap-refine:start"})Tool calls: file_symbols=3 (empty=0), list_files=9 (empty=0), read_file=81 (empty=0), read_issue=2 (empty=0), read_spec=18 (empty=0), references=4 (empty=0), search_code=44 (empty=3)
The stage job read the open pull requests and their files in 1 GraphQL request(s).
The plan request held these comments of the item whole: #6627 (comment), #6627 (comment), #6627 (comment).
Warnings:
tests/roadmap/test_roadmap_body_hash.pydoes not exist.21 remaining items
devops-cli-service commentedon Nov 22, 2026
The draft pull request #6720 holds the final title and body. In mode
onofroadmap.fix_checks.mode, the watch row marks it ready when its checks pass, and a fix-checks Job repairs a failed check whose name gives the class test, lint or types. In each other case the watch row stops the item: another failed check, a cancelled check, a conflict, a fix-checks Job that ended with no repair, or another mode.Spend: 166 model requests, 13242961 input tokens, 90153 output tokens.
fix(roadmap): find a job block marker only as an HTML block (#6627)
docs(openspec): archive the change (#6627)
devops-cli-service commentedon Nov 22, 2026
Released in v0.192.1: https://github.com/dan-petty/devops-cli/releases/tag/v0.192.1
devops-cli-service commentedon Nov 22, 2026
Live since 2026-11-22 04:24 UTC
fix(roadmap): a job record reads back after an open block (#6792)