Skip to content

fix(git-remote): move --no-recurse-submodules from global to per-command args#985

Open
kyledeanjackson wants to merge 2 commits into
garrytan:masterfrom
kyledeanjackson:lattice-v0.33.2+bh-carries
Open

fix(git-remote): move --no-recurse-submodules from global to per-command args#985
kyledeanjackson wants to merge 2 commits into
garrytan:masterfrom
kyledeanjackson:lattice-v0.33.2+bh-carries

Conversation

@kyledeanjackson
Copy link
Copy Markdown

Problem

GIT_SSRF_FLAGS in src/core/git-remote.ts places --no-recurse-submodules in the global-options slot (before the subcommand). On git ≥2.43 this fails:

$ git -C /path -c http.followRedirects=false -c protocol.file.allow=never -c protocol.ext.allow=never --no-recurse-submodules pull --ff-only
unknown option: --no-recurse-submodules

--no-recurse-submodules is a per-command option for clone / pull / fetch only, not a top-level git flag. Older git versions were more lenient about flag position; modern git (2.43+, default on Ubuntu 24.04 and current macOS) enforces strict placement.

Repro

Reproduces on git 2.43.0 / Ubuntu 24.04 LTS on every gbrain sync operation. The error surfaces as:

[gbrain phase] sync.git_pull error 5ms (git pull failed in /apps/kyle/lattice/bh-brain: Command failed: git -C /apps/kyl)
Warning: git pull failed: git pull failed in /apps/kyle/lattice/bh-brain: Command failed: git -C /apps/kyle/lattice/bh-brain -

Found while upgrading BH-DevServer (Ubuntu 24.04, git 2.43.0) to v0.33.2 — every autopilot cycle's sync phase reported failed git pull on all federated sources. Cycle completed (embed --stale still ran) but staleness detection from upstream commits was bypassed.

Fix

  • Drop --no-recurse-submodules from GIT_SSRF_FLAGS
  • Append it explicitly to clone args (after 'clone')
  • Append it explicitly to pull args (after '--ff-only')

Net result: same submodule-recursion safety guarantee, with correct flag placement that works on git 2.43+.

Testing

Verified locally: sync.git_pull startsync.git_pull done <N>ms (success) across 3 federated sources on dev-server post-fix. Pre-fix all three failed in <10ms with the unknown-option error.

kyledeanjackson and others added 2 commits May 14, 2026 14:48
…and args

Bug: GIT_SSRF_FLAGS placed --no-recurse-submodules in the global-options
slot (before the subcommand). On git ≥2.43 this fails with:

  unknown option: --no-recurse-submodules

git accepts --no-recurse-submodules only as a per-command option for
clone / pull / fetch — not as a top-level git option. The previous
placement happened to work on older git versions that were more lenient
about flag position, but breaks on Ubuntu 24.04's git 2.43.0 (and on
modern macOS git).

Fix:
- Drop --no-recurse-submodules from GIT_SSRF_FLAGS
- Append it explicitly to the clone args after 'clone'
- Append it explicitly to the pull args after '--ff-only'

Net result: same submodule-recursion guarantee, with correct flag
placement that works on git 2.43+.

Discovered while upgrading BH-DevServer to gbrain v0.33.2 — first cycle
of lattice-autopilot post-restart failed sync.git_pull on all three
sources (bh-brain, bh-vault, bh-studio-general) with the unknown-option
error. Pull command exec'd directly via execFileSync confirmed the
placement was the cause.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ink.extra_dirs config

Bug context: the upstream DIR_PATTERN is a hard-coded alternation of
canonical dir names (people, companies, meetings, ...). Sites with custom
slug layouts — numbered dirs like '03-ventures'/'06-people'/'07-decisions',
or shorthand wikilink aliases like 'venture/'/'person/'/'decision/' —
have ZERO of their entries match the whitelist, so 'gbrain extract links
--source db' produces 0 links across N pages and the brain reports brain
score 46/100 with link_density_score 0 / no_orphans_score 0 (every page
orphaned).

This is the symptom BHSOFM-48 captured in our deployment (0 links / 599
pages pre-upgrade, 0 links / 735 pages post-upgrade to v0.33.2 — the
v0.32.8 'multi-source bug class extermination' addressed cross-source
resolution, NOT this regex).

Fix (config-driven, default behavior unchanged):

- Introduce DEFAULT_ENTITY_DIRS as the canonical-dirs export
- Add buildDirPattern(extraDirs) + buildEntityRegexes(extraDirs) factories
  that build the regex bundle from default ∪ extras
- Add getAutoLinkExtraDirs(engine) helper that reads auto_link.extra_dirs
  from engine config — supports JSON array string or comma-separated
- Refactor extractEntityRefs + extractPageLinks to accept optional extras
- Wire callers (extract.ts extractLinksFromDB, operations.ts put_page
  autolink path) to fetch from config + pass through

Backward compat:
- Module-level constants ENTITY_REF_RE / WIKILINK_RE / QUALIFIED_WIKILINK_RE
  retained, built from default dirs only — same behavior as before for any
  direct importer
- extractEntityRefs / extractPageLinks signatures backward-compat (extras
  is optional); callers that don't pass it get default behavior
- Config key not set = default behavior (no regression for non-BH users)

For BH:
  gbrain config set auto_link.extra_dirs '["03-ventures","06-people","07-decisions","08-writing","00-inbox","02-being-human","04-projects","05-research","venture","decision","person","research","writing"]'

Then 'gbrain extract links --source db' should produce >0 links and
link_density_score should improve.

Upstream PR forthcoming to garrytan/gbrain — solves the same class of
problem for any user with custom dir layouts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kyledeanjackson
Copy link
Copy Markdown
Author

Adding a second commit to this branch — ce0b12d feat(link-extraction): make entity-dir whitelist extensible via auto_link.extra_dirs config.

Same scope, different file. Full description in the commit message. Happy to split into two separate PRs if you'd prefer — the changes are independent (different files, different bug class). Let me know.

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.

1 participant