Second adversarial review of the replica-aware lease work, against the opt-in
rewrite. One blocker, in the operating instruction rather than the code.
node_id was documented as "BEADS_NODE_ID, or node_id in config.yaml", and
`bd config set node_id` wrote the PROJECT .beads/config.yaml — a git-TRACKED
file (nothing in .beads/.gitignore excludes it). Commit "node_id: mini" and
every clone that pulls reads "mini", so every granted_node comparison matches
and the guard is at once fully ARMED and fully INERT: laptop reaps mini's
leases exactly as if they were local. That is the precise hazard the feature
exists to close, now happening while the operator believes they are protected
— strictly worse than the pre-feature state, where nobody thought they were.
node_id is per-machine state, the class .beads/.gitignore already excludes as
sync-state.json / push-state.json / redirect. It now routes to the user-global
~/.config/bd/config.yaml through a new exact-key arm of IsUserGlobalKey (the
prefix list only ever held "metrics."); viper already merges that file, so
config.NodeID() reads it straight back.
The docs also said to set it "on every replica sharing the queue", which on a
shared or remote dolt sql-server means every HOST — rebuilding the same
fail-closed regression this commit's parent removed the hostname fallback to
avoid. The load-bearing rule was never stated: node_id names the STORE, not
the host. Clients of one sql-server are ONE replica and must share a value or
leave it unset. Now said outright in federation.md and `bd reclaim --help`.
Also from the review:
- bd show claimed "reclaim will decline it" for any foreign node, but with an
unnamed local node the guard is disarmed and reclaim reverts the lease
happily. The annotation is now gated on config.NodeID() != "".
- TestNodeIDContextOverride's empty-override assertion had gone tautological
when the hostname fallback went away: config.NodeID() is "" under test, so
it passed whether or not WithNodeID worked at all. It now sets a non-empty
fallback, asserts the fallback is what a no-override read returns, and only
then asserts the empty override still beats it.
- The heartbeat backfill's bare `granted_node = ''` is COALESCE'd, matching
the reclaim predicates; under NULL the IF took the else branch and the row
was never backfilled. Unreachable today (0016 is NOT NULL DEFAULT ''), but
the two sites disagreed about whether NULL was possible.
- The --any-replica audit line is skipped when localNode is "" rather than
printing `not this node ("")`: nothing was overridden, the guard was never
armed.
- reclaimReplicaSQL documents WHY granted_node stays unqualified — the DELETE
splices it into a bare `DELETE FROM leases` with no alias to qualify with —
and what to do if issues ever grows a column of that name.
- CHANGELOG entry, which this feature owed: a new flag, a new config key, two
env vars, and two public struct fields shipped without one.
Adversarial review of the landed replica-aware lease work (966ddac5a) found
that deriving the granting replica from os.Hostname() answers the wrong
question: the hostname names the CLIENT PROCESS's machine, not the store.
That is a fail-CLOSED regression in three topologies with no federation to
defend against. With a shared or remote dolt sql-server (BEADS_DOLT_SERVER_HOST,
ServerModeExternal, Hosted Dolt, a VPS) many hosts are clients of ONE store, so
a supervisor would match no worker's lease and reclaim 0 forever. In a container
the hostname is a per-run container ID, so a replaced worker's successor sees
its own single-machine leases as foreign. On macOS/DHCP the transient hostname
follows the network. Stranding a lease on a single-store deployment is a worse
failure than the cross-replica reclaim the guard exists to prevent.
So the guard is now OPT-IN: config.NodeID() reads BEADS_NODE_ID / BD_NODE_ID /
node_id in config.yaml and nowhere else, and "" (the default) disarms the guard
back to exactly the pre-feature behavior. This also settles the heartbeat
backfill hazard — on an unnamed deployment the backfill writes '' over '' and
cannot silently convert a fail-open row into a fail-closed one.
Also from the review:
- node_id joins recognizedConfigKeys and YamlOnlyKeys, so the documented
`node_id: mini` mitigation no longer warns and no longer writes to the Dolt
config table that NodeID() never reads (the GH#536 class YamlOnlyKeys exists
to prevent).
- reclaimReplicaSQL/warnReplica/reportForeignSkips move above the
ReclaimExpiredLeasesInTx doc block, which they had orphaned onto a private
helper.
- The --any-replica audit line moves past both re-checks, so it can no longer
log a revert that a post-snapshot heartbeat prevented.
- lease_granted_node joins ephemeralExportKeys in the conformance round trip.
- New cmd/bd/protocol coverage for the JSONL path (RestoreLeaseOnImportInTx),
the sole reason the field is on the wire: a lease claimed under
BEADS_NODE_ID=mini keeps mini after import on laptop, laptop's reaper
declines it, and --any-replica reverts that same row.
- The embeddeddolt test stops claiming its surviving-lease assertion exercises
the DELETE-side guard; inside one transaction that copy is defense in depth.
- A stray U+201D and an inconsistent COALESCE in reportForeignSkips.
A claim lease is only meaningful on the replica that granted it. Every other
replica's view of the holder's liveness is stale by up to one sync interval,
so a reaper over there can revert a unit that is very much alive here. Until
now the only defense was operator discipline: partition every supervisor's
reclaim by label and hope nobody runs an unscoped sweep.
Leases now record WHICH replica granted them (leases.granted_node, ignored
migration 0016, stamped from config.NodeID(): BEADS_NODE_ID / node_id config,
falling back to the hostname). bd reclaim skips a lease that positively names
another replica — on both the snapshot SELECT and the per-row DELETE
re-check — and names each skip on stderr, since silence there is
indistinguishable from "nothing to recover" while a genuinely dead remote
worker's unit sits in_progress forever. bd reclaim --any-replica is the
operator escape hatch for a replica that is gone for good.
The guard is deliberately fail-open on unknown provenance: granted_node ''
(a row predating the column, or a deployment whose NodeID is empty) is
treated as local, so the upgrade itself can never strand a stale lease the
reaper could previously recover. A heartbeat backfills an unknown row with
the local node and never overwrites a known one.
The one path that can materialize a FOREIGN lease row locally is
RestoreLeaseOnImportInTx — lease fields round-trip the JSONL interchange — so
the granting replica rides types.Issue.LeaseGrantedNode and a restored lease
keeps the replica the snapshot names, never this node. A snapshot from an
older binary carries none, restores as unknown, and behaves exactly as before.
What the guard cannot enforce is documented instead, in both bd reclaim --help
and docs/multi-agent/federation.md: grace window > sync interval, and lease
TTL > sync interval. A TTL shorter than the cadence at which replicas exchange
state is meaningless across the bridge — the remote view is a full interval
old by construction.
doc/beads-upstream-asks.md section 5.
Field incident from the first production run of this runbook (wy-7lmdp,
2026-07-18): all local writers were fenced, but a peer machine's scheduled
bridge-sync job was never stopped. One tick after the clean force-push it
pulled the new baseline, cross-merged it into its old chain, and pushed the
entire old history back to the freshly replaced remote.
Step 1 now tells the operator that writers include scheduled sync jobs on
every machine that syncs the database, to enumerate and verify them by
name, and why one live peer undoes the procedure. Step 5 orders re-enabling
per machine after its re-clone; the top warning says 'on every machine'.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The runbook (#4864) and the release-pinned CLI reference (#4876) crossed
mid-flight: the prevention section links /cli-reference/heartbeat, a page
the pin removed because bd heartbeat is not in v1.1.0. The dangling link
fails the docsync guard on main and on every branch cut from it. Keep the
prose, drop the link.
The v1.1.0 release notes tell the designated migrator to run
BD_ALLOW_REMOTE_MIGRATE=1 bd migrate, but the docs never named the
variable after the escape-hatch scrub. One mention belongs in the upgrade
guide, where a blocked or CI-scripting reader actually looks; the wording
is derived from the v1.1.0 source (remote_migrate_gate.go): boolean values
accepted, consulted only when the gate would fire, and it bypasses the
gate entirely — including the already-forked lanes — so the sentence says
to wire it into exactly one clone's upgrade job.
Old clones share the root by construction (Step 2 keeps it as sole
ancestor), so a pull is not refused — it cross-merges and, if pushed,
resurrects the bloat on the squashed remote. Wording per lion's re-review.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A Dolt remote accumulates chunks monotonically, so Step 4's force-push
re-points refs without freeing the old chain's storage. Warn and give the
replace-the-remote recipe; clones must re-clone after a squash anyway.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The per-section forwarding map mirrored the live playbook's structure — a
copy that would drift as docs/recovery/ evolves. A stub carries nothing to
maintain: one pointer to the live playbooks plus the reason the file
exists. Deep anchors from the wild land at the top of the page, where the
pointer is the first thing a reader sees.
Released v1.1.0 binaries print
github.com/gastownhall/beads/blob/main/docs/RECOVERY.md#pk-fork-refused in
the Dolt merge-refusal guidance (printAncestorPKMismatchGuidance,
cmd/bd/dolt.go at the tag), and github.com blob paths cannot be redirected —
the URL has 404ed since the docs restructure, at exactly the moment a user
is mid-incident. main's binary already prints the new path; this stub
un-rots the link for binaries already in the wild.
The stub reproduces the old file's section headings verbatim so GitHub
mints the same anchor slugs, and each section forwards to its successor in
docs/recovery/init-safety.md (all four sections map there 1:1). It is
registered in test/docsync's docsPublishExemptions as a deliberate,
documented exception to the no-pointer-stubs rule (decision 6), scoped to
last only while supported releases print the path.
* docs(pipeline): pin the generated CLI docs to the released bd; repair main's CLI reference
The #4874 squash-merge raced the docs-autofix bot: the bot had pushed a
regeneration from main's source onto the PR branch, so the squash landed a
contradictory mix — the release-aligned hand-written docs plus a CLI
reference re-documenting unreleased commands and flags, with docs.json
referencing four pages (heartbeat, migrate-personal, reclaim, unclaim)
whose files do not exist. That broken nav fails the docsync guard on main
and on every branch cut from it. This restores the intended end state of
#4874 and lands the pin that prevents the race from recurring.
- Regenerate the CLI reference from a bd built from the v1.1.0 tag (CI's
canonical pure-Go build), removing the unreleased commands/flags and
fixing the dangling nav entries.
- docs/cli-docs.pin names the release tag; scripts/resolve-docs-bd.sh
builds and caches a canonical pure-Go bd from that tag, fetching the tag
first in shallow CI checkouts.
- generate-cli-docs.sh, check-doc-flags.sh, and check-cli-docs-drift.sh
resolve bd through the pin and ignore a supplied binary while pinned
(BD_DOCS_IGNORE_PIN=1 bypasses), so the drift gates and the autofix bot
now enforce docs-match-release instead of docs-match-main.
- tools/docsmint detects the pre-overhaul Docusaurus staging layout that
bd <= v1.1.0 emits and converts it to the generic form before its normal
Mintlify transform (tested); removable once the pin reaches a release
whose emitter writes build/cli-docs.
- check-doc-flags.sh: run without timeout(1) on macOS instead of failing
Check 4.
- Decision record: engdocs/decisions/2026-07-17-docs-release-pin.md; the
beads-docs skill §8 updated to match.
* lint: annotate gosec G705 false positive in the docsmint legacy bridge
Same class as the existing nav-splice annotation: a developer tool writing
repo Markdown, not a web-output sink.
* docs: align user docs and CLI reference with the v1.1.0 release
The Mintlify site publishes from main, so the docs had drifted ahead of the
latest release — documenting features that no released binary ships.
- Remove architecture/storage-backends: v1.1.0 supports only Dolt (the
SQLite/Postgres/MySQL backends are post-tag work on main). Redirect the
old routes to /architecture/dolt and drop the alternate-backend claims
from README, core-concepts, architecture index, and FAQ.
- Stamp the docs homepage with the release: "These docs are for the 1.1.0
release" plus a link to the v1.1.0 release notes.
- Regenerate the CLI reference (docs/cli-reference/, docs/CLI_REFERENCE.md,
docs.json nav) from the released v1.1.0 binary via tools/docsmint: removes
pages for post-1.1.0 commands (heartbeat, migrate-personal, reclaim,
unclaim) and post-1.1.0 flags.
- Fix hand-written pages that referenced post-1.1.0 CLI surface, verified
against the v1.1.0 binary: bd dep relate/unrelate (not top-level
relate/unrelate), bd admin reset (not bd reset), bd hooks list (not
status), bd history / bd vc status (not vc log/diff), release the claim
via bd assign + bd update (no bd unclaim), drop bd migrate-personal and
bd daemon mentions, and reduce the Cursor integration page to the rules
file that v1.1.0's bd setup cursor actually installs.
- Stop documenting the BD_ALLOW_REMOTE_MIGRATE escape hatch (and the
nonexistent-in-1.1.0 bd migrate --force): the remote-migrate gate prints
its own operator guidance by design; docs now defer to it.
* docs: auto-regenerate CLI reference
Applied from the cli-docs-freshness-patch artifact of https://github.com/gastownhall/beads/actions/runs/29613329749
(generated with CI's canonical pinned build). See
scripts/check-cli-docs-drift.sh for how drift is attributed.
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Addresses lion's review on #4864: remote-tracking refs from past pushes/
fetches keep the pre-squash chain reachable, so Step 3's gc silently
reclaimed nothing on exactly the long-lived synced workspaces this runbook
targets. Step 3 now deletes them (force-push recreates them on the new
chain) and verifies with du -sh. Also: why the root commit stays as the
baseline parent, and Prevention links to the heartbeat/wisps pages.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fenced-window procedure: backup, soft-reset squash to a baseline commit,
drop stale refs, gc --full, force re-publish, re-clone everywhere else.
Motivated by the wyvern deployment's 3.6G of reachable lease-churn
history (wy-7lmdp).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claims/heartbeats no longer mint dolt commits: lease state (holder,
granted_at, lease_expires_at, heartbeat_at) moves off the issues table
into a leases table registered in dolt_ignore. Migration 0055 +
ignored/0012 move live leases over; all full-issue query sites hydrate
via LEFT JOIN; import never clobbers a live local lease.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds the new bd init flags (--proxied-server-external-tls-ca-cert-path,
--proxied-server-external-tls-server-name, --proxied-server-external-tls-skip-verify)
to the generated CLI reference. Also picks up gate help drift already on
this branch.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Review follow-ups on the pool-claim feature:
- The proxied-server (uow) claim path has its own CAS
(issueSQLRepositoryImpl.Claim) and did not get the pool predicate, so
in dolt.mode=proxied-server a pool-assigned issue was still refused as
"already claimed by <pool>". It now resolves claim.pools through the
same issueops.ClaimPoolAliasesInTx and extends its predicate
identically, and ClaimRowResult carries CurrentAssigneeIsPool so the
use-case layer reports a status conflict instead of a held-by-pool
refusal on CAS loss. Covered by three new subtests in the domain/db
suite (pool take + lease, unconfigured alias protected, status
conflict flagged).
- claim.* is now a recognized config namespace: bd config set
claim.pools previously warned "not a recognized config key" on the
feature's own setup command. The embedded pool test now fails on that
warning (the exit code alone missed it), and the recognizer unit test
pins claim.pools.
- bd config --help documents the key (Claim Pools section + example),
including the reclaim caveat: an expired pool take returns to the
unassigned pool, not to the pool alias it was dispatched to. CLI
reference regenerated.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Dispatcher fleets pre-assign issues to a pool pseudo-assignee (e.g.
'fable-crew') and members take items from the pool. --claim refused
those ("already assigned"), forcing a two-step '--assignee <me>
-s in_progress' per issue — reported by the wyvern rig as their
biggest friction, hit on all 10 beads of a review session.
Aliases listed in the claim.pools config (comma-separated) are now
claimable by any actor through the same atomic CAS: the assignee
predicate gains 'OR assignee IN (<pools>)', resolved in-transaction
via GetConfigInTx, so there is no storage-interface change and no new
flag. A pool take stamps the normal lease. Issues assigned to a real
actor — or to an alias not in the config — keep their anti-steal
protection, and the 0-row disambiguation reports a status conflict
for pool-assigned rows instead of a misleading held-by refusal.
Off by default: with no claim.pools configured the predicate and
behavior are byte-identical to before.
New TestEmbeddedClaimPools covers the full dispatcher flow (pool
assign -> claim -> close), a second alias, lease stamping, and both
protection boundaries (real actor, unconfigured alias).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The --claim refusal for an issue assigned to another actor said "Use
bd unclaim <id> to release it before re-claiming". In a multi-agent
fleet that copy taught exactly the wrong move: an agent's silenced
'unclaim; claim' batch loop evicted another agent's live, heartbeated
claim mid-review (wyvern incident wy-yuclk, ask wy-zs5s2).
The ownership check itself (foreign unclaim requires --force) already
landed in #4675; this completes the ask by fixing the guidance around
it:
- The open-but-assigned --claim refusal now says to coordinate with
the holder and notes that releasing another actor's claim requires
bd unclaim --force.
- Unclaim's ErrNotOwner rejection frames --force as an abandoned-claim
escape hatch (crashed agent, expired lease), not a routine override.
- bd unclaim's help documents the ownership rule and points at lease
expiry for genuinely abandoned work.
Tests pin the new coordinate-with-holder copy and assert the old
release-before-reclaiming suggestion stays gone. CLI reference
regenerated; picks up the same pre-existing auto-backup help drift
hunk as #4839 (identical content, merges cleanly either order).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Document the rollback of direct PostgreSQL and MySQL adapters because supporting additional general-purpose server databases adds operational and maintenance complexity. Our goal is to keep Beads as simple as possible and consume as few resources as possible.
Clarify that embedded Dolt, Dolt server, and SQLite remain supported, including Dolt server use of the MySQL wire protocol.
Existing PostgreSQL and MySQL databases are not opened or modified. Migration requires an export from a supporting build, reinitialization guided by bd help init-safety, and import; JSONL remains issue-level interchange rather than a complete backup.
Refresh generated CLI reference material alongside the storage guidance.
Agent-Signature: codex-gpt-5-unknown-reasoning on behalf of Test User
* feat(graph): add --open flag for LLM-friendly compact layer output (GH#3544)
Add --open flag to `bd graph` that filters out closed/deferred issues and
renders only actionable items in compact layer format.
Key behaviors:
- Filters to open/in_progress/blocked statuses only
- Computes transitive closure of blocking edges through removed nodes
(if A blocks B(closed) blocks C, adds synthetic edge A→C)
- Auto-selects compact layer rendering for LLM-friendly output
- Works with both single-issue and --all modes
- Deduplicates edges when direct and transitive paths overlap
- Falls back to highest-priority open issue when root is filtered out
* docs: regenerate CLI reference for --open flag and federation updates
Resolves modify/delete conflicts on website/* (Mintlify migration deleted
the tree in main; accept deletion). cmd/bd/prime.go auto-merged cleanly,
re-siting --no-memories on top of #4335's custom-PRIME.md/formatMemoriesForPrime
handling and #4230's doltSync gating without further edits.
Agent-Signature: claude-fable-5-high on behalf of matt wilkie
Resolves the Mintlify website-tree deletion conflict (52aea3f7e) against
this PR's now-obsolete website/*/cli-reference/prime.md doc edits: accept
main's deletion. cmd/bd/prime.go merged cleanly (no conflict markers) —
the PR's --memories-only-before-custom-PRIME.md dispatch and its
memory-append-under-custom-PRIME.md logic both survived alongside main's
agent.profile Long-help bullet (#4585). Regenerated CLI docs
(scripts/generate-cli-docs.sh) produced no additional diff beyond the
merge itself.
Agent-Signature: claude-fable-5-high on behalf of matt wilkie
* docs: redirect legacy Pages site to Mintlify (mybd-aokv)
Agent-Signature: codex-gpt-5.6-sol-high on behalf of matt wilkie
* docs: harden legacy Pages redirect
Agent-Signature: codex-gpt-5.6-terra-medium on behalf of matt wilkie
WP2 of the beads protocol conformance corpus (PROPOSAL-beads-protocol-v0 §11).
Seven §J clauses had no test; the keystone one had no test anywhere.
cmd/bd/protocol/interchange_test.go pins:
J6.6 export -> import into an EMPTY store -> export reproduces the stream.
bd-go had same-DB byte-stability and per-field round-trip tests, but
nothing asserted CROSS-store equivalence — the exact blind spot where an
import that drops, defaults, or rewrites a field hides. The fixture
spans P0 (the zero-value priority), every core issue_type, a closed
issue with close_reason, labels, inline comments, both dep orientations,
metadata, assignee, and memories.
J1.2 unknown fields ignored — a record carrying future fields at the top
level, inside a dependency, and inside a comment still imports cleanly.
J1.3 `_schema` header records skipped, on both the file and stdin readers.
J6.1 import never deletes: a partial stream does not remove the ids it omits.
J6.3 a dependency whose target id is absent is skipped AND reported
(skipped_dependencies in `bd import --json`).
J6.5 `bd import -` reads a stream from stdin.
J2.4 zero/unknown timestamps export as the Unix epoch, never year-0001
(which json.Marshal refuses outright, failing the whole export).
J1.3 needed a code fix, not just a test. parseJSONLFile (the bootstrap reader)
skipped the header record, but the `bd import` reader loop — the one `bd import`
and `bd import -` both run through — did not: the header line fell through to
the issue path, unmarshaled into an empty Issue, and aborted the WHOLE import
with "validation failed for issue : title is required". So a canonical export
carrying a provenance header could not be imported at all. Verified against the
new test: it fails with exactly that error without the guard.
Two stale artifacts found during the extraction, fixed here:
- TestCLI_Import_PrefixValidation_E2E asserted that import REJECTS a foreign
id prefix without --skip-prefix-validation, a flag that no longer exists
(every import path now passes SkipPrefixValidation). Being build-tagged out
of CI (cgo && integration), it rotted unnoticed. Rewritten as
TestCLI_Import_ForeignPrefix_E2E, pinning the behavior bd actually has —
which the protocol requires anyway: §J6.6 round-trips through a store with
its own prefix, and §J7.1 makes ids opaque.
- docs/reference/json-schema.md claimed export emits schema_version per line.
It does not (and must not): schema_version belongs to the --json command
envelope; the interchange's version marker is the optional _schema header.
The import --json summary field list was also missing five fields.
Gates: gofmt + go vet clean, go build ./... ok, full cmd/bd/protocol package
green (280s, -count=1).
* fix(unclaim): enforce claim ownership and rewrite row_lock/lease on release
bd unclaim accepted an actor argument but never compared it to the current
assignee, so any process could release another agent's claim. It also wrote
only status/assignee, leaving lease_expires_at/heartbeat_at/started_at set and
row_lock unchanged, violating the row_lock invariant (lease.go): a concurrent
heartbeat or reclaim on the released row would silently cell-merge instead of
conflicting.
UnclaimIssueInTx now:
- rejects a non-owner with storage.ErrNotOwner (typed, not a silent no-op);
- accepts force to bypass the ownership check (admin/reaper), threaded from a
new `bd unclaim --force` flag;
- clears lease_expires_at/heartbeat_at/started_at and rewrites row_lock so a
racing heartbeat/reclaim conflicts.
DoltStore.UnclaimIssue is now wrapped in withRetryTx like the other
claim-family writes, so a lost optimistic merge (1213/1205) is retried rather
than surfaced as a hard failure.
Tests (dolt/lease_test.go): non-owner unclaim is rejected and leaves the claim
intact; owner unclaim clears the lease columns and rewrites row_lock; --force
overrides the ownership check.
* fix(claim): stamp lease and row_lock on the proxied-server (uow) claim path
The uow claim path (internal/storage/domain/db Claim, used in proxied-server
mode) ran the compare-and-swap but omitted lease_expires_at, heartbeat_at, and
the row_lock rewrite that issueops.ClaimIssueInTx writes. A claim made through
this path left the lease columns NULL, so it was invisible to bd reclaim (dead
workers never recovered) and reintroduced the cell-merge class the row_lock
invariant guards against.
Both claim branches now append the shared lease SET-clause and rewrite
row_lock, reusing the same fragment as claim.go via new exported
issueops.LeaseSetClause/LeaseTTL wrappers so the two paths stay in lockstep.
Existing claim behavior (started_at handling, idempotency, conflict surfacing
via ClaimRowResult) is unchanged.
Test (domain/db/issue_test.go): a proxied-mode claim stamps lease_expires_at,
heartbeat_at, and a non-zero row_lock, and is subsequently reclaimable.
* fix(update): exit non-zero when a --claim in a batch is lost
`bd update <a> <b> --claim` set firstUpdatedID from any winner, so a mixed
batch where one claim won and another was lost to a different owner exited 0 —
hiding the lost claim from exit-code automation (beads audit finding #10). Track
a requested-but-lost claim separately and return a non-zero exit while still
committing the winners.
Scoped to the exit-code half of the defect. The `--json` lost-claim surface
(a conflict currently emits nothing on stdout, only stderr) is left as a
follow-up: emitting a structured error object there would change the stdout
contract from a plain issue array and needs its own design.
Test (gated cmd/bd embedded suite): a partial-loss batch exits non-zero, the
winning claim still lands in_progress, and the lost issue is untouched.
* fix(update): exit non-zero when a proxied-server --claim in a batch is lost
The batch exit-code fix (bd4dee4a4) only covered the non-proxied path in
update.go. On the proxied-server runtime, runUpdateProxiedServer set anyUpdated
from any winner, so a mixed batch where one --claim won and another lost to a
different owner still exited 0 — masking the lost claim from exit-code
automation, the same defect as beads audit finding #10 but on the other runtime.
applyUpdateProxiedOne now reports a requested-but-lost claim (already-claimed /
not-claimable while --claim was set) via a new return value; the caller tracks
it in a claimFailed flag and returns SilentExit() at the end, matching the
non-proxied semantics exactly: winners still commit (each ID commits its own
UOW), a lost claim in the batch flips the exit code. No other proxied behavior
changes.
Test (proxied integration suite): a partial-loss batch exits non-zero, the
winning claim lands in_progress under the winning actor, and the pre-claimed
issue is untouched — parity with update_claim_batch_partial_loss_exits_nonzero.
The proxied harness currently can't run because `bd init --proxied-server` is
stubbed upstream (init.go: "not yet implemented"), so this test is wired to the
same contract as its ~20 sibling proxied tests and executes once init lands.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test(unclaim): cover ownership rejection and --force at the CLI level
The unclaim ownership fix (fe908d40b) enforced ErrNotOwner and added
`bd unclaim --force`, but was only covered by storage-layer tests
(dolt/lease_test.go) — no CLI-level e2e test, unlike the sibling batch-claim
fix. Add gated embedded-dolt CLI tests:
- unclaim_non_owner_rejected: a non-owner release exits non-zero with the
ownership error and leaves the claim (assignee + in_progress) intact.
- unclaim_non_owner_force_succeeds: --force lets a non-owner release the claim.
Also assert the new --force flag is registered (TestUnclaimCommand_Flags).
Fix a pre-existing breakage the ownership enforcement introduced but did not
update: unclaim_from_open_stuck_claim released alice's assignment as the default
actor, which now fails ErrNotOwner. Release as the owner (--actor alice),
preserving the open+assigned "stuck claim" dimension the test exercises.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(unclaim): route wisp tables in UnclaimIssueInTx (Copilot #4675)
UnclaimIssueInTx hardcoded issues/events while ClaimIssueInTx routes via
WispTableRouting(IsActiveWispInTx). bd unclaim on an active wisp read the wisp
via GetIssueInTx but UPDATE'd the permanent issues table -> 0 rows / no event
for wisps. Mirror the claim path so a wisp release updates the wisp tables.
The nolint(gosec) comment is now accurate: table names do come from
WispTableRouting. Regular-issue unclaim is unchanged (TestEmbeddedUnclaim).
* docs(cli): regenerate CLI reference for bd unclaim --force flag
The new --force flag on bd unclaim was not reflected in the generated CLI
docs, failing the doc-freshness CI gate. Regenerate docs/CLI_REFERENCE.md and
website/docs/cli-reference/unclaim.md.
---------
Co-authored-by: sjarmak <sjarmak@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: matt wilkie <maphew@gmail.com>
* fix(gate): scope `bd gate list <issue-id>` to that issue's gates
`bd gate list` accepted no positional argument, so `bd gate list <issue-id>`
silently ignored the argument and returned every gate in the database. A caller
that trusted it to be bead-scoped (e.g. a janitor purging 'its lane's' gates)
could act on unrelated issues' gates.
Add an optional [issue-id] argument: when given, list only the gates that block
that issue (its own dependency gates), honoring --all and --limit. No argument
keeps the existing DB-wide behavior. An unknown id is a clean error rather than
a DB-wide dump.
Tests: TestFilterIssueGates (unit, the scoping/filter helper) and
TestEmbeddedGateListScoped (integration: two gated issues, scoped list returns
only the named issue's gate and never the other's).
* docs(cli): regenerate CLI reference for scoped gate list help text
Mechanical maintainer commit so the doc-freshness gate passes; also
merges current upstream/main. No code changes beyond the merge.
Agent-Signature: claude-fable-5-high on behalf of maphew
---------
Co-authored-by: matt wilkie <maphew@gmail.com>
- docsmint: all page rewrites (HTML-comment, relative-link, ESM) now skip
fenced code blocks; fence contents render verbatim
- docsmint: spliceCLINav fails closed when the "pages" key found after
"group": "CLI Reference" is not a sibling key of the same object, and
validates the spliced docs.json parses before writing
- docsmint: neutralize MDX ESM hazards in docs/CLI_REFERENCE.md too (bd
emits it without the per-page transforms, but Mintlify serves it as a
hidden page); regenerated docs/CLI_REFERENCE.md accordingly
- help_all: fail loudly when two commands collide on the same doc page ID
instead of letting the later write win; repair a garbled comment
- generate-cli-docs.sh: --check no longer trusts a repo-root ./bd it was
not explicitly given (the CGO guard detects CGO-ness, not staleness)
- docsync: validate the docs.json redirects array (well-formed, no dup
sources, destinations resolve)
- pour: runtime strings match the corrected Long text (Dolt sync, issue
database — not "sync to git" / "persistent in .beads/")
- testdata: formula_help.txt asserts the new docs/workflows/formulas.md path
- FAQ: fix bulk migration/export commands (tracker pull/push need explicit
IDs; bulk lives on sync --pull-only / --pull / --push-only / --push) and
correct the cross-project isolation claim (hydration + external targets)
- quickstart: replace the broken DOLT.md blob URL with site links
- installation: Quick Install Script heading matches its macOS/Linux/FreeBSD
body
- rewrite 33 stale SCREAMING_CASE link labels to the target pages' titles
- add description frontmatter to the 55 authored pages missing it
- docs.json: wildcard redirects for the old /next/ and version-prefixed
route spaces (1.0.0, 1.0.4, 1.0.5)