Skip to content

fix(opencode): preserve response model metadata - #49571

Open
KarmCraft wants to merge 1 commit into
anomalyco:devfrom
KarmCraft:actual-model-metadata-v2
Open

KarmCraft wants to merge 1 commit into
anomalyco:devfrom
KarmCraft:actual-model-metadata-v2

Conversation

@KarmCraft

Copy link
Copy Markdown

Replaces #49317 and #42433, which were closed by repository automation rather than a code or review rejection.

Issue for this PR

Closes #42420

Related to #26091, but intentionally narrower: this keeps the AI SDK's structured model ID instead of arbitrary response headers.

This is also the upstream prerequisite for pingdotgg/t3code#10726.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

OpenCode currently discards response.modelId when adapting AI SDK stream events. This carries that value on the corresponding step-finish part and exposes it as optional modelID in the session schema and generated SDK type. Response headers are not retained.

How did you verify your code works?

  • 47 focused session tests
  • typechecks for packages/llm, packages/schema, packages/sdk, and packages/opencode
  • SDK regeneration
  • full pre-push Turbo typecheck: 30 packages
  • targeted lint with zero errors
  • formatting and git diff --check

The branch is rebased onto current dev at 23d3d240344abcf9bc5eb72ab55eeaa6c5da6e8e.

Screenshots / recordings

Not applicable; this is session metadata only.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potentially related PR:

Related PR:

This PR is related because it addresses model ID tracking, which is the core functionality that #49571 is preserving and exposing in the session schema. However, it appears to be a different approach or earlier work on the same problem domain.

The PR mentions it replaces #49317 and #42433, which were closed by automation, so those are not duplicates but rather superseded attempts at the same fix.

No other open duplicate PRs found with the same scope of preserving response model metadata in the current PR.

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.

AI SDK response model ID is discarded from assistant turns

1 participant