-
Notifications
You must be signed in to change notification settings - Fork 4.1k
fix: don't fallback to relative path if not markdown file #9266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
|
✅ Review Complete Code Review SummaryTroubleshooting
|
|
No documentation updates are needed for this PR. This is an internal bug fix that adds validation to enforce that agent file paths must be markdown files ( or ). This behavior was already implicitly expected and documented throughout the docs - all examples use markdown files for agents, rules, and prompts. The change improves error messages by preventing confusing ENOENT errors when non-markdown paths are provided, but doesn't change the user-facing API or require any updates to existing documentation. |
|
No documentation updates are needed for this PR. This is an internal bug fix that adds validation to enforce that agent file paths must be markdown files ( The change improves error messages by preventing confusing ENOENT errors when non-markdown paths are provided, but doesn't change the user-facing API or require any updates to existing documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 1 file
CI Check StatusThe failing CI checks are related to code issues, not documentation:
These code-related issues are outside the scope of documentation review. The PR author or code reviewers should address these failures. As previously noted, no documentation updates are required for this PR since it's an internal bug fix that enforces already-documented behavior. |
|
🤖 All Green agent started: View agent |
- Remove unused variable 'e' in catch block - Update tests to use .md extensions for file path loading tests - Add test for non-markdown paths throwing errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="extensions/cli/src/services/AgentFileService.test.ts">
<violation number="1" location="extensions/cli/src/services/AgentFileService.test.ts:727">
P1: Test is missing hub mock rejection. For two-part paths like `owner/agent.md`, the implementation tries hub first (per test at line 529). Without `mockLoadPackageFromHub.mockRejectedValue()`, hub loading succeeds and returns `mockAgentFile`, never reaching the file reading code being tested.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
| it("should throw error when hub loading fails and file fallback also fails", async () => { | ||
| mockLoadPackageFromHub.mockRejectedValue(new Error("Hub error")); | ||
| mockPathResolve.mockReturnValue("/resolved/owner/agent"); | ||
| it("should throw error when file reading fails for markdown path", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Test is missing hub mock rejection. For two-part paths like owner/agent.md, the implementation tries hub first (per test at line 529). Without mockLoadPackageFromHub.mockRejectedValue(), hub loading succeeds and returns mockAgentFile, never reaching the file reading code being tested.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At extensions/cli/src/services/AgentFileService.test.ts, line 727:
<comment>Test is missing hub mock rejection. For two-part paths like `owner/agent.md`, the implementation tries hub first (per test at line 529). Without `mockLoadPackageFromHub.mockRejectedValue()`, hub loading succeeds and returns `mockAgentFile`, never reaching the file reading code being tested.</comment>
<file context>
@@ -741,19 +724,29 @@ You are a helpful agent`;
- it("should throw error when hub loading fails and file fallback also fails", async () => {
- mockLoadPackageFromHub.mockRejectedValue(new Error("Hub error"));
- mockPathResolve.mockReturnValue("/resolved/owner/agent");
+ it("should throw error when file reading fails for markdown path", async () => {
+ mockPathResolve.mockReturnValue("/resolved/owner/agent.md");
mockReadFileSync.mockImplementation(() => {
</file context>
✅ Addressed in 53a9fa4
Add mockLoadPackageFromHub.mockRejectedValue() to test that verifies file reading failure for markdown paths. Without this, the hub would succeed and the file reading code wouldn't be exercised. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
🎉 This PR is included in version 1.38.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.37.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |

Description
When reading agent file, only fallback to file if it's a markdown file.
Avoid e.g.
Unhandled error: Failed to load agent from continuedev/default-hub-cloud-agent: ENOENT: no such file or directory, open '/root/remote-config-server/continuedev/default-hub-cloud-agent'when slug failsSummary by cubic
Stop falling back to a local file when the agent path isn’t a markdown file, preventing ENOENT errors for slug paths and returning a clearer error instead.
Written for commit 53a9fa4. Summary will update automatically on new commits.