Burnmydays Claude Sonnet 4.6 commited on
Commit ·
15a5568
1
Parent(s): 0a78dd9
fix: route ccusage codex --json through parse_codex correctly
Browse filesis_codex_shape only checked snake_case keys; ccusage codex --json emits
camelCase (cachedInputTokens, reasoningOutputTokens). Detection missed,
data fell through to parse_ccusage: no 2:1 split, no cache, raw combined
input inflated. Now checks both cases. Also scopes ./sigrank default to
ccusage claude --json so Claude and Codex are never combined.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ingest.py +2 -1
- sigrank.py +3 -3
ingest.py
CHANGED
|
@@ -50,7 +50,8 @@ def is_codex_shape(d):
|
|
| 50 |
elif isinstance(o, list):
|
| 51 |
for v in o: scan(v)
|
| 52 |
scan(d)
|
| 53 |
-
return "cached_input_tokens" in keys or "
|
|
|
|
| 54 |
|
| 55 |
def parse_codex(text):
|
| 56 |
"""
|
|
|
|
| 50 |
elif isinstance(o, list):
|
| 51 |
for v in o: scan(v)
|
| 52 |
scan(d)
|
| 53 |
+
return ("cached_input_tokens" in keys or "cachedInputTokens" in keys or
|
| 54 |
+
"reasoning_output_tokens" in keys or "reasoningOutputTokens" in keys)
|
| 55 |
|
| 56 |
def parse_codex(text):
|
| 57 |
"""
|
sigrank.py
CHANGED
|
@@ -64,9 +64,9 @@ def _grab_usage(args):
|
|
| 64 |
return open(args.file, encoding="utf-8").read(), f"file {args.file}"
|
| 65 |
if args.stdin:
|
| 66 |
return sys.stdin.read(), "stdin"
|
| 67 |
-
# auto: run ccusage on the user's machine
|
| 68 |
-
sub = ["codex", "--json"] if args.codex else ["--json"]
|
| 69 |
-
label = "ccusage codex" if args.codex else "ccusage"
|
| 70 |
if shutil.which("ccusage"):
|
| 71 |
cmd = ["ccusage"] + sub
|
| 72 |
elif shutil.which("npx"):
|
|
|
|
| 64 |
return open(args.file, encoding="utf-8").read(), f"file {args.file}"
|
| 65 |
if args.stdin:
|
| 66 |
return sys.stdin.read(), "stdin"
|
| 67 |
+
# auto: run ccusage on the user's machine — subcommand scopes to one agent only
|
| 68 |
+
sub = ["codex", "--json"] if args.codex else ["claude", "--json"]
|
| 69 |
+
label = "ccusage codex" if args.codex else "ccusage claude"
|
| 70 |
if shutil.which("ccusage"):
|
| 71 |
cmd = ["ccusage"] + sub
|
| 72 |
elif shutil.which("npx"):
|