Skip to content

fix(subagent): attach subAgentId and subAgentName metadata to delegated task messages (#1407) - #1410

Open
teddiesloco wants to merge 1 commit into
VoltAgent:mainfrom
teddiesloco:fix/subagent-metadata-attribution
Open

teddiesloco wants to merge 1 commit into
VoltAgent:mainfrom
teddiesloco:fix/subagent-metadata-attribution

Conversation

@teddiesloco

@teddiesloco teddiesloco commented Sep 3, 2026

Copy link
Copy Markdown

Motivation

Fixes #1407.

When delegating tasks to sub-agents via delegate_task, the error task message fallback previously lacked metadata (subAgentId, subAgentName, parentAgentId), leading to asymmetric message structures during task failures.

Proposed Changes

  • Add subAgentId, subAgentName, and parentAgentId metadata to the fallback errorTaskMessage in delegate_task execution workflow within packages/core/src/agent/subagent/index.ts.
  • Aligns error message structure with normal execution task messages, ensuring UI and persistence layers can reliably group and filter all sub-agent interaction steps.

Summary by cubic

Adds subAgentId, subAgentName, and parentAgentId metadata to fallback messages created when delegate_task fails. Previously, these error messages lacked metadata, preventing UI and persistence layers from consistently grouping or filtering delegated sub-agent steps.

Written for commit cdba2c9. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Error messages from delegated tasks now include relevant sub-agent and parent-agent details, making failures easier to understand and troubleshoot.

@changeset-bot

changeset-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: cdba2c9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 656491dc-e59a-462f-9274-9001500307ba

📥 Commits

Reviewing files that changed from the base of the PR and between 44b4c8e and cdba2c9.

📒 Files selected for processing (1)
  • packages/core/src/agent/subagent/index.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The handoff error path now adds sub-agent and parent-agent metadata to the user task message.

Changes

Sub-agent message metadata

Layer / File(s) Summary
Record metadata on error tasks
packages/core/src/agent/subagent/index.ts
Error-path task messages now include the target sub-agent ID and name and the originating parent-agent ID.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to cdba2

Fallback delegated-task messages now carry the same sub-agent and parent-agent metadata as normal handoffs, allowing complete sub-agent conversations to be grouped consistently. No merge-blocking risk remains.

Suggested reviewers: omeraplak

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the motivation and proposed code change, and it references issue #1407. However, it does not include the repository checklist or clearly labeled current behavior, new behavior… Add the required PR checklist and complete the template sections. State the current and new behavior explicitly, document test coverage, docs and changeset status, and add reviewer notes or mark them as not applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the sub-agent change and the metadata added to delegated task messages. It is specific and related to the primary change.
Linked Issues check ✅ Passed The change satisfies issue #1407 by adding sub-agent metadata to fallback delegated task messages. The added subAgentId, subAgentName, and parentAgentId fields make error task messages consistent with…
Out of Scope Changes check ✅ Passed The summarized change is limited to one relevant file and adds metadata required for delegated sub-agent task messages. No unrelated changes are identified.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Full details: Description check

Explanation

The description explains the motivation and proposed code change, and it references issue #1407. However, it does not include the repository checklist or clearly labeled current behavior, new behavior, testing, documentation, changeset, and reviewer-notes sections.

Full details: Linked Issues check

Explanation

The change satisfies issue #1407 by adding sub-agent metadata to fallback delegated task messages. The added subAgentId, subAgentName, and parentAgentId fields make error task messages consistent with normal sub-agent interaction messages. [#1407]

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

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.

Sub-Agent Messages Are Stored as Supervisor User Messages

1 participant