#22924: feat(model-usage): merge basic observability modes (errors/overview)
size: M
Cluster:
Skill and Session Management Fixes
## Summary
This PR extends the `model-usage` skill from cost-only reporting to a combined **cost + observability** utility.
### Added
- New modes:
- `errors`: scan recent OpenClaw sessions for failed/aborted runs and provide concise diagnostics
- `overview`: combine cost summary + error summary in one report
- `openclaw` dependency in skill metadata (for session/log inspection paths)
- Basic gateway log hint collection to improve triage context
### Existing behavior preserved
- `current` and `all` cost modes continue to work as before (CodexBar-based)
## Why
Operators often need a quick one-shot view of **model spend + recent failures**.
This reduces context switching between separate scripts/commands when doing routine health checks.
## Validation
- `python3 skills/model-usage/scripts/model_usage.py --help`
- Verified mode flags include: `current | all | errors | overview`
## Scope
Touches only:
- `skills/model-usage/SKILL.md`
- `skills/model-usage/scripts/model_usage.py`
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR extends the `model-usage` skill from cost-only reporting to a combined cost + observability utility. It adds two new modes (`errors` and `overview`) to scan OpenClaw sessions for failed/aborted runs and combines cost summaries with error diagnostics.
**Critical Issue Found:**
- The script calls `openclaw sessions list --limit <num>` but the CLI does not support the `--limit` flag, causing runtime failure. The filtering must be done in Python after fetching all sessions.
**Style Issues:**
- SKILL.md contains Chinese text mixed with English (lines 19-22, 45-48, 52-54), which is inconsistent with repository documentation standards.
**Positive Aspects:**
- Clean code structure with well-organized functions
- Proper error handling for missing dependencies (`codexbar`, `openclaw`)
- Cross-platform log collection (journalctl for Linux, file fallback for macOS)
- Backward compatibility maintained for existing `current` and `all` modes
<h3>Confidence Score: 2/5</h3>
- This PR contains a critical bug that will cause runtime failure in the new error/overview modes
- Score reflects a critical logical error where the code uses a non-existent CLI flag (`--limit`) that will cause the `errors` and `overview` modes to fail at runtime. While the code is well-structured and the existing modes are preserved, the new functionality cannot work without fixing this bug. The Chinese documentation also needs to be translated to English for consistency.
- Pay close attention to `skills/model-usage/scripts/model_usage.py` line 70 - the `--limit` flag must be removed and filtering applied after fetching sessions
<sub>Last reviewed commit: a2e40d6</sub>
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#16087: docs: enhance OpenCode documentation in coding-agent skill
by imwxc · 2026-02-14
74.6%
#22525: [Bug]: Session snapshot not reloading skills after gateway restart ...
by zwffff · 2026-02-21
74.3%
#19664: fix(skills): log skill YAML parsing diagnostics with skill name
by orchidsun · 2026-02-18
73.6%
#10665: fix(docs): replace removed gateway wake with system event in coding...
by Yida-Dev · 2026-02-06
73.4%
#22306: Warn on malformed skill parsing failures in load path
by AIflow-Labs · 2026-02-21
73.3%
#10973: docs: add model-level usage summary via CodexBar CLI
by rohansachinpatil · 2026-02-07
73.2%
#8873: fix: document skill loading locations in system prompt
by ytfh44 · 2026-02-04
73.1%
#8455: feat: add thinking/model config to skills.entries
by tsukhani · 2026-02-04
72.9%
#19267: fix: derive failover reason from timedOut flag to prevent unknown c...
by austenstone · 2026-02-17
72.9%
#20266: feat: skills-audit — Phase 1 security scanner for installed skills
by theMachineClay · 2026-02-18
72.6%