Skip to content

opencode: sqlite session token fallback column - #858

Closed
avs-io wants to merge 1 commit into
getagentseal:mainfrom
avs-io:fix/opencode-session-model-column
Closed

opencode: sqlite session token fallback column#858
avs-io wants to merge 1 commit into
getagentseal:mainfrom
avs-io:fix/opencode-session-model-column

Conversation

@avs-io

@avs-io avs-io commented Jul 29, 2026

Copy link
Copy Markdown
Member

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.model column is not a plain string but a JSON blob of the shape { id, providerID }. #801 casts it to a blob and parses it into providerID/id.

This branch selected model AS model_id and 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_id fallback for kilo-code, which shares tryQuerySessionTokens and 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 real kilo.db.

Original description follows for the record.


tryQuerySessionTokens in src/providers/sqlite-session-parser.ts selected model_id from the OpenCode session table. The real OpenCode schema names that column model, 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 in tests/providers/opencode.test.ts asserted against a model_id schema, so it agreed with the bug.

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
@avs-io avs-io changed the title opencode: use the real model session column in the sqlite token fallback [superseded by #801] opencode: sqlite session token fallback column Jul 29, 2026
@avs-io avs-io closed this Jul 29, 2026
@avs-io avs-io changed the title [superseded by #801] opencode: sqlite session token fallback column opencode: sqlite session token fallback column Jul 30, 2026
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