fix: preserve code blocks in PR status summary without treating them as tasks#855
fix: preserve code blocks in PR status summary without treating them as tasks#855
Conversation
…d slashes The task decomposer was incorrectly splitting compound words like 'additions/removals' or file paths like 'src/utils' into separate tasks because it matched any '/' character. This caused the agents:apply-suggestions workflow to corrupt issue bodies by creating spurious subtasks like: - Color-coded additions (verify: confirm completion in repo) - removals (verify: confirm completion in repo) Fix: - task_decomposer._split_task_parts: Only split on spaced slashes ' / ' (indicating alternatives) not unspaced slashes (compound words/paths) - issue_optimizer._is_large_task: Only flag tasks with spaced slashes as 'large' requiring decomposition Closes: Issue with corrupted tasks in PRs #4355 and #4353
Automated Status SummaryHead SHA: 73898aa
Coverage Overview
Coverage Trend
Top Coverage Hotspots (lowest coverage)
Updated automatically; will refresh on subsequent CI/Docker completions. Keepalive checklistScopeNo scope information available Tasks
Acceptance criteria
|
🤖 Keepalive Loop StatusPR #855 | Agent: Codex | Iteration 0/5 Current State
🔍 Failure Classification| Error type | infrastructure | |
|
Status | ✅ no new diagnostics |
|
Autofix updated these files:
|
There was a problem hiding this comment.
Pull request overview
This pull request fixes a bug where the task decomposer was incorrectly splitting compound words and file paths containing unspaced slashes (like additions/removals or src/utils) into separate tasks. The fix changes the logic to only split on spaced slashes (/), which typically indicate alternatives or multiple options.
Changes:
- Updated
_split_task_parts()intask_decomposer.pyto only split on/instead of any/ - Updated
_is_large_task()inissue_optimizer.pyto only flag tasks with/as large - Added comprehensive tests to verify spaced slashes are still split while compound words are preserved
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
scripts/langchain/task_decomposer.py |
Changed slash splitting from regex pattern matching any / to simple string split on / |
scripts/langchain/issue_optimizer.py |
Updated large task detection to only flag tasks with / instead of any / |
tests/scripts/test_task_decomposer.py |
Renamed test and added new test cases for compound word preservation |
tests/scripts/test_issue_optimizer.py |
Added comprehensive tests for slash handling in _is_large_task |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Compound words should NOT be flagged as large | ||
| assert not issue_optimizer._is_large_task("Color-coded additions/removals") | ||
| assert not issue_optimizer._is_large_task("Update src/utils module") | ||
|
|
There was a problem hiding this comment.
This line has trailing whitespace. Consider removing it to maintain consistent code formatting.
| if any(sep in lowered for sep in (" and ", " + ", " & ", " then ", "; ")): | ||
| return True | ||
| return bool(re.search(r"\s\+\s", lowered) or ", " in task or "/" in task) | ||
| return bool(re.search(r"\s\+\s", lowered) or ", " in task or " / " in task) |
There was a problem hiding this comment.
The capability_check.py module contains a similar function _is_multi_action_task (line 180) that also checks for "/" in task. This will have the same issue as the functions fixed in this PR - it will incorrectly flag compound words like "additions/removals" and paths like "src/utils" as multi-action tasks. Consider updating that function to check for " / " in task instead for consistency with this fix.
The Automated Status Summary in PR bodies was extracting checkbox patterns (- [ ]) from inside fenced code blocks and treating them as tasks. For example, code examples like: ```python tasks = ['- [ ] example task'] ``` Were being parsed as actual tasks, corrupting the PR body. Fix: - Add stripCodeBlocks() function that removes fenced code blocks (both ``` and ~~~ style) before parsing - Apply code block stripping in collectSections() before extracting tasks - Add regression tests for code block handling This is the actual fix for the corrupted tasks issue - the previous commit (task decomposer slash splitting) addressed a different but related problem.
- Add isCodeFenceLine() helper to detect ``` and ~~~ fences - Update normaliseChecklist() to skip checkbox normalization inside code blocks - Update extractListBlocks() to continue through code blocks - Update extractListBlocksWithOffsets() similarly for offset tracking - Update collectSections() to skip heading detection inside code blocks This fixes the issue where code examples in issue bodies containing patterns like 'tasks:' or '- example item' were being incorrectly detected as section headings or converted to task checkboxes. Code blocks are now: 1. Preserved in the output (not stripped) 2. Excluded from heading detection 3. Excluded from checkbox normalization Closes #TBD
…k.py Per Copilot reviewer feedback: capability_check.py contains a similar function _is_multi_action_task that also checks for '/' in task. This had the same issue - incorrectly flagging compound words like 'additions/removals' and paths like 'src/utils' as multi-action tasks. Changes: - Updated _is_multi_action_task to check for ' / ' (spaced slash) instead - Added comprehensive tests for the fix
Summary
Fixes the issue where code examples in issue bodies were being incorrectly parsed in the PR Automated Status Summary:
tasks:inside YAML examples were detected as section headings- example iteminside code blocks were converted to task checkboxesChanges
Added
isCodeFenceLine()helper - Detects ```` and~~~code fence boundariesUpdated
normaliseChecklist()- TracksinsideCodeBlockstate and skips checkbox normalization inside code blocksUpdated
extractListBlocks()andextractListBlocksWithOffsets()- Treat code block content as continuation, not block boundariesUpdated
collectSections()- Skips heading detection when inside code blocks (preventstasks:in YAML from being detected as a section header)Behavior
Code blocks are now:
Example
Before:
After:
Tests