fix(tracker): scope review time estimates to the provider in use #83

Merged
rcsheets merged 1 commit from fix/duration-estimate-per-provider into main 2026-07-26 21:39:36 +00:00
Owner

EstimateDuration regressed duration_ms against diff_chars over every
completed review row, with no provider filter, and widened from
tier-scoped to all tiers when a tier was short on data. With A/B fan-out
running several model configs against every PR, that pool mixes
providers whose throughput differs by an order of magnitude, so the
"a quick scan like this typically takes X" line in the pending comment
described an average across inference services rather than the one
actually doing the work.

Confine the sample to the primary config's provider and never fall back
across providers: widen from exact config + tier, to exact config, to
provider + tier, to provider, then give up and let the caller print the
existing "not enough data" line. The config-to-provider step matters on
first boot, where FallbackConfig mints a fresh UUID per run and so has
no config-level history to draw on.

Two population fixes fall out of the same read:

  • Restrict to primary runs. recordConfigResult stores whole-pipeline
    wall time on primary rows but LLM-call time alone on shadow rows;
    pooling them averaged two different measurements, and the primary
    one is what a PR reader is waiting on.

  • Drop truncated runs. A generation bounded by max_tokens says
    nothing about how long the diff takes, as reviewer.IsTruncated
    already documents. Filtered in Go rather than SQL because migration
    000009 stores finish_reason unnormalized across two wire
    vocabularies and directs callers to that predicate instead of
    literals. This adds tracker -> reviewer; reviewer is a leaf, so
    there is no cycle.

Scope selection and query construction are split into durationScopes and
durationQuery so the filter composition is testable without a database,
which the package has no harness for.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

EstimateDuration regressed duration_ms against diff_chars over every completed review row, with no provider filter, and widened from tier-scoped to all tiers when a tier was short on data. With A/B fan-out running several model configs against every PR, that pool mixes providers whose throughput differs by an order of magnitude, so the "a quick scan like this typically takes X" line in the pending comment described an average across inference services rather than the one actually doing the work. Confine the sample to the primary config's provider and never fall back across providers: widen from exact config + tier, to exact config, to provider + tier, to provider, then give up and let the caller print the existing "not enough data" line. The config-to-provider step matters on first boot, where FallbackConfig mints a fresh UUID per run and so has no config-level history to draw on. Two population fixes fall out of the same read: - Restrict to primary runs. recordConfigResult stores whole-pipeline wall time on primary rows but LLM-call time alone on shadow rows; pooling them averaged two different measurements, and the primary one is what a PR reader is waiting on. - Drop truncated runs. A generation bounded by max_tokens says nothing about how long the diff takes, as reviewer.IsTruncated already documents. Filtered in Go rather than SQL because migration 000009 stores finish_reason unnormalized across two wire vocabularies and directs callers to that predicate instead of literals. This adds tracker -> reviewer; reviewer is a leaf, so there is no cycle. Scope selection and query construction are split into durationScopes and durationQuery so the filter composition is testable without a database, which the package has no harness for. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
fix(tracker): scope review time estimates to the provider in use
All checks were successful
ci / check (pull_request) Successful in 43s
f559d66280
EstimateDuration regressed duration_ms against diff_chars over every
completed review row, with no provider filter, and widened from
tier-scoped to all tiers when a tier was short on data. With A/B fan-out
running several model configs against every PR, that pool mixes
providers whose throughput differs by an order of magnitude, so the
"a quick scan like this typically takes X" line in the pending comment
described an average across inference services rather than the one
actually doing the work.

Confine the sample to the primary config's provider and never fall back
across providers: widen from exact config + tier, to exact config, to
provider + tier, to provider, then give up and let the caller print the
existing "not enough data" line. The config-to-provider step matters on
first boot, where FallbackConfig mints a fresh UUID per run and so has
no config-level history to draw on.

Two population fixes fall out of the same read:

  - Restrict to primary runs. recordConfigResult stores whole-pipeline
    wall time on primary rows but LLM-call time alone on shadow rows;
    pooling them averaged two different measurements, and the primary
    one is what a PR reader is waiting on.

  - Drop truncated runs. A generation bounded by max_tokens says
    nothing about how long the diff takes, as reviewer.IsTruncated
    already documents. Filtered in Go rather than SQL because migration
    000009 stores finish_reason unnormalized across two wire
    vocabularies and directs callers to that predicate instead of
    literals. This adds tracker -> reviewer; reviewer is a leaf, so
    there is no cycle.

Scope selection and query construction are split into durationScopes and
durationQuery so the filter composition is testable without a database,
which the package has no harness for.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Collaborator

Automated review by pr-reviewer v0.41.0 | Safety Check | Mistral Small | tracking id r-667de1-b7c5df
This is an AI-generated review and may contain mistakes.

Status: Completed


Verdict: LGTM — No obvious bugs, security issues, accidentally committed files, or breaking changes detected.

The changes are narrowly scoped to fixing duration estimate logic and add unit tests for the new scope selection and query construction. No red flags detected.

*Automated review by [pr-reviewer](https://git.brooktrails.org/brooktrails/pr-reviewer) v0.41.0 | Safety Check | Mistral Small | tracking id `r-667de1-b7c5df`* *This is an AI-generated review and may contain mistakes.* **Status:** ✅ Completed --- **✅ Verdict: LGTM** — No obvious bugs, security issues, accidentally committed files, or breaking changes detected. The changes are narrowly scoped to fixing duration estimate logic and add unit tests for the new scope selection and query construction. No red flags detected.
rcsheets deleted branch fix/duration-estimate-per-provider 2026-07-26 21:39:36 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
brooktrails/pr-reviewer!83
No description provided.