Repository navigation
Conversation
…t reply A provider failure is persisted by the agent runtime as an assistant message with stopReason error and no content, so the history projection returned an empty array and the server logged nothing. Carry the provider, model and failure category into both surfaces.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
模型调用失败时(没配 key、上游 429/5xx、网关超时),pi-agent-core 会把失败写进一条
stopReason: "error"的 assistant 消息——但它不抛异常。于是:我在本地真机复现过一次:没有凭据的实例发一条消息,
turnStatus: failed、52ms、content: []——用户看到的就是「没反应」。改法
失败原因只存在于持久化记录里,所以从记录里读:
apps/server/src/runtime/agent/model-failure.tsmodelFailureFrom(message):只认role: "assistant"且stopReason === "error"(或带errorMessage)的消息,按正则分三类——credential_missing/upstream_error/model_errormodelFailureText(failure):生成一行人能看懂的话,带 provider/model/category/reason,不回显任何凭据agent-session-repository.ts:内容为空且命中失败时,把这句话写回消息体,前端自然就显示了node-session-service.ts:每个message.completed事件检查一次,命中就log("error", ...)并带结构化字段(provider/model/category),不重复刷验证(先红后绿)
9 passedagent-session-repository.ts回退到292d0ec6再跑 →1 failed | 2 passed,失败点正是「空内容应被替换成可读文本」43b9608f79b43f15772cd2026b7fc0f95fd5551b与 HEAD 一致,工作树干净pnpm --filter @pi-science/server typecheckexit 0风险与已知限制
model_error这个兜底类(仍比空白好,但不是精确归因)。