Repository navigation
fix(protocol): keep forwarded request headers out of logged ACP params - #553
Open
stephen-wang24 wants to merge 1 commit into
Open
stephen-wang24 wants to merge 1 commit into
stephen-wang24 wants to merge 1 commit into
Conversation
The ACP params models rendered `request` (the forwarded x-* headers, which can carry end-user credentials) in str() and repr(), and the default, temporal and temporal-openai-agents templates plus the Temporal tutorials logged the whole params object at INFO. - Mark `request` repr=False on CreateTaskParams, SendMessageParams, SendEventParams, CancelTaskParams and InterruptTaskParams. Attribute access and model_dump() are unchanged, so handlers, the ADK and the Temporal signal payload still receive the headers. - Log task and event ids instead of the whole params in the templates, the Temporal tutorials and the procurement demo. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Author
stephen-wang24
marked this pull request as ready for review
October 27, 2026 00:04
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
str()of the ACP params models includedrequest, which holds thex-*headers FastACP forwards to the agent. Those headers can carry end-user credentials such asx-user-oauth-credentials. Thedefault,temporalandtemporal-openai-agentstemplates and the Temporal tutorials log the wholeparamsat INFO, so the header values were written to agent stdout on every call.What changed
src/agentex/protocol/acp.py):requestis nowField(repr=False)onCreateTaskParams,SendMessageParams,SendEventParams,CancelTaskParamsandInterruptTaskParams.str(params),repr(params)andf"{params}"no longer include it. Attribute access,model_dump(),model_dump_json()and the JSON schema are unchanged, so handlers, the ADK's header forwarding and the Temporal signal payload still get the headers.paramsnow log the task id, plus the event id in event handlers:default(3 lines),temporal(2) andtemporal-openai-agents(2)tests/test_acp_params_repr.py): for each model, a canary header value is absent fromstr()/repr(), while.request,model_dump(),model_dump_json()and amodel_dump()→model_validate()round trip (the Temporal signal path) still carry it.Before / After
main@ 7e421c6)defaultagent after task/create, event/send and task/cancel that carry anx-user-oauth-credentialsheadertemporalagent after the same three callsRECEIVE_EVENTsignal handlerparams) once it runs this SDKrequest=print(params)orf"{params}"in agent coderequest={'headers': {...}}with the valuesrequestoutparams.request)Proof
Ran agents scaffolded from
mainand from this branch with the realagentex agents run. Each got task/create, event/send and task/cancel carryingx-user-oauth-credentials: test-canary-not-a-real-token, and I counted that value in the agent's stdout:defaultdefaulttemporalRECEIVE_EVENTsignal handlertemporaldefault{params}lines)temporal{params}lines)The header still reaches the code. A throwaway probe line in the branch's event handlers compared
params.request["headers"]["x-user-oauth-credentials"]with the canary, and it loggedTruein both thedefaulthandler and thetemporalworkflow.The event handler's log line, before and after (timestamps replaced by
..., the middle of long lines trimmed to…):Setup and full run output
Setup, for
mainand this branch, each with its own venv:defaultand atemporalagent with the callsagentex initmakes after its prompts.agentex agents run --manifest manifest.yaml.Harness: a stand-in Agentex backend on
:5003(registration and message writes) and the Temporal Java test server on:7233. Redis was not running, soadk.messages.createlogs the same Redis stream-publish errors on both sides.All handler lines:
Printing a params model directly, with the canary in
request. HereTruemeans the canary appears in that output, and for.requestanddumpit means the value equals the forwarded one:Supporting checks (these show nothing broke, not the change itself):
tests/test_acp_params_repr.py. Against main'sacp.py, the 5 str/repr tests fail and the 5 "headers still carried" tests pass. On this branch all 10 pass../scripts/test): 1774 passed, 1622 skipped on Python 3.12 and on 3.13.mainon 3.12 gives 1764 passed with the same 1622 skips../scripts/lint(ruff, pyright with 0 errors, import check),./scripts/check-slim-depsandmypy src/agentex/protocol/acp.py: all clean.Test Tutorial Agentsfor the changed tutorials 000-080 against a real AgentEx server.git grepoversrc/,tests/,examples/andadk/found no code that readsstr()orrepr()of a params model.Upgrade note
Agents scaffolded from older templates keep their own
{params}log lines. With this SDK version those lines no longer includerequest(the old-template rows in the Proof table), but they still print the rest of the params, including user input. Changing them to log ids is up to each agent.Not verified
agentex-sdkrelease that includes this change, and after the agent upgrades. A search of an upgraded agent's logs forrequest=in its handler lines would show it.manifest.yaml, and the procurement demo is outsideexamples/tutorials, so CI tests neither. For those two, onlypython -m py_compileran.{params.task}are unchanged. That is theTaskmodel, which has norequestfield.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no blocking issues were found.Summary
Keeps forwarded headers out of ACP parameter strings and replaces whole-parameter logs with task and event IDs.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A["Forwarded headers"] --> B["params.request"] B --> C["Handler access and model_dump(): preserved"] B --> D["str() and repr(): request omitted"] E["Templates and examples"] --> F["Log task and event IDs only"]Reviews (2) · Last reviewed commit: "fix(protocol): keep forwarded request he..." · Reviewed by Greptile