fix(session): coerce legacy string tool-part input - #44705
LovePlayCode wants to merge 3 commits into
Conversation
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>
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potentially related PR: PR #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. |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #44688
Type of change
What does this PR do?
1.14 stored some tool-part
state.inputvalues as JSON strings. 1.18 encodes messages withSchema.Record, soGET /session/:id/message400s the whole transcript.Hydrate now parses those strings (invalid JSON / non-objects become
{}). A data migration rewrites the storedpartrows the same way.How did you verify your code works?
bun typecheckinpackages/coreandpackages/opencodebun test test/session/message-v2.test.tsinpackages/opencode(hydrate + HTTP encode)bun test test/database-migration.test.tsinpackages/core(SQL backfill)Screenshots / recordings
If this is a UI change, please include a screenshot or recording.
Checklist
Made with Cursor