a2aproject / a2aproject/a2a-js

[Bug]: toCoreMessage defaults optional taskId to "" instead of undefined

Open Beginner friendly
#678 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
615
Forks
169
Avg merge
1d 6h
Merged PRs (30d)
21

Description

### What happened?

When a v0.3 message does not have a `taskId`, `toCoreMessage` in the compat layer sets it to `""` instead of leaving it as `undefined`:

```
// dist/compat/v0_3/client/index.js, line 996
taskId: compatMsg.taskId ?? "",
```

`taskId` is optional in v0.3, so not every message has one. Setting it to `""` causes problems for consumers that check whether `taskId` is present, because `""` looks like a value but is not a valid task ID. In JavaScript, an optional field that is not set should be `undefined`, not `""`.

### Relevant log output

```shell

```

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Research direction

The issue points to the file `dist/compat/v0_3/client/index.js` at line 996. Start by finding the source file for this compat layer, likely in `src/compat/v0_3/client/`. Look for the `toCoreMessage` function and the line setting `taskId`. Understand the v0.3 message schema to confirm `taskId` is optional. Change the default from an empty string to `undefined`. Run any existing tests for the compat layer to ensure the change works and doesn't break anything.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend-api-design
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.