Skip to content

feat(a2a): stream agent image pull progress and color-code readiness indicator - #933

Merged
edenreich merged 3 commits into
mainfrom
feat/agent-pull-progress
Jul 18, 2026
Merged

edenreich merged 3 commits into
mainfrom
feat/agent-pull-progress

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Summary

Closes #542.

During local A2A agent startup the only feedback was a flat, dim A2A: n/m segment - the image pull discarded all of its output, so the user had no idea whether an agent was downloading, stuck, or failed. This PR makes agent startup observable while keeping the main chat view clean:

  • Main view: the A2A: n/m indicator is now color-coded - green once all agents are ready, red while any agent has failed, dim during normal startup. Nothing else is added to the main view.
  • Expanded view (indicator or /a2a): now live-updates on AgentStatusUpdateEvent instead of only rebuilding when opened. During a pull the agent row shows layer-count progress (Pulling image: python:3.12 (3/7 layers)) advancing in place; state transitions (pulling image -> starting -> waiting -> ready/failed) and the (n/m ready) title update without reopening. Multi-line docker errors are flattened so a failed agent stays a single row.
  • Pull path fix: AgentManager.pullImage previously shelled out to a hardcoded docker pull with stdout/stderr sent to io.Discard, bypassing the ContainerRuntime abstraction entirely (Podman users got docker for pulls). It now routes through ContainerRuntime.PullImage, which streams output through a new layer-counting parser (internal/services/pull_progress.go) shared by the Docker and Podman runtimes.

How it works

Non-TTY docker pull emits one line per layer state change (<id>: Pulling fs layer / Already exists / Pull complete); podman emits Copying blob <id> ... done. The parser counts registered vs completed layers and fires a callback only when the counts change (no throttling timer needed). Progress flows over the existing push pipeline - SetPullProgressCallback -> StateManager.UpdateAgentPullProgress (new LayersDone/LayersTotal fields on AgentStatus) -> the existing AgentStatusUpdateEvent re-render. No new event types, no polling.

Testing

  • Table-driven parser tests: docker fresh pull, Already exists, podman output, garbage lines, changed-only firing.
  • A2A agents view test for live updates (TestA2AAgentsView_LiveUpdatesOnAgentStatusEvent) and status bar test for the indicator color decision (TestInputStatusBar_A2AIndicatorColor).
  • Verified end-to-end against real docker pulls by driving infer chat in tmux: captured the layer counts advancing live in the open /a2a view, the indicator turning red on a failed agent and green when all agents were ready, and the flattened single-row failure details.
  • task build, task test, task lint all clean; no mock regeneration needed (ContainerRuntime.PullImage had no callers or fakes).

Follow-up

…indicator

Stream docker/podman pull output (previously discarded) through the
ContainerRuntime abstraction, deriving layer-count progress that flows
over the existing status pipeline into the UI:

- The A2A: n/m indicator is now color-coded: green when all agents are
  ready, red while any agent has failed, dim during startup.
- The A2A agents view (/a2a) live-updates on AgentStatusUpdateEvent
  instead of only when opened, showing per-agent state, pull progress
  as layer counts, and flattened single-line failure details.
- pullImage now routes through ContainerRuntime.PullImage, fixing the
  Podman bypass where pulls were hardcoded to docker.

Closes #542
@edenreich
edenreich requested a review from a team as a code owner July 18, 2026 19:32
Comment thread internal/services/pull_progress.go Resolved
@edenreich
edenreich merged commit 882e8c2 into main Jul 18, 2026
1 check passed
@edenreich
edenreich deleted the feat/agent-pull-progress branch July 18, 2026 19:45
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.149.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add progress bar for local agents pulling

1 participant