Skip to content

fix(validate): report the env writer's progress on the event loop, which a Temporal heartbeat needs - #335

Merged
earakely-scale merged 1 commit into
mainfrom
fix/validation-progress-on-loop
Oct 26, 2026
Merged

earakely-scale merged 1 commit into
mainfrom
fix/validation-progress-on-loop

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Why. Since #325, A2AAgent.validate() writes the example env in a thread (asyncio.to_thread) and calls on_progress from that thread. The hub worker's on_progress sends a Temporal activity heartbeat, which only works on the activity's event loop. So every hub validation now fails at its first progress line with RuntimeError: no running event loop. That started when the worker took 0.9.1357. A validation of claude-code-cli in prod failed this way on both attempts and wrote nothing.

Change. The writer's progress lines go through loop.call_soon_threadsafe, so on_progress runs on the validator's event loop like every other line. It also keeps the caller's context, which the heartbeat needs to find its activity. The lines arrive before the write's await returns, since the thread schedules them before its result.

Test. A new unit test checks that the writer's line reaches the callback on the event loop with the caller's context variables. On main it fails with the same RuntimeError: no running event loop; with this change it passes. The CLI and A2A agent unit tests pass (625).

Labelled bump-version, so merging it cuts the release that fixes hub validations once the worker pins it.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

Writer progress now reaches on_progress on the validator’s event loop.

  • Environment-writing progress reaches callbacks on the validator’s event loop.

Diagram

sequenceDiagram
    participant V as Validator event loop
    participant W as Writer thread
    participant P as Progress callback
    V->>W: asyncio.to_thread(write_validation_env)
    W->>V: call_soon_threadsafe(report, line)
    V->>P: Report progress with copied caller context
    W-->>V: Writer completes
    V->>V: Await _run
Loading

Reviews (1) · Last reviewed commit: "fix(validate): report the env writer's p..." · Reviewed by Greptile

…ich a Temporal heartbeat needs

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@earakely-scale

Copy link
Copy Markdown
Collaborator Author

End to end, through the hub worker's real activity. I ran prod's worker image (018ae5b445) as uid 65532 against dev, with the worker's own validate_a2a_agent activity. It ran under a local Temporal dev server, so heartbeats and progress signals run as they do in prod, on the dev test agent fd4305-validate-test.

Worker image Result
as deployed (0.9.1357) the activity fails with RuntimeError: no running event loop, and 0 progress signals reach the workflow, as in prod
with this branch's wheels (framework and protocol) completes in 3 min 15 s with 96 progress signals; all 7 extensions validated, and the agent's results rewritten at 18:03:23Z

The containers, the images and the temporary credentials are deleted.

@earakely-scale
earakely-scale merged commit 01ba2f4 into main Oct 26, 2026
14 checks passed
@earakely-scale
earakely-scale deleted the fix/validation-progress-on-loop branch October 26, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant