Auto-fix CI failures for PR #1175#1181
Conversation
Fixed: - src/lib/langfuse/trace-proxy-request.ts: Rename updateTrace to setTraceIO to match Langfuse SDK API CI Run: https://github.com/ding113/claude-code-hub/actions/runs/25849324809 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| rootSpan.setTraceIO({ | ||
| input: actualRequestBody, | ||
| output: actualResponseBody, | ||
| }); |
There was a problem hiding this comment.
setTraceIO is deprecated in the v5 SDK
The Langfuse JS/TS v5 migration guide marks setTraceIO() as deprecated — it exists only for backward compatibility with legacy trace-level LLM-as-a-judge evaluators. The project already declares @langfuse/tracing@^5. The recommended v5 approach is to set input/output directly on the root observation instead of calling setTraceIO on the span. While this fix unblocks the TypeScript build, it lands on a deprecated code path that may be removed in a future SDK minor or major.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/lib/langfuse/trace-proxy-request.ts
Line: 411-414
Comment:
**`setTraceIO` is deprecated in the v5 SDK**
The Langfuse JS/TS v5 migration guide marks `setTraceIO()` as deprecated — it exists only for backward compatibility with legacy trace-level LLM-as-a-judge evaluators. The project already declares `@langfuse/tracing@^5`. The recommended v5 approach is to set `input`/`output` directly on the root observation instead of calling `setTraceIO` on the span. While this fix unblocks the TypeScript build, it lands on a deprecated code path that may be removed in a future SDK minor or major.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a22117c4aa
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| // Explicitly set trace-level input/output (propagateAttributes does not support these) | ||
| rootSpan.updateTrace({ | ||
| rootSpan.setTraceIO({ |
There was a problem hiding this comment.
Update the Langfuse test mock for setTraceIO
In the unit-test environment, mockRootSpan in tests/unit/langfuse/langfuse-trace.test.ts still only defines updateTrace and the assertions still expect that method. After this call switches to setTraceIO, every successful trace path hits TypeError: rootSpan.setTraceIO is not a function, which is swallowed by the catch block before rootSpan.end() runs, so the Langfuse trace tests now fail instead of validating trace IO. Please update the test mock and expectations alongside this SDK method rename.
Useful? React with 👍 / 👎.
CI Auto-Fix
Original PR: #1175
Failed CI Run: Non-Main Branch CI/CD
Fixes Applied
updateTracetosetTraceIOError Details
The Langfuse SDK's
LangfuseSpantype (inherited fromLangfuseBaseObservation) exposessetTraceIO()for setting trace-level input/output, notupdateTrace(). The method name in the code did not match the actual SDK API, causing a TypeScript compilation error.Verification
bun run typecheckpassesbun run lintpassesAuto-generated by Claude AI
Greptile Summary
This auto-generated PR fixes a TypeScript compilation error from PR #1175 by renaming
updateTracetosetTraceIOon a LangfuserootSpancall in the proxy request tracer — the v5 SDK removedupdateTraceentirely.trace-proxy-request.ts:rootSpan.updateTrace(…)→rootSpan.setTraceIO(…), resolving the build failure introduced by upgrading to@langfuse/*@^5.setTraceIOis deprecated in v5: The Langfuse JS/TS v4→v5 migration guide notes thatsetTraceIOis a backward-compat shim for legacy trace-level LLM-as-a-judge evaluators; the preferred v5 pattern is to setinput/outputdirectly on the root observation.Confidence Score: 4/5
The change is a minimal one-line rename that unblocks the TypeScript build with no logic changes; safe to merge, though the chosen method is already deprecated in the SDK version in use.
The rename from
updateTracetosetTraceIOcorrectly fixes the compilation error, but lands on an API the Langfuse v5 SDK explicitly marks as deprecated — intended only for backward compat with legacy evaluators. No functional regression is introduced, but the team will need to revisit this call site again when the deprecated method is eventually removed.src/lib/langfuse/trace-proxy-request.ts — specifically the
setTraceIOcall at line 411, which uses a deprecated SDK method.Important Files Changed
updateTrace(removed in v5 SDK) tosetTraceIO. The rename resolves the TypeScript compilation error, butsetTraceIOis itself marked deprecated in the v5 SDK migration guide.Sequence Diagram
sequenceDiagram participant Caller participant traceProxyRequest participant rootSpan as rootSpan (LangfuseSpan) participant LangfuseSDK Caller->>traceProxyRequest: traceProxyRequest(ctx) traceProxyRequest->>rootSpan: create root span traceProxyRequest->>rootSpan: add child generation span Note over traceProxyRequest,rootSpan: Before PR #1181: rootSpan.updateTrace({input, output}) → TS error Note over traceProxyRequest,rootSpan: After PR #1181: rootSpan.setTraceIO({input, output}) → compiles, but deprecated traceProxyRequest->>rootSpan: "setTraceIO({ input, output })" traceProxyRequest->>rootSpan: end(requestEndTime) rootSpan->>LangfuseSDK: flush trace dataPrompt To Fix All With AI
Reviews (1): Last reviewed commit: "fix: auto-fix CI failures" | Re-trigger Greptile