← Back to PRs

#22924: feat(model-usage): merge basic observability modes (errors/overview)

by futuremind2026 open 2026-02-21 20:38 View on GitHub →
size: M
## 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