Skip to content

Parse trace tags with a linear scan instead of regexes - #39

Merged
armand0e merged 1 commit into
TeichAI:mainfrom
cfahlgren1:cfahlgren1/linear-tag-parsing
Nov 17, 2026
Merged

armand0e merged 1 commit into
TeichAI:mainfrom
cfahlgren1:cfahlgren1/linear-tag-parsing

Conversation

@cfahlgren1

@cfahlgren1 cfahlgren1 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Tag parsing in the converter (<think>, <tool_call>, <tool_response>, <command-name>, and the teich prompt <file> wrapper) used .*? regexes that backtrack badly on unclosed tags, so a small malformed trace could take minutes to convert. They now use plain str.find instead, the same primitive vLLM and SGLang use to split out <think> blocks, and return the same output as before.

Malformed trace Size Before (main) After
Claude Code 60 KB 5.29 s <0.01 s
Hermes 48 KB 4.36 s <0.01 s
Hermes 2 KB 4.12 s <0.01 s
Hermes, inline thinking 56 KB 1.21 s <0.01 s

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T20:31:20.507470Z b8d6810 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

2 participants