Skip to content

✨ Durable one-PR-per-topic claims for long-lived agents - #18501

Merged
kubestellar-prow[bot] merged 1 commit into
v5from
feat/18493-topic-pr-claim
Nov 16, 2026
Merged

kubestellar-prow[bot] merged 1 commit into
v5from
feat/18493-topic-pr-claim

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #18493

What

A long-lived agent can now record which pull request carries an ongoing topic and find that PR by number on later kicks, even after a branch rename.

  • Store: pkg/beads/topic.go. A topic claim is one in_progress chore bead in the agent's own bead store (external_ref topic:<key>, metadata topic_key/repo/pr/branch/state), written under the existing cross-process flock. At most one open claim per key; re-claiming for the same PR is idempotent and updates the branch; a different PR is refused with ErrTopicClaimed.
  • Agent CLI: bd topic claim <key> --repo <owner/name> --pr <n> [--branch] [--actor], bd topic get|list [--json], bd topic release <key>. Refusal exits 2 and names the holding PR.
  • Kick: new 📌 Topic claims block in the dynamic tail when the agent holds claims, also available as the ${TOPIC_CLAIMS} template variable (renders usage lines even with no claims). FIX-BEFORE-NEW and hold-gated PR rows carry [topic: <key>].
  • Release / follow: claims are released on the hive's own merge/close audit record, on observed terminal PRs (SetPRTerminalObservedHook), and on each eval cycle from the actionable snapshot (Items/Held/Attributed), which also refreshes topic_branch when the head ref changed.
  • Docs: src/docs/beads-cli.md "Topic claims"; changelog fragment.

Tests

pkg/beads/topic_test.go, cmd/bd/topic_test.go, pkg/scheduler/topic_claims_test.go, cmd/hive/topic_claims_test.go.

Related: #18488 (an in-use branch signal that a topic claim can feed).

🤖 Generated with Claude Code

@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#18540 🐛 inference: refresh rotated gateway keys and refuse ignored api_key_file paths same files src/cmd/hive/main.go
#18505 ✨ Discover agents declared in a managed repo's .hive/agents/ behind owner approval same files src/cmd/hive/main.go
#18542 🐛 hive never applies hold itself: gates use ready-for-review / decision-needed same files src/cmd/hive/github_client_config.go
src/cmd/hive/main.go
#18534 🐛 Create a governor issue in every repo of a multi-repo hive same files src/cmd/hive/main_eval_cycle.go
#18507 ✨ governor: release-feed watcher kicks agents when a tracked upstream dependency releases CONFLICT src/cmd/hive/main.go
src/pkg/scheduler/scheduler.go (conflict)
src/pkg/scheduler/templates.go
#18536 ✨ feature: choose remote repository write identity same files src/cmd/hive/main.go

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Mutation testing

gremlins found 4 surviving mutant(s) in changed files: the code ran under tests, but changing it did not fail any test.

File Line Mutation
src/pkg/beads/topic.go 75 CONDITIONALS_BOUNDARY
src/pkg/beads/topic.go 100 CONDITIONALS_BOUNDARY
src/pkg/beads/topic.go 256 CONDITIONALS_BOUNDARY
src/pkg/beads/topic.go 270 CONDITIONALS_BOUNDARY

5 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the mutation/acknowledged label to accept this.

File Line Mutation
src/cmd/hive/github_client_config.go 386 CONDITIONALS_NEGATION
src/pkg/beads/topic.go 238 CONDITIONALS_BOUNDARY
src/pkg/beads/topic.go 238 CONDITIONALS_NEGATION
src/pkg/scheduler/topic_claims.go 94 ARITHMETIC_BASE
src/pkg/scheduler/topic_claims.go 95 ARITHMETIC_BASE

ℹ️ 1 mutant(s) on added lines were SKIPPED because gremlins v0.6.0 only honours the first lines added lines of each default-context hunk, so non-contiguous edits in one hunk are partly missed. This does not affect the verdict.

File Line Mutation
src/cmd/hive/github_client_config.go 393 CONDITIONALS_NEGATION

Verdict: lived (#17349).

@hivecommons-hive

hivecommons-hive Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • build-go
  • build-hub (linux/amd64, true, false, 60)
  • build-hub (linux/arm64, true, true, 75)
  • docker (hive)
  • docker (hub)
  • test (dashboard 1/4)
  • test (dashboard 2/4)
  • test (dashboard 3/4)
  • test (dashboard 4/4)
  • test (dashboard shuffle 1/3)
  • test (dashboard shuffle 2/3)
  • test (dashboard shuffle 3/3)
  • test (scheduler 1/3)
  • test (scheduler 2/3)
  • test (scheduler 3/3)

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

hive/awaiting-ci: rebased onto v5 (one conflict in policy_overlays.go: busy-branch guard + topic tags merged into one formatter). CI pending — sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: 563ce8756

— hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

@github-actions github-actions Bot added conflicts-with-open-pr Open PR has a merge conflict with another open PR and removed conflicts-with-open-pr Open PR has a merge conflict with another open PR labels Nov 16, 2026
@clubanderson clubanderson added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 16, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hivecommons-hive
hivecommons-hive Bot force-pushed the feat/18493-topic-pr-claim branch from c28da3c to bfa21ab Compare November 16, 2026 21:29
@kubestellar-prow kubestellar-prow Bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 16, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

New changes are detected. LGTM label has been removed.

@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 16, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

scanner: CI is red but baseline triage says PR-local and stale-branch (action MERGE_BASE): the branch is behind v5 and the red checks (build-go, golangci-lint, test shards) should be re-evaluated after merging the base in. Not pushing to this human-authored branch; please merge/rebase v5 and re-run. Deferred this kick.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

— hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

@clubanderson

Copy link
Copy Markdown
Member Author

cc @joerunde: this is part of the hive changes for the spyre-inference deps agent and sandboxed reviewer setup.

Adds bd topic claim/get/list/release backed by the agent's bead store.
A second open claim for the same topic is refused; the governor follows
a claimed PR's renamed head branch, releases the claim when the PR
merges or closes, lists claims in the kick (and as ${TOPIC_CLAIMS}),
and tags claimed PRs in the FIX-BEFORE-NEW and held-PR blocks.

Fixes #18493

Signed-off-by: Andy Anderson <andy@clubanderson.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. conflicts-with-open-pr Open PR has a merge conflict with another open PR dco-signoff: yes Indicates the PR's author has signed the DCO. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ Durable one-PR-per-topic claim for long-lived agents

1 participant