Skip to content

fix(bridge,work): surface why a claimed item never gets worked - #423

Merged
getappz merged 1 commit into
masterfrom
bridge-claim-diagnostics
Aug 10, 2026
Merged

fix(bridge,work): surface why a claimed item never gets worked#423
getappz merged 1 commit into
masterfrom
bridge-claim-diagnostics

Conversation

@getappz

@getappz getappz commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

Two diagnosability gaps found while chasing why a GitHub-bridge-claimed issue (#421) sat untouched for 40+ minutes, looking indistinguishable from "actively being worked":

  • record_claim (github/bridge/tick.rs) decides ready-for-work labeling once, at first claim, and stays silent when no work_agent is configured. An issue claimed before AGENTFLARE_BRIDGE_WORK_AGENT is set — or on a workstation that never sets it — now logs that it will not be auto-dispatched, instead of silently sitting there.
  • agentflare work's claim-status handling (cli/work.rs) formatted every non-acquired claim as "held by {owner} ({age}s)", but ClaimOutcome::BlockedByAssignee (an unaccepted handoff) has no owner/age_secs fields — producing the meaningless "held by ? (0s)" instead of the actionable reason the claim response already carries.

Neither is a behavior change to the claim/dispatch logic itself — both are purely making an existing silent/confusing state observable.

Test plan

  • cargo test --bin agentflare cli::work:: — 26 passed
  • cargo test --bin agentflare github::bridge::tick — 27 passed
  • cargo clippy / cargo fmt --check clean on both touched files
  • Manual: reproduced the exact "held by ? (0s)" message against a real handed-off item, confirmed the new code path surfaces the real reason instead

Summary by CodeRabbit

  • Bug Fixes

    • Improved claim failure messages to distinguish blocked handoffs from items held by another owner.
    • Blocked claims now display the reason provided in the response, while held claims continue to show ownership and elapsed time.
  • Improvements

    • Added a warning when automatic work dispatch is unavailable, including guidance for configuration or manual dispatch.

Two diagnosability gaps found while chasing why a bridge-claimed
issue sat untouched for 40+ minutes:

- record_claim only decides ready-for-work labeling once, at first
  claim, and stays silent when no work_agent is configured -- an
  issue claimed before AGENTFLARE_BRIDGE_WORK_AGENT is set (or
  claimed on a workstation that never sets it) looks identical to
  one actively being worked, with nothing pointing at the real
  cause. Log it.

- `agentflare work`'s claim-status handling formatted every non-
  acquired claim as "held by {owner} ({age}s)", but
  ClaimOutcome::BlockedByAssignee (an unaccepted handoff) has no
  owner/age_secs fields at all -- producing the meaningless "held
  by ? (0s)" instead of the actionable reason already carried in
  the response.

Agentflare-Agent: claude-code
Agentflare-Branch: bridge-claim-diagnostics
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 60d52c2f-63a6-4d08-a8b4-721419dcd0bc

📥 Commits

Reviewing files that changed from the base of the PR and between 9c47be7 and 0a13f72.

📒 Files selected for processing (2)
  • src/cli/work.rs
  • src/github/bridge/tick.rs

📝 Walkthrough

Walkthrough

The CLI now distinguishes blocked handoffs from held claims. The GitHub bridge warns when new claims lack a configured work_agent and therefore cannot be auto-dispatched.

Changes

Claim reporting and dispatch

Layer / File(s) Summary
Claim failure status reporting
src/cli/work.rs
Blocked claims display the response reason. Held claims retain owner and age details.
Missing work agent warning
src/github/bridge/tick.rs
New claims produce a warning when work_agent is unset and are reported as not automatically dispatchable.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: improving diagnostics for claimed items that are not being worked.
Description check ✅ Passed The description includes a clear summary and detailed test plan; the optional reviewer notes section is omitted.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bridge-claim-diagnostics

Comment @coderabbitai help to get the list of available commands.

@getappz
getappz merged commit 5a2fcab into master Aug 10, 2026
18 checks passed
@getappz
getappz deleted the bridge-claim-diagnostics branch August 10, 2026 07:49
getappz added a commit that referenced this pull request Aug 11, 2026
…ge collisions (#456)

* git-shim/worktree residual polish: teardown messaging, branch-create accuracy, stranded-checkout recovery

- worktree deny message now distinguishes provisioning (claim) from
  teardown (check_merge/release/audit --prune) so an agent denied
  mid-teardown gets the exact cleanup action (vent #350)
- is_branch_create() classifies checkout -b/-B and switch -c/-C;
  canonical-checkout deny says 'create a new branch' instead of the
  misleading 'would detach HEAD' (vent #395)
- audit_orphans flags worktrees stranded on the default branch (intact
  gitdir) so worktree audit --prune clears the gh pr merge --delete-
  branch / post-merge-sync collision root cause (vents #351/#394/#423)
- AGENTFLARE_GIT_ALLOW_CANONICAL_MUTATE now also lifts the default-branch
  checkout/switch deny in the canonical checkout, giving stranded
  checkouts a sanctioned way back (vent #386 residual)
- allowlist classify.rs (already 1604L on master) in the LOC gate

Agentflare-Agent: 1
Agentflare-Branch: task/441
Agentflare-Item: 441

* fix(git-shim): close branch-create detection gaps, protect dirty stranded worktrees

CodeRabbit review on PR #456:
- is_branch_create only matched exact -b/-B/-c/-C, missing --orphan
  (checkout+switch), switch's --create/--force-create long forms, and
  attached short-option spellings (-bname). Those forms slipped past
  both would_detach_head and deny_canonical_detach_reason undetected,
  letting an agent create a branch in the canonical checkout via e.g.
  'git switch --orphan x' or 'git checkout -bx' with no deny at all.
- audit_orphans' new on-default-branch detection could hand a dirty,
  uncommitted stranded worktree to gc_orphans for deletion; the only
  other gc_orphans caller (cleanup_item_worktree) already refuses on
  a dirty status check first. Apply the same guard here.

Agentflare-Agent: claude-code_2-1-227_agent
Agentflare-Branch: task/441
Agentflare-Item: 441
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant