Skip to content

AI-382: keep hosted tool credentials out of workflow history - #1752

Draft
xumaple wants to merge 1 commit into
mainfrom
maplexu/AI-382-tool-credential-refs
Draft

AI-382: keep hosted tool credentials out of workflow history#1752
xumaple wants to merge 1 commit into
mainfrom
maplexu/AI-382-tool-credential-refs

Conversation

@xumaple

@xumaple xumaple commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Giving a hosted tool a credential means putting it in the tool config, and the tool config travels from your workflow to the model as an activity argument. So the credential is written into workflow history on every model turn, readable by anyone who can open the run, and it stays there after you rotate it. There is no way to avoid it today: authorization, header values and container domain secrets are fields on OpenAI's own API types, and the real token has to arrive at the provider.

secret_reference("MY_MCP_TOKEN") returns a placeholder you put where the credential goes. The worker reads that variable from its own environment and substitutes the value immediately before the model call, so what the workflow holds is the variable's name. It covers a hosted MCP tool's authorization and each header value, and the value of each container domain secret on the hosted shell and code interpreter tools. Set the variable on every worker that runs model activities; a worker without a value for it fails the call with a non-retryable error naming the variable.

What it deliberately does not cover is anything a provider or a remote MCP server sends back. A counterparty that quotes your credential into its own error text is the counterparty's bug, and defending against it means guessing at every way a string can be rendered, which is not a set you can finish enumerating.

Note: hosted ShellTool was raising UserError on every model turn, because _build_tool passed an executor unconditionally and upstream rejects one for a hosted environment. That made hosted shell tools unusable, and fixing it is a prerequisite for the domain-secret substitution there, so it rides along.

A hosted tool's credential is sent from workflow code to the model, so
writing it into the tool config puts the credential in the workflow
itself, on every model turn. There was no alternative: these are fields
on OpenAI's own API types and the real token has to reach the provider.

secret_reference() returns a placeholder carrying the name of an
environment variable. The worker substitutes its value in _build_tool,
immediately before the model call, so what the workflow holds is the
variable's name. It applies to a hosted MCP tool's authorization and
each header value, and to the value of each container domain secret on
the hosted shell and code interpreter tools.

Anything a provider or a remote MCP server sends back is deliberately
out of scope. A counterparty that quotes a credential into its own
error text is the counterparty's bug, and covering it would mean
guessing at every way a string can be rendered.

Also fixes a hosted ShellTool crash that blocked one of those sites:
_build_tool passed an executor unconditionally, but upstream rejects one
for a hosted environment, so every model turn raised UserError.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant