Clone dev packages and check out specific version based on config#2166
Clone dev packages and check out specific version based on config#2166tjcouch-sil wants to merge 4 commits intomainfrom
Conversation
| try { | ||
| execSync('git pull', { stdio: 'inherit', cwd: repoPath }); | ||
| } catch { | ||
| console.log( | ||
| `Could not pull in ${ | ||
| folder | ||
| } — likely a detached HEAD (tag or commit hash). Continuing with checked-out revision.`, | ||
| ); | ||
| } |
There was a problem hiding this comment.
🟡 git pull failures silently swallowed regardless of cause
The catch block on git pull (lines 88-94) catches ALL errors and logs a message assuming the failure is due to a detached HEAD. However, git pull can also fail on a branch due to merge conflicts (e.g., if a developer has unpushed local commits on the tracked branch that diverge from origin) or authentication errors. Since git status --porcelain at dev-package-utils.ts:73 only checks for uncommitted changes and does not detect unpushed commits, this scenario is reachable. When git pull fails silently on a branch, the build proceeds with stale/incompatible code and a misleading log message ("likely a detached HEAD"), making the root cause difficult to diagnose.
Suggested improvement
Distinguish detached HEAD from other failures, e.g. by checking git symbolic-ref HEAD before pulling, or by inspecting the error message in the catch block and only suppressing the specific "not on a branch" error.
Prompt for agents
In .erb/scripts/dev-package-utils.ts, lines 86-94, the catch block around `git pull` silently swallows all errors, assuming they indicate a detached HEAD. Instead, before calling `git pull`, check whether the repo is actually on a branch (e.g., run `git symbolic-ref --quiet HEAD` and check its exit code). If on a branch, do NOT catch `git pull` errors — let them propagate so merge conflicts or other issues are surfaced. Only skip `git pull` (without try/catch) when in detached HEAD state.
Was this helpful? React with 👍 or 👎 to provide feedback.
https://discord.com/channels/892072317436448768/1488009040033349632/1488620297975500830
This change is