The Case for Blocking HTTP Approvals
Why `msh local` intentionally hangs HTTP connections while waiting for human approval instead of building an async negotiation protocol, and why simplicity often beats correctness in proxy design.
Originally published on the Iddio engineering blog. Iddio is now part of Mezite as msh local — here’s why.
The Request-Response Paradox
When building an interception proxy that requires out-of-band human approval for specific operations, the immediate architectural instinct is to reach for asynchronous negotiation.
The standard playbook looks like this:
- Client makes a sensitive request.
- Proxy intercepts, returns an HTTP 403 or a custom
40xstatus code with anApproval-Requiredpayload containing a token. - Client parses the response, suspends its operation, and begins polling a status endpoint with the token.
- Human approves the request via Slack or a dashboard.
- Client’s next poll returns
Approved. - Client re-submits the original request, this time including the approval token.
This design is “correct.” It adheres perfectly to HTTP semantics, prevents connection pooling exhaustion, and cleanly separates the authentication/authorisation phase from the execution phase. It is also entirely the wrong design for an infrastructure gateway.
The Reality of AI Agents
msh local sits between autonomous AI agents and critical infrastructure APIs (Kubernetes, AWS, Terraform). We don’t control the clients. We can’t force kubectl, the AWS CLI, or an MCP client to implement a custom async approval handshake.
If we return a 403 with a JSON payload asking the client to poll, the client will simply crash with Error: Forbidden. The agentic loop will then attempt to debug the 403, hallucinate a solution involving new IAM roles, and spiral into an unrecoverable state.
We needed a solution that required zero client-side changes. The AI agent needed to believe it was talking to a slow, but compliant, upstream API.
Embracing the Hang
Our solution is intentionally crude: when an AI agent makes a request that requires human approval, msh local simply stops reading from the socket and hangs the connection.
Behind the scenes:
- The command classifier assigns the request a risk tier (e.g.,
kubectl apply -f manifest.yaml→ modify), and the policy engine returns an escalate decision. - The proxy sends an approval request via the daemon’s IPC socket to the Mezite Desktop prompt or the
msh local approvalCLI. - The goroutine handling the client connection intentionally blocks on the approval’s completion channel.
- From the AI agent’s perspective, the cluster is just slow.
- When the human clicks “Approve,” the channel unblocks, the proxy forwards the request to the upstream server, and the response flows back to the AI agent.
No client-side retries. No polling endpoints. No approval tokens for the AI agent to carry. The only state is an in-memory map of pending approvals inside the daemon.
The Trade-offs
This design choice carries significant implications, which we accepted:
Connection Timeouts
Standard HTTP clients eventually time out. In msh local, the broker enforces a 30-second DefaultTimeout. If the human approver does not respond within this window, the proxy unblocks, returning an HTTP 403 Deny to the client with a distinct timed_out audit verdict. When the AI agent inevitably retries, it receives a fresh prompt; there is no request deduplication across retries.
Resource Exhaustion
Hanging connections consume file descriptors and memory on the proxy. A misbehaving AI agent in a tight loop could exhaust the proxy’s resources by spawning thousands of pending approval requests.
Our mitigation: We manage real bounds through the 30-second budget, a sweeper eviction process for stale approvals, and client-disconnect cancellation. There is explicitly no rate limiting today.
Connection Maintenance
Proxies and load balancers between the AI agent and msh local might aggressively reap idle connections.
Our mitigation: msh local runs as a local daemon over the loopback interface and speaks HTTP/1.1 (ALPN default). Because the connection never leaves the local machine, intermediary infrastructure dropping idle connections is not a concern.
Simplicity Wins
By choosing to block the HTTP connection, we entirely eliminated the need for an “component inside the AI agent.” The AI agent simply gets a standard kubeconfig or environment variable. The complexity of human escalation is completely transparent to the caller.
In proxy design, developers often optimise for protocol purity at the expense of client compatibility. We chose the opposite. By treating the network as a temporal buffer, we built a zero-trust gateway that works perfectly with standard, unmodified CLI tools. Sometimes, the best state machine is no state machine at all.
Mezite Team
Engineering