codex: usage is never captured in a real run (tokens: null) because the Stop hook payload has no transcript_path — read_usage() returns before the codex-rollout parser runs
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 70/100
Hướng nghiên cứu
Theo dõi cách xử lý usage từ src/bmad_loop/adapters/generic.py qua src/bmad_loop/signals.py, rồi so sánh với việc phát hiện rollout trong probe.py. Thêm một bài kiểm thử dựa trên fixture cho payload Stop không có transcript_path nhưng vẫn tạo ra usage từ một Codex rollout, sau đó cập nhật docs/adapter-authoring-guide.md để ghi lại yêu cầu hoặc fallback; bài kiểm thử phải thất bại khi việc phát hiện bị loại bỏ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
- Observed: bmad-loop 0.11.1 (installed via uv tool; source clone identical on the cited files), Windows 11, psmux backend, Codex CLI 0.153.4, profile
codex(usage_parser = "codex-rollout", hooks dialectcodex-hooks-json,.codex/hooks.jsonrelaying SessionStart + Stop tobmad_loop_hook.py). Run20260909-144751-8e8b, review stage on[adapter.review] name = "codex", model gpt-6-astra, 38-minute session that completed normally via the Stop hook. Journal:{"kind": "session-end", "task_id": "TASK-2831-review-1", "status": "completed", "tokens": null, "tokens_weighted": null}— while the dev stage (claude) on the same run reportedtokens: 19777795, tokens_weighted: 2460930. The task dirtasks/TASK-2831-review-1/holds onlyheartbeat.json+prompt.txt(nomessages.json). - The rollout files for that session exist and DO carry usage:
~/.codex/sessions/2026/09/09/rollout-2026-09-09T15-01-52-01a08530-0657-7ba1-91dd-8dd32958cdec.jsonl(39token_countevents) androllout-2026-09-09T15-02-26-01a08530-8bb7-7910-afd1-5cab56cd8bef.jsonl(18; the session spawned a subagent) —payload.type == "token_count"withpayload.info.total_token_usage.*, exactly whattally_codex_rolloutreads. - Code path:
src/bmad_loop/adapters/generic.py:1252-1254—read_usage()doesif not result.transcript_path: return Nonebeforetally_usage(self.profile.usage_parser, path)(:1262).src/bmad_loop/signals.py:113fillstranscript_path=data.get("transcript_path")from the hook payload. Codex's Stop hook payload carries notranscript_path(it is a Claude Code field), so for the codex profile the declaredusage_parseris unreachable in a real run — every codex session logstokens: null, and the[limits]token budget / cost ledgers see 0 for Codex. - Why
bmad-loop probe-adapter codex --probereports usage fine: probe mode discovers the rollout itself (probe.py~line 790, glob~/.codex/sessions/*/*/*/rollout-*.jsonl→infer_token_schema()), bypassingread_usage(); the same-day probe on this machine returnedinput_tokens: 2942, cache_read_tokens: 12928, output_tokens: 5fromrollout-2026-09-09T14-46-06-01a08521-99b8-72a0-b98b-156a48d74ca2.jsonl. The probe's captured Stop payload has notranscript_pathkey either — the JSON report keys arebinary, binary_found, captured_events, cli, declared_events, dialect, help, hooks_registered, known_profile, mode, next_steps, schema_version, tokens, transcript, usage_parser, version, warnings, withtranscript.locationcoming from the glob. - Proposed fix (either): (a) when the profile's usage parser is
codex-rolloutand the payload has notranscript_path, resolve the rollout from the Stop payload's session/thread id — rollout filenames end with the session UUID (rollout-<timestamp>-<session_id>.jsonl), so~/.codex/sessions/**/rollout-*-<session_id>.jsonlis deterministic; sum usage across the subagent rollouts spawned by that session if they can be attributed; or (b) reuse the probe's discovery (newest rollout whosepayload.cwd== the unit's cwd and whose first timestamp ≥ session start) as a fallback insideread_usage(), behind the profile (transcript_discovery = "codex-sessions-glob"). Add a zero-token test with a fixture rollout + a Stop payload lackingtranscript_paththat asserts usage is populated (ablation: remove the fallback → the test must fail). - Also worth a line in
docs/adapter-authoring-guide.md:usage_parseron a profile is only reached when the CLI's Stop payload suppliestranscript_path.
Source
found-in: bmad-loop 0.11.1 (uv tool) + source clone E:\vibe-coding\bmad-loop (main), Windows 11 · session: Claude Code 4d0f4496 (2026-09-09) · while: first color-dev-loop run with the review stage on Codex (customthing/ai-pod-auto PR #766) · evidence: journal session-end tokens null vs dev stage populated; rollout files with 39/18 token_count events; generic.py:1252-1254, signals.py:113, probe.py glob discovery
- Ngôn ngữ chính
- Python
- Star
- 165
- Fork
- 69
- Merge trung bình
- 1 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 78
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 bmad-code-org/bmad-loop
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
bmad-code-org/bmad-loop#973 ·
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 78/100
bmad-code-org/bmad-loop#965 ·
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 75/100
bmad-code-org/bmad-loop#835 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
tickets: an injected plan_halt result for a built plan escalates with stopped-attempt wordingĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 36/100
bmad-code-org/bmad-loop#972 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 49/100
bmad-code-org/bmad-loop#971 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của bmad-code-org/bmad-loop
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
NVIDIA/flare-local-inference#90 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/streaming comp/gateway P2 platform/telegram type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NousResearch/hermes-agent#144897 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
request-theme
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 66/100
LizardByte/ThemerrDB#9575 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Author Page: noshin-nawalĐang mởauthor-page correction
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
acl-org/acl-anthology#10599 · 1 bình luận ·
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 78/100
zilliztech/memsearch#818 ·
Maintainer thường phản hồi trong vòng 1 ngày