fix agent-audit scan crash#4
Conversation
agent-audit scan will crash with SKILL.md: ``` --- name: description: metadata: --- ```
|
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 41 minutes and 57 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: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/audit/agent_audit/scanners/skill_meta_scanner.py`:
- Around line 170-177: The current traversal over frontmatter (using nested =
frontmatter and iterating keys ("metadata","openclaw")) correctly descends into
nested dicts but then returns the original frontmatter, causing later calls
(e.g., meta.get("persistence")) to miss nested values; change the final return
to return the resolved nested dict when traversal succeeds (i.e., return nested)
while keeping the existing type checks and early returns intact so non-dict or
missing paths still return frontmatter or {} as intended.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1d1e5a1a-fc72-4880-ab94-2fac565a69a8
📒 Files selected for processing (1)
packages/audit/agent_audit/scanners/skill_meta_scanner.py
|
Thanks for catching this @007gzs — this is a legitimate crash path. Empty The fix looks good after the latest commit (returning Could you add a test case? The repo's convention is that any crash fix ```python def test_get_openclaw_meta_empty_dict(): def test_get_openclaw_meta_non_dict_input(): def test_get_openclaw_meta_valid_path(): One design question worth confirming: when the Once the test is added, this is good to merge. Thanks again. |
I implemented this based on the original code below. In the previous code, if |
|
Good point, you're right that preserving the original contract is the correct scope for a crash fix. I missed that the pre-existing behavior was already "return frontmatter when nested resolution fails," so your implementation correctly keeps that semantics. The contract question is really a pre-existing design issue, not something this PR should tackle. Just the test case then, and this is good to merge. Thanks for the careful read. |
Add tests for skill files with and without metadata.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/test_scanners/test_skill_meta_scanner.py`:
- Around line 423-494: The tests incorrectly assert len(results) == 0 and
duplicate a test name, causing failures and one test to be overridden; update
each new test that calls self.scanner.scan(...) (the tests exercising
_scan_skill_file and scan() which return a SkillMetaScanResult) to assert
len(results) == 1 and then assert results[0].security_findings == [] (or
appropriate expectations), and rename the second test_skill_file_metadata_str to
a unique name (e.g., test_skill_file_metadata_list) so both the JSON-string
metadata test and the list-format metadata test run independently.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8caba34f-1c0a-4b67-9c44-6ea823579a5d
📒 Files selected for processing (2)
packages/audit/agent_audit/scanners/skill_meta_scanner.pytests/test_scanners/test_skill_meta_scanner.py
agent-audit scan will crash with SKILL.md:
Summary by CodeRabbit
Bug Fixes
Tests