Files
imeai-aKode/akode-rs/akode-mcp
andrea.difonzo 4e1f551b84 aKode: cache del prompt più stabile e attese lunghe dei server locali (punto 4, blocco A)
- Ordine fisso dei blocchi di contesto: le sezioni uguali in ogni sessione
  (skill, permessi) vengono prima, quelle delle estensioni (<code_map>,
  riepilogo della memoria) dopo; prima <code_map> stava subito dopo le
  istruzioni di sistema e cambiava da un repository all'altro.
- Strumenti in ordine stabile (per nome, namespace dopo); nella sessione resta
  l'ordine della prima richiesta e i nuovi strumenti vanno in coda, mai in mezzo.
- La prima richiesta aspetta fino a 5 s (prima 1 s) i server MCP in avvio.
- Ogni byte ricevuto azzera il timer di inattività: commenti SSE ed eventi
  imeai.queue/imeai.prefill compresi. Il timeout vale anche per l'attesa delle
  intestazioni ed è di 30 minuti per i server locali (5 per gli altri).
- Niente keepalive TCP nel client HTTP: reqwest sonda dopo 15 s e chiude dopo
  3 sonde senza risposta; attraverso NetBird le sonde non passano e ogni
  risposta partita dopo 60 s veniva tagliata e richiesta da capo.
- Test adattati al nuovo ordine degli strumenti (snapshot con soli riordini) e
  alla nuova attesa dei server MCP.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 17:59:12 +01:00
..

Codex MCP runtime

This crate manages Codex's MCP connections, tool calls, and their captured authority.

Sandbox request metadata

An MCP server advertises the experimental codex/sandbox-state capability to receive sandbox metadata on tool calls. The deprecated capability name codex/sandbox-state-meta opts into the same contract during migration.

Codex supplies these entries in the request's _meta object:

Key Value
codex/sandbox-state Opaque policy to pass to akode sandbox --sandbox-state-json.
codex/sandbox-state-meta An identical copy of that policy under the deprecated name.
codex/sandbox-launcher When available, an object with an absolute codexExecutable path to a verified full Codex CLI on the MCP server's host.

Use the launcher path to invoke sandbox --sandbox-state-json with the entire state value serialized as one argument, followed by -- and the command to run. The state contains neither launcher discovery data nor deprecation messages. Preserve unknown policy fields by forwarding the original value rather than deserializing and reconstructing it. The two state names are aliases, not separate policies; new consumers should prefer codex/sandbox-state.

Launcher metadata is currently available only for local stdio servers. An HTTP endpoint, including loopback, or a remote executor does not establish a shared filesystem with the harness. Codex omits the launcher when its path is unknown, not representable as UTF-8, or fails the cached capability probe. Absence does not authorize a PATH search or unsandboxed fallback. Servers that require a launcher must fail closed or require an explicit operator opt-out.

The state and launcher describe the issuing call. Retain both when starting a long-lived subprocess or caching policy-bound results; reject changed authority before reusing them. Tool arguments supplied by the model are not authority. See sandbox_metadata.rs for the wire types and binding.rs for execution-environment selection.