Skip to content

fix(#59): recognize tilde code fences in parse_update_instructions - #60

Merged
csoceanu merged 1 commit into
mainfrom
agent/59-tilde-code-fence-support
Aug 16, 2026
Merged

fix(#59): recognize tilde code fences in parse_update_instructions#60
csoceanu merged 1 commit into
mainfrom
agent/59-tilde-code-fence-support

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Summary

  • Extend parse_update_instructions() in src/comments.py to recognize tilde code fences (~~~) in addition to backtick fences (```), per the CommonMark spec
  • Add two test cases in tests/test_comment_parsing.py: basic tilde fence and tilde fence with language specifier

Context

PR #58 added code fence tracking to prevent filename.ext: text lines inside fenced code blocks from being misclassified as per-file instructions. However, it only handled backtick fences. Tilde fences (~~~) are equally valid CommonMark delimiters and were not detected, leaving the same bug class open for tilde-fenced blocks.

Testing

  • All 41 tests in test_comment_parsing.py pass, including 2 new tilde fence tests
  • ruff check passes with no warnings
  • Secret scan passes

Closes #59

Post-script verification

  • Branch is not main/master (agent/59-tilde-code-fence-support)
  • Secret scan passed (gitleaks — 52290e8f55a69f5cddf0920ee6b95718b6f30fff..HEAD)
  • PR body secret scan passed (gitleaks — no-git)

The code fence detection added in PR #58 for issue #57 only handled
backtick fences (```). Tilde fences (~~~) are equally valid per the
CommonMark spec but were not recognized, causing lines matching the
file-pattern inside ~~~ blocks to be incorrectly extracted as per-file
instructions instead of preserved as global instructions.

Extend the fence detection condition to also match lines starting
with ~~~. Add two test cases: one for basic tilde fences and one
for tilde fences with a language specifier.

Closes #59
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 16, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 11:05 AM UTC · Completed 11:15 AM UTC

Commit: a44c99a · View workflow run →

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Low

  • [edge-case] src/comments.py:186 — The fence toggle treats backtick and tilde delimiters interchangeably: a block opened with ``` can be closed by ~~~ and vice versa. Per CommonMark, a closing fence must use the same character as the opener. In practice this is unlikely in user comments and was already a pre-existing limitation for nested backtick fences of different lengths.
    Remediation: Track which fence character opened the block (e.g., store the delimiter in a variable instead of a boolean) and only toggle off when the same character is encountered.

Labels: PR fixes a bug in comment parsing (tilde code fence recognition) in Python source files

Comment thread src/comments.py
# Toggle code fence state on lines starting with triple backticks
# (handles language specifiers like ```python)
if stripped.startswith("```"):
# or triple tildes (handles language specifiers like ```python)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low] edge-case

The fence toggle treats backtick and tilde delimiters interchangeably: a block opened with ``` can be closed by ~~~ and vice versa. Per CommonMark, a closing fence must use the same character as the opener. In practice this is unlikely in user comments and was already a pre-existing limitation for nested backtick fences of different lengths.

Suggested fix: Track which fence character opened the block (e.g., store the delimiter in a variable instead of a boolean) and only toggle off when the same character is encountered.

@fullsend-ai-review fullsend-ai-review Bot added ready-for-merge All reviewers approved — ready to merge bug Something isn't working python Pull requests that update python code labels Aug 16, 2026
@Benkapner Benkapner assigned Benkapner and unassigned Benkapner Aug 16, 2026
@csoceanu
csoceanu merged commit 8c89349 into main Aug 16, 2026
22 checks passed
@fullsend-ai-retro

fullsend-ai-retro Bot commented Aug 16, 2026

Copy link
Copy Markdown

🤖 Finished Retro · ✅ Success · Started 12:01 PM UTC · Completed 12:11 PM UTC

Commit: a44c99a · View workflow run →

@fullsend-ai-retro

Copy link
Copy Markdown

Retro: PR #60 — Tilde code fence support

PR #60 was a fully agent-driven lifecycle: the retro agent on PR #58 identified a gap (tilde fences not handled), filed issue #59, the triage agent confirmed it, the code agent implemented the fix, the review agent approved with one valid low-severity finding, and a human merged it. Total time: ~76 minutes from issue creation to merge.

Timeline

Time (UTC) Event Actor
10:44 Issue #59 created (retro finding from PR #58) retro agent
10:45 Triage run — confirmed bug, posted analysis triage agent
10:49 Code run — false-positive skip (thought PR #45 covered #59) code agent
10:57 Human override: /fs-code --force csoceanu
10:58 Forced code run — created PR #60 code agent
11:04 CI passed (lint + tests) CI
11:04–11:16 Review run — approved with 1 [low] finding review agent
12:00 PR merged csoceanu

Key findings

1. False-positive skip (corroborates fullsend-ai/fullsend#5900). The code agent's pre-code.sh script searched for "59 in:body,title" and matched the string "65.59%" (a coverage percentage) in the unrelated PR #45's body. This is the exact same root cause as #5900 (bare issue-number substring matching). This PR provides additional evidence: the false positive came from a coverage percentage rather than a version string, confirming the pattern is broader than Dependabot titles. The proposed fix in #5900 ("#${ISSUE_NUMBER} in:body") would have prevented this skip.

2. Review agent quality was strong. The review agent identified a real CommonMark compliance issue: the fence toggle uses a boolean that treats backtick and tilde delimiters interchangeably, allowing a block opened with ``` to be closed by ~~~. It correctly classified this as [low] edge-case severity, documented a clear remediation, and approved the PR — appropriate given the near-zero practical probability of cross-delimiter fences in user comments. One proposal below for the underlying code fix.

3. No human review comments. The human reviewer merged the PR without adding review comments. The review agent's analysis was the only substantive review performed, and it caught a finding the code agent missed. This suggests strong review agent performance for small, well-tested bug fixes in this repo.

4. Three-level agent improvement chain. Issue #57 → PR #58 → retro creates issue #59 → PR #60. The retro agent's ability to identify gaps in its own prior work product and file follow-up issues demonstrates effective autonomous improvement loops. The only human intervention in this chain was the /fs-code --force override necessitated by the false-positive skip.

Proposals filed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working python Pull requests that update python code ready-for-merge All reviewers approved — ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parse_update_instructions does not recognize tilde code fences (~~~)

2 participants