beads/cmd/bd/gate_discover.go
Julian Knutsen ae693ef7cc
fix(http): bd gate create, add-waiter and discover over a connected HTTP workspace (#7621)
* fix(http): gate create, add-waiter and discover through the library roles

bd gate create, bd gate add-waiter and bd gate discover wrote through the
legacy CreateIssue, AddDependency and map-based UpdateIssue, which the http
store does not implement, so over a connected HTTP workspace each failed
before any gate member reached the wire. They now run through the roles on
every route (direct, proxied server, http):

- gate create is ONE Lifecycle.Create carrying the gate members and a
  reverse blocks edge from the blocked issue to the new gate: atomic on
  every route, one createIssue over http behind issues.create.gates. The
  proxied-server route's private unit of work is gone; it uses the same
  role.
- gate add-waiter reads through Reader.Get, deduplicates, and writes the
  whole waiter list through Lifecycle.Update guarded by the row version it
  read, retrying up to three times on ErrVersionMismatch, so concurrent
  adders cannot lose each other's waiter. Over http: issues.update.gates.
- gate discover lists through issueops.ListGates and records the run ID
  through the same Lifecycle await_id patch gate check makes; bd close's
  gh:run persist (updateGateAwaitID) takes the same path.
- Against a server without the token, each refuses before any write,
  naming the token.
- gate discover skips template gates, as gate check already does, instead
  of recording a run ID on a proto every later pour copies.

Tests: unit tests for the one-Create shape, the refusal, the add-waiter CAS
retry, and discover over ListGates with its template skip;
backend/http TestE2E_GatesOverHTTP (advertised and masked); four served
corpus shapes, pending until the reference server advertises the gate
tokens (verified to pass against a profile that does). CHANGELOG.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(gate): add-waiter backs off under contention; discover fails on a failed write

Review follow-ups to the gate CLI port.

- gate add-waiter's guarded write retried three times with no wait, so a
  convoy of workers registering on one gate at once failed all but a few
  (the proxied route's old unit of work had served them all). Each retry
  now waits a jittered, doubling backoff (10 ms to 400 ms, drawn from
  [d/2, d)), for at most 20 writes. The bound is attempts, not wall time:
  under a loaded server one round takes seconds, and a wall-clock budget
  failed the convoy after two or three rounds. A cancelled wait stops the
  loop. TestProxiedServerGateAddWaiterConvoy (direct SQL and
  proxied, real Dolt server) and TestE2E_GatesOverHTTP's concurrent case
  run 11 simultaneous adders (one duplicate): all exit 0, every waiter
  present once.
- gate discover counts only the gates whose run ID was recorded and exits
  non-zero when any matched gate's write failed; it used to print the
  refused gate as updated and exit 0. TestE2E_GatesOverHTTP covers
  discover with and without issues.update.gates (fake gh).
- TestServedGateCheckOverAwaitTypedGates masks issues.update.gates itself,
  so upgrading reference_server.json does not turn its gh:run case into a
  different test.
- The discover listing test asserts closed gates are not listed.
- CHANGELOG: discover's template skip and add-waiter's template refusal
  are behavior changes on the local routes; gate create refuses
  a negative --timeout; gate create/add-waiter follow dolt.auto-commit and
  use the role's commit messages; the proxied create no longer journals
  dependency_added.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 02:15:07 +00:00

607 lines
22 KiB
Go

package main
import (
"context"
"encoding/json"
"errors"
"fmt"
"os"
"os/exec"
"sort"
"strconv"
"strings"
"time"
"github.com/spf13/cobra"
"github.com/steveyegge/beads/internal/beads"
"github.com/steveyegge/beads/internal/metrics"
"github.com/steveyegge/beads/internal/types"
"github.com/steveyegge/beads/internal/ui"
"github.com/steveyegge/beads/issueops"
)
// GHWorkflowRun represents a GitHub workflow run from `gh run list --json`
type GHWorkflowRun struct {
DatabaseID int64 `json:"databaseId"`
DisplayTitle string `json:"displayTitle"`
HeadBranch string `json:"headBranch"`
HeadSha string `json:"headSha"`
Name string `json:"name"`
Status string `json:"status"`
Conclusion string `json:"conclusion,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
WorkflowName string `json:"workflowName"`
URL string `json:"url"`
}
// gateDiscoverCmd discovers GitHub run IDs for gh:run gates
var gateDiscoverCmd = &cobra.Command{
Use: "discover",
Short: "Discover await_id for gh:run gates",
Long: `Discovers GitHub workflow run IDs for gates awaiting CI/CD completion.
This command finds open gates with await_type="gh:run" that don't have an await_id,
queries recent GitHub workflow runs, and matches them using heuristics:
- Branch name matching
- Commit SHA matching
- Time proximity (runs within 5 minutes of gate creation)
Once matched, the gate's await_id is updated with the GitHub run ID, enabling
subsequent polling to check the run's status.
A gate whose metadata.repo targets another repository is only matched
against runs queried from that repository, never against the current
repository's runs of a same-named workflow.
Examples:
bd gate discover # Auto-discover run IDs for all matching gates
bd gate discover --dry-run # Preview what would be matched (no updates)
bd gate discover --branch main --limit 10 # Only match runs on 'main' branch`,
SilenceUsage: true,
SilenceErrors: true,
RunE: runGateDiscover,
}
func init() {
gateDiscoverCmd.Flags().BoolP("dry-run", "n", false, "Preview mode: show matches without updating")
gateDiscoverCmd.Flags().StringP("branch", "b", "", "Filter runs by branch (default: current branch)")
gateDiscoverCmd.Flags().IntP("limit", "l", 10, "Max runs to query from GitHub")
gateDiscoverCmd.Flags().DurationP("max-age", "a", 30*time.Minute, "Max age for gate/run matching")
gateCmd.AddCommand(gateDiscoverCmd)
}
func runGateDiscover(cmd *cobra.Command, args []string) error {
if usesProxiedServer() {
return HandleErrorRespectJSON("gate discover is not supported in proxied-server mode")
}
CheckReadonly("gate discover")
evt := metrics.NewCommandEvent("gate-discover")
defer func() {
if c := metrics.Global(); c != nil {
c.CloseEventAndAdd(evt)
}
}()
dryRun, _ := cmd.Flags().GetBool("dry-run")
branchFilter, _ := cmd.Flags().GetString("branch")
limit, _ := cmd.Flags().GetInt("limit")
maxAge, _ := cmd.Flags().GetDuration("max-age")
ctx := rootCtx
gates, err := findPendingGates(ctx)
if err != nil {
return HandleError("finding gates: %v", err)
}
if len(gates) == 0 {
fmt.Println("No pending gh:run gates found (all gates have numeric run IDs)")
return nil
}
fmt.Printf("%s Found %d gate(s) awaiting run ID discovery\n\n", ui.RenderAccent("🔍"), len(gates))
// userSpecifiedBranch must be captured BEFORE the auto-detect fallback
// below overwrites branchFilter with the local branch - otherwise
// branchFilterForRepo can never tell "the user explicitly asked to
// filter by this branch" apart from "this is just the local branch we
// defaulted to", and an explicit `--branch` is dropped for every
// cross-repo gate exactly like the un-requested auto-detected one is.
userSpecifiedBranch := branchFilter != ""
if !userSpecifiedBranch {
branchFilter = getGitBranchForGateDiscovery()
}
// Scope run discovery per gate's own repo selector (SF1): a gate whose
// metadata targets another repository must only be matched against runs
// queried FROM that repository, never against a same-named workflow run
// from the current repo. matchGatesToRuns groups gates by their
// validated repo and issues one query per distinct repo.
matches := matchGatesToRuns(gates, maxAge, func(repo, workflowHint string) ([]GHWorkflowRun, error) {
return queryGitHubRunsInRepo(branchFilterForRepo(branchFilter, repo, userSpecifiedBranch), limit, repo, workflowHint)
})
// Step 3/4: report matches (and, outside dry-run, persist them)
// matchCount counts the gates whose run ID was recorded (or, under
// --dry-run, would be); updateFailures the matched gates whose write
// failed, which fail the command after the summary.
matchCount := 0
updateFailures := 0
for _, m := range matches {
if m.err != nil {
fmt.Fprintf(os.Stderr, " %s %s - %v\n",
ui.RenderFail("✗"), ui.RenderID(m.gate.ID), m.err)
continue
}
if m.run == nil {
if jsonOutput {
continue
}
fmt.Printf(" %s %s - no matching run found\n",
ui.RenderFail("✗"), ui.RenderID(m.gate.ID))
continue
}
runIDStr := strconv.FormatInt(m.run.DatabaseID, 10)
if dryRun {
matchCount++
fmt.Printf(" %s %s → run %s (%s) [dry-run]\n",
ui.RenderPass("✓"), ui.RenderID(m.gate.ID), runIDStr, m.run.Status)
continue
}
if err := updateGateAwaitID(ctx, m.gate.ID, runIDStr); err != nil {
updateFailures++
fmt.Fprintf(os.Stderr, " %s %s - update failed: %v\n",
ui.RenderFail("✗"), ui.RenderID(m.gate.ID), err)
continue
}
matchCount++
fmt.Printf(" %s %s → run %s (%s)\n",
ui.RenderPass("✓"), ui.RenderID(m.gate.ID), runIDStr, m.run.Status)
}
fmt.Println()
if dryRun {
fmt.Printf("Would update %d gate(s). Run without --dry-run to apply.\n", matchCount)
} else {
fmt.Printf("Updated %d gate(s) with discovered run IDs.\n", matchCount)
}
// A GitHub query failure (gh missing, unauthenticated, rate limited, ...)
// is fatal, matching pre-multi-repo behavior: before per-repo scoping,
// any query error returned HandleError immediately. Per-gate detail was
// already reported above; report a summary here and exit non-zero so a
// wholly-failed discovery is never mistaken for "0 gates matched".
if failures := gateDiscoveryQueryFailures(matches); len(failures) > 0 {
repos := make([]string, 0, len(failures))
for repo := range failures {
repos = append(repos, repo)
}
sort.Strings(repos)
details := make([]string, 0, len(repos))
for _, repo := range repos {
label := repo
if label == "" {
label = "current repo"
}
details = append(details, fmt.Sprintf("%s: %v", label, failures[repo]))
}
return HandleError("querying GitHub runs failed for %d repo(s): %s", len(failures), strings.Join(details, "; "))
}
if updateFailures > 0 {
return HandleError("recording the discovered run ID failed for %d gate(s)", updateFailures)
}
return nil
}
// gateDiscoveryMatch pairs a gate with the run matched for it, or an error
// explaining why it could not be matched (invalid repo metadata, or the
// GitHub query for its repo failed).
type gateDiscoveryMatch struct {
gate *types.Issue
run *GHWorkflowRun
err error
}
// gateQueryError wraps a failed GitHub query for a specific repo. It is
// distinguished from other gateDiscoveryMatch errors (e.g. invalid repo
// metadata) so runGateDiscover can tell "we couldn't even ask GitHub"
// (gh missing, unauthenticated, rate limited, ...) apart from a per-gate
// data problem: a wholly-failed discovery must exit non-zero, matching the
// pre-multi-repo behavior where a query failure was fatal.
type gateQueryError struct {
repo string
err error
}
func (e *gateQueryError) Error() string { return e.err.Error() }
func (e *gateQueryError) Unwrap() error { return e.err }
// gateDiscoveryQueryFailures returns the distinct repos whose GitHub query
// failed among matches, keyed by repo ("" meaning the current repository)
// with the query error that repo produced.
func gateDiscoveryQueryFailures(matches []gateDiscoveryMatch) map[string]error {
failures := make(map[string]error)
for _, m := range matches {
var qe *gateQueryError
if errors.As(m.err, &qe) {
failures[qe.repo] = qe.err
}
}
return failures
}
// branchFilterForRepo returns the branch filter to use when querying a gate's
// repo. It always applies the branch filter to the current repo (repo ==
// ""). For a foreign repo it drops an auto-detected local branch - a
// cross-repo gate's target branch has no relationship to the branch checked
// out locally, so `gh run list --repo <other> --branch <local-branch>` would
// filter out every run in that repo and the gate would never be discoverable
// (this was the cross-repo-discovery-is-inert bug) - but keeps a branch the
// user explicitly passed via `--branch`: an explicit filter is a deliberate
// instruction about the TARGET repo's branch, not a guess about the local
// checkout, and dropping it silently for cross-repo gates would make
// `bd gate discover --branch main` appear to work while doing nothing.
func branchFilterForRepo(localBranchFilter, repo string, userSpecified bool) string {
if repo != "" && !userSpecified {
return ""
}
return localBranchFilter
}
// matchGatesToRuns scopes run discovery per gate's own repo selector (SF1).
// Gates are grouped by their validated metadata.repo (via githubRepoFromIssue;
// "" means the current repository), and queryRuns is called at most once per
// distinct (repo, workflow hint) pair among the given gates. A gate is only
// ever matched against runs queried from ITS repo - never against another
// repo's runs of a same-named workflow, which would otherwise persist the
// wrong await_id permanently (the persisted ID pins the gate).
//
// queryRuns receives a workflowHint - the gate's AwaitID workflow name hint,
// non-empty only for a foreign (cross-repo) query - so it can narrow the
// `gh run list` call with --workflow. Without that narrowing, a busy foreign
// repo's unfiltered recent-run list (capped by --limit) might never surface
// the specific workflow a gate is waiting on. The current repo's query is
// never narrowed this way (workflowHint is always "" for it), matching
// pre-existing `bd gate discover` behavior for local gates.
func matchGatesToRuns(gates []*types.Issue, maxAge time.Duration, queryRuns func(repo, workflowHint string) ([]GHWorkflowRun, error)) []gateDiscoveryMatch {
runsByKey := make(map[string][]GHWorkflowRun)
queryErrByKey := make(map[string]error)
results := make([]gateDiscoveryMatch, 0, len(gates))
for _, gate := range gates {
repo, repoErr := githubRepoFromIssue(gate)
if repoErr != nil {
results = append(results, gateDiscoveryMatch{gate: gate, err: fmt.Errorf("invalid repo metadata: %w", repoErr)})
continue
}
foreign := repo != ""
hint := getWorkflowNameHint(gate)
// Cross-repo discovery requires a workflow hint. With local-commit/
// local-branch heuristics neutralized for a foreign repo (see
// matchGateToRun), a hintless gate could only ever score on time
// proximity alone and risk pinning the wrong run in another
// repository permanently. Skip the query entirely rather than spend
// a GitHub API call on a gate that can never match.
if foreign && hint == "" {
results = append(results, gateDiscoveryMatch{gate: gate})
continue
}
queryHint := ""
key := repo
if foreign {
queryHint = hint
key = repo + "\x1f" + hint
}
runs, cached := runsByKey[key]
if !cached {
if qErr, queried := queryErrByKey[key]; queried {
results = append(results, gateDiscoveryMatch{gate: gate, err: &gateQueryError{repo: repo, err: qErr}})
continue
}
queried, err := queryRuns(repo, queryHint)
if err != nil {
queryErrByKey[key] = err
results = append(results, gateDiscoveryMatch{gate: gate, err: &gateQueryError{repo: repo, err: err}})
continue
}
runsByKey[key] = queried
runs = queried
}
// A gate's local-commit/local-branch heuristics only make sense
// against the current repo's runs; a foreign repo (repo != "") never
// shares a commit SHA or branch name with the local checkout, so
// those heuristics are neutralized for it (see matchGateToRun).
results = append(results, gateDiscoveryMatch{gate: gate, run: matchGateToRun(gate, runs, maxAge, foreign)})
}
return results
}
// isNumericRunID returns true if the string looks like a GitHub numeric run ID.
// This is a local alias for consistency - the canonical implementation is isNumericID in gate.go.
func isNumericRunID(s string) bool {
return isNumericID(s)
}
// needsDiscovery returns true if a gh:run gate needs run ID discovery.
// This is true when AwaitID is empty OR contains a non-numeric workflow name hint.
func needsDiscovery(g *types.Issue) bool {
if g.AwaitType != "gh:run" {
return false
}
// Empty AwaitID or non-numeric (workflow name hint) needs discovery
return g.AwaitID == "" || !isNumericRunID(g.AwaitID)
}
// getWorkflowNameHint extracts the workflow name hint from AwaitID if present.
// Returns empty string if AwaitID is empty or numeric (already resolved).
func getWorkflowNameHint(g *types.Issue) string {
if g.AwaitID == "" || isNumericRunID(g.AwaitID) {
return ""
}
return g.AwaitID
}
// workflowNameMatches checks if a workflow hint matches a GitHub workflow run.
// It handles various naming conventions:
// - Exact match (case-insensitive)
// - Hint with .yml/.yaml suffix vs display name without
// - Hint without suffix vs filename with .yml/.yaml
func workflowNameMatches(hint, workflowName, runName string) bool {
// Normalize hint by removing .yml/.yaml suffix for comparison
hintBase := strings.TrimSuffix(strings.TrimSuffix(hint, ".yml"), ".yaml")
// Exact matches (case-insensitive)
if strings.EqualFold(workflowName, hint) || strings.EqualFold(runName, hint) {
return true
}
// Match hint base against workflow display name
if strings.EqualFold(workflowName, hintBase) {
return true
}
// Match hint (with suffix added) against run filename
if strings.EqualFold(runName, hintBase+".yml") || strings.EqualFold(runName, hintBase+".yaml") {
return true
}
return false
}
// findPendingGates returns open gh:run gates that need run ID discovery.
// This includes gates with empty AwaitID OR non-numeric AwaitID (workflow name hint).
//
// The open gates come from issueops.ListGates over the route's Querier, the
// entry `bd gate list` and `bd gate check` use, so a connected HTTP workspace
// answers it with queryIssues rather than refusing the raw storage filter.
func findPendingGates(ctx context.Context) ([]*types.Issue, error) {
querier, err := openQuerier()
if err != nil {
return nil, err
}
return findPendingGatesWith(ctx, querier)
}
// findPendingGatesWith is findPendingGates over a given Querier. Template
// gates are skipped: a template is read-only (work is poured from it), so its
// await_id is never a run to discover.
func findPendingGatesWith(ctx context.Context, querier issueops.Querier) ([]*types.Issue, error) {
allGates, err := issueops.ListGates(ctx, querier, issueops.GateListRequest{})
if err != nil {
return nil, fmt.Errorf("search gates: %w", err)
}
var gates []*types.Issue
for _, g := range allGates {
if g.IsTemplate {
continue
}
if needsDiscovery(g) {
gates = append(gates, g)
}
}
return gates, nil
}
// getGitBranchForGateDiscovery returns the current git branch name
// Uses CWD repo context since this is for user's project CI discovery
func getGitBranchForGateDiscovery() string {
rc, err := beads.GetRepoContext()
if err != nil {
return "main" // Default fallback
}
cmd := rc.GitCmdCWD(context.Background(), "rev-parse", "--abbrev-ref", "HEAD")
output, err := cmd.Output()
if err != nil {
return "main" // Default fallback
}
return strings.TrimSpace(string(output))
}
// getGitCommitForGateDiscovery returns the current git commit SHA
// Uses CWD repo context since this is for user's project CI discovery
func getGitCommitForGateDiscovery() string {
rc, err := beads.GetRepoContext()
if err != nil {
return ""
}
cmd := rc.GitCmdCWD(context.Background(), "rev-parse", "HEAD")
output, err := cmd.Output()
if err != nil {
return ""
}
return strings.TrimSpace(string(output))
}
// queryGitHubRunsInRepo queries recent workflow runs from GitHub using gh
// CLI, scoped to repo ("" means the current repository) and optionally
// narrowed to a single workflow (workflow == "" queries all workflows). This
// is the query path for `bd gate discover`'s branch/heuristic matching (SF1)
// - distinct from queryGitHubRunsForWorkflowInRepo in gate.go, which filters
// by a specific --workflow name for the direct await_id discovery used by
// `bd gate check`. matchGatesToRuns only ever passes a non-empty workflow for
// a foreign repo, to recover the visibility --limit would otherwise cost an
// unfiltered cross-repo query (see matchGatesToRuns).
func queryGitHubRunsInRepo(branch string, limit int, repo string, workflow string) ([]GHWorkflowRun, error) {
if _, err := exec.LookPath("gh"); err != nil {
return nil, fmt.Errorf("gh CLI not found: install from https://cli.github.com")
}
return queryGitHubRunsInRepoWithRunner(branch, limit, repo, workflow, runGHCommand)
}
func queryGitHubRunsInRepoWithRunner(branch string, limit int, repo string, workflow string, runGH ghCommandRunner) ([]GHWorkflowRun, error) {
args := []string{
"run", "list",
"--json", "databaseId,displayTitle,headBranch,headSha,name,status,conclusion,createdAt,updatedAt,workflowName,url",
"--limit", strconv.Itoa(limit),
}
if branch != "" {
args = append(args, "--branch", branch)
}
if repo != "" {
args = append(args, "--repo", repo)
}
if workflow != "" {
args = append(args, "--workflow", workflow)
}
output, stderr, err := runGH(args...)
if err != nil {
if len(stderr) > 0 {
return nil, fmt.Errorf("gh run list failed: %s", string(stderr))
}
return nil, fmt.Errorf("gh run list: %w", err)
}
var runs []GHWorkflowRun
if err := json.Unmarshal(output, &runs); err != nil {
return nil, fmt.Errorf("parse gh output: %w", err)
}
return runs, nil
}
// matchGateToRun finds the best matching run for a gate using heuristics.
// If the gate has a workflow name hint in AwaitID, only runs matching that workflow are considered.
//
// foreignRepo must be true when runs were queried from a repo other than the
// current one (SF1: a gate whose metadata.repo targets another repository).
// In that case the local commit SHA and branch name are meaningless - they
// describe the current checkout, not the foreign repo - so the commit/branch
// heuristics are skipped entirely rather than comparing against them anyway.
func matchGateToRun(gate *types.Issue, runs []GHWorkflowRun, maxAge time.Duration, foreignRepo bool) *GHWorkflowRun {
workflowHint := getWorkflowNameHint(gate)
// Cross-repo discovery requires a workflow hint. With the commit/branch
// heuristics below neutralized for a foreign repo, a hintless gate could
// otherwise reach bestScore >= 30 on time proximity (+ in-progress/queued
// status) alone and pin the wrong run in another repository permanently -
// matchGatesToRuns already skips the query for this case, but guard here
// too so any other caller gets the same safety.
if foreignRepo && workflowHint == "" {
return nil
}
now := time.Now()
var currentCommit, currentBranch string
if !foreignRepo {
currentCommit = getGitCommitForGateDiscovery()
currentBranch = getGitBranchForGateDiscovery()
}
var bestMatch *GHWorkflowRun
var bestScore int
for i := range runs {
run := &runs[i]
score := 0
// Skip runs that are too old
if now.Sub(run.CreatedAt) > maxAge {
continue
}
// If gate has a workflow name hint, require matching workflow
// Match against both WorkflowName (display name) and Name (filename)
if workflowHint != "" {
workflowMatches := workflowNameMatches(workflowHint, run.WorkflowName, run.Name)
if !workflowMatches {
continue // Skip runs that don't match the workflow hint
}
// Workflow match is a strong signal
score += 200
}
// Heuristic 1: Commit SHA match (strongest signal after workflow
// match). Skipped for a foreign repo (currentCommit is "" there).
if currentCommit != "" && run.HeadSha == currentCommit {
score += 100
}
// Heuristic 2: Branch match. Skipped for a foreign repo (see
// Heuristic 1) and mirrors its currentCommit != "" guard: if local
// branch detection failed, currentBranch is "" and a run with an
// empty HeadBranch (if GitHub ever returns one) must not
// accidentally "match" it.
if !foreignRepo && currentBranch != "" && run.HeadBranch == currentBranch {
score += 50
}
// Heuristic 3: Time proximity to gate creation
// Closer in time = higher score
timeDiff := run.CreatedAt.Sub(gate.CreatedAt).Abs()
if timeDiff < 5*time.Minute {
score += 30
} else if timeDiff < 10*time.Minute {
score += 20
} else if timeDiff < 30*time.Minute {
score += 10
}
// Heuristic 4: Prefer in_progress or queued runs (more likely to be current)
if run.Status == "in_progress" || run.Status == "queued" {
score += 5
}
if score > bestScore {
bestScore = score
bestMatch = run
}
}
// Require at least some confidence in the match
// With workflow hint, workflow match (200) alone is sufficient
// Without workflow hint, require branch or commit match (30+ from time proximity)
if bestScore >= 30 {
return bestMatch
}
return nil
}
// updateGateAwaitID records a discovered run ID as a gate's await_id through
// the Lifecycle role (persistGateCheckAwaitID), the write `bd gate check` and
// `bd close` make for the same discovery. A connected HTTP workspace sends it
// as updateIssue behind issues.update.gates, and a server that does not
// advertise that token refuses it before any request is sent.
func updateGateAwaitID(_ interface{}, gateID, runID string) error {
return persistGateCheckAwaitID(rootCtx, gateID, runID)
}