Skip to content

fix(ci): fetch main's head objects before config sync in 'ci pr --keep-lane'#10460

Merged
davidfirst merged 7 commits into
masterfrom
fix-ci-pr-keep-lane-config-sync-fetch
Jun 29, 2026
Merged

fix(ci): fetch main's head objects before config sync in 'ci pr --keep-lane'#10460
davidfirst merged 7 commits into
masterfrom
fix-ci-pr-keep-lane-config-sync-fetch

Conversation

@davidfirst

Copy link
Copy Markdown
Member

bit ci pr --keep-lane runs syncConfigFromMain, which 3-way-merges aspect config from main onto the lane. For each component it loads main's head Version object (modelComponent.head). The lane import only fetches lane-head objects plus the lightweight version-history (parent graph) — enough for the diverge check to see main is ahead, but NOT the full Version object for main's head where main advanced past the lane's fork point.

So loadVersion(mainHead) throws VersionNotFoundOnFS, the per-component catch swallows it as skipping config sync from main (… was not found on the filesystem), and the config sync silently no-ops for those components.

Fix: pre-fetch main's head objects in one batched call via importObjectsFromMainIfExist before the merge loop — the same pre-merge pattern used by merge-status-provider / merge-lanes. Passes the specific main-head version so cache: true still fetches it, and is best-effort so a fetch hiccup doesn't abort ci pr.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

fix(ci): prefetch main head objects before config sync in ci pr --keep-lane
🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

Description

• Prefetch main-head Version objects so config sync from main doesn’t silently no-op on diverged
 lanes.
• Keep bit ci pr --keep-lane best-effort when remote object fetch fails.
• Improve e2e file-read limit failures by showing only newly-loaded files and refresh snapshot.
Diagram

graph TD
  A["bit ci pr --keep-lane"] --> B["CiMain.syncConfigFromMain"] --> C["Compute main-head IDs"] --> D["importer.importObjectsFromMainIfExist"] --> E{{"Fetch ok?"}}
  E -- "yes" --> F["Per-component 3-way merge"] --> G[("Local scope objects")]
  E -- "no (warn)" --> F
  D --> H{{"Remote main scope"}}

  subgraph Legend
    direction LR
    _cmd["CLI command"] ~~~ _svc["Service/logic"] ~~~ _db[("Object store")] ~~~ _ext{{"Remote"}} ~~~ _dec{{"Decision"}}
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Fetch main-head objects on-demand inside the merge loop
  • ➕ Simpler upfront logic; only fetches for components that actually need it
  • ➕ Errors naturally scoped to a single component
  • ➖ Multiple remote round-trips (N components) and worse performance
  • ➖ Harder to preserve cache: true semantics consistently
  • ➖ More log noise and less predictable behavior under partial failures
2. Import full main lane state (not just specific head Versions)
  • ➕ Eliminates many missing-object cases beyond just head Versions
  • ➕ May simplify future merge/sync logic that assumes main completeness
  • ➖ Potentially large download and slower ci pr runs
  • ➖ Higher risk of unintended side effects in --keep-lane workflows
3. Change lane switch/import to always include main-head Version objects
  • ➕ Moves correctness to a lower-level invariant (main heads always present)
  • ➕ Avoids special-casing in config sync logic
  • ➖ Broader behavioral change affecting other flows
  • ➖ Harder to justify/validate performance impact across commands

Recommendation: Keep the PR’s batched prefetch approach. It mirrors existing merge flows, minimizes network chatter versus per-component fetch, and preserves best-effort behavior for bit ci pr while fixing the silent config-sync no-op on diverged components.

Files changed (3) +272 / -196

Bug fix (1) +34 / -1
ci.main.runtime.tsPrefetch main-head Version objects before syncing config from main +34/-1

Prefetch main-head Version objects before syncing config from main

• Before running the per-component config merge, computes component IDs pinned to main-head versions and batch-fetches their objects from main via 'importObjectsFromMainIfExist'. Fetch is best-effort (warn and continue) to avoid aborting 'bit ci pr --keep-lane' while preventing silent config-sync no-ops for diverged components.

scopes/git/ci/ci.main.runtime.ts

Tests (2) +238 / -195
files-snapshot.txtRefresh bootstrap loaded-files snapshot for file-read performance test +197/-170

Refresh bootstrap loaded-files snapshot for file-read performance test

• Updates the expected list of files read during bootstrap to match current dependency/output shape. Keeps the filesystem-read e2e test aligned with CI’s latest installation footprint.

e2e/performance/files-snapshot.txt

filesystem-read.e2e.tsMake file-read limit failures show newly-loaded files instead of full output +41/-25

Make file-read limit failures show newly-loaded files instead of full output

• Replaces noisy console dumps with a concise error message when file-read thresholds are exceeded. Adds a helper to compute the diff vs the stored snapshot and improves assertions to ensure debug output is present.

e2e/performance/filesystem-read.e2e.ts

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 27, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Promise.all aborts config sync ✓ Resolved 🐞 Bug ☼ Reliability
Description
syncConfigFromMain() now resolves model components via Promise.all before the per-component
try/catch; if any getModelComponentIfExist() call rejects, the entire config-sync throws and aborts
instead of skipping just that component. This changes failure semantics in CI from
best-effort-per-component to fail-the-whole-sync.
Code

scopes/git/ci/ci.main.runtime.ts[R390-398]

+    const componentsToSync = compact(
+      await Promise.all(
+        currentLane.components.map(async (laneComp) => {
+          const modelComponent = await legacyScope.getModelComponentIfExist(laneComp.id);
+          const mainHead = modelComponent?.head; // the component's head on main
+          if (!modelComponent || !mainHead || mainHead.isEqual(laneComp.head)) return undefined;
+          return { laneComp, modelComponent, mainHead };
+        })
+      )
Evidence
The new pre-pass runs getModelComponentIfExist() in a Promise.all outside the merge loop’s
try/catch, so a single rejection prevents any later per-component handling.
getModelComponentIfExist() delegates to sources.get(), which performs object loads that can
throw/reject, meaning this is a realistic failure mode.

scopes/git/ci/ci.main.runtime.ts[387-492]
components/legacy/scope/scope.ts[421-423]
components/legacy/scope/repositories/sources.ts[112-178]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`syncConfigFromMain()` builds `componentsToSync` using `await Promise.all(currentLane.components.map(...))` outside the existing per-component `try/catch`. If any `legacyScope.getModelComponentIfExist()` call rejects (I/O error, corrupted object, etc.), `Promise.all` rejects and the function aborts before reaching the merge loop’s error handling.
### Issue Context
The merge loop is explicitly documented as “best-effort per component” (it logs and continues). The new pre-pass should preserve that behavior.
### Fix Focus Areas
- scopes/git/ci/ci.main.runtime.ts[387-399]
### Suggested fix
Wrap each `getModelComponentIfExist` call in a per-item `try/catch` (return `undefined` on failure, optionally log), **or** replace `Promise.all` with `Promise.allSettled` and filter only fulfilled results.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Hardcoded chalk.yellow in syncConfigFromMain() 📘 Rule violation ⚙ Maintainability
Description
New CLI output in syncConfigFromMain() uses a hardcoded chalk.yellow(...) style instead of the
shared @teambit/cli output formatting toolkit. This can lead to inconsistent CLI formatting and
violates the repository CLI output style guide expectations.
Code

scopes/git/ci/ci.main.runtime.ts[R414-416]

+        this.logger.console(
+          chalk.yellow(`Could not pre-fetch main's objects for config sync (continuing): ${e?.message || e}`)
+        );
Evidence
PR Compliance ID 1 requires CLI output formatting to use the shared toolkit from @teambit/cli and
avoid hardcoded chalk styles. The added code prints a new warning line using chalk.yellow(...),
which is direct chalk styling rather than @teambit/cli's shared formatter functions.

CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles): CLAUDE.md: CLI Output Must Use Shared Output Formatting Toolkit (No Hardcoded Chalk Styles)
scopes/git/ci/ci.main.runtime.ts[414-416]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new warning message printed during `syncConfigFromMain()` uses `chalk.yellow(...)` directly. Per the CLI output style guide, CLI output should use the shared formatting toolkit from `@teambit/cli` (e.g. `formatWarningSummary`, `warnSymbol`, `formatTitle`, etc.) rather than hardcoded chalk styling.
## Issue Context
This message is part of `bit ci pr` output (`this.logger.console(...)`). The code currently prints:
- `chalk.yellow(...)` with a custom string
## Fix Focus Areas
- scopes/git/ci/ci.main.runtime.ts[414-416]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Status guard can no-op 🐞 Bug ☼ Reliability
Description
The bit status filesystem-read test does not assert that BIT_DEBUG_READ_FILE emitted any #
lines, so getNumberOfReads() can return 0 and the threshold check will pass even when the debug
mechanism is broken, disabling the regression guard.
Code

e2e/performance/filesystem-read.e2e.ts[R74-77]

+        const numberOfReads = getNumberOfReads(output);
+        if (numberOfReads >= MAX_FILES_READ_STATUS) {
+          throw new Error(buildExceededError('bit status', numberOfReads, MAX_FILES_READ_STATUS));
+        }
Evidence
getNumberOfReads() returns 0 when no # line exists; the bit status test only checks the upper
bound so 0 will pass. The bit --help test explicitly asserts numberOfReads > 0, highlighting the
inconsistency.

e2e/performance/filesystem-read.e2e.ts[70-78]
e2e/performance/filesystem-read.e2e.ts[39-53]
e2e/performance/filesystem-read.e2e.ts[99-116]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The `bit status` read-count test can silently pass when `BIT_DEBUG_READ_FILE` output is missing because it only checks `numberOfReads >= MAX_FILES_READ_STATUS`, and `getNumberOfReads()` returns 0 when no `#<num>` lines exist.
### Issue Context
`bit --help` already asserts `numberOfReads > 0`, but `bit status` does not.
### Fix Focus Areas
- e2e/performance/filesystem-read.e2e.ts[70-78]
### Suggested change
After computing `numberOfReads` for `bit status`, add an assertion similar to the `bit --help` case, e.g.
- `expect(numberOfReads, 'no "#<num>" read lines found in the output').to.be.greaterThan(0);`
This keeps the regression guard effective if the debug mechanism stops emitting read lines.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

4. Unbounded prefetch fanout 🐞 Bug ➹ Performance
Description
syncConfigFromMain() computes mainHeadIds via Promise.all(currentLane.components.map(...)),
which triggers potentially large parallel model-component loads; on big lanes this can spike I/O/CPU
and slow bit ci pr.
Code

scopes/git/ci/ci.main.runtime.ts[R397-407]

+    const mainHeadIds = compact(
+      await Promise.all(
+        currentLane.components.map(async (laneComp) => {
+          const modelComponent = await legacyScope.getModelComponentIfExist(laneComp.id);
+          const mainHead = modelComponent?.head;
+          return mainHead && !mainHead.isEqual(laneComp.head)
+            ? laneComp.id.changeVersion(mainHead.toString())
+            : undefined;
+        })
+      )
+    );
Evidence
The new code uses Promise.all over currentLane.components. The model lookup path
(getModelComponentIfExist) calls sources.get(), and that repository uses concurrency-limited
mapping for getMany(), indicating bounded concurrency is the intended pattern for large ID sets.

scopes/git/ci/ci.main.runtime.ts[377-407]
components/legacy/scope/scope.ts[421-423]
components/legacy/scope/repositories/sources.ts[77-93]
components/legacy/scope/repositories/sources.ts[112-120]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new prefetch scan uses `Promise.all()` over all lane components, which means fully-parallel execution proportional to lane size. This can create an avoidable burst of object-store reads and CPU work before the merge loop.
### Issue Context
The underlying model lookup (`legacyScope.getModelComponentIfExist`) delegates to `SourceRepository.get()`, which performs object loading/population work; elsewhere in the codebase, bulk operations use concurrency-limited helpers (e.g. `pMapPool` + `concurrentComponentsLimit()`).
### Fix Focus Areas
- scopes/git/ci/ci.main.runtime.ts[387-407]
### Suggested change
Replace the `Promise.all(currentLane.components.map(...))` with a concurrency-limited map (e.g. `pMapPool` + `concurrentComponentsLimit()`), or use an existing bulk API (if available) to fetch model components in a bounded way. Keep behavior identical (best-effort, same filtering) while avoiding unbounded parallelism.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread scopes/git/ci/ci.main.runtime.ts
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit c058756

Comment thread scopes/git/ci/ci.main.runtime.ts
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit e31982b

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit fd873be

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 85d46c6

@davidfirst davidfirst merged commit b05b77d into master Jun 29, 2026
13 checks passed
@davidfirst davidfirst deleted the fix-ci-pr-keep-lane-config-sync-fetch branch June 29, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants