[fix] Preserve invoke auth without trace context#5266
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthrough
ChangesTracing context capture
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🤖 The AI agent says: This is an independent two-file hotfix extracted from #5242. Please verify the early return now drops the tracing context only when both @coderabbitai review |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
gh pr diff 5266 --repo Agenta-AI/agentaLength of output: 2315 🏁 Script executed: #!/bin/bash
sed -n '1,90p' sdks/python/agenta/sdk/agents/tracing.py 2>/dev/null || gh api repos/Agenta-AI/agenta/contents/sdks/python/agenta/sdk/agents/tracing.py -q .content | base64 -dLength of output: 3724 This checks out — the diff and the resulting
This is a minimal, correctly scoped fix for the described bug. ✅ Action performedReview finished.
|
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
fd -a "tracing.py" | grep -i sdk || fd -a "tracing.py"
echo "---"
fd -a "test_tracing.py"Length of output: 729 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== contexts/tracing.py ==="
cat -n sdks/python/agenta/sdk/contexts/tracing.py
echo "=== agents/tracing.py ==="
cat -n sdks/python/agenta/sdk/agents/tracing.py
echo "=== test file ==="
cat -n sdks/python/oss/tests/pytest/unit/agents/test_tracing.pyLength of output: 20558
traceparent = headers.get("traceparent")
authorization = headers.get("Authorization")
if not traceparent and not authorization:
return NoneThis correctly drops the tracing context only when both The two regression tests in
Both scenarios are correctly exercised, and the early-return condition matches the stated intent. This is a clean, minimal, well-scoped hotfix — no other issues found in the two files. ✅ Action performedReview finished.
|
Context
An agent invocation could carry its Agenta authorization through the tracing context even when no active trace span produced a
traceparent.trace_context()returnedNonewhenevertraceparentwas absent, so it silently discarded the authorization and the downstream runner request could become unauthenticated.Changes
trace_context()now keeps the context when eithertraceparentorAuthorizationis present. It still returnsNonewhen both are absent.Tests / notes
How to review
Read the early-return condition in
tracing.py, then the two regression cases intest_tracing.py.