feat(opencode): emit used_fallback from native LLM runtime gate - #20
Conversation
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.
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
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. |
There was a problem hiding this comment.
💡 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, |
There was a problem hiding this comment.
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 👍 / 👎.
Summary
used_fallbackon the run result from the native LLM runtime gate (true on AI SDK fallback path, false on native provider path).used_fallback=0with no runtime artifact.Test plan
bun run typecheck— 29/29 successful (re-run m5-team)Feeds