Skip to content

Fix team task claim queue stalls - #5624

Open
vicksiyi wants to merge 1 commit into
multica-ai:mainfrom
vicksiyi:multica-fix/issue-3166-team-queue-stall
Open

Fix team task claim queue stalls#5624
vicksiyi wants to merge 1 commit into
multica-ai:mainfrom
vicksiyi:multica-fix/issue-3166-team-queue-stall

Conversation

@vicksiyi

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes a claim-path stall for large team/squad-assigned queues. Team work routes many queued tasks to the same leader agent/runtime; the batch claim endpoint was reading every queued task as a candidate and then dispatching at most one task for that leader per poll. This changes candidate listing to one representative per runtime/agent and lets the batch claim loop reuse remaining free slots for the same agent while still going through ClaimTask for capacity and serialization checks.

Related Issue

Closes #3166

Multica issue: ZIC-97

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Refactor / code improvement (no behavior change)
  • Tests (adding or improving test coverage)
  • CI / infrastructure

Changes Made

  • Collapse queued claim candidates to one representative per agent/runtime in server/pkg/db/queries/agent.sql.
  • Update batch runtime claiming to round-robin candidate agents and claim additional same-agent tasks only while ClaimTask reports capacity/runnable work.
  • Add regression coverage for collapsed team-leader candidate lists and same-agent multi-claim behavior.

How to Test

  1. cd server && go test ./internal/service
  2. cd server && go test ./internal/handler -run 'TestClaimTasksByRuntime|TestClaimTaskByRuntime'
  3. make check-worktree (exited 0 locally, but printed Docker unavailable while checking PostgreSQL: Cannot connect to the Docker daemon)

Checklist

  • I have included a thinking path that traces from project context to this change
  • I have run tests locally and they pass
  • I have added or updated tests where applicable
  • If this change affects the UI, I have included before/after screenshots
  • I have updated relevant documentation to reflect my changes
  • If I added a new runtime / coding tool / UI tab, I synced the change to landing copy (apps/web/features/landing/i18n/) and relevant docs (apps/docs/content/docs/)
  • If this PR touches Chinese product copy, I checked it against apps/docs/content/docs/developers/conventions.zh.mdx (terminology, mixed-rule for task / issue / skill)
  • I have considered and documented any risks above
  • I will address all reviewer comments before requesting merge

AI Disclosure

AI tool used: Multica Agent

Prompt / approach:
Traced GitHub #3166 from the daemon claim timeout logs into the runtime batch claim service and SQL candidate list. Implemented the smallest backend fix with focused service and handler regression tests.

Screenshots (optional)

N/A

Co-authored-by: multica-agent <github@multica.ai>
@vercel

vercel Bot commented Jul 18, 2026

Copy link
Copy Markdown

@vicksiyi is attempting to deploy a commit to the IndexLabs Team on Vercel.

A member of the Team first needs to authorize it.

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.

[Bug]: Use the team's tasks with unlimited queuing

1 participant