* feat(github): sync epic/child and blocks relationships to GitHub
bd github sync only ever pushed issue content (title/body/labels/state);
Epic-child links and beads "blocks" dependencies never reached GitHub's
relationships panel. Adds a GitHub relationship-sync pass, mirroring the
existing GitLab dependency-link push, using GitHub's sub-issues and issue
dependencies REST APIs:
- internal/github/client.go: AddSubIssue/ListSubIssues and
AddBlockedBy/ListBlockedBy against GitHub's sub_issues and
dependencies/blocked_by endpoints.
- internal/github/links.go: DependencyLink + LinkResolver, converting beads
epic/child parent-child dependencies into GitHub sub-issues and beads
"blocks" dependencies into GitHub blocked_by relationships. Idempotent
(lists current relationships before creating) and additive (stale remote
relationships are left untouched).
- cmd/bd/github.go, cmd/bd/sync_push_pull.go: wires the push pass into both
`bd github sync` and `bd github push`.
Verified against a live GitHub repo (create, list, and idempotent re-push
all confirmed via the real API), in addition to httptest-mocked unit tests.
Fixes gastownhall/beads#5970
* fix(github): update last_sync after relationship push to prevent sync churn
When AddSubIssue or AddBlockedBy is called, GitHub updates the issue's
updated_at timestamp as a side effect. Without updating last_sync after
the relationship push completes, the next sync would see those issues as
'changed' and pull/push them again, causing unnecessary churn.
This fix updates last_sync to the current time after a successful
relationship push (only if links were created), accounting for any
timestamp changes GitHub made during relationship creation.
Fixes continuous sync churn observed when running bd github sync
multiple times with no local changes.
* fix(github): use relationship reader for link sync
* fix(bazel): enumerate links.go and its tests in internal/github BUILD.bazel
The base advance added internal/github/BUILD.bazel with explicitly
enumerated srcs (gazelle-generated). This PR adds links.go,
links_test.go and review_fixes_test.go, which the base-generated
enumeration cannot know about, so //internal/github:github failed to
build:
internal/github/tracker.go:41:35: undefined: LinkResolver
internal/github/tracker.go:244:30: undefined: RefScope
Regenerated with `bazel run //:gazelle` (not hand-edited). Purely
additive; no deps change is needed because links.go only imports
//internal/types, already declared.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(github): scope the relationship pass to --parent and report skipped links
Maintainer review fixup for PR #5971, adopt-pr review iterations 1 and 3.
filterGitHubLinkScopedIssues reimplemented four of the SyncOptions
selectors and dropped ParentID, so `bd github sync --push --parent X`
narrowed the content push to the subtree and then created GitHub
sub-issue and blocked-by links for every GitHub-linked issue in the
workspace -- outward API writes on issues the user had excluded. It now
resolves the subtree and requires membership in it. The traversal moves
from gitlab.go to sync_flags.go as buildSyncDescendantSet, beside the
--parent flag that populates the field, and the GitLab and GitHub link
passes share the one copy. The doc comments that claimed parity with the
engine's push loop now enumerate the selectors this path actually
applies, and name the three it does not (State, ExcludeIDPrefix,
ExcludeIDPatterns -- no GitHub command sets them today).
PushLinkResult.UnsupportedSkipped had no reader anywhere in the repo, so
a host without the sub-issue/dependency APIs reported nothing at all.
pushGitHubDependencyLinks now emits one curated line for it, and a 404
on the source issue is classified apart from a 404 on the relationship
endpoint: collapsing the two reported a deleted, renumbered or
permission-hidden issue as an unsupported host. The classifying probe is
memoized per issue number, so a source carrying both link types costs
one extra read.
`bd github push --dry-run` printed "Synced N relationship links" for
links it had only planned, because PushLinks counts planned links in
Created. The `bd github sync` twin already gated that line on its
dry-run flag; the push side now does too.
Tests: a table test over filterGitHubLinkScopedIssues with a row per
selector -- its three ParentID rows fail without the scope fix -- plus a
direct pin that a blocks-edge dependent is not a descendant, and
httptest cases driving 404 through the list call, the create call and
the source-issue probe.
Not fixed here: the PR body still describes a `lastSync` advance that
commit ee6d65692 removed from this PR. That is a PR-surface edit, not a
code change, and is left to the finalize step.
Also not fixed here, and named in buildSyncDescendantSet's doc comment
so the shared helper does not read as covering every tracker: the ADO
link pass has the same scope hole this commit closes for GitHub.
pushADOLinks takes no sync options, so `bd ado sync --push --parent X`
still writes ADO relations for the whole workspace. That predates this
PR, and ADO is outside its diff.
Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Julian Knutsen <julian@gastownhall.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
* feat(gitlab): sync issue dependency links on push
After issue content syncs, mirror local beads dependency edges as GitLab
issue links: blocks -> GitLab blocks/is_blocked_by (direction-normalized),
related/relates-to -> a single relates_to link per unordered pair (deduped).
Children of synced epics also keep the epic's milestone during a
dependency-only sync. Reports links_pushed in --json.
Additive only (never deletes remote links). License-aware: blocks/
is_blocked_by needs GitLab Premium/Ultimate; on instances without it the
link is reported as a single curated, non-fatal message (links_license_skipped
in JSON) while relates_to and milestones still apply. Genuine (non-license)
link failures remain real warnings, kept distinct from the license case.
Feature: max-efe
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* refactor(gitlab): address review — drop dead RelationMap, add push link parity
Follow-up to maphew's review on #4294.
- Delete the dead GitLab RelationMap: issueLinksToDependencies maps link
types via hardcoded constants and ignores MappingConfig, so the field, its
default, and the test assertion were dead config surface implying a
configurability that does not exist. (Linear's RelationMap is untouched.)
- Give `bd gitlab push` dependency-link + epic-milestone parity with
`bd gitlab sync`: extract the shared pushGitLabDependencyLinks helper from
runGitLabSync's inline block and call it from runGitLabPush, scoped to the
requested IssueIDs. Render push output natively so the link pass runs
before the summary, dry-run ordering is correct, and the --json payload
carries links_pushed / links_license_skipped / milestones_updated, matching
sync in all output modes; also guard OnMessage under !jsonOutput.
Reviewed with /code-review + /codex (dry-run "Synced" line, output ordering,
and --json link-stat omission all caught and fixed here).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(gitlab): check outputJSON error in runGitLabSync (errcheck)
CI lint (first run on this branch, only-new-issues=false) flagged the
unchecked outputJSON return in the sync --json path. Return it, matching
runGitLabPush. Fixes the Lint / Build Artifacts / PR Lint failures.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(gitlab): carry closed state on push; surface failed-close in sync result
GitLab's POST /issues (and milestone/work-item creation) cannot set state,
so closed beads were pushed as opened issues and closed epics as active
milestones — milestone progress read 0/X even when all children were done.
- Close after create on all three paths (CreateIssue, createMilestone,
createTaskWorkItem) via a best-effort follow-up state_event=close.
- BeadsIssueToGitLabFields emits state_event close/reopen so the update path
flips both directions (reopening a bead reopens the GitLab issue). deferred
stays open — only "done" work counts toward milestone completion.
- A failed best-effort close now records a warning on TrackerIssue.Warnings,
which the engine drains into the sync result (visible in --json) instead of
a bare stderr print that left --json reporting errors:0 while the issue was
left open.
On close failure the created issue and its external_ref are still returned so
the next push doesn't create a duplicate (the push skip-guard means it won't
retry the close until the bead is next modified — hence the surfaced warning).
Reviewed via /code-review + Codex.
bd: max-9t6
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ten error messages across github, gitlab, and ado commands recommend
'bd config {key} {value}' but the CLI requires the 'set' verb:
'bd config set {key} {value}'.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds CLI layer for selective sync on top of #2957:
- --issues flag registered on all 6 tracker sync commands via shared helpers
- New push/pull subcommands with --dry-run support
- --parent flag ported from Linear-only to ADO, Jira, GitHub, GitLab
Co-authored-by: Harry <harry_miller@trimble.com>
- Fix pull dedup: check wisps table and match work_items URLs
- Add type-based filtering to GitLab sync CLI
- Default-exclude molecule/message/event types from push
- Fix source_system update that breaks external_ref persistence
- Map all beads statuses to GitLab scoped labels for board columns
- Handle status::review and status::done labels on pull
- Map epic beads to GitLab milestones instead of issues
- Create task beads as GitLab Task work items with parent hierarchy
- Walk parent chain to find epic milestone, use API ID not IID
Co-authored-by: ktoulgaridis <ktoulg@gmail.com>
Executed-By: beads/crew/emma
* feat: add optional group-level GitLab issue sync (be-711)
When gitlab.group_id is configured, FetchIssues and FetchIssuesSince
use the /groups/:id/issues API endpoint to aggregate issues across all
projects in the group. Issue creation still uses the project endpoint
(via gitlab.project_id or gitlab.default_project_id).
New config keys:
- gitlab.group_id / GITLAB_GROUP_ID
- gitlab.default_project_id / GITLAB_DEFAULT_PROJECT_ID
Backward compatible: existing project-level sync is unchanged when
group_id is not set.
* feat: add filtering support to GitLab group sync (be-4js)
Add optional filters for labels, project, milestone, and assignee to
the GitLab issue sync. Filters work on both project and group endpoints.
Filters can be set via config (gitlab.filter_labels, etc.), environment
variables (GITLAB_FILTER_LABELS, etc.), or CLI flags (--label, --project,
--milestone, --assignee). CLI flags override config defaults.
Labels, milestone, and assignee are passed as GitLab API query params.
Project filtering within a group is done client-side since the GitLab
group issues API doesn't support it natively.
Several helper paths (list, completions, github, gitlab, linear) reopen
Dolt with only a raw path when the global store is nil. This loses
repo-local metadata like custom dolt_database names and server ports,
falling back to the wrong database or port.
Add a shared openReadOnlyStoreForDBPath() helper that maps dbPath back
to its owning .beads dir and reopens with full metadata. Also fix port
resolution in applyConfigDefaults to use BeadsDir (the .beads/ config
directory) instead of Path (the dolt data directory).
Fixes#2627
Co-Authored-By: Gary <gary@algorune.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
In shared-server mode, the DB issue_prefix belongs to whichever project
initialized first. This caused all projects sharing a server to use the
wrong prefix for issue creation, ID generation, and imports.
Fix: YAML config.yaml issue-prefix now takes precedence over the DB value
in create.go, github.go, gitlab.go, linear.go, orphans.go, and merge_slot.go
(which already had the correct pattern).
Also: EnsureRunning() now calls KillStaleServers() before starting a new
server, cleaning up orphaned dolt sql-server processes that accumulate when
parent processes crash without graceful shutdown (GH#2372).
Also: add cross-project data isolation tests (5 tests covering read isolation,
port collision, same-prefix isolation, concurrent writes, and concurrent
read-write mix). Based on tests by @PabloLION (PR #2472).
Co-Authored-By: PabloLION <dev@pablolion.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove Config.ServerMode and Config.OpenTimeout fields (dead since embedded removal)
- Rewrite doctor/dolt.go to use MySQL protocol instead of embedded dolthub/driver
- Rename openDoltDBWithLock to openDoltConn, remove closeDoltDB helpers
- Delete dolt_nocgo.go stubs (doctor + store_nocgo_test.go)
- Remove cgo build tags from doctor package
- Update lock error messages for server-only world
- Clean up unused lockTimeout parameter threading in list.go
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phase 7 (a5da57e3) deleted internal/storage/factory/ and internal/storage/memory/
but left 30+ files still importing them. This commit fixes all broken references:
- Created internal/storage/dolt/open.go with NewFromConfig/NewFromConfigWithOptions
- Replaced all factory.New/NewFromConfig/NewWithOptions with dolt equivalents
- Broke import cycles in dolt/bootstrap.go (routing/utils/audit → local types)
- Removed dead storage.Config struct
- Converted all test files from memory.New() to dolt.New() test stores
- Removed tests that depended on deleted detectPrefix/LoadFromIssues/mockRemoteStore
46 files changed, 249 insertions(+), 851 deletions(-)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Remove the entire internal/storage/sqlite/ package (~43K lines) and update
all 80+ files that imported it to use either the Dolt backend directly
(test files) or the storage factory (production files).
Key changes:
- Delete internal/storage/sqlite/ directory (150+ files)
- Update factory to make Dolt the sole backend, treating "sqlite" as alias for "dolt"
- Replace sqlite.New() calls with dolt.New() in tests, factory.New() in production
- Replace *sqlite.SQLiteStorage with storage.Storage interface throughout
- Replace :memory: SQLite URIs with t.TempDir() for Dolt compatibility
- Inline sqlite.GenerateIssueID() as SHA-256 content hashing where needed
- Fix import cycle in routing/routes.go (routing→factory→dolt→routing)
- Preserve backward-compatible beads.NewSQLiteStorage() wrapper in public API
228 files changed, 605 insertions, 43,821 deletions.
go vet ./... passes clean.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add wrapper functions (doPullFromGitLab, doPushToGitLab,
detectGitLabConflicts) so integration tests compile
- Change IssueConversion.Issue from interface{} to *types.Issue
(new package, no backwards compat needed); remove GetIssue() helper
- Replace raw http.Client in runGitLabProjects with gitlab.Client
method (ListProjects), getting retry/auth logic for free
- Add HTTPS validation on GitLab URL to prevent sending tokens
in cleartext (allows localhost for dev/testing)
- Add io.LimitReader (50MB) to client.go doRequest to prevent OOM
- Improve token masking: show only first 4 chars, not first+last 4
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Changes based on PR #1290 code review:
1. Wire up SyncContext in runGitLabSync - SyncContext was created
but not actually used in the main entry point
2. Delete legacy non-WithContext functions - removes code duplication
and eliminates dead code maintenance burden. All sync operations
now use WithContext variants exclusively
3. Fix --prefer-local behavior - conflicting issues now go to
forceUpdateIDs (to force push) instead of skipUpdateIDs. This
ensures local changes actually win when that strategy is selected
4. Document conflict detection 1-second tolerance - explains the
timestamp comparison window and its limitations for clock skew
5. Document UUID alternative for ID generation - notes that
distributed deployments may need UUIDs instead of the current
timestamp+counter+random approach
Test updates:
- All tests now use WithContext functions
- Removed global store manipulation from tests
- All 18 GitLab tests pass
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Add --prefer-local, --prefer-gitlab, and --prefer-newer flags to bd gitlab sync:
- --prefer-local: Always keep local beads version on conflict
- --prefer-gitlab: Always use GitLab version on conflict
- --prefer-newer: Use most recently updated version (default)
Features:
- Unified resolveGitLabConflicts() function with strategy parameter
- Flag validation (only one conflict strategy allowed)
- Automatic conflict detection and resolution in bidirectional sync
- 7 new tests for conflict resolution
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Added gitlab_sync.go with full sync implementation:
- doPullFromGitLab: imports GitLab issues to beads with incremental sync
- doPushToGitLab: creates/updates GitLab issues from local beads issues
- detectGitLabConflicts: finds issues modified on both sides since last sync
- resolveGitLabConflictsByTimestamp: resolves conflicts using newer-wins
- parseGitLabSourceSystem: parses "gitlab:projectID:iid" format
Updated gitlab.go:
- runGitLabSync now uses sync functions with --pull-only/--push-only flags
- Added proper error handling and progress output
8 new tests in gitlab_sync_test.go, all passing.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew