Skip to content

Fix pricing file not included in pip wheel - #17

Merged
anilmurty merged 2 commits into
mainfrom
fix-pricing-packaging
Apr 8, 2026
Merged

anilmurty merged 2 commits into
mainfrom
fix-pricing-packaging

Conversation

@anilmurty

Copy link
Copy Markdown
Contributor

Summary

pricing/models.toml lives at the repo root, outside the ocw/ package. The wheel only includes ocw/, so pip install openclawwatch results in:

CostEngine hook failed: [Errno 2] No such file or directory: '.../site-packages/pricing/models.toml'

All costs show $0.000000.

Fix: Copy models.toml into ocw/pricing/ (inside the package) and update the path in pricing.py. The original pricing/ at repo root is kept for reference.

Test plan

  • All 243 tests pass
  • python3 -c "from ocw.core.pricing import load_pricing_table; print(load_pricing_table())" works
  • After release: pip install --upgrade openclawwatch && python3 -c "from ocw.core.pricing import load_pricing_table; print('ok')" succeeds

🤖 Generated with Claude Code

anilmurty and others added 2 commits April 8, 2026 11:24
Move pricing/models.toml into ocw/pricing/ so it's packaged in the
wheel. Update path in pricing.py from parent.parent.parent (repo root)
to parent.parent (package root). Fixes CostEngine "No such file"
error when installed via pip.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@anilmurty
anilmurty merged commit 3cf744e into main Apr 8, 2026
4 checks passed
@anilmurty
anilmurty deleted the fix-pricing-packaging branch April 8, 2026 20:57
anilmurty added a commit that referenced this pull request Jun 19, 2026
#17: surface cache_write_tokens so cost reconciles from shown tokens
HoomanDgtl pushed a commit to HoomanDigital/tokenjam that referenced this pull request Jun 20, 2026
…om shown tokens

On cache-heavy Opus traffic, cache-write is ~91% of cost but was invisible
above the DB — the traces API omitted the field and the UI/tj cost never showed
cache tokens, so a displayed cost couldn't be derived from its own columns
(a trust problem for a cost tool).

- traces API (_span_to_dict) now returns cache_write_tokens alongside
  cache_tokens (read).
- UI trace-detail panel + waterfall tooltip render Cache read + Cache write.
- CostRow + get_cost_summary sum cache-read and cache-write; /api/v1/cost rows
  carry both + window totals; the UI Cost table and
                             TOKENS     TOKENS
  DATE       AGENT   MODEL   IN         OUT       CACHE R   CACHE W   COST
 ──────────────────────────────────────────────────────────────────────────────
  2026-06…   -       -       128.3k     1.1M      494.6M    0         $358.26…
  2026-06…   -       -       172.4k     1.6M      483.9M    2.8M      $361.65…
  2026-06…   -       -       5.5k       682.1k    395.7M    36.9k     $274.00…
  2026-06…   -       -       125        66.9k     38.5M     0         $47.9370
  2026-06…   -       -       635        180.7k    99.6M     0         $85.3886
  2026-06…   -       -       366        164.5k    65.7M     0         $66.3781
  2026-06…   -       -       45         30.8k     27.3M     0         $21.3287
                             307.4k     3.8M      1605.2M   2.9M      $1214.9…
                                                                                 table gain
  CACHE R / CACHE W columns (tool grouping stays cost-only — no token dimension).

Tests: trace detail + /cost expose cache-write (the reporter's exact span
reconciles); UI guard for the rendered fields. Suite green; ruff/mypy clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
anilmurty pushed a commit that referenced this pull request Jul 2, 2026
…lar (#17)

claimed "no UI change needed," but two dollar-bearing cells in the served
SPA still called bare `fmtCost(...)`. For a Max-subscription user
(framing.display_rule = suppress_dollars_for_subscription_share) this
leaked raw dollars: the session-detail "Cost & Tokens" / "Implied API
value" panel rendered e.g. "$198.9709" (and "$0.0000" on empty sessions),
and the Status "Archived sessions" table cost column showed raw "$0.0000".
The panel only relabeled the header for subscription users while still
emitting the raw figure — the exact honesty leak #191/#2 exist to prevent.

Both cells now route through the existing `fmtFramedDollar(value, framing)`
helper, matching how Traces/Cost/Optimize/Analytics render: subscription
users see token-share ("% of cycle"), local sees "—", and only api/unknown
plans see raw "$". The `framing` block is already in scope in both views —
SessionDetailView reads `data.framing` off /sessions/{id}; the Status view
reads `data.framing` off /status (already consumed by the agent cards'
"Cost today" cell). No backend change needed.

Guarded by two new static-grep regressions in
tests/unit/test_lens_ui_regression.py asserting the bare-fmtCost patterns
are gone and the framed forms are present (there is no JS runner in the
Python CI job; the served source is the unit under test).

Co-Authored-By: Claude <[email protected]>
anilmurty added a commit that referenced this pull request Aug 12, 2026
…ork (#717)

Four source comments cited #17 ("Fix pricing file not included in
pip wheel") for cache-write-token visibility work, which #17 does
not document. Per Critical Rule 23 in CLAUDE.md, describe the thing
plainly rather than cite a number that doesn't match.

Closes #594

Co-authored-by: Anil Murty <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant