Skip to content

Fix regex-heavy prompt rendering crash#48

Merged
roackb2 merged 1 commit intomainfrom
fix/issue-43-regex-heavy-prompt
May 3, 2026
Merged

Fix regex-heavy prompt rendering crash#48
roackb2 merged 1 commit intomainfrom
fix/issue-43-regex-heavy-prompt

Conversation

@roackb2
Copy link
Copy Markdown
Owner

@roackb2 roackb2 commented May 3, 2026

Summary

  • fix the chat renderer hang on unmatched inline markdown markers in regex-heavy prompts
  • refactor parseMessageBlocks into smaller reducer-style helpers
  • add regression coverage for regex-heavy prompt content and mixed block parsing

Testing

  • yarn vitest run src/tests/unit/tui/prompt-input.test.tsx
  • yarn build

@roackb2 roackb2 merged commit f7df9df into main May 3, 2026
4 checks passed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e32adce2c2

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +253 to +257
function appendParsedMessageBlock(state: MessageBlockParserState, block: MessageBlock): MessageBlockParserState {
return {
...state,
blocks: [...state.blocks, block],
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid quadratic array copies in message block parser

This helper now clones the full blocks array every time a line is parsed, which makes parseMessageBlocks O(n²) in the number of lines. In contexts this panel already handles (long assistant outputs, large diffs, or pasted logs), repeated spreads can noticeably increase CPU and memory and reintroduce UI stalls during rendering. The previous implementation used in-place pushes and stayed linear, so this is a regression introduced by the refactor.

Useful? React with 👍 / 👎.

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.

1 participant