A config and the two MCP processes print through an Inspect of their own: model keys as :redacted, an MCP server's env and headers by name; the session goes on with the values¶
Decision 857 · accepted · 2026-10-11 · issue #509
Issue #509. Troupe.Config had no Inspect of its own. It holds the session-wide
api_key, each named provider's api_key, and each MCP server's env and headers
(820), and a session's supervisor, its root agent and its /loop all hold one. A crash
report prints a process's state whenever the logger's level is debug, which is the level
a person turns on to report a bug, so the log they attach carried the keys.
Troupe.MCP.Stdio held a server's resolved env with no format_status/1, and the
session's supervisor held the servers as a bare map in Troupe.Session.MCP's child spec.
Inspect, becauseformat_status/1does not reach the stacktrace. A process that fails on a clause prints the call that failed with its arguments, and a callback's or a private function's arguments are its state.gen_serverhandsformat_status/1the bare reason and adds the stacktrace after it, so the redaction 820 gaveTroupe.Session.MCPstill printed its servers'envand headers there; the Elixir logger prints the arguments withinspect. So%Troupe.Config{},%Troupe.MCP.Stdio{}and%Troupe.Session.MCP{}each have anInspectthat prints the redacted form, wherever the value sits: the state, a stacktrace, a last message (a stdio server is sent its holder's exit, state and all), an agent's data, a supervisor's child specs.format_status/1stays on the two MCP processes, for:sys.get_status/1and a formatter that does not useinspect.@derive {Inspect, except: ...}was not enough for the config: it dropsmcpwhole, and the names are what a report needs.- What counts as a secret.
api_keyat the top and on every entry ofproviders, and an MCP server'senvandheaders: the fields the schema markssecretthat aConfigholds. A key is printed:redacted, an unset one staysnil, so a report says which were set.envandheadersbecome their names, sorted, as 820 prints them. An MCP server'sargsandurlare printed: they are the command and the address as written, which/mcpshows already, and the schema marks neither secret. Troupe.Config.redacted_server/1is the one rule for a server's entry, atom or string keys, used by the config'sInspectand by both MCP processes (replacingTroupe.Session.MCP's private copy).Troupe.Session.MCPis started with theConfig,config:in place ofservers:, so the session supervisor's child spec prints its servers through the config'sInspectrather than as a bare map.- For printing only. Nothing else reads the redacted form; the session sends the key and the server is started with its environment as before.
- Not here. A server's entry passed on its own, as a bare map, to a function that
fails prints as it is.
config_overridesis a keyword list a caller builds, and the live bench passes the person's key in it (Troupe.Bench.Live); it sits in the session's child spec and the watcher's branch options as given.
Governs: apps/troupe_core/lib/troupe/config.ex, apps/troupe_core/lib/troupe/mcp/stdio.ex, apps/troupe_core/lib/troupe/session.ex, apps/troupe_core/lib/troupe/session/mcp.ex