-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix(CLI): HOTFIX allow default config fallback for headless #8356
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
|
✅ Review Complete Code Review for PR #8356Overall AssessmentThis PR addresses a critical issue with config fallback in headless CLI mode. The changes are well-structured and improve error handling. Here are some specific observations: ✅ Good Changes
🔍 Issues & Suggestions1. Missing import validation (extensions/cli/src/configLoader.ts:16)import { fileURLToPath } from "node:url";The if (savedUri.startsWith("file:")) {
try {
const filePath = fileURLToPath(savedUri);
if (fs.existsSync(filePath)) {
return { type: "saved-uri", uri: savedUri };
}
} catch (err) {
logger.warn(`Invalid file URI: ${savedUri}`);
}
} else if (fs.existsSync(savedUri)) {
return { type: "saved-uri", uri: savedUri };
}2. Typo in warning message (extensions/cli/src/configLoader.ts:112)logger.warn("Saved URI does not exists");Should be: 3. Silent error swallowing (extensions/cli/src/services/ConfigService.ts:236-245)When not in headless mode, errors are logged but execution continues without a model. This could lead to confusing downstream failures. Consider:
} else {
logger.error("Failed to load default model with no model specified", e);
throw new Error("No model specified and failed to load default model");
}4. Logic clarity (extensions/cli/src/services/ModelService.ts:67-71)The variable rename ( const persistedName = getModelName(authConfig);
if (persistedName) {
preferredModelName = persistedName; // Just assigns the same value
modelSource = "persisted";
}Could simplify to: preferredModelName = getModelName(authConfig);
if (preferredModelName) {
modelSource = "persisted";
}🧪 Testing ConsiderationsNo test changes included. Consider adding tests for:
Security & Performance
Recommendation: Approve with minor fixes (typo + error handling improvement) |
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.
2 issues found across 3 files
Prompt for AI agents (all 2 issues)
Understand the root cause of the following 2 issues and fix them.
<file name="extensions/cli/src/configLoader.ts">
<violation number="1" location="extensions/cli/src/configLoader.ts:106">
Checking saved config existence this way drops any persisted slug:// config URI, so we no longer honor saved assistants when a slug was stored.</violation>
<violation number="2" location="extensions/cli/src/configLoader.ts:107">
Guard fileURLToPath against malformed file: URIs; the call can throw and crash during existsSync. Wrap the conversion in try/catch and skip/log invalid savedUri values instead of letting an exception propagate.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
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
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 3 files
|
🎉 This PR is included in version 1.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.27.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.30.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
Summary by cubic
Restores config fallback in headless CLI so runs can proceed with local/default config. Adds safe handling for missing saved URIs and default model injection to prevent crashes.