Skip to content

Conversation

@hanakannzashi
Copy link
Contributor

@hanakannzashi hanakannzashi commented Dec 9, 2025

Fix #235


Note

Improve reasoning tag parsing to preserve HTML and handle self-closing/malformed cases, with extensive tests; ignore .DS_Store.

  • Services (responses/service.rs):
    • Reasoning tag parsing:
      • Adds fast-path checks and preserves non-reasoning HTML (incl. <!DOCTYPE>, tags with attributes).
      • Supports self-closing tags (e.g., <br/>, <think/>) and avoids infinite loops on incomplete tags.
      • Handles malformed/nested reasoning tags, and ignores extra/misaligned closing/opening tags.
      • Routes reasoning content correctly while emitting tag transition states; outputs full non-reasoning tags verbatim.
    • Tests:
      • Adds comprehensive unit tests covering HTML preservation, self-closing tags (with/without spaces, with attributes), XML-style tags, malformed/nested cases, and attributes on reasoning tags.
  • Repo:
    • Update .gitignore to ignore .DS_Store.

Written by Cursor Bugbot for commit c0b6b34. This will update automatically on new commits. Configure here.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an issue where HTML tags with attributes and special tags like <!DOCTYPE> were being incorrectly parsed by the reasoning tag processor. The fix ensures that only simple tag names (alphanumeric with _ or -) are checked against the reasoning tags list, while complex tags with attributes, special characters, or directives are preserved in their entirety.

Key Changes:

  • Modified tag collection logic to capture full tag content including attributes and special characters
  • Introduced found_non_tag_char flag to distinguish simple tags from complex HTML/XML constructs
  • Added comprehensive tests for DOCTYPE and HTML tags with attributes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@think-in-universe think-in-universe changed the title fix: collect html label fix: incorrect html labels Dec 9, 2025
@think-in-universe
Copy link
Contributor

@claude review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@think-in-universe
Copy link
Contributor

Some thoughts:

  1. If delta_text contains no reasoning tags, we should skip the processing;
  2. To improve verifiability, ideally we should not process the content, but return the raw response from model to users with minimum verifiable changes. The reasoning tags can be processed in the frontend I think.

@think-in-universe think-in-universe merged commit 4f6e0d8 into main Dec 11, 2025
2 of 5 checks passed
@think-in-universe think-in-universe deleted the fix/html-label branch December 11, 2025 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Responses API returns incorrect HTML output format

3 participants