Skip to content

issue_prefix collision across parallel checkouts / agent worktrees #3153

@coffeegoddd

Description

@coffeegoddd

Problem

When multiple checkouts of the same project exist (e.g., parallel agent worktrees), they clone the same Dolt database and inherit the same issue_prefix. All checkouts then create issues in the same namespace (e.g., bd-XXXX), leading to:

  1. Cross-contamination on claim/update — Agent A can claim or modify Agent B's issues because they share the prefix namespace
  2. Ambiguous ownership — No way to determine which checkout created an issue
  3. Search/filter pollutionbd list in one checkout shows another checkout's work

This is a blocking problem for parallel agent workflows where each checkout should own its own set of issues.

Solution

Introduce a checkout_suffix config key that appends a short unique identifier to the issue_prefix at ID generation time, giving each checkout its own issue namespace while preserving the shared project identity.

  • issue_prefix = "bd", checkout_suffix = "" → IDs: bd-XXXX (unchanged, backward compatible)
  • issue_prefix = "bd", checkout_suffix = "k9x" → IDs: bd-k9x-XXXX

Why a separate key instead of mutating issue_prefix?

  • rename-prefix operates on issue_prefix and would need complex logic to preserve/strip suffixes
  • Sync/federation compares issue_prefix across remotes — mutating it would break clone detection
  • allowed_prefixes and ExtractIssuePrefixKnown already handle multi-segment prefixes
  • Rollback is trivial: clear checkout_suffix to rejoin the shared namespace
  • No schema migration needed — stored in the existing config key-value table

CLI interface

New --checkout-suffix flag on bd init and bd bootstrap:

  • --checkout-suffix=auto — generate a random 3-char base36 suffix
  • --checkout-suffix=k9x — use a specific suffix
  • --checkout-suffix=none — explicitly no suffix
  • Interactive prompt when no flag is provided (skipped in non-interactive/CI mode)

What changes

  • ID generation uses the effective prefix (issue_prefix + optional checkout_suffix)
  • ResolvePartialID adds the effective prefix to knownPrefixes for correct parsing
  • MergeSlotID includes the suffix so each checkout gets its own merge slot
  • Cross-checkout issues remain visible (suffix only affects creation, not reads)
  • Base prefix auto-added to AllowedPrefixes for cross-checkout validation

PR

#3152

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions