Skip to content

fix(session): coerce legacy string tool-part input - #44705

Open
LovePlayCode wants to merge 3 commits into
anomalyco:devfrom
LovePlayCode:tool-input-migration
Open

fix(session): coerce legacy string tool-part input#44705
LovePlayCode wants to merge 3 commits into
anomalyco:devfrom
LovePlayCode:tool-input-migration

Conversation

@LovePlayCode

Copy link
Copy Markdown

Issue for this PR

Closes#44688

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

1.14 stored some tool-part state.input values as JSON strings. 1.18 encodes messages with Schema.Record, so GET /session/:id/message 400s the whole transcript.

Hydrate now parses those strings (invalid JSON / non-objects become {}). A data migration rewrites the stored part rows the same way.

How did you verify your code works?

  • bun typecheck in packages/core and packages/opencode
  • bun test test/session/message-v2.test.ts in packages/opencode (hydrate + HTTP encode)
  • bun test test/database-migration.test.ts in packages/core (SQL backfill)

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Made with Cursor

Upgrades from 1.14 stored tool state.input as a JSON string, which made GET /session/:id/message fail schema encode for the whole transcript.
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potentially related PR:

PR #44535 - fix(session): stop creating phantom "unknown" tool parts on re-emitted deltas
#44535

This PR is related because it also addresses tool-part handling in sessions, though it focuses on preventing creation of phantom tool parts rather than coercing legacy string inputs.

The other PRs found (like #37541 and #41830) address broader session message encoding and structure, but are less directly related to the specific legacy string coercion issue that PR #44705 is fixing.

Sign up for freeto 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.

Missing data migration for tool-part state.input on upgrade 1.14.28 → 1.18.18

1 participant

@LovePlayCode