Fix three bugs that crash the CLI regardless of which A2A server you're talking to - #8
Open
shaileshpadave wants to merge 1 commit into
Open
Fix three bugs that crash the CLI regardless of which A2A server you're talking to#8shaileshpadave wants to merge 1 commit into
shaileshpadave wants to merge 1 commit into
Conversation
1. display_task_info() is keyword-only for `color` (has * in its signature) but was called as a positional argument in `send` command, causing a TypeError on every invocation without --wait. 2. task.model_dump(by_alias=True) in `get --json` omits mode="json", so TaskState enum values are not serialised — json.dumps raises TypeError on any completed task. 3. Task.artifacts is typed as Any|None, so Pydantic passes raw dicts through without converting them to Artifact objects. Accessing art.name and art.parts then crashes with AttributeError. Both display_task_info() and _extract_part_text() now handle dict and Artifact objects interchangeably.
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.
Hey! We were testing this CLI against an A2A server and ran into three crashes that happen with any server — not specific to our setup. Sharing the fixes in case they're useful.
What breaks and why
1.
sendcrashes immediately (without--wait)display_task_infohas*in its signature, makingcolora keyword-only argument:But it's called positionally in the
sendcommand:Fix: pass it as a keyword argument:
display_task_info(task, color=color)2.
get --jsoncrashes on any task that has a statusTaskStateis a Pydantic enum.json.dumpsdoesn't know how to serialise Python enums, so it raisesTypeError. The fix is one extra argument tomodel_dump:3.
get(andsend) crash when the task has artifactsTask.artifactsis typed asAny | None, so Pydantic passes the raw JSON dicts straight through rather than converting them intoArtifactobjects. When the display code then doesart.nameandart.parts, it getsAttributeError: 'dict' object has no attribute 'name'.The fix handles both cases (proper object and raw dict) in
display_task_infoand_extract_part_text.All three of these fail before any server-specific behaviour kicks in, so they affect every user of the published package. Happy to adjust anything if you'd like the fix structured differently!