GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: filter messages with only step-start parts in toModelMessage by coleleavitt · Pull Request #6383 · anomalyco/opencode

Conversation

@coleleavitt

@coleleavitt coleleavitt commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

Summary

Fixes compaction errors caused by messages containing only step-start parts being sent to the Claude API, which rejects them with "all messages must have non-empty content".

Problem

The previous fix (#4811, commit 13f89fd) filtered messages with zero parts, but messages containing only step-start parts still passed through. Since step-start is metadata that doesn't produce actual API content, these messages resulted in empty content blocks.

Solution

Changed the filter from checking msg.parts.length > 0 to checking msg.parts.some((part) => part.type !== "step-start"), ensuring messages have at least one content-producing part (text, tool results, reasoning, etc.) rather than just metadata parts.

Testing

This fix ensures that during compaction, only messages with meaningful content are sent to the API, preventing the "non-empty content" validation error.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
coleleavitt added 2 commits December 24, 2025 17:51
@coleleavitt
chore: gitignore local dev files
bb13b10
@coleleavitt
fix: filter messages with only step-start parts in toModelMessage
b7c17be
The previous fix (13f89fd) filtered messages with zero parts, but messages
containing only step-start parts still passed through. step-start is metadata
that doesn't produce actual API content, causing 'non-empty content' errors
during compaction when such messages are sent to Claude.

This fix ensures messages have at least one content-producing part (text, tool,
reasoning) rather than just checking for any parts.
@rekram1-node
rekram1-node merged commit b157fd1 into anomalyco:dev Dec 29, 2025
shuv1337 added a commit to shuv1337/shuvcode that referenced this pull request Dec 30, 2025
@shuv1337
sync: merge upstream v1.0.209 into shuvcode-dev
ea767f8
Resolved conflicts:
- .github/workflows/docs-update.yml: deleted (fork removed this workflow)
- .gitignore: merged both entries (docker/workspace + opencode-dev, logs/)
- packages/app/src/pages/layout.tsx: kept fork's inline layout structure,
  incorporated upstream's providers.all().length check for connect button

Upstream changes included:
- fix: filter messages with only step-start parts (anomalyco#6383)
- feat(format): add nixfmt formatter for Nix files (anomalyco#6380)
- fix(desktop): don't flash permissions with auto-accept
- fix(desktop): scroll sync
- fix(desktop): more performance/scrolling fixes
- feat(desktop): auto-accept edits toggle
- fix: prevent truncated Claude streams (anomalyco#6388)
- Desktop: Image Preview and Dedupe File Upload (anomalyco#6372)
@shuv1337 shuv1337 mentioned this pull request Dec 30, 2025
Merge shuvcode-dev: upstream v1.0.207-1 → v1.0.209 + fork improvements shuv1337/shuvcode#217
Merged
hk9890 pushed a commit to hk9890/opencode that referenced this pull request Jan 1, 2026
@coleleavitt @hk9890
fix: filter messages with only step-start parts in toModelMessage (an…
4c8353b
…omalyco#6383)
triklozoid pushed a commit to triklozoid/opencode that referenced this pull request Feb 2, 2026
@coleleavitt @triklozoid
fix: filter messages with only step-start parts in toModelMessage (an…
5166106
…omalyco#6383)
@srs-adamr srs-adamr mentioned this pull request Feb 3, 2026
[BUG]: Empty content error when switching from Cerebras GLM to Claude Opus #11991
Closed
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
@coleleavitt
fix: filter messages with only step-start parts in toModelMessage (an…
1c63d35
…omalyco#6383)
Rwanbt pushed a commit to Rwanbt/unifia that referenced this pull request Jun 14, 2026
@coleleavitt
fix: filter messages with only step-start parts in toModelMessage (an…
e5a5287
…omalyco#6383)
MarsQiu007 referenced this pull request in MarsQiu007/openNovel Jul 31, 2026
@coleleavitt
fix: filter messages with only step-start parts in toModelMessage (#6…
71c13c7
…383)
meSingh pushed a commit to meSingh/opencode that referenced this pull request Sep 6, 2026
@coleleavitt
fix: filter messages with only step-start parts in toModelMessage (an…
594bf15
…omalyco#6383)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@coleleavitt @rekram1-node
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.