Skip to content

fix(tasks): wire parent_task_id lineage end-to-end on the HTTP path (closes #111)#121

Open
umi-appcoder[bot] wants to merge 1 commit into
mainfrom
fix/parent-task-lineage
Open

fix(tasks): wire parent_task_id lineage end-to-end on the HTTP path (closes #111)#121
umi-appcoder[bot] wants to merge 1 commit into
mainfrom
fix/parent-task-lineage

Conversation

@umi-appcoder

@umi-appcoder umi-appcoder Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

What

Threads parent_task_id through the HTTP create path and records the child on its parent, so API-created sub-agent lineage actually populates. Closes #111 — PR 3 of the reliability-hardening series (good-first).

The bug

create_task accepted parent_task_id and set it on the child + init'd sub_task_ids=[], but nothing appended the child to the parent's sub_task_ids, and handle_claude_create_task dropped parent_task_id from the request body. So lineage was always empty and the Subagents tab / list-by-parent were dead for HTTP-created tasks (only the MCP orchestrator populated lineage, via its own path).

Fix

  • handle_claude_create_task passes parent_task_id from the body to create_task.
  • create_task appends the child to the parent via a new _append_sub_task_id helper using the meta-file lock (_atomic_update_meta) so concurrent creates can't clobber the list; best-effort, no-op when there's no parent or the parent is gone. Mirrors mcp_agent_orchestrator._append_sub_task_id.

Tests

tests/task_lineage_test.py (5): child↔parent linkage, multi-child append + dedupe, no-parent no-op, missing/empty parent safe, list_tasks(parent=...) filter. Full suite 471, OK.

Closes #111

🤖 Generated with Claude Code

…111)

create_task accepted parent_task_id and recorded it on the child + init'd
sub_task_ids=[], but nothing appended the child to the *parent's*
sub_task_ids, and handle_claude_create_task dropped parent_task_id from
the request body — so API-created sub-agent lineage was always empty and
the list-by-parent / Subagents tab were effectively dead for HTTP-created
tasks.

- handle_claude_create_task now threads parent_task_id from the body to
  create_task.
- create_task appends the child to the parent via a new
  _append_sub_task_id helper that uses the meta-file lock
  (_atomic_update_meta) so concurrent creates can't clobber the list;
  it's best-effort and a no-op when there's no parent or the parent is
  gone. Mirrors mcp_agent_orchestrator._append_sub_task_id.

Tests (tests/task_lineage_test.py, 5): child records parent + parent
lists child, multiple-children append + dedupe, no-parent no-op,
missing/empty parent safe, list_tasks(parent=...) filter. Full suite
471, OK.

Closes #111
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

fix(tasks): wire parent_task_id lineage end-to-end on the HTTP path

0 participants