Skip to content

Test parser fuzz variants#68

Merged
TraderSamwise merged 1 commit into
masterfrom
test/chat-parser-fuzz-generator
Jun 6, 2026
Merged

Test parser fuzz variants#68
TraderSamwise merged 1 commit into
masterfrom
test/chat-parser-fuzz-generator

Conversation

@TraderSamwise

@TraderSamwise TraderSamwise commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • add deterministic generated Claude/Codex transcript variants for parser fuzz coverage
  • assert submitted prompts, assistant responses, status/activity rows, and active suggestions stay in their intended block types
  • fix Codex normalization so repeated/template active inputs remain status even when later progress rows appear before the next turn

Verification

  • /Users/sam/cs/aimux/node_modules/.bin/vitest run src/agent-output-parser-fuzz.test.ts src/agent-output-parser-fixtures.test.ts src/agent-output-parser.test.ts src/context/context-bridge.test.ts
  • /Users/sam/cs/aimux/node_modules/.bin/tsc --noEmit
  • PATH=/Users/sam/cs/aimux/node_modules/.bin:/Users/sam/.local/volta-shims:/Users/sam/.local/bin:/Users/sam/.bun/bin:/Users/sam/.codex/tmp/arg0/codex-arg0MLlwy8:/Users/sam/.volta/tools/image/packages/@openai/codex/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex-path:/opt/homebrew/opt/mysql-client/bin:/Users/sam/opt/anaconda3/envs/py39/bin:/Users/sam/.npm-global/bin:/Users/sam/pathother:/Users/sam/apache-ant/bin:/usr/local/mysql/bin:/Users/sam/.codex/tmp/arg0/codex-arg0FiIdYh:/Applications/cmux.app/Contents/Resources/bin:/Users/sam/.nvm/versions/node/v24.16.0/bin:/Users/sam/opt/anaconda3/condabin:/Users/Sam/.npm-global/bin:/Users/Sam/pathother:/Users/Sam/apache-ant/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/pkg/env/global/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:/Users/sam/.cargo/bin:/Users/sam/bin yarn lint
  • PATH=/Users/sam/cs/aimux/node_modules/.bin:/Users/sam/.local/volta-shims:/Users/sam/.local/bin:/Users/sam/.bun/bin:/Users/sam/.codex/tmp/arg0/codex-arg0MLlwy8:/Users/sam/.volta/tools/image/packages/@openai/codex/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex-path:/opt/homebrew/opt/mysql-client/bin:/Users/sam/opt/anaconda3/envs/py39/bin:/Users/sam/.npm-global/bin:/Users/sam/pathother:/Users/sam/apache-ant/bin:/usr/local/mysql/bin:/Users/sam/.codex/tmp/arg0/codex-arg0FiIdYh:/Applications/cmux.app/Contents/Resources/bin:/Users/sam/.nvm/versions/node/v24.16.0/bin:/Users/sam/opt/anaconda3/condabin:/Users/Sam/.npm-global/bin:/Users/Sam/pathother:/Users/Sam/apache-ant/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/pkg/env/global/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:/Users/sam/.cargo/bin:/Users/sam/bin yarn build
  • PATH=/Users/sam/cs/aimux/node_modules/.bin:/Users/sam/.local/volta-shims:/Users/sam/.local/bin:/Users/sam/.bun/bin:/Users/sam/.codex/tmp/arg0/codex-arg0MLlwy8:/Users/sam/.volta/tools/image/packages/@openai/codex/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex-path:/opt/homebrew/opt/mysql-client/bin:/Users/sam/opt/anaconda3/envs/py39/bin:/Users/sam/.npm-global/bin:/Users/sam/pathother:/Users/sam/apache-ant/bin:/usr/local/mysql/bin:/Users/sam/.codex/tmp/arg0/codex-arg0FiIdYh:/Applications/cmux.app/Contents/Resources/bin:/Users/sam/.nvm/versions/node/v24.16.0/bin:/Users/sam/opt/anaconda3/condabin:/Users/Sam/.npm-global/bin:/Users/Sam/pathother:/Users/Sam/apache-ant/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/pkg/env/global/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:/Users/sam/.cargo/bin:/Users/sam/bin yarn test

Summary by CodeRabbit

  • Tests

    • Added comprehensive fuzz testing for agent output parsing with synthetic transcripts across multiple tool modes.
  • Bug Fixes

    • Improved transcript block classification for codex tool mode to better handle repeated and template prompts.

@vercel

vercel Bot commented Jun 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Jun 6, 2026 8:31am

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown

Worried about impact? Review this PR in Change Stack to explore blast radius before you approve or request changes.

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates the Codex prompt-to-status reclassification heuristic in the agent output parser and introduces a comprehensive deterministic fuzz test suite. The parser now allows repeated or template-like prompts to convert to status blocks even when active work is present. The fuzz test validates parsing stability across 80 seeded transcript variants for both tool modes.

Changes

Codex prompt reclassification and fuzz validation

Layer / File(s) Summary
Parser reclassification logic for Codex prompts
src/agent-output-parser.ts
Introduces repeatedPrompt and templatePrompt flags to relax the constraint on active work before next turn, allowing promptstatus conversion when a prompt is repeated or contains placeholder syntax.
Deterministic fuzz test for transcript parsing
src/agent-output-parser-fuzz.test.ts
Fuzz test generates seeded transcript variants with embedded sentinel strings for both claude and codex tools across 80 seeds, asserts stable parsed blocks, and validates prompt/response/status sentinel containment and forbidden-prompt exclusion. Includes RNG helpers, tool-specific fragment generators (startup, turn, activity, survey, markdown, MCP), collection aggregators, and main fuzz loop with multi-seed assertions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • TraderSamwise/aimux#67: Both PRs refine the parser's status/active-work classification logic; PR #67 refactors activity/progress detection and adds invariants to keep those rows as exact status text.
  • TraderSamwise/aimux#54: Both PRs modify Codex transcript block classification in src/agent-output-parser.ts, directly overlapping in prompt/status handling heuristics.
  • TraderSamwise/aimux#58: Main PR's prompt→status reclassification for repeated/template prompts directly targets the same Codex prompt-block handling covered in PR #58's test suite.

Poem

🐰 A parser learns to spot the hints—
When prompts repeat or templates flex,
No need to wait for work to end!
Eighty seeds now fuzz and test,
Transcripts parse with steadfast zest. 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Test parser fuzz variants' directly reflects the main change: adding a new fuzz test file for the agent output parser with deterministic generated transcript variants.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/chat-parser-fuzz-generator

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/agent-output-parser.ts (1)

229-366: ⚠️ Potential issue | 🟠 Major

Regenerate dist/ for src/agent-output-parser.ts runtime changes

  • dist/ is missing, so there’s no compiled output to verify that this parser change made it into runtime artifacts.
  • Run yarn build and confirm the dist output for agent-output-parser is present and reflects the update.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/agent-output-parser.ts` around lines 229 - 366, The dist/ build artifacts
for the runtime are missing for the changes in normalizeTranscriptBlocks
(src/agent-output-parser.ts); run the project build (e.g., yarn build) to
regenerate compiled output, verify that dist/ contains the updated compiled
artifact for agent-output-parser reflecting the new normalizeTranscriptBlocks
logic, and commit the updated dist/ files so the runtime uses the new parser
implementation.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/agent-output-parser.ts`:
- Around line 229-366: The dist/ build artifacts for the runtime are missing for
the changes in normalizeTranscriptBlocks (src/agent-output-parser.ts); run the
project build (e.g., yarn build) to regenerate compiled output, verify that
dist/ contains the updated compiled artifact for agent-output-parser reflecting
the new normalizeTranscriptBlocks logic, and commit the updated dist/ files so
the runtime uses the new parser implementation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ee7bd713-9253-4644-8e9c-efb0d8b04025

📥 Commits

Reviewing files that changed from the base of the PR and between 2021112 and 2159532.

📒 Files selected for processing (2)
  • src/agent-output-parser-fuzz.test.ts
  • src/agent-output-parser.ts

@TraderSamwise
TraderSamwise merged commit ccdd306 into master Jun 6, 2026
3 checks passed
@TraderSamwise
TraderSamwise deleted the test/chat-parser-fuzz-generator branch June 6, 2026 08:36
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