[codex] fix Python SDK decorator metadata duplication#693
[codex] fix Python SDK decorator metadata duplication#693Rachit-Gandhi wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ff67bf85c4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2760072a1e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6238d1cdd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 400bd8377d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Performance
✓ No regressions detected |
📊 Coverage gateThresholds from
✅ Gate passedNo surface regressed past the allowed threshold and the aggregate stayed above the floor. |
📐 Patch coverage gateThreshold: 80% on lines this PR touches vs
✅ Patch gate passedEvery surface whose lines were touched by this PR has patch coverage at or above the threshold. |
santoshkumarradha
left a comment
There was a problem hiding this comment.
Reviewed the decorator metadata refactor and ran the targeted Python tests locally. The metadata dedup and accepts_webhook handling look consistent now.
Head branch was pushed to by a user without write access
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7e3506d82
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7e3506d82
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 303bee4e02
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| vc_enabled=vc_setting, | ||
| triggers=list(decorator_triggers or []), | ||
| accepts_webhook=decorator_accepts_webhook, | ||
| triggers=list(merged_triggers or []), |
There was a problem hiding this comment.
Keep runtime trigger bindings visible to endpoints
When a plain @app.reasoner(triggers=[EventTrigger(..., transform=...)]) or router reasoner is registered, the merged triggers are now stored only in the ReasonerEntry; _execute_reasoner_endpoint still applies transforms by reading func._reasoner_triggers, and this refactor no longer stamps that attribute on the original function. In those webhook-triggered paths the trigger still registers, but the SDK skips the declared transform and invokes the reasoner with the raw event payload; either pass the entry bindings into execution or keep the runtime attribute in sync without reintroducing cross-agent leakage.
Useful? React with 👍 / 👎.
santoshkumarradha
left a comment
There was a problem hiding this comment.
Rechecked the follow-up commits, merged main into the branch, and reran the Python SDK suite locally. The metadata handling stays correct across the stacked decorator cases, and the agent-local registration fix closes the leakage edge cleanly.
Summary
Fixes #652.
This removes duplicated Python SDK decorator metadata handling by introducing a shared helper for:
@on_event/@on_scheduletriggers=[...]mergingcode_originstampingaccepts_webhookresolutionAgent.reasoner, module-level@reasoner, and router/agent direct-registration handling now share the same small metadata path while leaving the existing endpoint execution behavior inAgentunchanged.Root Cause
Agent.reasoner, module-level@reasoner, andAgentRoutereach had their own partial implementation of decorator metadata handling. That caused drift:@app.reasoner(triggers=[...])did not stamp triggercode_origin, and explicitaccepts_webhook=Falsecould be treated as missing during registration metadata serialization.Validation
uv run --extra dev pytest tests/test_decorator_code_origin.py tests/test_accepts_webhook.py tests/test_router.py tests/test_reasoner_path_normalization.py -quv run --extra dev pytest -quv run --extra dev python -m compileall agentfield/decorator_metadata.py agentfield/decorators.py agentfield/agent.py agentfield/router.pygit diff --check