- Format types.go (struct field alignment was off by one space)
- parseRetryAfter: use http.ParseTime for HTTP-date form (RFC 1123 /
RFC 850 / ANSI C) instead of time.Parse(time.RFC1123) — the latter
requires an exact timezone abbreviation while http.ParseTime accepts
the canonical GMT form mandated by RFC 9110 §10.2.3
- Add MaxRetryAfterDelay (300s) cap on server-provided Retry-After
delays; log a warning to stderr and clamp when the hint exceeds the cap
- Wire linear.rate_limit_floor / LINEAR_RATE_LIMIT_FLOOR through both
Tracker.Init() and getLinearClient() so the config key is functional
via `bd config set linear.rate_limit_floor <n>` and the env var
- ErrRateLimitExhausted now implements RateLimitExhausted() bool;
engine.go uses an interface check (no import cycle) to abort the
push loop immediately on quota exhaustion instead of cascading the
error across every remaining issue
- Tests: extend TestParseRetryAfter with HTTP-date future/past cases;
add TestExecute_RetryAfterCapApplied to confirm the cap path is taken
Fix-merged for release prep: preserved the contributor rate-limit handling and added the maintainer fix to avoid sleeping after the final retry attempt. Auto-merge after CI.
Adds engine-level IssueIDs filter to SyncOptions, enabling selective sync for both push and pull paths.
Co-authored-by: Harry <harry_miller@trimble.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
openStoreForRig was removed by upstream refactor (d7629204). Remove
the --rig flag and rig routing from runReadyExplain. Also remove
unused 'now' variable in engine.go introduced during conflict
resolution.
- Collect warnings in Engine.warnings during Sync() and populate
result.Warnings (field existed but was never used)
- Fix createDependencies: return error count, stop silently discarding
GetIssueByExternalRef errors (previously used _ discard)
- Fix external_ref update failure: now increments stats.Errors when
the local link-back fails after creating an external issue
- Add Errors field to PullStats and propagate to SyncResult
- Dependency creation failures now counted as Skipped in pull stats
Fixes: bd-5cx
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add ui.SanitizeForTerminal() to strip ANSI escape sequences, OSC sequences,
and C0/C1 control characters from external content before terminal display.
Preserves printable UTF-8, newlines, and tabs.
- Apply sanitization in tracker engine dry-run output (3 call sites)
- Add MaxResponseSize (50MB) and io.LimitReader to Linear client to prevent
OOM from malformed API responses (was the only tracker without this guard)
- Add comprehensive test suite for sanitization (17 test cases including
ANSI injection, screen clearing, OSC title change, control characters)
Fixes: bd-u9u
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds internal/notion/ package with direct REST API client, field mapping,
and tracker adapter. Adds bd notion init/connect/status/sync commands.
Enhances tracker engine: conflict detection before pull, label sync,
no-op skip, batch push interface, RFC3339Nano timestamps. Removed dead
matchesFetchOptions function, added gosec nolint for Notion API client.
Co-Authored-By: Osamu Okano <okano.osamu@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(linear): add --parent flag to limit sync push to a ticket tree
Adds --parent=TICKET to bd linear sync --push, restricting the push
to the named beads ticket and all its transitive descendants via
parent-child dependencies.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test(tracker): add tests for ParentID push filter
Six cases: basic parent+children, deep transitive descendants,
leaf with no children, non-parent-child edges not followed,
empty ParentID pushes all, dry-run with parent filter.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(otel): comprehensive OpenTelemetry instrumentation
Phase 1 (telemetry foundation + SQL + CLI + AI):
- Add internal/telemetry package: Init/Shutdown, Tracer/Meter helpers,
stdout + OTLP/gRPC exporters, noop providers when disabled
- Add internal/telemetry/storage.go: InstrumentedStorage decorator for
SDK consumers with bd.storage.* counters and duration histograms
- Instrument DoltStore SQL layer (execContext, queryContext, queryRowContext)
with dolt.exec / dolt.query / dolt.query_row spans
- Instrument Anthropic API calls in compact/haiku.go and find_duplicates.go
with bd.ai.input_tokens, bd.ai.output_tokens, bd.ai.request.duration
- Add bd.command.<name> span in PersistentPreRun/PostRun with actor attribute
Phase 2 (VC ops, hooks, sync, metrics):
- Add dolt.commit / dolt.push / dolt.force_push / dolt.pull / dolt.branch /
dolt.checkout / dolt.merge spans for Dolt version-control procedures
(these bypass execContext so needed dedicated spans)
- Add bd.db.retry_count counter in withRetry (server mode retries)
- Add bd.db.lock_wait_ms histogram in AcquireAccessLock (flock contention)
- Add ephemeral.count / ephemeral.nuke spans for SQLite ephemeral store
- Add hook.exec spans in hooks_unix/windows runHook (background root spans)
- Add tracker.sync / tracker.pull / tracker.push / tracker.detect_conflicts
spans with per-phase stats attributes in tracker/engine.go
- Add bd.issue.count gauge (by status) in InstrumentedStorage.GetStatistics
- Fix: call initAIMetrics via sync.Once in newHaikuClient so ai metrics
are actually registered
Configuration:
BD_OTEL_ENABLED=true enable (default: off, zero overhead)
BD_OTEL_STDOUT=true write to stdout for dev/debug
OTEL_EXPORTER_OTLP_ENDPOINT=... ship to Jaeger/Grafana/Honeycomb/etc.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor(otel): align with VictoriaMetrics HTTP stack
- Switch metric exporter: gRPC → HTTP (otlpmetrichttp)
- Activation: BD_OTEL_METRICS_URL presence (no more BD_OTEL_ENABLED flag)
matches GT_OTEL_METRICS_URL convention from the local observability stack
- BD_OTEL_METRICS_URL=http://localhost:8428/opentelemetry/api/v1/push
- BD_OTEL_LOGS_URL=http://localhost:9428/insert/opentelemetry/v1/logs (reserved)
- Traces: stdout only (BD_OTEL_STDOUT=true); noop otherwise since VictoriaMetrics
is a metrics-only backend — no trace overhead in production
- Remove: otlptracegrpc, otlpmetricgrpc
- Update docs/OBSERVABILITY.md to match the diffusiontown README style
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(otel): capture hook stdout/stderr and bd.args in spans
- hook.exec span now records stdout and stderr as span events after
the hook process exits (including partial output on timeout)
- Output is truncated to 1024 bytes; the event carries both the text
(output) and the original size (bytes) as attributes
- bd.command.<name> span now includes bd.args with the raw CLI
arguments (e.g. "create 'title' -p 2")
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(otel): address review feedback — stale comment, span leak, hot-path alloc
1. Fix stale BD_OTEL_ENABLED comment in main.go (actual env vars are
BD_OTEL_METRICS_URL and BD_OTEL_STDOUT)
2. Use defer+named returns in Merge() to prevent span leaks
3. Cache doltSpanAttrs() via sync.Once to avoid per-call allocation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: beads/crew/emma <steve.yegge@gmail.com>
Strip out the multi-backend storage layer: factory pattern, memory/in-memory
provider, connection string parsing, local provider, and associated tests.
Inline Dolt as the sole storage backend. Part of Dolt-Native Beads v2 epic.
WIP - SQLite removal in progress, more cleanup phases to follow.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Self-review found two issues:
1. FormatDescription was declared in PushHooks but never called in doPush.
Now applied to a shallow copy before CreateIssue/UpdateIssue to avoid
mutating local data.
2. GenerateID hook had no test coverage. Added tests for both success and
error (collision) cases, plus FormatDescription test that verifies
local issue is not mutated.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Phase 3 of tracker refactor (dolt-y60t.3). Adds optional hook callbacks
to the Engine so tracker adapters can opt into proven CLI patterns:
PullHooks: ShouldImport (filter before conversion), TransformIssue
(description formatting/normalization), GenerateID (hash-based IDs).
PushHooks: ShouldPush (custom filtering), ContentEqual (content-hash
dedup to skip unnecessary API calls), FormatDescription (tracker-specific
rendering), BuildStateCache/ResolveState (batch workflow state resolution).
Also adds ExcludeEphemeral to SyncOptions for wisp filtering on push.
Dropped from original plan: tombstone filtering (Dolt handles natively),
UseImporter delegation (importer package tied to dying JSONL/SQLite infra).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew