opencode: sqlite session token fallback column - #858
Closed
avs-io wants to merge 1 commit into
Closed
Conversation
tryQuerySessionTokens selected model_id from the OpenCode session table, but the real OpenCode schema names that column model, so the fallback query threw and was swallowed by the catch-all, making the fallback dead in practice. Try `model` first and fall back to `model_id` so providers using an older/alternate schema (e.g. kilo-code, which shares this parser) keep working. Fixes getagentseal#769
model session column in the sqlite token fallback
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.
Closed in favour of #801, which is the better fix.
@EuanTop's #801 (open since before this branch) establishes something this branch got wrong: OpenCode's
session.modelcolumn is not a plain string but a JSON blob of the shape{ id, providerID }. #801 casts it to a blob and parses it intoproviderID/id.This branch selected
model AS model_idand passed the value through as a string, which would have surfaced raw JSON as the model name. It fixes the thrown query but not the value, so it is superseded on the merits rather than merely duplicated.Nothing here is worth salvaging into #801. The only element it carried that #801 does not is a
model_idfallback forkilo-code, which sharestryQuerySessionTokensand whose schema is not established anywhere in this repo. That was defensive guesswork against an unverified schema, not a known requirement, and it is not a reason to hold up the correct fix. If kilo-code's fallback path turns out to need a different column, that is better handled with a real fixture from a realkilo.db.Original description follows for the record.
tryQuerySessionTokensinsrc/providers/sqlite-session-parser.tsselectedmodel_idfrom the OpenCode session table. The real OpenCode schema names that columnmodel, so the query threw, was swallowed by the function's catch-all, and the fallback was dead in practice (#769). The existing session-level fallback fixture intests/providers/opencode.test.tsasserted against amodel_idschema, so it agreed with the bug.