Skip to content

Conversation

uinstinct
Copy link
Contributor

@uinstinct uinstinct commented Oct 8, 2025

Description

When doing runNormalFlow, we need the config only for rules injection.

We already fetch the config again when initializing services for config.

resolves CON-4174

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screen recording or screenshot

reduction of init time by approx 2 seconds

before

image

after
image

Tests

[ What tests were added or updated to ensure the changes work as expected? ]


Summary by cubic

Make CLI start faster by initializing normal-flow config asynchronously instead of blocking; startup time drops by ~2 seconds. Addresses CON-4174.

  • Refactors
    • Initialize normal flow and config in parallel; inject rules after config is ready.
    • Remove wasOnboarded return from initializeServices; onboarding stays internal.

@uinstinct uinstinct requested a review from a team as a code owner October 8, 2025 12:29
@uinstinct uinstinct requested review from RomneyDa and removed request for a team October 8, 2025 12:29
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 8, 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

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="extensions/cli/src/onboarding.ts">

<violation number="1" location="extensions/cli/src/onboarding.ts:300">
Discarding the promise from runNormalFlow here lets onboarding continue even if config initialization fails, and the resulting rejection becomes unhandled.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

if (rules && rules.length > 0 && !result.wasOnboarded) {
result.config = await injectRulesIntoConfig(result.config, rules);
// when running normal flow, initialize (remote) config asynchronously
void (async () => {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discarding the promise from runNormalFlow here lets onboarding continue even if config initialization fails, and the resulting rejection becomes unhandled.

Prompt for AI agents
Address the following comment on extensions/cli/src/onboarding.ts at line 300:

<comment>Discarding the promise from runNormalFlow here lets onboarding continue even if config initialization fails, and the resulting rejection becomes unhandled.</comment>

<file context>
@@ -280,24 +280,35 @@ export async function initializeWithOnboarding(
-  if (rules &amp;&amp; rules.length &gt; 0 &amp;&amp; !result.wasOnboarded) {
-    result.config = await injectRulesIntoConfig(result.config, rules);
+    // when running normal flow, initialize (remote) config asynchronously
+    void (async () =&gt; {
+      const onboardingResult = await runNormalFlow(
+        authConfig,
</file context>

✅ Addressed in 452da6e

Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uinstinct cubic comment seems right

Do we actually need the rules injected in config for onboarding? Could we just not load config/only load model or similar?

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Oct 8, 2025
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Oct 9, 2025
@uinstinct uinstinct requested a review from RomneyDa October 9, 2025 06:16
@uinstinct
Copy link
Contributor Author

@uinstinct cubic comment seems right

Do we actually need the rules injected in config for onboarding? Could we just not load config/only load model or similar?

Right.
I dove a little deeper and rules injection is unnecessary because we are injecting the rules in the SystemMessageService. Also running the normalFlow is unnecessary because all parts of it are done in ConfigService, MCPService and AuthService in service initialization.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 9, 2025
@RomneyDa RomneyDa merged commit 8dacb32 into continuedev:main Oct 9, 2025
54 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Oct 9, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2025
@uinstinct uinstinct deleted the cli-long-start branch October 10, 2025 03:05
@sestinj
Copy link
Contributor

sestinj commented Oct 12, 2025

🎉 This PR is included in version 1.24.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

lgtm This PR has been approved by a maintainer released size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants