Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

[Bug]: event.model-fallback tests fail — output.message["model"] is undefined after fallback #2341

@guazi04

Description

@guazi04

Prerequisites

  • I have checked the latest version of the plugin
  • I have searched for existing issues with the same problem
  • I have read the documentation
  • I am writing this issue in English

Bug Description

Two tests in src/plugin/event.model-fallback.test.ts fail on the dev branch. The chatMessageHandler returned by createEventHandler does not write the fallback model to output.message["model"] after applying a model fallback. The abort + re-prompt logic works correctly, but the model override is not reflected in the output object.

Steps to Reproduce

  1. Check out the dev branch
  2. Run bun test src/plugin/event.model-fallback.test.ts
  3. Observe 2 test failures out of 5

Expected Behavior

All 5 tests pass. After applying a model fallback, output.message["model"] should contain the fallback model (e.g., { providerID: "anthropic", modelID: "claude-opus-4-6" }).

Actual Behavior

output.message["model"] is undefined after fallback is applied. The failing tests:

  • triggers retry prompt on session.status retry events and applies fallback
  • advances main-session fallback chain across repeated session.error retries end-to-end

Error output:
```
expect(output.message["model"]).toEqual({
providerID: "anthropic",
modelID: "claude-opus-4-6",
})

Expected: { providerID: "anthropic", modelID: "claude-opus-4-6" }
Received: undefined
```

Doctor Output

```
oMoMoMoMo Doctor

⚠ 3 issues found:

  1. Loaded plugin is outdated
    Loaded 3.8.3, latest 3.10.1.
    Fix: Update: cd ~/.config/opencode && bun update oh-my-opencode
    Affects: plugin features

  2. Model override uses unavailable provider
    Provider(s) not found in OpenCode model cache: INTSIG_claude, INTSIG_openai, INTSIG_google
    Affects: model resolution

  3. Comment checker unavailable
    Comment checker binary is not installed.
    Fix: Install @code-yeongyu/comment-checker
    Affects: comment-checker hook
    ```

Operating System

macOS

OpenCode Version

1.2.20

Additional Context

These failures are reproducible on a clean checkout of the dev branch with no local configuration. The test file was not recently modified — the failures appear to be a regression from changes to the event handler or model fallback logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions