Skip to content

fix(tracing): preserve tool names in ChatML history - #126

Open
CNSeniorious000 wants to merge 2 commits into
langfuse:mainfrom
CNSeniorious000:fix/chatml-tool-names
Open

CNSeniorious000 wants to merge 2 commits into
langfuse:mainfrom
CNSeniorious000:fix/chatml-tool-names

Conversation

@CNSeniorious000

Copy link
Copy Markdown

Skill and MCP display names also leak into ChatML history, replacing the tool name Codex actually called. For example, a call recorded as exec_command appears as skill:bug-mentor in the next generation's input.

Use the recorded tool name for assistant tool calls and tool replies. Keep observation names and trace tags unchanged.

Tests

  • Cover skill calls with skill_tags on and off, plus MCP calls; assert original names in both history roles and unchanged observation names.
  • pnpm run lint and pnpm test pass (127 tests).
  • Bundled Stop hook → local OTLP receiver: verify exported history, display names, sidecar writes, and repeat-Stop deduplication. The history assertion fails on unmodified v0.4.3.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@CLAassistant

CLAassistant commented Nov 1, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T03:19:53.286734Z 8e01bc0 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sangkyoonnam sangkyoonnam left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two history fields lose the "tool" fallback for an empty or missing name. The parent builds both through toolObservationName(tc), whose final fallback (parent trace.ts:284) is tc.name || "tool". The head assigns tc.name directly in both places.

I ran pnpm --config.manage-package-manager-versions=false exec vitest run plugins/tracing/test/trace.test.ts -t "keeps real tool names|captures web search, local shell, and MCP" 3 times on the head (3 passed each) and 3 times with only trace.ts reverted to its parent version (3 failed each). The two inline suggestions keep the fallback.

Comment thread plugins/tracing/src/trace.ts Resolved
Comment thread plugins/tracing/src/trace.ts Resolved

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants