fix(web): harden session diffs handling and support local asset override#19266
fix(web): harden session diffs handling and support local asset override#19266codeg-dev wants to merge 4 commits intoanomalyco:devfrom
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. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one related PR: PR #19221: fix(app): guard diffs with Array.isArray to prevent .map crash Why it's related: This PR addresses the same core issue - protecting against crashes when I also found PR #19261 (fix: add defensive checks for undefined values in diff handling) which may be tangentially related to the diffs handling aspect. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Code reviewFound 1 issue:
🤖 Generated with OpenCode |
…gling tool_use blocks When a retryable error (rate limit, timeout) occurs mid-stream while tool calls are in pending/running state, the previous continue statement skipped the cleanup at the end of the while loop. This left tool parts in pending/running state in the DB. On the next request, these orphaned parts could produce tool_use blocks without corresponding tool_result blocks, causing Anthropic API error: 'tool_use ids were found without tool_result blocks immediately after'. Fix: run tool cleanup before the continue so pending/running parts are converted to error state even on retry. The retry will generate new tool call IDs, so old stale parts must be marked as error to maintain valid tool_use/tool_result pairing. Ref: upstream issues anomalyco#16749, anomalyco#10616
Issue for this PR
Closes #19268
Type of change
What does this PR do?
This PR fixes a web crash where session review paths called
.map()on non-array diff payloads (summary.diffs,session_diff).It adds
Array.isArraynormalization at all UI entrypoints that consume diffs, and adds an optional server-side local asset override (OPENCODE_APP_DIST) so operators can serve patched web bundles when CDN chunks are stale.How did you verify your code works?
bun turbo typecheckbun test test/provider/sanitize-surrogates.test.ts(packages/opencode)bun run build(packages/opencode)packages/opencode/src/server/server.tsindex-DSTRUJlB.jsandsession-CDIAwBxQ.jswithArray.isArrayguards presentScreenshots / recordings
N/A
Checklist