fix: prevent shell failure render crash#174
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 13 minutes and 29 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughRefactors trigger rendering in Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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 unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request addresses a renderer crash by refactoring the BasicTool component to use a helper function instead of SolidJS Switch and Match components. It includes a new E2E test for shell command failures and a regression test that checks the source code for the removed components. Feedback indicates that the source-code-based regression test is fragile and should be made more robust.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/app/e2e/prompt/prompt-shell.spec.ts`:
- Around line 120-121: Remove the wall-clock wait: delete the call to
page.waitForTimeout(250) in the test and replace it with a deterministic wait
that asserts the desired state (for example use page.waitForFunction to poll
until errors.pageErrors does not contain "switchFunc(...) is not a function", or
waitForSelector / waitForResponse that indicates the operation completed).
Specifically, update the assertion block around errors.pageErrors.join("\n") so
the test waits on a condition tied to application state instead of fixed time,
keeping the final expect(...) check the same.
- Around line 79-117: The test asserts the exact shell error text "command not
found", which is platform-specific; update the assertions in the shell flow
(references: project.shell, withSession,
page.locator('[data-component="bash-output"]'), the poll that reads
project.sdk.session.messages and uses isBash) to accept platform variations
(e.g., test for either "command not found" OR Windows "is not recognized" or use
a regex/substring check that matches both), and replace both the immediate UI
expect and the polled message assertion to use this resilient check so CI won't
fail on Windows.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 8e7de3ff-2dcd-4a3a-a5e7-851513ff257b
📒 Files selected for processing (3)
packages/app/e2e/prompt/prompt-shell.spec.tspackages/ui/src/components/basic-tool-trigger.test.tspackages/ui/src/components/basic-tool.tsx
8f87b81 to
00530f5
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/app/e2e/prompt/prompt-shell.spec.ts`:
- Around line 79-80: Rename the test-level constant identifiers to
SCREAMING_SNAKE_CASE: change command to COMMAND (or COMMAND_TEST) and
commandFailurePattern to COMMAND_FAILURE_PATTERN, and apply the same renaming
for the other test constants referenced (lines grouping around 88-93, 107-113,
118) so all test constants use SCREAMING_SNAKE_CASE; update every usage of these
identifiers in prompt-shell.spec.ts (e.g., references inside tests and helper
calls) to the new names to avoid breakage.
In `@packages/ui/src/components/basic-tool-trigger.test.ts`:
- Around line 6-8: The test currently slices source using indices from
source.indexOf("const triggerInfo = () =>") and source.indexOf("const trigger =
() =>", triggerInfoStart) without verifying those calls found the markers; add
guard assertions to ensure triggerInfoStart !== -1, triggerStart !== -1 and
triggerStart > triggerInfoStart before creating triggerSource (i.e., assert the
marker strings exist and are in order), so the test fails deterministically
instead of producing false-positive passes when markers are missing or
reordered.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 6849ce00-2179-4c4e-a19b-0956f6ad4aff
📒 Files selected for processing (3)
packages/app/e2e/prompt/prompt-shell.spec.tspackages/ui/src/components/basic-tool-trigger.test.tspackages/ui/src/components/basic-tool.tsx
00530f5 to
846bf56
Compare
Summary
Fixes the renderer crash risk when a user-entered shell command fails through composer shell mode.
Why
Issue #171 showed that shell failures such as
definitely-not-a-command-171 --helpproduce valid command-not-found output, but the renderer could crash while displaying the completed bash tool part. This is separate from #170, which covers PATH and GitHub CLI environment assembly.Related Issue
Fixes #171.
How To Verify
Screenshots or Recordings
Not included. This is a renderer crash fix for an existing shell output view, not a visual design or copy change. The e2e regression verifies failed shell output renders without the Solid Switch page error.
Checklist
dev, and my PR title and commit messages use Conventional Commits in EnglishSummary by CodeRabbit
Tests
Refactor