Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

pi-coding-agent: Pi 1.4 system messages dropped, so LLM spans have no system prompt or tools

未关闭
#2,662 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@pcbeingused333 已经在做这个了。

开始于 2026年10月25日。

  • #2663 来自 @pcbeingused333 —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
领域
observability

调研方向

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:

  • normalizePiContextInput adds a system message only from context.systemPrompt;
  • normalizePiMessage returns [] for a role: "system" message, so the transcript's system messages are dropped;
  • extractToolMetadata(context.tools) (LLM span metadata.tools) and wrapPiToolExecutors(context.tools) see undefined.

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 SystemMessage into a { role: "system", content } input message, rendering content followed by its sections (later messages replace sections by name; null removes one), or at least keep the message's content and sections.
  • Fold toolsAdded / toolsRemoved across the transcript's system messages into the declared tool set and report it as metadata.tools, falling back to context.tools for callers that still pass it.
  • Wrap tool executors from the agent's tools (agent.state.tools) rather than context.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 小时
30 天内合并 PR
67

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

braintrustdata/braintrust-sdk-javascript 的其他 Issue

查看 braintrustdata/braintrust-sdk-javascript 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。