Skip to content

chore: in_review sweep/list query misses an item with a valid state_id — stale read-index, not corrupted state_id - #810

Merged
getappz merged 4 commits into
masterfrom
task/630-in-review-sweep-list-query-misses-an-ite
Sep 25, 2026
Merged

getappz merged 4 commits into
masterfrom
task/630-in-review-sweep-list-query-misses-an-ite

Conversation

@getappz

@getappz getappz commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Verified independently. Findings below.

Root cause — confirmed

  • claim() stores raw owner Some(owner.to_string()) (claim.rs:143), bypassing canonicalize — so assignee_agent carries <agent>:<instance>.
  • create/update canonicalize via agent_registry::canonicalize (crud.rs:290), which only alias-maps/lowercases and passes unknown strings through unchanged (registry.rs:68-72) — suffix preserved.
  • item_list used exact string match, so any claimed item dropped out of its own agent's inbox. Fix's agent_part (claim.rs:36) splits on : + canonicalizes → correct.

Fix — correct

  • Applied to both retain and sort key; matches documented list semantics and the existing agent_part comparison already used in claim's BlockedByAssignee check (claim.rs:119-121). No regression: inbox = "mine + unassigned" now correctly treats same-agent/different-instance as mine; unassigned still unwrap_or(true) in retain, unwrap_or(false) in sort (unchanged semantics).

Scoping — correct

  • No cache/index exists: list_by_project is direct SQL (crud.rs:124-131). run_review_sweep (supervisor.rs:1286, 1304-1310) builds in_review from list_by_project + state_by_id group check, no assignee filter — genuinely unaffected by this bug, correctly scoped out.

Checks (foreground, in task/630 worktree)

  • cargo fmt --check → exit 0
  • cargo test --bin agentflare item_tests:: → 58 passed / 0 failed / 1 ignored
  • cargo test --bin agentflare item_list_includes_a_claimed_item_for_its_own_agent → passes (would fail pre-fix: exact match drops the suffixed-assignee "Mine")
  • cargo clippy --bin agentflare → exit 0, zero item.rs diagnostics (1 pre-existing unsafe-code warning in agentflare-config)

Diff focused (2 files, +70/-3), clear rationale comment, faithful regression test.

REVIEW_APPROVED


Opened by opencode on flared:c997d745ae66 for item #630 via agentflare.

Summary by CodeRabbit

  • Bug Fixes
    • Agent inbox filters now include items assigned to an agent instance, while continuing to include unassigned items and exclude items assigned to other agents.
  • Tests
    • Added coverage for listing agent-instance-assigned and unassigned items.

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: getappz/agentflare/.coderabbit.yaml

Review profile: CHILL

Plan: Essentials

Run ID: 805fe28e-22e5-4e86-bf22-04f07dfde860

📥 Commits

Reviewing files that changed from the base of the PR and between 7731882 and d052687.

📒 Files selected for processing (2)
  • src/mcp_server/item.rs
  • src/mcp_server/tests/item_tests.rs

Included review availability: 2 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.


📝 Walkthrough

Walkthrough

item_list now matches assignees by canonical agent ID. The regression test checks that an agent’s default list includes an item claimed under an instance ID and an unassigned item.

Changes

Item list agent matching

Layer / File(s) Summary
Canonical agent filtering and regression test
src/mcp_server/item.rs, src/mcp_server/tests/item_tests.rs
item_list compares canonical agent IDs when filtering and sorting. The regression test checks inclusion of a claimed item with an instance suffix and an unassigned item.

Priority: ⬇️ Low

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to d0526

The list change addresses the claimed-item visibility case, and no merge-blocking concern is established.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title identifies the affected list query, but it incorrectly attributes the issue to a stale read-index and corrupted state_id. The title remains related to the change because the PR fixes an item…
Description check ✅ Passed The description is detailed and directly explains the root cause, fix, scope, regression coverage, and validation results. It does not use the template headings exactly, but it provides the required i…
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 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

@getappz

getappz commented Sep 25, 2026

Copy link
Copy Markdown
Owner Author

Claiming self-repair for flared:c997d745ae66.

@getappz

getappz commented Sep 25, 2026

Copy link
Copy Markdown
Owner Author

supervisor — CI self-repair dispatched

Failing checks: build (ubuntu-latest), build (windows-latest).

Please investigate and push a fix.

job: cgpv-41gsuFyFctYLsnR3

…sweep-list-query-misses-an-ite' into task/630-in-review-sweep-list-query-misses-an-ite
@getappz

getappz commented Sep 25, 2026

Copy link
Copy Markdown
Owner Author

supervisor — CI green

Checks are passing again.

@getappz
getappz merged commit 7c000a4 into master Sep 25, 2026
16 checks passed
@getappz
getappz deleted the task/630-in-review-sweep-list-query-misses-an-ite branch September 25, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant