Test parser activity status rows#67
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Linter diff in the way? Review this PR in Change Stack to focus on meaningful changes and expand context only when needed. 📝 WalkthroughWalkthroughThe PR adds a new contract invariant requiring activity/progress rows to remain classified as status text while preserving their exact wording. The parser refactors activity/progress detection into shared regex helpers and applies them consistently across status-line classification and active-work detection. Test fixtures extend coverage with multiple Claude/Codex activity patterns. ChangesActivity/Progress Status Parsing Invariant and Refactor
Possibly Related PRs
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes 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.
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)
245-253:⚠️ Potential issue | 🟠 Major | ⚡ Quick winNormalize bullet-prefixed status lines before active-work checks.
At Line 253,
looksLikeActiveWorkStatusevaluates raw trimmed lines. For•-prefixed status rows,looksLikeActivityProgressText()won’t match (it expects the activity verb at the start), and^Starting MCP serversalso misses due the leading bullet. That can incorrectly sethasActiveWorkBeforeNextTurnand skew prompt/status normalization.Suggested fix
const looksLikeActiveWorkStatus = (text: string) => String(text || "") .split("\n") .some((line) => { - const trimmed = line.trim(); + const trimmed = line.trim(); + const normalized = trimmed.replace(/^(?:[•*-]|[✻✽✶])\s+/, ""); return ( - /\bWorking \(\d+s\b.*\besc to interrupt\b/i.test(trimmed) || - /^Starting MCP servers\b/i.test(trimmed) || - looksLikeActivityProgressText(trimmed) + /\bWorking \(\d+s\b.*\besc to interrupt\b/i.test(normalized) || + /^Starting MCP servers\b/i.test(normalized) || + looksLikeActivityProgressText(normalized) ); });🤖 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 245 - 253, The active-work detection in looksLikeActiveWorkStatus tests the raw trimmed line, so lines that start with a bullet (e.g., "•", "-", "*", U+2022) won't match starts-with patterns or looksLikeActivityProgressText; normalize each trimmed line by stripping any common bullet characters plus following whitespace (e.g., use a regex to remove leading [•\-\*\u2022]\s*), assign that to a variable like normalizedLine, and run the existing checks (/\\bWorking \\(\\d+s\\b.*\\besc to interrupt\\b/i.test, /^Starting MCP servers\\b/i.test, and looksLikeActivityProgressText) against normalizedLine instead of trimmed so bullet-prefixed status rows are correctly detected by looksLikeActiveWorkStatus.
🤖 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 245-253: The active-work detection in looksLikeActiveWorkStatus
tests the raw trimmed line, so lines that start with a bullet (e.g., "•", "-",
"*", U+2022) won't match starts-with patterns or looksLikeActivityProgressText;
normalize each trimmed line by stripping any common bullet characters plus
following whitespace (e.g., use a regex to remove leading [•\-\*\u2022]\s*),
assign that to a variable like normalizedLine, and run the existing checks
(/\\bWorking \\(\\d+s\\b.*\\besc to interrupt\\b/i.test, /^Starting MCP
servers\\b/i.test, and looksLikeActivityProgressText) against normalizedLine
instead of trimmed so bullet-prefixed status rows are correctly detected by
looksLikeActiveWorkStatus.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2ab4b861-fab6-4953-91aa-74816c19c18f
📒 Files selected for processing (4)
src/agent-output-parser-contract.tssrc/agent-output-parser-fixtures.test.tssrc/agent-output-parser-fixtures.tssrc/agent-output-parser.ts
Summary
Verification
Summary by CodeRabbit
New Features
Tests