Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/reconcile-models/RULES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ What a reconcile-models run changes, what it skips and why, and what it hands to
5. **Only what the report can list.** Change only values a report field covers, so an existing `Description` stays as it is. A new model's `Description` comes from its vendor's own pages.
6. **Append-only.** Adding a model never edits an existing entry: ordering, succession and price tiers are derived when the catalogue is read, and a newer model in a series is a new entry. Adding a regional copy extends its family, and may re-route the family's bare names only as new-copy-offered-region says. A retired model keeps its entry, so old usage stays priceable.
7. **No questions, little prose.** No person takes part in a CI run, so the bot never stops to ask: a case that needs a person becomes a `needs_human` row with its Ask's fixed question. A hand run asks the person that question instead. The report's only free text is three short sentences on a `needs_human` row (`why`, `rule_when` and `rule_does`, in plain characters; see Report values): every other value is an ID, a field, a skip reason, a short value or a URL on a named host, and code writes the rest of the PR's notes. Every row names the rule that gives its outcome: a `changes` row names the Default for its field, and a `skipped` or `needs_human` row its Default or Ask, or no-rule when none does. Skip an offering only when a rule leaves it out, and never beside a `needs_human` row for it, so a skip always means something. A `no_catalog_field` row leaves out one fact, not the offering, so it can stand beside the offering's other rows.
8. **Recorded decisions.** Read `.github/reconcile-models/decisions.yaml` before proposing changes, and don't change a decided value, so later runs don't reopen what a review settled. Still report the rows the rules call for; the PR shows a row a decision answers as held, linked to the decision. Each decision names one offering and field, its kind (keep or hold), a public reason and a `review_by` date, and never widens sources, paths or checks; a case that would need many decisions becomes a rule here instead. Decisions change only in reviewed PRs.
8. **Recorded decisions.** Read `.github/reconcile-models/decisions.yaml` before proposing changes, so later runs don't reopen what a review settled. A keep fixes a value, or only the parts its `keys` name: don't change it. A hold on `new_model` or `new_copy` keeps that model or copy out; a hold on another field leaves the value out while its `rule` still asks, and never stops a change another rule makes. A decision that names a `rule` answers only that rule's questions. Still report the rows the rules call for; the PR shows a row a decision answers as held, linked to the decision. Each decision names one offering and field, its kind, a public reason and a `review_by` date, and never widens sources, paths or checks. `review_by` is three months after `decided`, or a year for a decision that records a lasting choice rather than a wait for a fix; its reason then says so. A case that covers many models becomes a rule here instead; one model's case may take a decision for each of its IDs. Decisions change only in reviewed PRs.

## Report values

Expand Down
75 changes: 73 additions & 2 deletions .github/reconcile-models/decisions.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,78 @@
# Review decisions for reconcile-models runs; RULES.md (Principles) says how they work.
# Public file: no people, customers, internal systems or ticket keys.
# An offering is <package>:<model ID>. A keep's lock uses the field's shape in
# catalog/snapshot.json; a hold is on new_model or new_copy with no lock.
# catalog/snapshot.json, or only the parts its keys name. A hold takes no lock;
# on a field other than new_model or new_copy it names the rule whose question
# it answers, never no-rule, and on those two no rule. The PR that closes a held
# gap deletes its hold.
# review_by is three months after decided; a decision that records a lasting
# choice, not a wait for a fix, gets a year, and its reason says so. The check
# refuses a date more than a year out; the three months are the reviewer's to
# check.
# TestDecisionsHold fails on a contradiction and prints the current value to
# paste as a lock.
decisions: []
decisions:
- id: DEC-001
offering: bedrock:global.amazon.nova-2-lite-v1:0
field: price
kind: hold
rule: out-of-reach
reason: "AWS prices Nova 2 Lite profile calls by the calling region, but the catalogue holds one rate per profile and a profile's reply doesn't name that region, so these rates wait for SDK support."
decided: 2026-11-17
review_by: 2027-02-17
- id: DEC-002
offering: bedrock:eu.amazon.nova-2-lite-v1:0
field: price
kind: hold
rule: out-of-reach
reason: "AWS prices Nova 2 Lite profile calls by the calling region, but the catalogue holds one rate per profile and a profile's reply doesn't name that region, so these rates wait for SDK support."
decided: 2026-11-17
review_by: 2027-02-17
- id: DEC-003
offering: bedrock:us.amazon.nova-2-lite-v1:0
field: capability
kind: hold
rule: reasoning-unsendable
reason: "Nova 2 Lite takes reasoning efforts through reasoningConfig, but the SDK's Bedrock code sends reasoning only in Anthropic's format, so the efforts stay out until it sends reasoningConfig."
decided: 2026-11-17
review_by: 2027-02-17
- id: DEC-004
offering: bedrock:eu.amazon.nova-2-lite-v1:0
field: capability
kind: hold
rule: reasoning-unsendable
reason: "Nova 2 Lite takes reasoning efforts through reasoningConfig, but the SDK's Bedrock code sends reasoning only in Anthropic's format, so the efforts stay out until it sends reasoningConfig."
decided: 2026-11-17
review_by: 2027-02-17
- id: DEC-005
offering: bedrock:global.amazon.nova-2-lite-v1:0
field: capability
kind: hold
rule: reasoning-unsendable
reason: "Nova 2 Lite takes reasoning efforts through reasoningConfig, but the SDK's Bedrock code sends reasoning only in Anthropic's format, so the efforts stay out until it sends reasoningConfig."
decided: 2026-11-17
review_by: 2027-02-17
- id: DEC-006
offering: bedrock:jp.amazon.nova-2-lite-v1:0
field: capability
kind: hold
rule: reasoning-unsendable
reason: "Nova 2 Lite takes reasoning efforts through reasoningConfig, but the SDK's Bedrock code sends reasoning only in Anthropic's format, so the efforts stay out until it sends reasoningConfig."
decided: 2026-11-17
review_by: 2027-02-17
- id: DEC-007
offering: fireworks:accounts/fireworks/models/deepseek-v4p1-flash
field: capability
kind: hold
rule: reasoning-unsendable
reason: "Fireworks documents a hard thinking budget for DeepSeek V4.1 only on Chat Completions, but the SDK calls these models through Messages, which has none, so the budget stays out until the SDK can send it."
decided: 2026-11-17
review_by: 2027-02-17
- id: DEC-008
offering: fireworks:accounts/fireworks/models/deepseek-v4p1-flash-1017
field: capability
kind: hold
rule: reasoning-unsendable
reason: "Fireworks documents a hard thinking budget for DeepSeek V4.1 only on Chat Completions, but the SDK calls these models through Messages, which has none, so the budget stays out until the SDK can send it."
decided: 2026-11-17
review_by: 2027-02-17
11 changes: 8 additions & 3 deletions REVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,15 @@ To review one:
row covers needs a new rule.
- Settle each question in "Open questions" as its Decide line says, or record a
decision in `.github/reconcile-models/decisions.yaml`, in a PR to the base
branch. A decision stops the question coming back. You may also merge with a
question open; the next run asks it again.
branch. A decision stops the question coming back. For a gap the SDK can't
fill yet, record a `hold` that names the question's rule; the PR that adds
the support deletes it. You may also merge with a question open; the next
run asks it again.
- In "Held by decisions", each value should still match its entry in
`.github/reconcile-models/decisions.yaml`.
`.github/reconcile-models/decisions.yaml`. The line that counts recorded
decisions also names any decision that names a rule, on a model the
catalogue carries, and answered no question this run. A run can miss a
question, so delete it only if its reason no longer holds.
- Approve a move in "Routing changes" only if every caller of that name can
take the new profile and its price.
- Read the files under "Code changed" as code before marking the PR ready: that
Expand Down
88 changes: 73 additions & 15 deletions cmd/catalog-report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,9 @@ func (base Base) questionBlock(q numbered) string {
// principle 8).
func (base Base) decide(q numbered) string {
item, n := q.row, len(q.offerings)
// decisions.yaml takes no decision on a location, and a keep on a fact
// the catalogue lacks has nothing to lock, so a rule stops those too.
// decisions.yaml takes no decision on a location, and a fact the
// catalogue lacks can take neither a keep (nothing to lock) nor a hold
// (it can't name no-rule), so a rule stops those too.
added := item.Field == reconcile.FieldNewCopy || item.Field == reconcile.FieldNewModel
none := !added && strings.EqualFold(item.Catalogue, "none")
stop := func(kind string) string {
Expand Down Expand Up @@ -951,11 +952,15 @@ func sameOffering(reported, provider, decided string) bool {
}

// hold takes the needs_human and skipped rows a decision already answers out
// of the report, and returns the rest with the held table's rows.
func (base Base) hold(report Report, provider string) (Report, []string) {
find := func(offering string, wanted ...string) (reconcile.Decision, bool) {
// of the report, and returns the rest with the held table's rows and the IDs
// of the decisions that answered one. A decision that names a rule answers
// only that rule's rows.
func (base Base) hold(report Report, provider string) (Report, []string, map[string]bool) {
answered := map[string]bool{}
find := func(offering, rule string, wanted ...string) (reconcile.Decision, bool) {
for _, d := range base.Decisions {
if slices.Contains(wanted, d.Field) && sameOffering(offering, provider, d.Offering) {
if slices.Contains(wanted, d.Field) && sameOffering(offering, provider, d.Offering) && d.Answers(rule) {
answered[d.ID] = true
return d, true
}
}
Expand All @@ -973,7 +978,7 @@ func (base Base) hold(report Report, provider string) (Report, []string) {
var needs []NeedsHuman

for _, item := range report.NeedsHuman {
if d, ok := find(item.Offering, item.Field); ok {
if d, ok := find(item.Offering, item.Rule, item.Field); ok {
held = append(held, row(d, item.Offering, valueList(rowValues(item))))
} else {
needs = append(needs, item)
Expand All @@ -983,7 +988,7 @@ func (base Base) hold(report Report, provider string) (Report, []string) {
var skipped []Skipped

for _, item := range report.Skipped {
if d, ok := find(item.Offering, reconcile.FieldNewModel, reconcile.FieldNewCopy); ok {
if d, ok := find(item.Offering, item.Rule, reconcile.FieldNewModel, reconcile.FieldNewCopy); ok {
held = append(held, row(d, item.Offering, item.Reason))
} else {
skipped = append(skipped, item)
Expand All @@ -992,7 +997,7 @@ func (base Base) hold(report Report, provider string) (Report, []string) {

report.NeedsHuman, report.Skipped = needs, skipped

return report, held
return report, held, answered
}

// byRule groups change rows by rule, in RULES.md's order so every run lists
Expand Down Expand Up @@ -1156,8 +1161,10 @@ func (base Base) splitWaiting(report Report) (Report, []Skipped) {
}

// summary is one line about decisions.yaml itself: how many decisions it
// holds, and which are past their review date. It shows on every run.
func (base Base) summary() string {
// holds, which are past their review date, and which of those that name a
// rule answered no question in a run that checked them. It shows on every
// run.
func (base Base) summary(parts []vendorPart) string {
if len(base.Decisions) == 0 {
return ""
}
Expand All @@ -1175,8 +1182,58 @@ func (base Base) summary() string {
due = strings.Join(overdue, ", ") + " (still enforced)."
}

return fmt.Sprintf("Recorded decisions: %d, in %s. Past their review date: %s\n\n",
line := fmt.Sprintf("Recorded decisions: %d, in %s. Past their review date: %s",
len(base.Decisions), base.fileLink("decisions.yaml", reconcile.DecisionsPath, 0), due)
if ids := base.unanswered(parts); len(ids) > 0 {
line += fmt.Sprintf(" Answered no question this run: %s. A run can miss a question, so delete %s only if its reason no longer holds.",
strings.Join(ids, ", "), plural(len(ids), "it", "one"))
}

return line + "\n\n"
}

// unanswered names each decision that names a rule, on an offering the
// catalogue carries, that answered no question in the run of its model's
// publisher. Each vendor's catalogue holds every offering, so any one will
// do; a vendor whose patch changed nothing brings none, and when none did,
// nothing is named. A decision with no rule is never named: a keep may stop
// a change a Default would make, which raises no question, and a hold on
// new_model or new_copy ends when its offering is added (TestDecisionsHold
// fails) or at its review date.
func (base Base) unanswered(parts []vendorPart) []string {
var catalogue *reconcile.Snapshot

// answered holds, for each vendor whose run didn't fail, the decisions
// that answered one of its questions.
answered := map[string]map[string]bool{}

for _, part := range parts {
if catalogue == nil {
catalogue = part.Before
}

if !part.Failed {
answered[part.Name] = part.answered
}
}

if catalogue == nil {
return nil
}

var ids []string

for _, d := range base.Decisions {
offering, found := catalogue.Offering(reconcile.PackageOf(d.Offering, ""))
model, _ := offering["model"].(string)
publisher, _ := catalogue.Facts[model]["publisher"].(string)

if used, ran := answered[publisher]; found && ran && d.Rule != "" && !used[d.ID] {
ids = append(ids, d.ID)
}
}

return ids
}

// Vendor is one vendor's part of the PR: its report, and the catalogue
Expand Down Expand Up @@ -1207,6 +1264,7 @@ type vendorPart struct {
base Base
shown Report
held []string
answered map[string]bool
waiting []Skipped
asks []question
unreported []string
Expand All @@ -1217,7 +1275,7 @@ type vendorPart struct {
func (base Base) part(vendor Vendor) vendorPart {
part := vendorPart{Vendor: vendor, base: base}
part.base.Before, part.base.After = vendor.Before, vendor.After
part.shown, part.held = part.base.hold(vendor.Report, vendor.Name)
part.shown, part.held, part.answered = part.base.hold(vendor.Report, vendor.Name)
part.shown, part.waiting = part.base.splitWaiting(part.shown)
part.asks = questions(part.shown.NeedsHuman)
// Held and waiting rows still count as rows here.
Expand Down Expand Up @@ -1265,7 +1323,7 @@ func (base Base) render(vendors []Vendor, codeFiles []string, hasDiff bool) (str
body.WriteString("## Catalogue drift: " + strings.Join(names, ", ") + "\n\n")

if rows == 0 && !failed && !hasDiff {
body.WriteString("No drift found.\n\n" + base.summary())
body.WriteString("No drift found.\n\n" + base.summary(parts))
return body.String(), nil
}

Expand All @@ -1292,7 +1350,7 @@ func (base Base) render(vendors []Vendor, codeFiles []string, hasDiff bool) (str
// says why (plan.sh, carry.sh); REVIEW.md has the details.
body.WriteString("You can push commits here: the bot never removes them. It doesn't read comments.\n\n")

body.WriteString(base.summary())
body.WriteString(base.summary(parts))

// What the PR asks of people takes a share of the room like a vendor's
// section, so many questions can't push every Changes table out of a
Expand Down
84 changes: 84 additions & 0 deletions cmd/catalog-report/report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,14 @@ func TestRender(t *testing.T) {
holdCopy.Field = reconcile.FieldNewCopy
otherField := keepLimit
otherField.Field = "price"
otherRule := keepLimit
otherRule.Rule = "out-of-reach"
sameRule := keepLimit
sameRule.Rule = reconcile.JudgmentRule
gapHold := reconcile.Decision{
ID: "DEC-003", Offering: "anthropic:claude-sonnet-5-5", Field: "limit", Kind: reconcile.KindHold, Rule: reconcile.JudgmentRule,
Reason: "The SDK can't send it yet.", ReviewBy: "2027-01-13", Line: 20,
}
// #259's copies in India, which Bedrock doesn't offer, and one in a second region.
waiting := []Skipped{
{Offering: "bedrock:in.anthropic.claude-opus-5", Reason: "region_not_offered", Rule: "region-not-offered"},
Expand Down Expand Up @@ -831,6 +839,26 @@ func TestRender(t *testing.T) {
contains: []string{"### Open questions (1)"},
notContains: []string{"### Held by decisions"},
},
{
name: "a decision on another rule holds nothing",
report: validReport(),
base: Base{URL: baseURL, Decisions: []reconcile.Decision{otherRule}, Today: "2026-10-14"},
contains: []string{"### Open questions (1)"},
notContains: []string{"### Held by decisions"},
},
{
name: "a decision on the question's rule holds it",
report: validReport(),
base: Base{URL: baseURL, Decisions: []reconcile.Decision{sameRule}, Today: "2026-10-14"},
contains: []string{"### Held by decisions (1)"},
},
{
name: "a hold on a field holds its rule's question",
report: validReport(),
base: Base{URL: baseURL, Decisions: []reconcile.Decision{gapHold}, Today: "2026-10-14"},
contains: []string{"| [DEC-003](" + decisionsURL + "#L20) | `claude-sonnet-5-5` | limit | `65535`, `65536` | The SDK can't send it yet. |"},
notContains: []string{"### Open questions"},
},
{
name: "an overdue decision is named even with no drift",
report: Report{},
Expand Down Expand Up @@ -884,6 +912,62 @@ func TestRender(t *testing.T) {
}
}

// TestRenderUnansweredDecisions checks that the decisions line names a
// decision that answered no question in a run of its model's vendor, so a
// record whose case is gone gets deleted.
func TestRenderUnansweredDecisions(t *testing.T) {
t.Parallel()

snap, err := reconcile.ParseSnapshot([]byte(`{
"facts": {"anthropic/claude-sonnet-5-5": {"publisher": "anthropic"}, "anthropic/claude-opus-5-5": {"publisher": "anthropic"}},
"providers": [{"provider": "anthropic", "offerings": [
{"id": "claude-sonnet-5-5", "model": "anthropic/claude-sonnet-5-5"},
{"id": "claude-opus-5-5", "model": "anthropic/claude-opus-5-5"}]}]}`))
require.NoError(t, err)

stale := keepLimit
stale.ID, stale.Offering, stale.Rule = "DEC-002", "anthropic:claude-opus-5-5", "out-of-reach"
// A keep with no rule may stop a Default's change, which raises no
// question, so answering none says nothing about it.
guard := keepLimit
guard.ID, guard.Offering, guard.Field = "DEC-003", "anthropic:claude-opus-5-5", "price"
base := Base{Decisions: []reconcile.Decision{keepLimit, stale, guard}, Today: "2026-10-14"}
const named = "Answered no question this run: DEC-002. A run can miss a question, so delete it only if its reason no longer holds."

tests := []struct {
name string
vendors []Vendor
want string
}{
{
"names a decision its vendor's run didn't use",
[]Vendor{{Name: "anthropic", Report: validReport(), Before: &snap, After: &snap}},
named,
},
{
"reads another vendor's catalogue when this one changed nothing",
[]Vendor{{Name: "anthropic", Report: validReport()}, {Name: "openai", Before: &snap, After: &snap}},
named,
},
{"names none when no vendor brings a catalogue", []Vendor{{Name: "anthropic", Report: validReport()}}, ""},
{"names none for a failed run", []Vendor{{Name: "anthropic", Failed: true}, {Name: "openai", Before: &snap, After: &snap}}, ""},
{"names none for another vendor's run", []Vendor{{Name: "openai", Report: validReport(), Before: &snap, After: &snap}}, ""},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

body := Render(tt.vendors, "", nil, base)
if tt.want == "" {
assert.NotContains(t, body, "Answered no question")
return
}

assert.Contains(t, body, tt.want)
})
}
}

// TestRenderCarried checks the line under the checks line (proposal 12): each
// commit people pushed that the carry job carried, and that such commits get
// fewer checks than the bot's own (carry.sh).
Expand Down
Loading
Loading