Repository navigation
fix(session): preserve raw running tool state - #34959
GrilledFoch wants to merge 1 commit into
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
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
Fixes #34960.
Related context, but not marked as closing: #29822, #24731, #21489, #27871.
Type of change
What does this PR do?
This preserves
rawtool input while a legacy v1 tool part is still pending/running.The bug I hit was observed with OpenCode v1.14.28 on Windows PowerShell. My local Mavis wrapper/log observer is not part of OpenCode, but its logs showed the failure shape as a terminal state mismatch:
lastStatus=runningwhile terminalstatus=completed, followed about 30 minutes later bysession.finish reason=stale.Relevant local Mavis log anchors:
[stream-stall] progress ignored without armed statelastStatus=runningwithstatus=completedsession.finish reason=stale,idleMs=1800408The local trigger shape was:
On current
dev, I reproduced the relevant OpenCode-side state loss with a focused regression test. A cleanorigin/devworktree atf52424e05f, with only the regression test applied, failed because the running tool state hadraw === undefinedwhile the PowerShell pipeline was still running.This PR:
tool-input-deltatext into pending/runningrawraw,time.start,title, andmetadataacross pending -> running and running metadata updatesraw?: stringto legacy v1ToolStateRunningrawin sanitized session exportrawrawin subagent compaction, while keeping error compaction cleanGenerated artifacts were regenerated/checked with:
bun dev generate > ../sdk/openapi.jsoninpackages/opencodebun ./packages/sdk/js/script/build.tsat repo rootThe generated SDK/OpenAPI content diff is limited to optional
rawonToolStateRunning.How did you verify your code works?
Environment: Windows. Initial focused verification used Bun
1.3.13. Before pushing, I upgraded local Bun to1.3.14to satisfy the repository pre-push hook (packageManager: bun@1.3.14); the hook then ran rootbun typechecksuccessfully.PowerShell regression prefers
powershell.exe, falling back topwshonly if Windows PowerShell is unavailable. On this machinepowershellresolves toC:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe,$PSVersionTable.PSVersion=5.1.26100.8737.Passing locally:
bun run typecheckinpackages/opencodebun run typecheckinpackages/sdk/jsbun run typecheckinpackages/schemabun typecheckvia the pre-push hook after upgrading to Bun1.3.14bun test test/session/processor-effect.test.ts test/cli/export.test.ts test/cli/run/subagent-data.test.ts --timeout 30000inpackages/opencode25 pass,0 fail,112 expect() callsbun test test/session/prompt.test.ts --timeout 30000inpackages/opencode44 pass,14 skip,0 fail,186 expect() callsgit diff --checkFull-suite note:
bun test --timeout 30000inpackages/opencodeexceeded the 604 second command timeout before producing a complete result.Screenshots / recordings
N/A; this is a session state handling fix.
Checklist