Skip to content

Bug: SchemaError missing content, reasoning leak, identical edit string #49017

Closed as not planned

Description

@Pajt9whauht283as

Summary

Three persistent bugs fixed via source-level patches:

1. oldString === newString throws error (FIXED)

File: packages/core/src/tool/edit.ts

The edit tool now treats identical strings as a no-op instead of throwing ToolFailure. When the LLM generates an edit where oldString equals newString (e.g., to verify current state), it returns a successful no-op response with 0 replacements.

Test updated: packages/opencode/test/tool/edit.test.ts — changed from expecting error to expecting no-op success.

2. SchemaError(Missing key at ["content"]) (FIXED)

File: packages/opencode/src/session/message-v2.ts

Added guard in toModelMessagesEffect to skip assistant messages that only contain reasoning parts with no renderable content (text or tool output). This prevents provider schema validation errors when messages have empty/missing content fields.

3. Reasoning display (ALREADY CORRECT)

Analysis: The CLI already gates reasoning display with --thinking flag (default true in interactive mode, false in non-interactive). The web/desktop UI gates it with showReasoningSummaries prop, defaulting to hide via thinking_mode KV storage.

No source changes needed — the behavior is already correct. Users can disable with --no-thinking in CLI or toggle in UI settings.

Files Changed

  • packages/core/src/tool/edit.ts — no-op for identical strings
  • packages/opencode/src/session/message-v2.ts — skip reasoning-only messages
  • packages/opencode/test/tool/edit.test.ts — updated tests

Testing

  • Edit tool test updated and passing
  • Content validation guard prevents empty-content messages from reaching providers

Activity

  1. github-actions commented on Sep 14, 2026

    @github-actions
    Contributor

    This issue does not fully meet our contributing guidelines.

    What needs to be fixed:

    • The issue does not use the bug report template. Required fields such as Description, Steps to reproduce, OpenCode version, Operating System, and Terminal are missing.
    • The content reads like a patch summary or PR description ("FIXED", "Files Changed", "Testing") rather than a report of a bug you are experiencing. Please describe the actual problem you encountered, including how to reproduce it.
    • Three separate topics are bundled into one issue. Please open separate issues for each distinct bug.
    • No system or environment information is provided (version, OS, terminal).

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


    This issue might be a duplicate of existing issues. Please check:

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

  2. github-actions commented on Sep 14, 2026

    @github-actions
    Contributor

    This issue 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 issue that follows our issue templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions