Test parser live mined actions#71
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Ready to act? Review this PR in Change Stack to turn feedback into patch suggestions you can inspect and refine. 📝 WalkthroughWalkthroughThis PR extends the agent output parser to recognize tool/action-like text in status lines and adds comprehensive test coverage. The parser now detects common command patterns (bash, read, update, git, yarn) and completion phrases, classifying bullet-prefixed lines containing these patterns as status blocks. Two new fixtures and updated fuzz/integration tests validate the behavior. ChangesTool/Action Row Parsing and Validation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/agent-output-parser.ts (1)
34-48: 💤 Low valueConsider tightening the
\b.*\bpattern in the tool-name regex.Lines 38-40 use
\b.*\b(?:ctrl\+o|to expand|Running in the background|exit code)which matches word-boundary + any content + word-boundary before the specific phrases. While this works correctly for the tested fixtures, it's quite permissive and could theoretically match unintended text likeBash arbitrary content ctrl+o.A more constrained pattern might reduce false-positive risk, for example limiting the middle portion to common patterns like
\d+\s+\w+.*for file-count constructs. However, given the regex is anchored with specific tool names and the fixtures validate the intended behavior, the current approach is acceptable.🤖 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 34 - 48, The regex in looksLikeToolActionText uses \b.*\b before the tail phrases which is overly permissive; update that portion of the first big regexp in the looksLikeToolActionText function to a tighter pattern (for example restrict the middle to common constructs like file/count patterns or limit length) such as replacing \b.*\b with a constrained alternative like \d+\s+\w+.* or a bounded character class (e.g. .{0,50}) so it only matches expected short phrases (file counts, short descriptions) before the group (ctrl+o|to expand|Running in the background|exit code), then run tests to ensure no desired fixtures break.
🤖 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.
Nitpick comments:
In `@src/agent-output-parser.ts`:
- Around line 34-48: The regex in looksLikeToolActionText uses \b.*\b before the
tail phrases which is overly permissive; update that portion of the first big
regexp in the looksLikeToolActionText function to a tighter pattern (for example
restrict the middle to common constructs like file/count patterns or limit
length) such as replacing \b.*\b with a constrained alternative like \d+\s+\w+.*
or a bounded character class (e.g. .{0,50}) so it only matches expected short
phrases (file counts, short descriptions) before the group (ctrl+o|to
expand|Running in the background|exit code), then run tests to ensure no desired
fixtures break.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a4153b42-218b-405b-9cd5-4275930168a8
📒 Files selected for processing (4)
src/agent-output-parser-fixtures.tssrc/agent-output-parser-fuzz.test.tssrc/agent-output-parser-harness.test.tssrc/agent-output-parser.ts
Summary
Verification
Summary by CodeRabbit
Tests
Improvements