Skip to content

Commit f922ff6

Browse files
kdziedzic70Krzysztof Dziedzic
andauthored
test: force itk agent to create task before updating the status (#980)
# Description Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Follow the [`CONTRIBUTING` Guide](https://github.com/a2aproject/a2a-python/blob/main/CONTRIBUTING.md). - [ ] Make your Pull Request title in the <https://www.conventionalcommits.org/> specification. - Important Prefixes for [release-please](https://github.com/googleapis/release-please): - `fix:` which represents bug fixes, and correlates to a [SemVer](https://semver.org/) patch. - `feat:` represents a new feature, and correlates to a SemVer minor. - `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking change (indicated by the `!`) and will result in a SemVer major. - [ ] Ensure the tests and linter pass (Run `bash scripts/format.sh` from the repository root to format) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕 Co-authored-by: Krzysztof Dziedzic <dziedzick@google.com>
1 parent 1863359 commit f922ff6

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

.github/workflows/itk.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
run: bash run_itk.sh
2929
working-directory: itk
3030
env:
31-
A2A_SAMPLES_REVISION: itk-v.015-alpha
31+
A2A_SAMPLES_REVISION: itk-v.016-alpha

itk/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ podman system migrate
3535
You must set the `A2A_SAMPLES_REVISION` environment variable to specify which revision of the `a2a-samples` repository to use for testing. This can be a branch name, tag, or commit hash.
3636

3737
Example:
38-
```bash
38+
```
3939
export A2A_SAMPLES_REVISION=itk-v.015-alpha
4040
```
4141

@@ -58,6 +58,7 @@ The script will:
5858
To enable debug logging and persist logs for inspection:
5959

6060
1. Set the `ITK_LOG_LEVEL` environment variable to `DEBUG`:
61+
6162
```bash
6263
export ITK_LOG_LEVEL=DEBUG
6364
```

itk/main.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
Message,
3333
Part,
3434
SendMessageRequest,
35+
Task,
3536
TaskState,
37+
TaskStatus,
3638
)
3739
from a2a.utils import TransportProtocol
3840

@@ -198,7 +200,16 @@ async def execute(
198200
context.context_id,
199201
)
200202

201-
await task_updater.update_status(TaskState.TASK_STATE_SUBMITTED)
203+
# Explicitly create the task by sending it to the queue
204+
task = Task(
205+
id=context.task_id,
206+
context_id=context.context_id,
207+
status=TaskStatus(state=TaskState.TASK_STATE_SUBMITTED),
208+
history=[context.message] if context.message else [],
209+
)
210+
async with task_updater._lock: # noqa: SLF001
211+
await event_queue.enqueue_event(task)
212+
202213
await task_updater.update_status(TaskState.TASK_STATE_WORKING)
203214

204215
instruction = extract_instruction(context.message)

0 commit comments

Comments
 (0)