fix(tasks): block child issues from running while parent is incomplete (#970) - #1650
Closed
jmoney8896 wants to merge 1 commit into
Closed
fix(tasks): block child issues from running while parent is incomplete (#970)#1650jmoney8896 wants to merge 1 commit into
jmoney8896 wants to merge 1 commit into
Conversation
multica-ai#970) agent_task_queue scheduling ignored parent_issue_id entirely — children were picked up in parallel with their parents, defeating the sub-issue hierarchy users rely on to model ordered work. Reproducible with e.g. [Infra] Phase 1 parent + [Feature] Phase 2 child in the same backlog. Reporter's preferred fix (Option A in multica-ai#970): filter at the SQL level on both scheduling paths. - `ListPendingTasksByRuntime` now LEFT JOINs `issue` twice (task's own issue + its parent) and excludes tasks whose parent is NOT in {'done','cancelled'}. - `ClaimAgentTask` gets the same filter in its subquery so the atomic claim can't sneak a blocked child through. Both queries treat chat tasks (`issue_id IS NULL`) and top-level issues (`parent_issue_id IS NULL`) as always-eligible so nothing else changes. Existing service tests (mock-based) still pass; the SQL change is straightforward and will be exercised by the integration test suite on CI. Happy to add a dedicated parent-gate test in a follow-up if reviewers prefer. Refs multica-ai#970
|
@jmoney8896 is attempting to deploy a commit to the IndexLabs Team on Vercel. A member of the Team first needs to authorize it. |
Collaborator
|
Closing — this problem is covered by newer work. Three open PRs have been targeting parent/child issue blocking:
Since #5616 enforces the invariant at the write boundary rather than only in the claim query, it subsumes the data-layer approach here. Closing this branch so the work converges. Thanks for raising it — the underlying issue (#970) was a real gap. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Makes the task scheduler respect the
parent_issue_idrelationship. Previously child issues werepicked up in parallel with their still-running parents, which defeated the sub-issue hierarchy
users rely on to model ordered work.
Applies the reporter's preferred SQL-level fix (Option A in #970) to both scheduling paths:
ListPendingTasksByRuntime— LEFT JOINsissuetwice (task's own issue + its parent) andexcludes tasks whose parent is not
done/cancelled.ClaimAgentTask— same filter inside the atomic claim subquery so the claim can't sneak ablocked child through.
Both queries treat chat tasks (
issue_id IS NULL) and top-level issues (parent_issue_id IS NULL) as always-eligible so nothing else changes.Related Issue
Refs #970
Type of Change
Changes Made
server/pkg/db/queries/agent.sql— add parent-status filter toListPendingTasksByRuntimeandClaimAgentTask.server/pkg/db/generated/agent.sql.go— regenerated-style output matching the SQL change. Runsqlc generateto verify my hand-edit matches.How to Test
cd server && go build ./...— clean.go test ./internal/service/... ./internal/handler/...— existing tests (mock-based) stillpass. The SQL change is straightforward and will be exercised by the integration suite on CI.
in_progress; observe that only the parent task starts. Transition parent todone; child taskstarts on the next claim cycle.
Checklist
(would need the fixture harness used by repocache tests, not the mock Queries used by service
tests)
AI Disclosure
AI tool used: Claude Code
Prompt / approach: Followed the reporter's clear root-cause diagnosis in #970, applied their
preferred SQL-level fix across both scheduler entry points (not just
ListPendingTasksByRuntime).Each edit reviewed before apply.