Codex Subagent Context: What a Child Agent Can See

Updated
8 min read
One Codex chat branches into two subagent threads inside a shared boundary.
TL;DR

Give a Codex subagent a task it can finish from its own instructions, then check the child thread and the evidence it returns.

Codex subagent context is easiest to reason about when you separate three things: the history a child receives, the tools it can use, and the activity its client shows you afterward. Each answers a different question. A child may understand its assignment from a short handoff and still have the same workspace permissions as the parent.

For a small example, suppose you want to find why a React form clears when a save fails. One child can trace the submit handler. Another can look for an existing failed-save test. Both can bring back file names and evidence while the main thread holds the actual decision about the fix.

Make the assignment stand on its own

Give each agent the repository area, the behavior to look for, and the result you expect it to return. Include any assumption from the parent discussion that changes the answer. On a build that supports controlling a history fork, the Codex tool specification distinguishes a spawn with surrounding history from a spawn without it. The exact controls available depend on the client and release.

A useful first assignment looks like this:

Inspect the save handler and error handling in the form package. Trace what happens when the API rejects the request. Do not edit files. Return the handler name, the line that clears the form, and any test that covers that path. If the form package has several save flows, identify which one the current page uses.

The child can act on that request even if it missed the discussion that led up to it. Keep long background material in the project docs and direct the agent to the relevant section. The Pristren AGENTS.md guide shows where to put recurring repository instructions.

Set the real boundary on the parent session

OpenAI’s subagent documentation says that subagents inherit the parent’s sandbox and approval settings. A custom instruction to leave files alone describes the job. Choose a read-only permission mode at the session level when you need the runtime to enforce that boundary. Review what tools and data are available in the session before delegating sensitive work.

If two children have to write, give them clearly separate files or workspaces. If both findings concern the same handler, let the main agent own that edit. The Codex harness checklist explains how to make the resulting change reviewable.

Inspect the thread and keep evidence you control

The documented clients offer different ways to inspect a child’s work. In the desktop app, open the child thread from the activity in the main chat. In the interactive CLI, use the subagent thread selector described in the docs. Check the files and test results the child points to before relying on its summary.

The public GitHub report about encrypted MultiAgentV2 messages describes an auditability problem reported for a specific implementation. It is evidence about what those users could read in their logs. If your team needs a durable record, keep the scope, referenced files, test command, and result in your own work item or PR. Use stable IDs and confirmed outcomes for tool calls that change records, as in our agent failure recovery guide.

Choose how much history the child actually needs

A history fork can be convenient when the work depends on a decision made earlier in the conversation. Suppose the team already agreed that a failed form test should cover a server rejection, rather than local validation. A child that receives that history can use the decision. With a fresh thread, include the same decision in the assignment. Neither approach guarantees the child has read every file or knows which source of truth to use.

For a codebase question, try a handoff with four fields:

Click any column to sort
4 rows
ScopeThe settings form and the save handler it currently calls
QuestionWhich state update clears the form after a failed save?
Safe actionsRead files and existing tests in the approved workspace
Return formatFile and function, evidence, and any unresolved alternative

The form task gives a child all it needs to begin. It also gives you a way to grade the answer. If the result talks about a similarly named form from another package, use the file path and route in the result to spot the mismatch. Good instructions reduce the risk of an attractive summary about the wrong code.

With a full-history spawn, keep the explicit scope anyway. The inherited discussion might contain old hypotheses, discarded proposals, or an example from a different service. A short task card tells the child which part of the history matters now. In a fresh spawn, include the starting commit or branch when repository state can change during work.

Compare two responses before asking anyone to edit

Imagine the first subagent finds a call to reset the form inside the success handler. The second finds a test that resets the form after a successful save. Neither finding explains the reported symptom yet. Ask for the rejected request path and the assertion that an error leaves the entered values visible. The main thread should reconcile findings by following the code, even when two children agree.

A real review can also produce a useful “I could not tell.” If one child had only access to the UI repository and the form relies on a generated API client elsewhere, its report should say where the trace stopped. The main agent can then use its authorized view of the application, ask for a bounded follow-up, or return the missing dependency to the developer. Avoid mixing an unresolved hypothesis into a list of confirmed facts.

Keep responsibilities small when there is implementation work. It can be efficient for one agent to handle an unrelated documentation update while another changes a test. Two agents writing the same fixture can cause a merge conflict or leave an implementation and test that match by accident. Ask each child to report modified files and commands, then have one person or thread own the integration check.

Use the interface to answer a specific audit question

Thread activity helps when you need to know which agent responded, where it looked, or why it asked for approval. Check the child thread for the tool action and its result. If you are reviewing a claim that a test passed, look for the command and the status returned by the runner. A summary can point to the evidence, but the review is easier when the command is also in the work item.

There are two useful kinds of records here. During the session, the thread view helps you follow work in progress. Afterward, a short record of the task and evidence gives the team a reference they can use from a different client or fresh checkout. The second record can be a review note with the branch, relevant locations, test command and open question. Keep secrets and raw contents of private fixtures out of it.

If a request in the child thread needs approval, read the actual operation and compare it to the assignment. You may discover that an ordinary test requires a service you did not expect, or that the agent is about to read a directory outside the intended project. Stop that part of the work until the owner can decide how it belongs in the task. See the sandbox permissions guide for ways to identify the boundary.

Decide when parallel work helps

A good first use is a task with two independent evidence requests. One child follows the application path. A second checks existing tests and notes a missing case. The primary thread makes the decision and verifies the combined result. You can usually tell whether this saved time by looking at the evidence returned and how much coordination it took.

For a small question with a single obvious source, a focused read in the main thread may be easier. Likewise, a task with tightly coupled changes may benefit from one writer and an independent reviewer after the change exists. Compare the amount of reviewing and waiting with the time saved by parallel work. Delegation should make the job easier to understand when it is over.

For the form example, a useful completion record is a link to the actual save handler and a focused test. If a later bug report mentions another form, a reader should be able to tell whether the first result applies. Keep the exact version and tool surface in mind when comparing visibility across clients. The durable part of your workflow is the scoped assignment and the evidence it returns.

Keep handoffs readable across different clients

A teammate who opens the project in an IDE may see a different activity panel from the person who ran the job in the terminal. Write the handoff so it survives that difference. Use the actual task name, refer to the file or test, and say how to check the result. A link to a client-specific activity panel can help people who have it, but the record should stand on its own.

If a child is stopped or a run ends before the result comes back, record which evidence never arrived. For the form case, it is safe to say one agent located the handler and the second did not finish checking the tests. You can then inspect that one gap directly. Treating a partial result as complete can hide a missed branch, especially when every child sounds sure of the parts it did see.

Start with two small, independent read-only assignments. If you can reconstruct each finding from the files it references, the delegation has saved time without making the review harder.

Frequently Asked Questions

Does a Codex subagent see the full parent chat?

It depends on the spawn behavior of your client and release. Make the assignment self-contained so a child can work even with no surrounding conversation history.

Can a custom Codex subagent override the parent sandbox?

The current Codex documentation says subagents inherit the parent’s sandbox and approval settings. Set actual restrictions on the parent session.

Where do I inspect a Codex subagent’s work?

Open the child thread from the main chat’s activity in the desktop app. In the interactive CLI, the current docs describe /subagents for inspecting and switching threads.

#codex#ai-agents#subagents#developer-tools

One AI engineering post, weekly

LLM benchmarks, prompt techniques, and token-cost breakdowns, delivered to your inbox.

What should we test or explain next?

Comments

Have a question or something to add? Sign in to join the discussion.

Mahmudul Haque Qudrati — CEO & ML Engineer at Pristren

Mahmudul Haque Qudrati

CEO & ML Engineer

Software architect, full-stack engineer, and machine learning practitioner. Founder & CEO of Pristren, CTO at Venture Kick-backed PIN Sport Application GmbH (Basel, Switzerland), Software Development Lead at DailyFrame GmbH (building Dimetra patient transport software), and creator of Zlyqor. Focused on custom workflow automation, scalable web and mobile applications, and production AI/ML systems.