codex icon indicating copy to clipboard operation
codex copied to clipboard

Regression: encrypted MultiAgentV2 messages remove readable task audit trail

Open ignatremizov opened this issue 5 months ago • 49 comments

What version of Codex CLI is running?

Originally reported after #26210 (Encrypt multi-agent v2 message payloads, merged 2026-06-05; post-0.137.0). Source review refreshed on 2026-10-26 against upstream main at 245691b2dc66. References to my fork below are from the maintained 0.164.0 integration.

What subscription do you have?

Not subscription-specific.

Which model were you using?

This concerns the default encrypted delivery used by MultiAgentV2 spawn_agent, send_message, and followup_task.

What platform is your computer?

Not platform-specific.

What terminal emulator and version are you using (if applicable)?

Not terminal-specific.

Codex doctor report

Not applicable to this source-level report.

What issue are you seeing?

This issue remains unresolved in upstream's default MultiAgentV2 workflow. Encrypted message delivery is still the default. Users still cannot inspect the exact tasks delegated by the parent, follow-up instructions, or intermediate child-to-parent messages when those payloads are encrypted.

#35845 added conditional plaintext-response handling and provider compatibility, but did not change that default or add a user-configurable plaintext delivery policy. The response flag and non-OpenAI provider handling are described below. Even when that separate plaintext path is used, normal parent/child transcript surfaces still omit readable messages.

This concerns messages explicitly sent between agents. The requested audit trail does not require exposing private reasoning.

What steps can reproduce the bug?

  1. Use the default OpenAI MultiAgentV2 workflow and delegate a task with spawn_agent; optionally send follow-ups with send_message or followup_task.
  2. Inspect the parent activity rows, switch to the child, and inspect its normal transcript/history.
  3. The encrypted task/message payload is unavailable locally as readable text.
  4. Resume the session and check the same surfaces. Knowing that a child ran or seeing its terminal answer does not establish what assignment or intermediate handoff it received.

What is the expected behavior?

Users should be able to choose readable inter-agent delivery and inspect a structured operational transcript with sender/recipient attribution. If encrypted delivery is retained, an explicit readable audit-copy mode is also useful.

The chosen representation should survive live display, history, resume, pagination, and agent switching. Ciphertext should never be presented as readable message text.

Current upstream status (2026-10-26)

Encrypted delivery remains the upstream default. All three bundled V2 schemas still mark message encrypted, and ordinary direct calls without an explicit plaintext response marker follow the encrypted path. Users have no upstream equivalent of my fork's delivery-policy setting.

#35845 added a conditional plaintext path and related provider compatibility. A direct collaboration response must explicitly carry encrypted_function_args: [] to be classified as plaintext; an absent marker does not select plaintext. For non-OpenAI provider requests, the client removes this OpenAI-specific metadata when serializing history: provider handling. This is provider-response metadata, not a user flag that disables encryption in the default OpenAI workflow.

The V2 helper also has a separate Code Mode plaintext path. Neither exception changes the default encrypted schema or restores a readable audit copy for encrypted calls.

The unresolved delivery and transcript gaps, with references pinned to the reviewed upstream commit:

Area Current behavior Source
Delivery selection Encrypted delivery remains the default. Plaintext direct calls require an explicit response marker; there is no equivalent of my fork's user-configurable three-mode delivery policy. Direct-call classification, plaintext/encrypted helper, send/follow-up schemas, spawn schema
Parent activity SubAgentActivityEvent and the public activity payload still have no task/prompt field. The TUI renders the activity title with an empty detail list. Core event, API payload, TUI rendering
Child history The normal history builder ignores InterAgentCommunication; its response-item handler accepts hook-prompt user messages, not ResponseItem::AgentMessage. A readable canonical agent message therefore does not itself establish a readable typed transcript. Rollout handling, response-item handling
Diagnostics Plaintext direct-call arguments are logged as [plaintext arguments]. The communication stream logs ciphertext when present and otherwise [plaintext], rather than the readable message. Tool log, communication log

Encrypted recipient input still deliberately selects the ciphertext representation: current conversion. A local audit copy needs its own persistence/presentation path; populating a runtime string alone does not make it visible.

Current implementation in my fork

The maintained implementation covers all three V2 communication tools:

[features.multi_agent_v2]
message_delivery = "plaintext" # encrypted | encrypted_with_audit | plaintext
  • plaintext emits one readable message, persists it, and delivers it with the contextual agent-message wrapper. No second audit payload is required.
  • encrypted_with_audit is the default in my fork. It requires encrypted message plus nonempty readable task_message. The sender's tool record and parent activity retain the audit copy; the recipient model still receives ciphertext.
  • encrypted retains opaque delivery without a readable assignment copy.

The audit copy in encrypted_with_audit is sender-supplied metadata, not decrypted ciphertext or cryptographic proof that both payloads match. The receiving child's encrypted message remains an opaque placeholder; my fork does not substitute the parent's audit copy into child model input or claim it recovered the exact plaintext.

The implementation also:

  • validates mode, required fields, and one combined 8 KiB UTF-8 payload limit before recipient resolution, restoration, or spawn;
  • preserves stored plaintext/encrypted provenance across resume rather than reinterpreting old messages under the current configuration;
  • carries full readable spawn/follow-up prompts through parent activity, applying configurable preview limits only when displaying them;
  • projects incoming agent messages into normal typed app-server/TUI history with sender/recipient provenance, canonical identities, encrypted placeholders, and live/resume/pagination handling;
  • retains readable audit content in communication diagnostics and rollout-trace interaction edges while keeping transport correlation separate;
  • exposes the latest accepted readable assignment through V2 list_agents as volatile registry metadata, not a durable delivery receipt.

Updated implementation commits:

Delivery and transcript contract.

Separately, my fork extends plaintext V1 send_input with attributed parent/child/sibling messages, distinct queued turns, receiver-selected durable mail, and optional commentary/final-response observation. This covers related coordination needs through one input operation; the V1 contract is documented separately.

Acceptance criteria

  • The selected delivery policy makes readable assignments available in parent tool history/activity without duplicating plaintext payloads unnecessarily.
  • Plaintext incoming messages appear in child transcripts with attribution. Encrypted incoming messages use a fixed opaque placeholder, never ciphertext presented as readable text.
  • Encrypted-with-audit delivery keeps audit metadata separate from recipient-model input and does not imply the audit text was decrypted or verified.
  • Live notifications, normal thread history, resume, pagination, and agent switching retain message identity, ordering, and duplicate suppression.
  • Communication diagnostics and rollout-trace edges distinguish readable content from encrypted transport identity.
  • Regression coverage exercises spawn_agent, send_message, and followup_task, delivery validation, parent/child presentation, and persisted history.

Related: #26210 introduced encryption; #35845 added conditional plaintext-response and provider compatibility handling while retaining encrypted delivery by default; #26753 concerns encrypted-schema validation failures; #33885 covers direct user corrections to V2 children.

ignatremizov avatar Jun 13 '26 08:06 ignatremizov

Guys, we don’t want to build Skynet and then be unable to audit what it’s doing.

ignatremizov avatar Jun 13 '26 08:06 ignatremizov

I too would like to be able to audit my agents… if we can’t audit agents… only providers can… it’s clear we are on a path to enterprise only has access to these tools, why restrict otherwise

septrcode avatar Jun 14 '26 01:06 septrcode

The auditability concern is no longer meaningfully opt-in for GPT-5.5 users on Codex 0.142.5.

[now applies to Sol and Terra, while 5.5 has been reverted to using v1 again]

The current GPT-5.5 model catalog sets multi_agent_version: v2, and the 0.142.5 runtime gives that value precedence over features.multi_agent_v2=false. In a fresh GPT-5.5 thread, features list says V2 is disabled, but spawn_agent still exposes the V2 task-path schema. A fresh GPT-5.4 thread with the same configuration uses V1 normally.

Because GPT-5.5 forces the encrypted V2 path, users selecting the current frontier model cannot choose the readable V1 delegation trail through the documented feature setting. That turns the loss of locally readable delegated-task content from an experimental opt-in tradeoff into mandatory behavior for that model.

The same forced surface also prevents selection of documented custom-agent profiles because it hides the agent type, model, and reasoning controls. This compounds the auditability problem: GPT-5.5 users cannot select the configured reviewer profile and also cannot inspect the plaintext task that a generic replacement received.

I have filed the configuration-precedence reproduction separately: https://github.com/openai/codex/issues/31097

Alek2077 avatar Jul 04 '26 09:07 Alek2077

Upd: https://github.com/openai/codex/pull/30867, and https://github.com/openai/codex/pull/30872 by @bolinfest and @rka-oai are directionally related, but they don’t address this issue yet.

The PRs add/prepare structured lifecycle logging for multi-agent communication, which is useful for operational observability. The gap here is specifically local auditability of the actual task/message text in rollout/history/replay/debug surfaces.

For encrypted MultiAgentV2 messages, the new logging path still falls back to encrypted_content when plaintext content is empty, so it will record an opaque encrypted payload rather than the human-readable task the model delegated.

A reminder that the desired behavior here is narrow: keep encrypted delivery if needed for some reason, and also persist a human-readable structured audit copy of spawn_agent / send_message / followup_task task text in the parent rollout history so users can later answer "what did this agent get asked to do?" without relying on provider-side visibility or opt-in trace logging.

ignatremizov avatar Jul 07 '26 13:07 ignatremizov

Please revert this! I need to be able to inspect those messages to debug my multi-agent workflows.

Who thought this is a good idea???

runfence avatar Jul 14 '26 07:07 runfence

I'm also being hit by this, playing around with GPT 5.6 Sol Ultra (which spawns sub-agents) and there is no way to introspect exactly what the main model sent the sub-agents, what on earth?! We have to be able to introspect exactly what inputs inference use, otherwise how are we supposed to be able to understand what went wrong, when things go wrong?

This seems like a completely bananas thing to implement, encrypt local content not to protect end-users, but to protect OpenAI from other providers extracting how the multi-agent stuff works? This basically makes the whole flashy new "Ultra" stuff unusable, as we have 0 introspection into what instructions they actually received when they started.

I came across the encrypted stuff some weeks or months ago even, thought it was just experimental things or things for enterprise users who sometimes want encrypted-at-rest stuff. Imagine my surprise when I now tried to integrate with the new stuff via app-server and y'all are trying to hide the actual prompts from us paying users?!

Please carefully consider resolving this as otherwise it becomes really hard to justify continuing to use codex as you're moving towards hiding stuff from us users rather than making it easier to work with codex.

embedding-shapes avatar Jul 14 '26 11:07 embedding-shapes

My current workaround: Not using subagents at all.

Aquaticat avatar Jul 14 '26 13:07 Aquaticat

My current workaround: Not using subagents at all.

Sorry to shamelessly plug my project in, but I just created stringbean to solve this problem.

You can use it to run your own agents in Codex, even non-OpenAI models.

ZenulAbidin avatar Jul 14 '26 13:07 ZenulAbidin

This is bad!

cooluser69 avatar Jul 14 '26 13:07 cooluser69

Moreover it doesn't really protect you from competition.

  1. There are ways to bypass it (I will not share them but it's easy)
  2. Anyone can fork and create their own client-side agents implementation that doesn't encrypt it cause agents don't really require any back-end functionality

runfence avatar Jul 14 '26 14:07 runfence

Update: #33030 removed last_task_message from list_agents and stopped tracking the most recent instruction in agent metadata. This makes the auditability problem described here even more significant: users can see that an agent exists and what status it has, but not what it was asked to do anymore at all.

Switching to the child thread does not fully replace this information because as mentioned, encrypted v2 task delivery is stored as opaque encrypted_content; the original readable delegation is not available in the local rollout for agent switching.

The #33030 description explains what was removed, but not why. Was this motivated by privacy, context size, correctness, or another constraint? Some attempt at building a moat? Anti-distillation? It's strange.

Agent inspection is operationally important for the average user. It should remain possible to answer:

  • What was this agent originally asked to do?
  • What follow-up task or message did it most recently receive?
  • Which readable instruction corresponds to an encrypted delivery?

One possible design is a configurable delivery policy:

  • encrypted only;
    • current design, not usable, but maybe some bad actors would want their agents to be inscrutable once they've infected a machine
  • encrypted delivery plus a plaintext audit copy;
    • burn more tokens, but could allow performance gains from encrypted deliverability if what I've understood about how OpenAI remote compaction works and they build something similar for inter-agent communication
  • plaintext only.
    • imo best design and was already working pre-#26210

This would preserve encrypted behavior while allowing users who prioritize local auditability or token efficiency to choose the appropriate tradeoff. At minimum, I think a readable task description should remain available somewhere in history, trace metadata, and/or list_agents.

ignatremizov avatar Jul 15 '26 11:07 ignatremizov

Update: #33885 documents another regression that makes the auditability problem here more significant.

#27173 rejects direct app-server turn/start and turn/steer input to MultiAgentV2 thread-spawn children. Merged PR #33841 now propagates that policy into the TUI: after a user explicitly switches to a child with Alt+Right or /agent, the composer is read-only and reports that direct input is disabled.

This means a user cannot directly correct a child that misunderstood its task, add a missing constraint, or steer an active child away from a bad approach. The only supported upstream route is to return to the parent, spend another parent-model turn asking it to relay the correction, and wait for an encrypted inter-agent message that this issue explains cannot be audited locally.

The child is still technically writable: parent-side AgentControl::send_input can submit ordinary input to the same thread. The restriction is specifically on user/app-server-origin input, so it converts an immediate, readable correction into a slower and opaque parent relay.

The desired behavior in #33885 is compatible with avoiding accidental child continuation: keep the parent as the default conversation target, clearly identify child threads, and require the user to explicitly switch/resume a child before writing to it. Once explicitly selected, the child should accept normal turn/start or turn/steer input and persist that correction as readable user history.

ignatremizov avatar Jul 17 '26 18:07 ignatremizov

The readable audit trail is genuinely load bearing for post-run debugging, not just compliance. Losing it on the multi agent case is where reproducing task failures gets impossible, since you cannot tell which subagent decision led to which change. Been running a side pipe that appends every tool call to an external event log I can query and replay later. etch.systems. Not saying it belongs in the CLI itself, but if a workaround here is useful I can share the ingest shape.

SaravananJaichandar avatar Jul 18 '26 03:07 SaravananJaichandar

@SaravananJaichandar current workaround is just to force GPT-5.6 family to use v1 MultiAgent tools by managing a custom model JSON catalog. For now, no upstream regressions identified in v1 behaviour.

Or, manage a codex fork with custom v2 MultiAgent tools following suggested implementation spec. It's just client code tools, Responses API handles custom implementations.

ignatremizov avatar Jul 18 '26 18:07 ignatremizov

Thanks, did not know you could force v1 via a custom model catalog. Useful workaround, filing away.

The gap I keep hitting even with v1 rollouts is external verifiability. When a customer or auditor later asks "what did the agent do on Tuesday," the local rollout is trustworthy for me but not for a third party who did not run the session. Have you had to answer that shape of question in your own workflow yet?

SaravananJaichandar avatar Jul 18 '26 18:07 SaravananJaichandar

@SaravananJaichandar no, the rollout is enough. Since that's the exact execution record already

ignatremizov avatar Jul 18 '26 18:07 ignatremizov

@SaravananJaichandar current workaround is just to force GPT-5.6 family to use v1 MultiAgent tools by managing a custom model JSON catalog. For now, no upstream regressions identified in v1 behaviour.

Or, manage a codex fork with custom v2 MultiAgent tools following suggested implementation spec. It's just client code tools, Responses API handles custom implementations.

Do you actually get the same prompts as if you're using V2? We wouldn't even know, as the prompt is kept completely secret on OpenAIs side. Sure, you can actually revert to old behaviour by not using Sol or Terra, but I think this issue is about solving the issue, not switching back to old stuff that might not even work the very same way.

embedding-shapes avatar Jul 19 '26 09:07 embedding-shapes

@embedding-shapes

Yeah it's the same. Because it's just a tools surface - like a set of MCP calls or plugins. The prompts don't change if it's Multi Agent v1 spawn_agent, v2 spawn_agent, or direct exec_command codex exec subagent calls, which was the case way before any native multi agent tools existed inside codex. This was the first orchestration wrappers people made, just scripts having one codex session spawning codex-sub processes. Switching and auditing was hard, so multi agent tools were added to Codex. That was the whole point, to see and switch fast between subagents contexts (see #2604). Multi Agent v2 is now regressing all that for some reason, encrypting communication and making follow-up prompts to subagents impossible.

I would even go farther to say that v1 prompts are just better, since v2 also has a strange mailbox queue subsystem and sibling agent discovery - so while a subagent works, a sibling subagent could in theory interrupt it and have it work on something else. With v1, only the main orchestrator knows which subagents were spawned (except sub-sub-agents when depth is more than 2, but those are usually explorer/awaiter agents anyways)

Only one thing that v2 improves upon v1 is that in v2, subagents are identified by a path-like task name. I.e., /root/agent-1, /root/researcher, /root/coder-submodule-phase-2 and so on. And this is model-visible, so followup task tools calls use that task name, which is more token efficient than in v1, which uses thread IDs - a long UUID like 019f5a50-d238-7000-b545-211f9fed72e6 - this uses more tokens than just /root/agent-1 for sending followup tasks or wait_agent calls. But! That's the only benefit.

I suggest staying on v1 for the foreseeable future. The models catalog override works for now for GPT 5.6 Sol and Terra.

ignatremizov avatar Jul 19 '26 11:07 ignatremizov

@ignatremizov

The prompts don't change if it's Multi Agent v1 spawn_agent, v2 spawn_agent, or direct exec_command codex exec subagent calls

How can you actually validate and/or know this though, when the prompts using V2 aren't surfaced anywhere where we can see them? For all we know, OpenAI could add/remove/change things in the prompt sent to the sub-agent, and we'd have no way of knowing, since it's all happening on their backend.

They're encrypted before being sent to the sub-agent, then the sub-agent locally again uses the cipher text for the inference call, there are at least two points where things can be changed without us knowing about it, as it's only cipher text we can see. I hope I'm wrong about this though and someone can correct me, but based on my understanding of reading the code this is how it works.

embedding-shapes avatar Jul 19 '26 17:07 embedding-shapes

@embedding-shapes Fine, v1 and v2 do not have byte-for-byte identical collaboration prompts. But, v2’s tool surface and model-visible instructions are not 'hidden backend prompts'. They are constructed by Codex locally and sent with the Responses API request.

All the sources are inspectable:

Also, the difference between "max" and "ultra" is just extra v2 guidance. on v1 - max and ultra reasoning have the exact same behavior. That is inspectable too: the root/subagent collaboration prompts, the proactive versus explicit-request mode text, and the code that adds those texts to model context.

Codex serializes the locally assembled instructions, input, and complete tool list into each Responses API request. There is no Codex path where a hidden MultiAgent tool schema is injected midway through that request.

The orchestration is entirely client-side. The v2 handler receives the spawn_agent call and creates the child through local AgentControl, while messages and follow-up tasks go through the local communication handler. The child inherits the parent’s base instructions, model, developer instructions, runtime policy, and cwd. For an ordinary local CLI session, that orchestration and tool execution happen on the Codex host - spawned agents use the same local environment and filesystem as the parent.

The encrypted part is specifically the delegated message. Codex stores it as encrypted_content and places that encrypted item into the child’s next model request here. That hiding of plaintext communication is exactly the what this issue is about. It does not imply that the whole v2 tool prompt or orchestration implementation is secretly supplied by the backend.

Something that is more opaque is techincally curated plugins, but they follow a similar inspectable path. They are synced from the public openai/plugins repository into $CODEX_HOME/.tmp/plugins (source) and installed beneath $CODEX_HOME/plugins/cache/<marketplace>/<plugin>/<version> (source). Once cached, their manifests, skills/prompts, and MCP configuration can be inspected locally; this loader code shows those files being loaded from the cached plugin root. Runtime MCP schemas are advertised by the configured MCP server, but the resulting model-visible specs still enter the same client-built tool list.

Could a hosted inference provider theoretically rewrite content in requests or apply additional undisclosed server-side instructions? Yes. That possibility exists for every hosted model API and cannot be disproved from client source. But it would be separate backend behavior, not how Codex’s v1 nor v2 orchestration is currently implemented. A naïve per-call mutation of a hidden prompt/tool prefix would also undermine prompt-cache reuse unless backed by considerably more deliberate late-binding or routing machinery. I have not seen evidence of such a mechanism here.

None of this makes the encrypted-message behavior acceptable. Even assuming completely benign backend behavior, users still cannot audit the exact task delegated by the parent.

If you want your own multi_agent tools, nothing is stopping you or me from creating a new tool namespace called multi_agent_v3 - can take inspiration from v1 and v2, make something greater. But all the prompts are in source. I made my own custom v2 implementation in my fork without encrypted content - that's how I updated the source analysis spec in the issue report. It's a local tools surface, not backend-Responses-API-supplied capability. In my fork, I can inspect what the agents command each other, and can send follow-up prompts.

OpenAI is a lot more open than Google Gemini or Anthropic or xAI Grok or many other providers at this moment, since the harness is the key to all of this. I thank them to allow me to be a super user.

ignatremizov avatar Jul 19 '26 18:07 ignatremizov