Skip to content

[scan-fix] Phase 8: LLM providers / usage / billing#322

Merged
rennf93 merged 17 commits into
fix/scan-schemas-apifrom
fix/scan-llm-providers
Jul 7, 2026
Merged

[scan-fix] Phase 8: LLM providers / usage / billing#322
rennf93 merged 17 commits into
fix/scan-schemas-apifrom
fix/scan-llm-providers

Conversation

@rennf93

@rennf93 rennf93 commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Phase 8 of the 9-phase serial codebase-scan fix program. Stacks on #321 (Phase 7). CEO merges bottom-up — do not merge until #321 lands.

Findings fixed (8)

  • H14_apply_grok enables the seeded GROK provider row so resolve_for_agent routes to GrokCliProvider (SuperGrok auth), not just sets the global default. roboco/services/llm.py
  • M31_resolve_active_tokens routes GROK to usage.json so the live USAGE_SNAPSHOT sweep reflects grok agents mid-run, not only at finalize. orchestrator.py
  • M32 — usage sweep passes cache read/write tokens to calculate_cost and tracks them in _usage_by_agent, so live cost reflects Anthropic cache spend (matches the finalize path). orchestrator.py
  • M33 — Ollama-Cloud rate-limit parking via a _RATE_LIMIT_MARKERS_BY_PROVIDER / _OVERLOAD_MARKERS_BY_PROVIDER marker map; a glm-5.2:cloud ollama.com 429 parks the provider instead of crash-respawning into the weekly limit. Grok deliberately absent (exit-75 detector). orchestrator.py
  • M34_reconcile_orphan_spawn_sessions at startup closes crash-orphaned agent_spawn_sessions rows so their tokens roll into usage/cost summaries. orchestrator.py
  • L12revisit_resets column (migration 067, additive) + persist/restore in the respawn tracker, mirroring tracing_resets, so the PM-respawn breaker's revisit counter survives a restart. tables.py + orchestrator.py
  • L18 — Sonnet-5 promo date-gate: _sonnet5_prices() returns the promo tuple <= 2026-08-31, list rates after; Sonnet-5 row removed from _PRICING. roboco/billing/pricing.py
  • L20grok_cli_usage.main() warns on run-log parse failure (lazy %-formatting) instead of silent zero-attribution; swallow preserved so finalize can't crash on one bad log. roboco/llm/providers/grok_cli_usage.py

Gate (green)

  • uv run ruff format . — 2 files reformatted (trailing hygiene commit fbfcf20b)
  • uv run ruff check . — clean
  • uv run mypy roboco/ — 358 files, no issues
  • ROBOCO_TEST_DB_PORT=55432 ROBOCO_TEST_DB_USER=renzof uv run pytest — 12025 passed, 418 skipped, 95% coverage (11 new tests over Phase 7)

Review

Per-task sonnet reviews all Approved (Tasks 1–9). Opus whole-branch review: SHIP, no fix wave. All binding constraints hold (signed commits, no new # type:ignore/# noqa, AGPL-3.0, migration 067 additive with down_revision=066_tasks_source_status_idx).

Notes for the CEO

  • Migration 067 (revisit_resets) ships here — run alembic upgrade head after merge.
  • Sonnet-5 promo time bomb (follow-up, not a blocker): the pre-existing TestSonnet5PromoTier class asserts promo rates with no date monkeypatch and will fail on/after 2026-09-01. Plan-mandated; the two new tests pin both sides of the gate. Worth a separate follow-up to monkeypatch or delete those 7 tests before the promo expires.
  • Revision-id shortening (Task 6): 067_respawn_tracker_revisit_resets (34 chars) → 067_respawn_revisit_resets (26 chars) because alembic_version.version_num is VARCHAR(32). down_revision unchanged.

🤖 Generated with Claude Code

@github-project-automation github-project-automation Bot moved this to Backlog in RoboCo Kanban Jul 7, 2026
@github-actions github-actions Bot added documentation Docs, README, CHANGELOG, governance files area: services Touches roboco/services/ (business logic, side effects) area: db Touches roboco/db/ or roboco/models/ area: alembic Touches alembic/ (database migrations) tests Test suite changes area: orchestrator Touches roboco/runtime/ (agent spawner, dispatch loops) labels Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Thanks for opening your first pull request on RoboCo!

Quick checklist before review (most of these are enforced by CI, but worth a glance):

  • make quality — ruff format check, ruff check, mypy, pytest (≥80% coverage), and the rest of the gate
  • Panel changes pass pnpm lint and pnpm exec tsc --noEmit (run from panel/)
  • No # noqa / # type: ignore shortcuts; pre-existing violations in touched files are fixed
  • Added an entry under ## [Unreleased] in CHANGELOG.md
  • Signed the CLA (the bot will prompt you on this PR)
  • Signed your commits — master requires verified signatures (SSH signing setup)
  • Updated any affected docs under docs/

See CONTRIBUTING.md for the full workflow and the Code of Conduct for the community standards we follow.

Welcome aboard — a maintainer will review shortly.

[phase9] Auth hardening: bound agent tokens (iat/exp) + JWT jti revocation
@github-actions github-actions Bot added the area: api Touches roboco/api/ (FastAPI routes, schemas, app) label Jul 7, 2026
@rennf93 rennf93 merged commit 5b125af into fix/scan-schemas-api Jul 7, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in RoboCo Kanban Jul 7, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: alembic Touches alembic/ (database migrations) area: api Touches roboco/api/ (FastAPI routes, schemas, app) area: db Touches roboco/db/ or roboco/models/ area: orchestrator Touches roboco/runtime/ (agent spawner, dispatch loops) area: services Touches roboco/services/ (business logic, side effects) documentation Docs, README, CHANGELOG, governance files tests Test suite changes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant