Skip to content

fix: port tms#73 provider resolution to bogocat-tmq events.py#7

Merged
jakecelentano merged 2 commits into
mainfrom
fix/issue-83-dual-writer-provider
Jul 18, 2026
Merged

fix: port tms#73 provider resolution to bogocat-tmq events.py#7
jakecelentano merged 2 commits into
mainfrom
fix/issue-83-dual-writer-provider

Conversation

@jakecelentano

Copy link
Copy Markdown
Contributor

Summary

Port _resolve_dispatch_model + MODEL_TO_PROVIDER from tms#73 to
bogocat-tmq src/tmq/events.py. The plugin was the second writer to
tms_review.events and passed provider/model through without resolution,
leaving 27 dispatch rows with empty provider (Jul 14-16).

What changed

  • Added _resolve_default_model() — reads pi settings.json for default model
  • Added _resolve_dispatch_model(provider, model) — mirrors tms#73 resolver:
    known fleet model → derives provider from mapping (authoritative);
    unknown model → preserves explicit provider;
    no model → falls back to pi settings defaults
  • Wired into log_dispatch and log_dispatch_failed
  • Added tests/test_events.py with 10 parameterized tests covering:
    explicit model without provider, explicit model+provider, each fleet model,
    stale default override, both-empty resolution, and dispatch_failed path

Out of scope

  • Backfill script — that is in the companion tms PR (tms#83)
  • Deploying the updated plugin

Review

  • Panel: reviewer, reviewer-m3
  • Classification: standard (code port from known-good resolver)

Test plan

.aoe-build/venv/bin/pytest tests/ -v
65 passed in 0.53s

Verification

  • Empty provider impossible when model is known (_resolve_dispatch_model)
  • Known fleet models map to correct providers
  • Stale default provider never combines with explicit model
  • All existing tests still pass

Follow-ups

  • tms#83 companion PR with backfill script
  • Operator: rebuild plugin venv and restart aoe daemon after merge

Add _resolve_dispatch_model + MODEL_TO_PROVIDER to events.py,
mirroring tms#73. When --model is passed without --provider, derive
provider from the fleet map. Model-to-provider mapping is authoritative
— a known model always resolves to its provider, ignoring stale defaults.

Falls back to pi settings defaults only when no model is provided.

Closes tms#83 (backfill script is in the tms repo).
- Update resolver comments to say 'refines' not 'mirrors' tms#73
- Document intentional divergence from tms#73 in docstring
- Remove unused test helpers (MODEL_TO_PROVIDER, _resolve_dispatch_model,
  _resolve_default_model) that were never called by tests
@jakecelentano

Copy link
Copy Markdown
Contributor Author

Code Review — tms#86 + bogocat-tmq#7

Mode: standard | Lines: 461 combined (197 tms, 264 tmq) | Files: 3
Risk surface: Data correction (backfill script) + event logging logic
Reviewers: reviewer (deepseek-v4-pro), reviewer-m3 (MiniMax-M3)

Consensus

Both PRs are correct and well-tested. No Critical (P0) findings.

P1 Warnings (all addressed)

# Finding Fix
W1 Resolver diverges from tms#73 — known-model mapping is authoritative while tms#73 preserves explicit provider Documented as intentional "refines" in comments (3439495)
W2 Dead code in tests/test_events.py — unused helpers Removed (3439495)

Summary

The resolver correctly handles all 4 dispatch scenarios: explicit model→provider, stale default override, unknown-model pass-through, and both-empty fallback. log_dispatch_failed also resolves. 10 tests, all green. Companion backfill PR: bogocat/tms#86

<<REVIEW-VERDICT: PASS sha=34394953fc0a84c0eacbc226b1293a4e6d77eddf rounds=1 panel=deepseek-v4-pro,minimax-m3>>

@jakecelentano
jakecelentano merged commit 226c4d5 into main Jul 18, 2026
2 of 3 checks passed
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