Skip to content

fix: set Kind discriminator in ToLegacyTask A2A conversion#2038

Merged
EItanya merged 2 commits into
kagent-dev:mainfrom
Daniel-Vaz:main
Jun 17, 2026
Merged

fix: set Kind discriminator in ToLegacyTask A2A conversion#2038
EItanya merged 2 commits into
kagent-dev:mainfrom
Daniel-Vaz:main

Conversation

@Daniel-Vaz

Copy link
Copy Markdown
Contributor

Description

Fix Pydantic validation error when resuming tasks after ask_user HITL interrupt.

Problem

When converting A2A v1 tasks back to legacy v0 format in ToLegacyTask(), the Kind discriminator field was not being set. This caused tasks serialized through the Go controller to be rejected by Python's Pydantic validation with:

ValidationError: 1 validation error for KAgentTaskResponse
data.kind
  Input should be 'task' [type=literal_error, input_value='', input_type=str]

Solution

Add Kind: trpc.KindTask to the trpc.Task struct literal in ToLegacyTask(), matching the pattern already used by toLegacyMessage().

Changes

  • convert.go: Set Kind field in legacy task conversion
  • convert_test.go: Add regression assertion in assertBackwardTaskFixture()

Testing

  • All existing tests pass
  • New assertion prevents future regressions

Fixes #2037

Copilot AI review requested due to automatic review settings June 17, 2026 14:19

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Signed-off-by: dvaz-external <dvaz.external@epo.org>
@github-actions github-actions Bot added the bug Something isn't working label Jun 17, 2026
@Daniel-Vaz

Copy link
Copy Markdown
Contributor Author

Build error doesn't seem related with the change:

ERROR: process "/bin/sh -c mkdir -p /opt &&     cd /opt &&     git clone --depth 1 --revision=ef4afdef4d711ba21a507d7f7369e305f7d3dbfa https://github.com/anthropic-experimental/sandbox-runtime.git &&     cd sandbox-runtime &&     npm install --save-exact lodash-es@4.18.1 @types/lodash-es@4.17.12 &&     npm install --save-exact brace-expansion@5.0.6 &&     npm run build &&     npm prune --omit=dev &&     npm install -g --ignore-scripts" did not complete successfully: exit code: 132

@Daniel-Vaz

Daniel-Vaz commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Using version 0.9.8 of the controller:

image

Questions were answered but there is no further reaction in the UI, checking the Agent logs I see the error logs describe in the issue #2037


Using a locally built version with the changes suggested in this PR

image

@jmhbh jmhbh 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.

makes sense to me, LGTM

@EItanya EItanya merged commit 01c3273 into kagent-dev:main Jun 17, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] KAgentTaskResponse validation error: data.kind empty after ask_user interrupt when resuming task

4 participants