Skip to content

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

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

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

Conversation

@KarmCraft

@KarmCraft KarmCraft commented Sep 16, 2026

Copy link
Copy Markdown

Replaces #42433, which was closed by the repository's automated age/reaction cleanup rather than a code or review failure.

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 replacement 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:

The searches reveal one potentially related PR that may have addressed similar concerns:

Related PR:

The current PR #49317 is a replacement for #42433 (which was closed by automated cleanup) and specifically addresses issue #42420. The search results confirm this is the only open PR with this exact title and related keywords, so there are no direct duplicate PRs in the system.

@KarmCraft

Copy link
Copy Markdown
Author

Thanks for flagging #45008. There is substantial overlap, but the contracts differ: #45008 adds a broader responseModelID field to both assistant messages and step-finish records, while this PR follows #42420's narrower client contract by exposing the provider model only on persisted step-finish metadata as optional modelID. This PR also includes focused adapter/processor regressions and regenerates the checked-in SDK type consumed by pingdotgg/t3code#10726. I have linked both approaches here so maintainers can choose the preferred schema; no response headers are retained by either approach.

@KarmCraft
KarmCraft force-pushed the actual-model-metadata-v2 branch from 3def058 to 23d3d24 Compare September 17, 2026 03:24
@KarmCraft

Copy link
Copy Markdown
Author

Rebased onto current dev; head is 23d3d240344abcf9bc5eb72ab55eeaa6c5da6e8e. Validation passes: 47 focused tests, four affected-package typechecks, the full 30-package pre-push typecheck, targeted lint with zero errors, Prettier, and git diff --check.

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Sep 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • "What does this PR do?" section is empty or only contains placeholder text. Please describe your changes.
  • No "Type of change" checkbox is checked. Please select at least one.
  • No issue referenced. Please add Closes #<number> linking to the relevant issue.
  • "How did you verify your code works?" section is empty. Please explain how you tested.
  • Not all checklist items are checked. Please confirm you have tested locally and have not included unrelated changes.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Sep 17, 2026
@github-actions github-actions Bot closed this Sep 17, 2026
@KarmCraft

Copy link
Copy Markdown
Author

GitHub would not reopen this automation-closed PR. The same validated head now continues in #49571 with the correctly formatted compliance template.

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