The Launch Had to Match the Lease
The process had to prove which job it belonged to
In One Permit for One Change I put the permit check next to the code that actually changes something. That left a practical question. When Codex starts a fresh child process, how does the operation arrive at that boundary with the right session and working tree attached?
My first instinct would have been to put another option on the ordinary launcher. The July source shows why I kept a separate route. An ordinary launch or an attach to an existing session already has its own assumptions about the environment. A governed launch needs a stronger contract from its first instruction. The session that asks for the work, the profile that describes the tools and the checkout that will receive the change have to agree. Passing them all through as user-supplied strings would leave the caller choosing the very identity the daemon was supposed to verify.
On 30 July, I kept the first increment off the ordinary launch path. Agent-assisted implementation split the work into a narrow tool interface, a profile check and a daemon lifecycle. Each one could be reviewed on its own.

A request can follow one authorized route through the local boundary. Conceptual illustration.
Give the tool only the fields it needs
The first piece was a local service using the Model Context Protocol, or MCP. With the stdio transport the parent and child exchange structured messages over standard input and output. FastMCP supplied the service framework. The protocol identifies a tool and carries arguments. The application still owns the decision to run the operation.
The tool surface was deliberately small. The historical service exposed typed file write, patch, commit and push operations. Exposure describes what a client can request. The daemon still decides which requested effects can proceed. The tool argument describes the requested effect, while the service takes session context from a local binding prepared by the daemon. The binding stored a reference to the local lease handle, plus the provider, scope, host and worktree references. The credential used to prove that lease to the authority stayed with the daemon.
The service talked to the daemon over a Unix domain socket, a local inter-process connection. The first implementation bounded that call at 1.2 seconds. A process that accepted a connection and then stopped answering could otherwise leave the child hanging. The service report records a test for that exact stalled-peer case. It also records an integration-job source-fetch DNS failure and a successful retry. The retry is the evidence that the gate eventually ran.
Follow the decision
Make the profile agree with the launch
A provider profile describes the child’s arguments and the environment it receives. I wanted the daemon to create a private profile for the session it had admitted and the host runner to check that association again. A mismatch should stop before the process starts.
Historical source excerpt · host_runner.py at 26bc94c7, lines 218–226
if intent.mode is not LaunchMode.LAUNCH:
raise LaunchExecutionError("governed_launch_requires_new_session")
if (
profile.provider is not intent.provider
or profile.session_id != intent.session_id
):
raise LaunchExecutionError("governed_profile_session_mismatch")
if intent.session_id in self._processes:
raise LaunchExecutionError("session_already_launched")
Explain this code line by line
- Reject a launch intent that tries to attach to an existing process.
- Return a bounded error requiring a new session.
- Begin a condition covering either incompatible profile identity field.
- Compare the profile provider with the launch provider.
- Reject a profile for a different session even if the provider matches.
- Close the combined mismatch condition.
- Raise the specific mismatch error before constructing a process.
- Look for an existing process under the requested session ID.
- Reject starting a second process with that ID.
The next source increment stitched those pieces together. The daemon looked up the opaque handle and checked that it belonged to the intended session. It created a private directory, wrote the session binding and rendered the provider profile, then called the bounded host runner. The runner resolved the worktree and executable through its registry. Lease release and observed child exit were cleanup points. Requiring an explicit artifact root kept existing host configuration from accidentally enabling the path.

The launch pins the intended worktree before the tool asks to change it. Conceptual illustration.
Follow one request across the boundary
Illustrative example. Suppose the admitted session is called Cedar and owns a scoped job in the index-review worktree. A tool call asks to write notes/check.txt with some text. The tool input supplies the relative target and content. The binding supplies the session’s already-chosen worktree. The daemon resolves the authorized context and sends the operation through the authority and effect checks described in Episode 19.
A profile created for another session, Birch, encounters a different boundary. The host runner rejects it when starting the process, before there is any tool call. If Cedar later releases its lease, a child process that is still alive does not gain another attempt merely by remembering its old handle. The release path cleans up the local artifacts. The next episode follows the separate question of what the tool path actually does when authority cannot be reached.
| Layer | What it can establish |
|---|---|
| Protocol and typed request | The client is asking for an identified operation with the expected fields. |
| Session binding and profile | The child is wired to the admitted session and registered worktree. |
| Daemon and authority | The current lease and requested effect can be checked at operation time. |
| Tool outcome | A separate observation establishes whether the requested operation completed. |
What the July checks established
The stdio report records six focused passes. The profile report records eleven focused passes and 290 passes with two skips across the agent control plane suite. The daemon lifecycle report records 294 passes with two skips. Those are historical reports from different revisions and test selections. I use them to trace which contract was checked at each step.
The source inspection for this draft confirms the host runner conditions in the excerpt. July delivery was source-only and default-off at this checkpoint. The merged implementation left host configuration and ordinary provider launches alone. It did not establish that either installed provider had performed a governed write.
The lesson I took from this slice is to keep identity out of ordinary tool arguments and to give ephemeral launch artifacts a definite lifetime. The next test was whether the path would still hold when the daemon was missing, and what would happen once the real components started talking to each other.
Glossary and primary references
MCP
Model Context Protocol. Defines structured exchanges between clients and tool servers.
Primary referenceWorktree
A checked-out working directory associated with a Git repository.
Primary referenceUnix domain socket
An endpoint processes on the same system use to exchange messages.
Primary referenceLease
Time-limited authority to act within an admitted scope.
Primary referenceProvider profile
The arguments and environment prepared for a particular child process.
Primary reference