fix(sell): allow concrete paid/<model> as default agent chat model#497
Merged
Merged
Conversation
OisinKyne
approved these changes
May 18, 2026
Contributor
OisinKyne
left a comment
There was a problem hiding this comment.
What is the point of paid/* so? do we need to keep it at all?
`resolveDefaultAgentModel` was using `strings.HasPrefix("paid/")` to
skip ALL entries in the `paid/` namespace — including concrete purchased
upstreams like `paid/aeon`. Only the literal `paid/*` wildcard should be
skipped: that entry is a LiteLLM routing namespace, not a callable model.
Concrete entries are real upstreams routed through the x402-buyer sidecar.
This unblocks `obol sell demo quant` (and any agent-backed demo) after a
user runs `obol buy inference … && obol model prefer paid/aeon` — the
preferred purchased model now appears as the agent's chat model without
requiring a `--chat-model` flag override.
Extracts pure `pickAgentDefault([]string)` helper for unit testability;
adds table-driven tests covering wildcard-skip, concrete-paid-wins,
wildcard-only error, and empty-list error cases.
86a5cb1 to
6e9eb3d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
resolveDefaultAgentModelwas skipping ALLpaid/-prefixed entries viastrings.HasPrefix; only the literalpaid/*wildcard (a LiteLLM routing namespace entry) should be filtered outpickAgentDefault([]string)helper and adds 5 table-driven unit tests covering the key casesWhy
After
obol buy inference v1337-aeon --model aeon && obol model prefer paid/aeon, runningobol sell demo quantwould pin the agent to the second-rank model because allpaid/*-prefixed entries were being skipped. The wildcardpaid/*and a concretepaid/aeonare different LiteLLM concepts: the wildcard is a routing namespace (not callable), while concrete purchased entries route through the x402-buyer sidecar and are fully valid chat models. This fix makes "agent uses my preferred model" work without a--chat-modelflag.Test plan
TestPickAgentDefault— 5 cases: concrete-paid-at-head wins, wildcard-skipped-fallthrough, wildcard-only error, concrete-paid-only, empty-list errorobol buy inference <name> --model <id>→obol model prefer paid/<id>→obol sell demo quant→kubectl get agent quant -n agent-quant -o jsonpath='{.spec.model}'should returnpaid/<id>