pi-coding-agent: Pi 1.4 system messages dropped, so LLM spans have no system prompt or tools
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, typescript
調査の方向性
Start in js/src/instrumentation/plugins/pi-coding-agent-plugin.ts: normalizePiMessage currently returns [] for role:"system" messages and normalizePiContextInput only reads context.systemPrompt. Read pi-agent-core's StreamFn/SystemMessage docs (content, sections, toolsAdded, toolsRemoved) and reproduce with Pi 1.4 by checking that an openai.responses.create span under AgentSession.prompt gains system input and metadata.tools. Done: system messages are normalized into input, tools are folded from toolsAdded/toolsRemoved with a fallback to context.tools, and executors are wrapped from agent.state.tools.
索引モデルが issue の本文から書いたものです。
説明
Summary
With @earendil-works/pi-coding-agent / pi-agent-core / pi-ai 1.4.0, the Pi Coding Agent integration (js/src/instrumentation/plugins/pi-coding-agent-plugin.ts, braintrust 3.39.0 and main at 50280e8b1) records LLM spans with no system prompt and no tool list.
Cause
Pi 1.4's agent loop calls the stream function with a normalized TranscriptContext. Its system prompt and tool declarations travel only in role: "system" messages (SystemMessage: content, sections, toolsAdded, toolsRemoved). pi-agent-core's StreamFn doc says: "the system prompt and tool declarations are carried by the transcript's system messages, never by context.systemPrompt or context.tools."
The plugin reads only those absent fields:
normalizePiContextInputadds a system message only fromcontext.systemPrompt;normalizePiMessagereturns[]for arole: "system"message, so the transcript's system messages are dropped;extractToolMetadata(context.tools)(LLM spanmetadata.tools) andwrapPiToolExecutors(context.tools)seeundefined.
Observed
In our dev project, every openai.responses.create LLM span under AgentSession.prompt has an input of only user/assistant/tool messages and no metadata.tools; the prompt span has pi_coding_agent.active_tools (names only). There is no plugin option to recover this: spanCustomizers.onSpanExport runs after the data is gone.
Suggested fix
- Normalize each
SystemMessageinto a{ role: "system", content }input message, renderingcontentfollowed by itssections(later messages replace sections by name;nullremoves one), or at least keep the message'scontentandsections. - Fold
toolsAdded/toolsRemovedacross the transcript's system messages into the declared tool set and report it asmetadata.tools, falling back tocontext.toolsfor callers that still pass it. - Wrap tool executors from the agent's tools (
agent.state.tools) rather thancontext.tools.
We work around it by adding the agent state's systemPrompt and tools to the AgentSession.prompt span through a span customizer.
- 主要言語
- TypeScript
- スター
- 29
- フォーク
- 21
- 平均マージ
- 1日 13時間
- マージ済み PR(30日)
- 67
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
braintrustdata/braintrust-sdk-javascript のほかの issue
-
Pi Coding Agent instrumentation double-counts tokens and estimated cost in trace rollups (AgentSession.prompt carries summed LLM usage)対応中かも @sharonadhitya が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
braintrustdata/braintrust-sdk-javascript#2659 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
AI SDK tool spans don't respect `toModelOutput`対応中かも @AbhiPrasad が 3 日前に担当しました。 オープンtypescript
braintrustdata/braintrust-sdk-javascript#2651 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
High TypeScript checking cost from generated Zod 3 schemas対応中かも @lforst が 10 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
braintrustdata/braintrust-sdk-javascript#2624 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[bot] Instrument Luma AI (17,324 weekly downloads)対応中かも @karthiksenv が 10 日前に担当しました。 オープンtypescript
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
braintrustdata/braintrust-sdk-javascript#2578 ·
メンテナーはふだん 1 日以内に返信
-
[bot] Instrument Letta Agent SDK (87,205 weekly downloads)対応中かも @karthiksenv が 13 日前に担当しました。 オープンtypescript
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
braintrustdata/braintrust-sdk-javascript#2577 ·
メンテナーはふだん 1 日以内に返信
braintrustdata/braintrust-sdk-javascript の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Merit-Systems/x402scan#1312 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Native Web
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
digitalfabrik/integreat-app#4517 ·
メンテナーはふだん 2 日以内に返信
-
TLS guide repeats certs/ in the certificate directory対応中かも @maheshrijal が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
prometheus/docs#3156 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
medusajs/dtc-starter#90 ·
メンテナーはふだん 1 日以内に返信