plugin: the agent-output readers crash on a JSON line that is not an object
维护者通常 1 天内回复
评估
调研方向
Read plugin/probe.py (run_session and inspect_session), plugin/sidecall.py (codex_call and copilot_call), and plugin/toolcheck.py (_init_tools); the report names each affected reader and the failure case. Check the regression tests mentioned in the linked pull request, then confirm malformed or non-object JSON lines are skipped while valid events still work. Pull request #183 is already open.
由索引模型根据 Issue 内容生成。
描述
What happens
Five readers of agent CLI output parse each line with json.loads and then call .get on the result, without the isinstance(ev, dict) check — the same gap #150 closed for the trace readers (and #181 for the cursor pair):
plugin/probe.pyrun_session— Copilot-p --output-format jsonstdout:ev.get("type")plugin/probe.pyinspect_session— Copilot's ownevents.jsonl:json.loads(line).get("data")(this one also has noexcept ValueError, so a partially-written or corrupt line containing"hook.end"crashes before.getis even reached)plugin/sidecall.pycodex_call—codex exec --jsonstdout:ev.get("item")plugin/sidecall.pycopilot_call— Copilot-pstdout:ev.get("type")plugin/toolcheck.py_init_tools—claude -p --output-format stream-jsonstdout:ev.get("type")
A line that is valid JSON but not an object (null, 42, "text", [1, 2]) — or, for inspect_session, any line with the "hook.end" prefilter that does not parse — raises and kills the whole probe / side call / tool check, instead of skipping the one line.
These are external-process streams, same exposure as the transcripts #150 hardened: anything the CLI or a tool it spawns writes to inherited stdout lands line-shaped in these loops.
Repro
>>> # sidecall.codex_call with a stubbed runner whose stdout is:
"null\n{\"type\":\"item.completed\",\"item\":{\"type\":\"agent_message\",\"text\":\"hi\"}}\n"
AttributeError: 'NoneType' object has no attribute 'get'
Fix
The same one-line isinstance(ev, dict) guard after json.loads in the four loops, plus the ValueError catch in inspect_session. I have it with regression tests ready and will open the PR.
- 主要语言
- Python
- 星标
- 5.6k
- 派生
- 344
- 平均合并
- 14 小时 41 分钟
- 30 天内合并 PR
- 54
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/TokenEconomizer 的其他 Issue
-
难度 5/5 一周以上 新手友好度 35/100
microsoft/TokenEconomizer#193 ·
维护者通常 1 天内回复
-
pricing: Claude's 1-hour cache writes are priced at 1.25x, but billed at 2x可能已有人在做 @anascherif 于 1 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 25/100
microsoft/TokenEconomizer#191 ·
维护者通常 1 天内回复
-
trace: Claude Code's `<synthetic>` notices count as requests and can make a Claude session price on the fallback curve可能已有人在做 @1AbdullahButt 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 20/100
microsoft/TokenEconomizer#189 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 20/100
microsoft/TokenEconomizer#186 ·
维护者通常 1 天内回复
-
trace: the cursor readers crash on a JSON line that is not an object可能已有人在做 @rahul05ranjan 于 1 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 25/100
microsoft/TokenEconomizer#180 ·
维护者通常 1 天内回复
查看 microsoft/TokenEconomizer 的全部 Issue
相似的 Issue
-
enhancement good first issue help wanted
难度 2/5 1-3 小时 新手友好度 88/100
-
Community
难度 2/5 1-3 小时 新手友好度 82/100
kedro-org/kedro-plugins#1575 ·
维护者通常 1 天内回复
-
hive size:simple
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
Significant-Gravitas/AutoGPT#16733 ·
维护者通常 1 天内回复
-
changelog investigate
难度 1/5 1 小时以内 新手友好度 74/100
ramnes/notion-sdk-py#444 ·