Add progress updates for inbound A2A tasks - #47
Merged
Conversation
dimavrem22
force-pushed
the
feat/a2a-worker-progress
branch
3 times, most recently
from
August 15, 2026 04:12
b1dfa9b to
a60ffae
Compare
dimavrem22
force-pushed
the
feat/a2a-worker-progress
branch
from
August 15, 2026 04:45
a60ffae to
ef062cd
Compare
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.
Executive Summary
This PR makes long-running inbound A2A work visible without exposing worker internals or waking requester agents.
Description
Every created or message admission first verifies the exact authoritative task, context, active state, and latest caller-role message. The durable payload is rebuilt from the authoritative message parts and task caller metadata, so webhook-supplied caller IDs, organization IDs, handles, and text cannot reach the receipt, registry, or model turn. Inbound A2A dispatch then records acknowledgement and progress delivery in the durable task registry.
Progress runs as a child of the active worker turn, retries uncertain active delivery after five seconds, and stops when the task settles, requests input, or the gateway shuts down. Delivery is matched only against exact agent-role history; cadence and pending delivery remain anchored to the original durable start across process restarts and caller follow-ups. Restart catch-up validates every persisted nonfinal key against the authoritative exact task, context, active state, and latest caller-role message before acknowledgement, progress, or model work. It then enumerates both exact active states, deduplicates task IDs, and applies the same authoritative admission so work already advanced to
workingis not missed. A stale persisted generation is finalized without replay, while the current authoritative caller message is admitted once with canonical parts and caller metadata.Codex item-start events expose only bounded normalized identifiers to a fresh read-only auxiliary turn. That turn disables tools and external capability sources; the normal worker turn keeps its existing tools. A task-scoped cross-process gate persists the current caller-message fence and ensures explicit and implicit outcomes drain in-flight progress before replying. Cancellation and shutdown close admission, signal progress runners, and drain active work before returning. Once closing starts, every A2A event—including cancellation and sent-task updates—receives a retryable 503 before it can mutate state or wake a session. Cancellation reconstructs missing message IDs, tombstones only that generation, and permits one distinct authoritative active caller follow-up.
Reason
Long-running delegated work otherwise appears idle after submission. A prompt receipt and occasional concise updates make worker activity visible without spending requester turns on informational events. Stale persisted work and spoofed webhook data must never select the caller identity, organization, text, or generation that Codex executes, and restart discovery must include work already in the working state.
Decisions
submittedandworkingstates, deduplicate by task ID, and pass every candidate through authoritative admission.agentorROLE_AGENThistory confirms delivery, and uncertain active delivery retries after five seconds.Testing
.venv/bin/python -m pytest -q— 527 passed, 23 skipped..venv/bin/python -m pytest -q tests/test_a2a_gateway.py— 45 passed.python3.11 -m pytest -q tests/test_a2a_gateway.py— 45 passed.ruff check inkbox_codex/gateway.py tests/test_a2a_gateway.py— passed..venv/bin/python -m compileall -q inkbox_codex— passed.python3.11 -m pip wheel . --no-deps— passed.git diff --check— passed.4 + 6 = 10.