plugin: the agent-output readers crash on a JSON line that is not an object
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 5.6k
- Fork
- 344
- Merge trung bình
- 14 giờ 41 phút
- Pull request đã merge (30 ngày)
- 54
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/TokenEconomizer
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
microsoft/TokenEconomizer#193 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
pricing: Claude's 1-hour cache writes are priced at 1.25x, but billed at 2xCó thể đã có người làm @anascherif đã nhận hôm nay. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
microsoft/TokenEconomizer#191 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
trace: Claude Code's `<synthetic>` notices count as requests and can make a Claude session price on the fallback curveCó thể đã có người làm @1AbdullahButt đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 20/100
microsoft/TokenEconomizer#189 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
microsoft/TokenEconomizer#186 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
trace: the cursor readers crash on a JSON line that is not an objectCó thể đã có người làm @rahul05ranjan đã nhận 1 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 25/100
microsoft/TokenEconomizer#180 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoft/TokenEconomizer
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Treat corrupt-shape state files as missing in `load_state`Có thể đã có người làm @Qrytics đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
OvertureMaps/overturemaps-py#175 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
awslabs/visual-asset-management-system#1278 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
aws-samples/sample-per-model-bedrock#835 ·
Maintainer thường phản hồi trong vòng 1 ngày