The tool call said completed. The title read "Web search: acp" and the query was right there. What the client didn't have was the one thing a search is for: the pages it found.
Nothing had failed, which is what made it hard to see. Codex's app-server already returned the sources. The adapter between it and the editor never passed them on, and every status along the way still said the search worked.
This post follows that one field from Codex's output to what an ACP client receives, using my fix in codex-acp PR #819 as the map. Along the way it covers how an editor and a coding agent talk to each other, what the Agent Client Protocol (ACP) fixes in place, what it leaves to each implementation, and how it sits next to MCP.
It's written for a developer who has used a coding agent inside an editor but never integrated one. You don't need to know ACP. You do need to be comfortable reading JSON. I'll mark which claims come from the spec, which from the PR, and which from the test fixtures, because that distinction matters later. PR #819 is open as I write this.
The Symptom: A Completed Search With No Sources
Here is the problem as the PR describes it. ACP clients could show the query Codex ran, but they couldn't show which pages it found.
In an editor, that would look like this (reconstructed from the PR description and the fixtures, not captured from a live client). You ask the agent something that needs the web. A tool call appears, titled something like "Web search: acp." It runs, it finishes, and you can read the query. There is nothing to open: no source list, no links, no way to check where an answer came from.
Nothing in that sequence is an error. The search ran, the status says it completed, and the query is correct. A tool call that succeeded and carried no results is a perfectly valid thing for a tool call to be. A failure that announces itself gives you a place to start. An absence gives you nothing to grep for.
Who Is Talking to Whom
To follow the data you need the cast, and mixing up these three is the fastest way to get lost.
- The client is the editor or other interface the person is looking at. In ACP's vocabulary, clients manage the environment, handle user interaction and control access to resources.
- The agent is the program that uses a model to modify code. The spec says agents typically run as subprocesses of the client. As far as the editor can tell, the agent in this story is
codex-acp. - The adapter is what
codex-acpreally is: an ACP server that exposes Codex to ACP clients. It speaks ACP on one side and talks to Codex's app-server on the other, translating between them.
Codex reports what happened as typed items. In the test fixtures, a web search is an item shaped like {type: "webSearch", id, query, action, results}. According to the PR, standalone web search already returned its source data in the app-server's webSearch.results field. The data existed upstream the whole time.
So the bug is not "search doesn't return sources." It is "the adapter received sources and didn't pass them on." Both ends looked fine, and the loss happened in the translation.
Here is the adapter opened up, using the names that appear in the PR's tests:
Following One Search Through the Adapter
Inside the adapter, a WebSearchReporter turns the app-server item into ToolFacts, and AcpToolCallRenderer turns those facts into ACP updates. The contract test shows the seam: each reporter result is passed to renderer.render(...).
View the reporter change and its tests in PR #819.
The reporter is called at three moments, and the contract test exercises all of them:
webSearch: [ WebSearchReporter.started(search), WebSearchReporter.completed(search), WebSearchReporter.history(search), ],
started: the search has begun. The client should show a tool call in progress.completed: the search has finished. The client should show the outcome.history: the client reloaded an old session, and the adapter is replaying what happened.
The PR's problem statement says the reporter wasn't forwarding webSearch.results at moments two and three: "when a search completed or when a client reloaded session history." Moment one has nothing to forward, because the search hasn't finished, and the PR leaves it unchanged.
The test suite had the same blind spot as the client. Before this PR, the contract test covered web search with one line: a single history call on an item with no results at all. A fixture without results can't fail on missing results, so the suite was green for the same reason the client looked healthy. It never held the data in the first place.
What the fix emits
For a completed search the adapter now does two separate things.
First, it forwards the original results in rawOutput.results. It doesn't parse them into a schema first. The PR says this is deliberate: keep the payload intact rather than making the adapter depend on the full result schema.
Second, for each entry with a valid HTTP(S) URL, it also emits an ACP resource_link. The link uses the entry's title when there is one and the URL otherwise. Entries with malformed or non-web URLs stay in the raw results but aren't surfaced as clickable sources.
Two things are deliberately left alone. The in-progress update is unchanged. And if the app-server returns no results, the adapter doesn't invent links and doesn't add an output field.
The fixture, entry by entry
The contract test feeds the reporter one search item with six results, chosen to be awkward on purpose:
const search = { type: "webSearch" as const, id: "web", query: "acp", action: null, results: [ {url: "https://example.com/protocol", title: "Protocol docs", providerField: true}, {url: "https://example.com/other"}, {url: "invalid"}, {url: "file:///private"}, {snippet: "No URL"}, null, ], };
The snapshots render that item once per client profile (a Zed-style profile and an AIR profile), and the adapter also has a v2 conversion path, toV2SessionUpdates, which gets its own snapshot. Here is what happens to each entry:
| # | Entry | Stays in rawOutput.results | Becomes a resource_link |
|---|---|---|---|
| 1 | URL, title, and an extra providerField | Yes, extra key intact | Yes, named "Protocol docs" |
| 2 | URL only | Yes | Yes, named after the URL |
| 3 | "invalid" as the URL | Yes | No |
| 4 | file:///private | Yes | No |
| 5 | A snippet with no URL | Yes | No |
| 6 | null | Yes | No |
Six entries go into the raw output and two come out as links. The providerField survives, and so do the null and the snippet-only entry. If you remember one thing from the fixture, make it that split: raw data keeps everything, links keep only what the adapter can vouch for.
Here is the completed update the AIR snapshot expects. The Zed snapshot has the same content and differs only in rawInput.
{ "sessionUpdate": "tool_call_update", "toolCallId": "web", "title": "Web search: acp", "status": "completed", "content": [ {"type": "content", "content": {"type": "resource_link", "uri": "https://example.com/protocol", "name": "Protocol docs"}}, {"type": "content", "content": {"type": "resource_link", "uri": "https://example.com/other", "name": "https://example.com/other"}} ], "rawInput": {"query": "acp", "action": null}, "rawOutput": { "results": [ {"url": "https://example.com/protocol", "title": "Protocol docs", "providerField": true}, {"url": "https://example.com/other"}, {"url": "invalid"}, {"url": "file:///private"}, {"snippet": "No URL"}, null ] } }
The spec is consistent with this shape. A tool call's rawOutput is defined as any JSON value, so forwarding a payload the adapter doesn't fully understand doesn't break the contract. A resource_link requires a uri and a name, so a result with no title still needs something to put in name, and the fixture uses the URL. And the spec's content page says content from the agent is untrusted, which is a good reason not to promote file:///private into something a user might open.
Why rawOutput.results Has to Be There Twice
A tool call has two lives in ACP, and a client can meet either one first. Fixing only one of them would pass a demo and fail the next morning.
Live updates
When the model asks for a tool, the agent reports it with a tool_call update. As the tool runs, it sends tool_call_update notifications. The spec says updates are patches: every field except toolCallId is optional, and only the fields being changed need to be included. It also says that omitting rawOutput on an update leaves the previously reported value unchanged.
The consequence is simple. If the completed update doesn't carry the results, the client has no later message from that turn that will.
Here is the start of that lifecycle in the AIR snapshot, the in-progress message this PR leaves exactly as it was:
{ "sessionUpdate": "tool_call", "toolCallId": "web", "kind": "search", "title": "Web search: acp", "status": "in_progress", "rawInput": {"query": "acp", "action": null} }
The kind: "search" is one of the spec's tool kinds. It is a hint that helps a client choose an icon and decide how to present progress.
Replay
The second life starts when the person closes the editor and opens it again. If the agent advertised loadSession, the client can call session/load, and the agent must replay the whole conversation as session/update notifications. That replayed history is built from scratch rather than reused from the live messages. In the fixtures, a replayed web search arrives as a whole tool_call that is already completed, not as a patch on an earlier one:
{ "sessionUpdate": "tool_call", "toolCallId": "web", "kind": "search", "title": "Web search: acp", "status": "completed", "content": [ /* the same two resource_links */ ], "rawInput": {"query": "acp", "action": null}, "rawOutput": {"results": [ /* the same six entries */ ]} }
| Live completion | Replay | |
|---|---|---|
sessionUpdate | tool_call_update | tool_call |
kind | not sent in the AIR snapshot | "search" |
status | completed | completed |
content links | two resource_links | the same two |
rawOutput.results | all six entries | all six entries |
The envelope differs, as it should. The substance has to match. Before the fix, the reporter dropped the results on both paths. After it, the same rawOutput.results and the same two links arrive whether you watched the search happen or opened the session a week later. The v2 snapshot checks this too: both moments come out as tool_call_update entries carrying the same links and the same raw results.
Replay is the path most likely to rot. Live updates get exercised constantly because people watch them. Replay gets exercised when someone reopens a session, which is rarer, and which is exactly when a missing source list makes an old answer impossible to check.
Checking a captured update
Save the completed AIR update above as completed.json. This small check reads that file with Node and tests the two things a reader of the search depends on. Save it as check-search.mjs and run node check-search.mjs in the same directory.
import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; const update = JSON.parse(readFileSync("completed.json", "utf8")); const results = update.rawOutput.results; const links = update.content .filter(block => block.type === "content") .map(block => block.content) .filter(item => item.type === "resource_link"); assert.equal(results.length, 6); assert.equal(results[0].providerField, true); assert.deepEqual( links.map(({ name, uri }) => [name, uri]), [ ["Protocol docs", "https://example.com/protocol"], ["https://example.com/other", "https://example.com/other"], ], );
Try deleting the second link from content while keeping all six raw results. The first two assertions still pass. The last one identifies exactly which source the editor lost. To check replay, save the corresponding replayed tool call as a second file and run the same assertions against it. Its message type changes, but these fields should agree.
What Was Tested (and What Wasn't)
The difference between these two lists decides how much to trust everything above, so I'll be exact. Every item comes from the PR description.
Verified:
- Three regression snapshots failed on the original reporter and passed with the patch, and all 23 focused tests passed.
- Coverage includes ACP v1 for standard Zed-style clients and for AIR clients, ACP v2, live completion, history replay, missing results and invalid URLs.
- Typecheck, the package build, and ACP v1 and v2 initialization over stdio passed.
Not verified:
- The full local suite did not finish. Seven client-suite failures were observed, and they also reproduced on the upstream base.
- A signed-in standalone search could not run in my environment because the app-server needed to write to a read-only filesystem.
So the results in those tests are fixtures, not a live capture. The snapshots prove what the adapter does with a payload shaped like the one the app-server returns. They don't prove what a real Codex session sends on a given day, and they don't prove how any particular client renders the links. The PR also states a limit on the fix itself: it doesn't make hosted search return sources the app-server didn't provide.
Two more facts keep this honest. The PR is open, not merged, and has no review yet. And its description discloses that the implementation and tests were prepared with Codex.
Why Editors and Agents Need a Shared Protocol
If you have read my MCP post, the shape of the problem will be familiar. Without a standard, every AI application writes custom code for every tool it wants to reach. That was the N×M problem, and MCP turned it into N+M.
The same arithmetic applies one layer up, between editors and agents. Without a shared protocol, an editor that wants to host a coding agent needs a separate integration for each agent, and each agent has to learn each editor's way of showing tool calls, asking permission and reloading history. With one, an editor implements ACP once and every ACP agent can plug in, and an agent implements it once and every ACP editor can host it.
PR #819 is a small proof of why that matters. The bug lived in one adapter, and the fix is expressed in protocol terms (rawOutput, resource_link, session/update), so it isn't tied to one editor's code.
What the protocol standardizes is the envelope. It uses JSON-RPC 2.0 with two kinds of message: methods, which are request-response pairs, and notifications, which are one-way and never get a reply. Everything in the next section is built from those two.
One Session, Start to Finish
Here is the flow the spec describes, with our web search sitting inside it:
Initialization
The client opens with initialize, sending an integer protocol version and the capabilities it supports, such as fs and terminal. The agent replies with the version it will use and its own capabilities:
{ "jsonrpc": "2.0", "id": 0, "result": { "protocolVersion": 1, "agentCapabilities": { "loadSession": true, "promptCapabilities": {"image": true, "audio": true, "embeddedContext": true}, "mcpCapabilities": {"http": true, "sse": true} }, "agentInfo": {"name": "my-agent", "title": "My Agent", "version": "1.0.0"}, "authMethods": [] } }
Two rules do most of the work. The version is a single integer that only changes for breaking changes, and an agent that supports the requested version echoes it back. Capabilities that are omitted are treated as unsupported, which is how the protocol grows without breaking old clients: a new feature is a new capability, and nobody uses it until both sides have said they can. For this story, loadSession is the capability that makes replay possible at all.
Creating or loading a session
A session is one conversation with its own context and history. session/new takes an absolute working directory and the MCP servers the agent should connect to:
{ "jsonrpc": "2.0", "id": 1, "method": "session/new", "params": {"cwd": "/home/user/project", "mcpServers": []} }
The agent must reply with a unique session ID, such as {"sessionId": "sess_abc123def456"}.
To return to an old conversation, the client calls session/load, but only if the agent advertised loadSession. The agent must replay the entire conversation as ordinary session/update notifications, then answer the load request itself. The replayed tool_call shown earlier is exactly what arrives on that path. Agents that advertise sessionCapabilities.resume also support session/resume, which reconnects without replaying anything.
Prompting and streamed updates
session/prompt carries the user's message as an array of content blocks. Clients may only send the types the agent advertised in promptCapabilities, with text and resource links as the baseline. Until the turn ends, the agent narrates through session/update notifications: message chunks, thought chunks, plans, tool_call and tool_call_update. A tool call moves through pending, in_progress, and then completed or failed, which is the stream that started and completed feed. The turn is over when the agent answers the original prompt request with a stop reason such as end_turn. If the user cancels, the client sends a session/cancel notification. The agent may still send updates, but must do so before it answers the prompt with the cancelled stop reason.
Permissions
Some tool calls shouldn't run without a human saying yes. For those, the agent calls a method on the client, session/request_permission, with the tool call and a set of options:
{ "jsonrpc": "2.0", "id": 5, "method": "session/request_permission", "params": { "sessionId": "sess_abc123def456", "toolCall": {"toolCallId": "call_001"}, "options": [ {"optionId": "allow-once", "name": "Allow once", "kind": "allow_once"}, {"optionId": "reject-once", "name": "Reject", "kind": "reject_once"} ] } }
The client answers with {"outcome": {"outcome": "selected", "optionId": "allow-once"}}, or with a cancelled outcome if the turn was cancelled in the meantime.
The spec's security notes are worth reading before you build either side. Clients shouldn't auto-approve based only on a tool call's title or an option's name, since those are agent-authored text. Agents shouldn't treat an outcome they don't recognize as approval, and should ask again if the command or resolved target changes after approval.
The web search fixtures never exercise this path. I'm showing the spec's own example rather than implying the PR covers it.
Where Each Implementation Still Has to Decide
The protocol fixes the envelope. A surprising amount of real behavior is left open on purpose, and each decision belongs to a specific party. The bug in this post lived in the first item.
The shape of rawOutput
The spec accepts any JSON. Whether to forward a provider's payload as it came or reshape it is the adapter's call, and PR #819 chose pass-through. Every field stays available to clients that know what to do with it, and the adapter vouches for none of it. That is why the links are built separately, from only the entries it can validate.
What counts as a link
Content from the agent is untrusted, so deciding which URLs become links is a real decision. The PR draws the line at valid HTTP(S) URLs and keeps the rest in the raw data. A client can still apply its own policy on top.
Remembered permissions
When a user picks an allow_always option, the spec says the agent stores that decision and chooses its scope and duration. The kind is only a UI hint, and the option's name is meant to describe the scope. Two agents can honor the same click differently.
Presentation
Tool kind helps a client choose an icon, but the client decides what the tool call looks like. Even the existing snapshots in this PR show two client profiles receiving slightly different rawInput for the same search: the Zed-style profile includes the original item's type and id, and the AIR profile sends only query and action. I didn't trace why they differ, and I'm not claiming a cause. It's a reminder that one adapter serves clients with different expectations.
Fallbacks for missing capabilities
If a client doesn't advertise support for notices, the spec lets the agent use an ordinary message instead. Every combination of capabilities has to be survivable, and that burden sits with the implementer.
The pattern is that ACP tells you what a valid message looks like. It doesn't tell you what a good one carries. The failure in this post was a completed tool call with no results, which is a perfectly valid message, and nothing in the protocol complains about it.
ACP and MCP in the Same Workflow
It is tempting to treat these as two protocols competing for the same job. They sit on different edges of the same system.
- ACP connects a client to an agent: the editor on one side, the thing that edits code on the other.
- MCP connects an agent to tools and data: files, databases, issue trackers and so on.
The vocabulary collides, so it's worth being explicit. In ACP, the client is the editor. In MCP, a client is a connector that the host creates for each server. When both protocols are in play, the agent runs the model and holds the MCP connections, which is the role my MCP post calls the host. The editor still has a say: it chooses which MCP servers the agent connects to when the session is created.
The seam is in the session flow above. session/new includes an mcpServers list:
{ "name": "filesystem", "command": "/path/to/mcp-server", "args": ["--stdio"], "env": [] }
The spec requires every agent to support stdio MCP servers, and makes HTTP and SSE optional behind mcpCapabilities. It also notes that a client can use this to give the model tools of its own by including its own MCP server. The content model lines up too: ACP's ContentBlock is a superset of MCP's, so an agent can forward content from an MCP tool's output to the client unchanged.
So a single turn can involve both. The editor sends a prompt over ACP. The agent calls a tool on an MCP server, then reports that tool call back to the editor over ACP as a tool_call with updates.
One caution from this PR. In the fixtures, web search is modeled as an app-server item of type webSearch, not as an MCP tool call. It reaches the client through ACP's tool-call updates because the adapter puts it there. A workflow can use both protocols at once and still produce a result that belongs to neither, and that gap is where the adapter has to make a decision.
A Shorter Example, at a Different Layer
I hit a related shape in agent-orchestrator PR #9532. It is not an ACP bug. It's a native Codex app-server plan-progress bug, in a different project.
A Codex plan update reported one completed step and three pending ones. When the turn ended successfully, the stored plan and the transcript summary jumped from 1/4 to 4/4. Turn completion was treating a successful turn as proof that every plan step was done, which it isn't. The PR marks native Codex plan updates so that settlement keeps their explicit statuses, and leaves other harnesses on the existing behavior.
Its description verifies the fix with a deterministic app-server fixture running through real daemons, not a signed-in Codex session. That PR is also open and unmerged.
The family resemblance with the search bug is the point. In both cases one layer reported a clean state, and the layer next to it quietly reinterpreted it. A completed turn says nothing about plan steps, and a completed search says nothing about its sources.
A Grid for Reviewing an Adapter
Both fixes come down to the same review habit. Pick a fact the user would hate to lose, then check every path it can travel and every place the protocol lets it land.
For the search, the paths are live completion, history replay and the v2 conversion. The places are rawOutput, which carries fidelity, and content, which carries display. The snapshots give this grid after the fix:
| Path | rawOutput.results | content links |
|---|---|---|
| Live completion | all six entries | two valid links |
| History replay | all six entries | two valid links |
| ACP v2 | all six entries | two valid links |
A field that fills a cell on one row and not the next is a bug waiting for someone to reopen a session. Four checks follow from the fixtures:
- Read the replay path separately from the live one. They are different code, and replay is the one nobody watches.
- Forward the raw payload, then promote only what you can validate. The six-entry split exists so a client with better knowledge can still use what the adapter wouldn't vouch for.
- Write the fixture with the ugly entries.
null, an invalid URL, afile:///URI and an unknown field are what real providers send, and the old test was green because it held none of them. - Say what the fixture proves. A snapshot shows how your adapter reshapes a payload. It doesn't show what a live provider sends today, or how a client draws it.
A search that finishes with no sources is valid ACP. Whether it's a good integration is a question for whoever wrote the adapter.
References
- codex-acp PR #819 and the issue it fixes, #725
- agent-orchestrator PR #9532
- ACP spec: overview, initialization, session setup, prompt turn, tool calls, content
- My earlier posts: MCP and LLM Evaluation

