Skip to content

feat(opencode): emit used_fallback from native LLM runtime gate - #20

Merged
TimothyVang merged 1 commit into
mainfrom
agent/m28-residuals
Jul 12, 2026
Merged

feat(opencode): emit used_fallback from native LLM runtime gate#20
TimothyVang merged 1 commit into
mainfrom
agent/m28-residuals

Conversation

@TimothyVang

Copy link
Copy Markdown
Owner

Summary

  • Emit a boolean used_fallback on the run result from the native LLM runtime gate (true on AI SDK fallback path, false on native provider path).
  • Fixes the m27 honesty gap where caseforge asserted used_fallback=0 with no runtime artifact.

Test plan

  • bun run typecheck — 29/29 successful (re-run m5-team)
  • Prior m28 focused tests: llm-native+tool-repair=27 pass; packages/llm=296 pass 30 skip
  • CI unit/e2e

Feeds

  • engine subtree pull
  • caseforge custody attestation (reads, never invents)

Surface a boolean used_fallback on RuntimeStatus/StreamResult and the
session LLM run result so downstream (caseforge) can read the real
native-vs-AI-SDK decision instead of inventing it.
@github-actions

Copy link
Copy Markdown

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

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e98eac62b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

})
return {
type: "native" as const,
used_fallback: native.used_fallback,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Propagate used_fallback through the public LLM stream

Adding used_fallback to this private run result does not make it available to any caller: Interface.stream still returns only Stream<LLMEvent>, and the wrapper immediately discards all result fields except stream/result before SessionProcessor consumes llm.stream(...). In the session path I checked (packages/opencode/src/session/processor.ts), downstream code still has no runtime artifact to read, so caseforge would still need to infer this value unless it is emitted on an event/part or exposed by the service API.

Useful? React with 👍 / 👎.

@TimothyVang
TimothyVang merged commit d5641ec into main Jul 12, 2026
9 of 10 checks passed
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