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分
- マージ済み PR(30日)
- 54
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/TokenEconomizer のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
microsoft/TokenEconomizer#193 ·
メンテナーはふだん 1 日以内に返信
-
pricing: Claude's 1-hour cache writes are priced at 1.25x, but billed at 2x対応中かも @anascherif が今日担当しました。 オープン
難易度 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 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 20/100
microsoft/TokenEconomizer#189 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 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
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
Treat corrupt-shape state files as missing in `load_state`対応中かも @Qrytics が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
OvertureMaps/overturemaps-py#175 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
awslabs/visual-asset-management-system#1278 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
aws-samples/sample-per-model-bedrock#835 ·
メンテナーはふだん 1 日以内に返信