Skip to content

Conversation

@RomneyDa
Copy link
Collaborator

@RomneyDa RomneyDa commented Dec 22, 2025

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 fails


Summary 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.

  • Bug Fixes
    • Only fallback to a relative path for .md/.markdown agent files in AgentFileService.
    • Throw a descriptive error for non-markdown paths instead of attempting to open a local file.

Written for commit 53a9fa4. Summary will update automatically on new commits.

@RomneyDa RomneyDa requested a review from a team as a code owner December 22, 2025 18:48
@RomneyDa RomneyDa requested review from Patrick-Erichsen and removed request for a team December 22, 2025 18:48
@continue
Copy link
Contributor

continue bot commented Dec 22, 2025

All Green - Keep your PRs mergeable

Learn more

All Green is an AI agent that automatically:

✅ Addresses code review comments

✅ Fixes failing CI checks

✅ Resolves merge conflicts


Unsubscribe from All Green comments

@continue-development-app
Copy link

All Green - Keep your PRs mergeable

Learn more

All Green is an AI agent that automatically:

✅ Addresses code review comments

✅ Fixes failing CI checks

✅ Resolves merge conflicts


Unsubscribe from All Green comments

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Dec 22, 2025
@github-actions
Copy link

github-actions bot commented Dec 22, 2025

✅ Review Complete

Code Review Summary

⚠️ AI review failed. Please check the Continue API key and configuration.

Troubleshooting

  • Verify the CONTINUE_API_KEY secret is set correctly
  • Check that the organization and config path are valid
  • Ensure the Continue service is accessible

@continue
Copy link
Contributor

continue bot commented Dec 22, 2025

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.

@continue
Copy link
Contributor

continue bot commented Dec 22, 2025

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 (.md or .markdown). 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.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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

@continue
Copy link
Contributor

continue bot commented Dec 22, 2025

CI Check Status

The failing CI checks are related to code issues, not documentation:

  1. Lint error: Unused variable e in catch block at line 61
  2. Test failures: 6 tests failing due to the new validation logic expecting markdown file extensions

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.

@continue
Copy link
Contributor

continue bot commented Dec 22, 2025

🤖 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>
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Dec 22, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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 () => {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 22, 2025

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(&quot;should throw error when hub loading fails and file fallback also fails&quot;, async () =&gt; {
-        mockLoadPackageFromHub.mockRejectedValue(new Error(&quot;Hub error&quot;));
-        mockPathResolve.mockReturnValue(&quot;/resolved/owner/agent&quot;);
+      it(&quot;should throw error when file reading fails for markdown path&quot;, async () =&gt; {
+        mockPathResolve.mockReturnValue(&quot;/resolved/owner/agent.md&quot;);
         mockReadFileSync.mockImplementation(() =&gt; {
</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>
@sestinj sestinj merged commit 16bd0fe into main Dec 22, 2025
57 of 58 checks passed
@sestinj sestinj deleted the dallin/relative-path-fallback-cli branch December 22, 2025 20:50
@github-project-automation github-project-automation bot moved this from Todo to Done in Issues and PRs Dec 22, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2025
@sestinj
Copy link
Contributor

sestinj commented Jan 13, 2026

🎉 This PR is included in version 1.38.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj
Copy link
Contributor

sestinj commented Jan 14, 2026

🎉 This PR is included in version 1.37.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

released size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants