Repository navigation
fix(langfuse): log custom_tool_call items in Responses API output - #36916
CNSeniorious000 wants to merge 2 commits into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Greptile SummaryThe PR now records Responses API
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (3): Last reviewed commit: "fix(langfuse): avoid Final assignment in..." | Re-trigger Greptile |
PR overviewAll previously flagged issues have been addressed. No open security concerns remain on this pull request. Security reviewNo open security issues remain on this pull request. Fixed/addressed: 1 · PR risk: 0/10 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Pushed two commits and refreshed the PR description:
Also filed the missing bug report: #37430, with an e2e reproduction. The Proof section has been re-captured against the current tip (before at the merge base |
|
Confirming the remaining red check is not from this PR: the target branch's own head is failing the same test.
The observed value is exactly half the expected one, which looks like batch pricing being applied where the assertion still expects list price — nothing this PR touches (it only adds an Happy to open a separate PR for that batch-cost assertion if it's useful — just say the word and I'll dig into which side is wrong. |
|
Fixed in e6cd02b — the redaction gap was in |
|
Friendly ping for review — this PR is ready from our side:
Would love a maintainer's eyes when someone gets a chance. Happy to split the redaction fix into its own PR if that's preferred. |
|
Synced with staging and preserved safe JSON parsing. Updated redaction coverage and removed redundant comments. Please review the latest commit. @greptileai |
|
@cursor review the current commit, including the staging conflict resolution, custom tool output serialization, and both message-redaction paths |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 8926f64. Configure here.
Keeps the payload build to a single dict literal so the type-discipline gate's LIT002 total stays at its ceiling.
8926f64 to
36a226c
Compare
TLDR
Problem this solves:
How it solves it:
User Flow
Before: a developer reviewing a freeform tool call cannot see its payload in Langfuse
execcustom tool andtool_choice: "required"custom_tool_callcontaining JavaScriptAfter: the same call appears in Langfuse and respects message redaction
custom_tool_callcontaining JavaScriptx-litellm-enable-message-redaction: true, its input isredacted-by-litellmRelevant issues
Fixes #37430
Affected release
Linear ticket
Pre-Submission checklist
Validation at
8926f645f5: both affected test files pass, 86 passed. The four new cases fail against merge base252c71c0b2. Changed executable lines have 100% coverage. Ruff, type-discipline and test-quality budgets pass without budget changes; the current CI lint passes tooLITELLM_LOCAL_MODEL_COST_MAP=True PYTHONPATH=. python -m pytest \ tests/test_litellm/integrations/test_langfuse_otel.py \ tests/test_litellm/litellm_core_utils/test_redact_messages.py -q # 86 passedScreenshots / Proof of Fix
Captured 2026-09-16 against two isolated proxies, the merge base on port 47431 and the current tip on 47432. Both used the same live
gpt-6-astradeployment and self-hosted Langfuse, with actual provider calls and no mocks. The same request on each proxy returned HTTP 200. The observations below belong to these test proxies, identified separately from the upstream gateway's tracesShared config, with credentials supplied through environment variables:
Set
LANGFUSE_PUBLIC_KEY,LANGFUSE_SECRET_KEY,LANGFUSE_HOSTandLANGFUSE_OTEL_HOSTfor the test project. Save this ascustom.json:{"model":"gpt-6-astra","input":"Use the exec tool to print 6*7 in JavaScript.","tools":[{"type":"custom","name":"exec","description":"Run JavaScript and return stdout"}],"tool_choice":"required","store":false,"reasoning":{"effort":"low"},"max_output_tokens":1024}For
function.json, replacetoolswith:[{"type":"function","name":"exec","description":"Run JavaScript","parameters":{"type":"object","properties":{"code":{"type":"string"}},"required":["code"],"additionalProperties":false},"strict":true}]For
text.json, removetoolsandtool_choice, and setinputtoReply with exactly: 42Before (252c71c)
Custom tool output
Send the request and inspect the returned item types
Read the test proxy's generation from Langfuse
{"id":"a57c0dc37adb3d3f","output":[{"role":"assistant","content":"I’ll print `6 * 7` using JavaScript."}]}Custom tool with redaction
Send the request and inspect the returned item types
Read the test proxy's generation from Langfuse
{"id":"1b1af6edb86ebe19","output":[{"role":"assistant","content":"redacted-by-litellm"}]}Function tool with redaction
Send the request and inspect the returned item types
Read the test proxy's generation from Langfuse
{"id":"82a77dafb63966fb","output":[{"role":"assistant","content":"redacted-by-litellm"},{"id":"fc_0e0d2eb388296538016aaa107e4b4487d091d700512679d1fe","name":"exec","call_id":"call_3KBeE9ARgEAlGLh6cHfgFge4","type":"function_call","arguments":{}}]}Plain text control
Send the request and inspect the returned item types
Read the test proxy's generation from Langfuse
{"id":"5e79a56489ba83b5","output":[{"role":"assistant","content":"42"}]}After (8926f64)
Custom tool output
Send the request and inspect the returned item types
Read the test proxy's generation from Langfuse
{"id":"ed115755387c8d3e","output":[{"role":"assistant","content":"I’ll print `6 * 7` using JavaScript."},{"id":"ctc_0ce2f9b6c75257ef016aaa107d8c6487d09fa29987888eb375","name":"exec","call_id":"call_ASagu9uv36LxaL7eGBiGIJBH","type":"custom_tool_call","input":"console.log(6 * 7);\n"}]}Custom tool with redaction
Send the request and inspect the returned item types
Read the test proxy's generation from Langfuse
{"id":"3ff3f0b2c3e3af99","output":[{"role":"assistant","content":"redacted-by-litellm"},{"id":"ctc_09d3b2412d2168e6016aaa107dd4e887d0ab33b52e9bcc9197","name":"exec","call_id":"call_i4IBJFyHMCJYtLPnQ9CvaEzC","type":"custom_tool_call","input":"redacted-by-litellm"}]}Function tool with redaction
Send the request and inspect the returned item types
Read the test proxy's generation from Langfuse
{"id":"8fd048d8e23cae6c","output":[{"role":"assistant","content":"redacted-by-litellm"},{"id":"fc_0166aa94101ea74d016aaa107e643087d0a8172ab47e56255f","name":"exec","call_id":"call_j7pPUZBOLEVI6hkiWLjTc1Ft","type":"function_call","arguments":{}}]}Plain text control
Send the request and inspect the returned item types
Read the test proxy's generation from Langfuse
{"id":"8efb4e3ca9b850f1","output":[{"role":"assistant","content":"42"}]}Type
Bug Fix
Caveats (if any)
Low
At
8926f645f5, 82 checks succeeded, two failed and one was skipped. Lint, integrations and core-utils passed. Greptile scored the current tip 5/5, Cursor Bugbot and Veria succeeded, and both review threads are resolvedThe target branch's Vertex job and this PR's Vertex job fail the same four embedding-pricing assertions, with the same observed and expected values. They are outside the four files changed here
The proxy-behavior job fails
test_join_binds_the_membership_to_the_requested_teamwithTypeError: object MagicMock can't be used in 'await' expressionafter the five-second prefetch cache expires. The affected test and implementation are unchanged by this PR; #41278 fixes the test clock on the same target branchFinal Attestation