Bring Anthropic usechat backend to OpenAI-level tool-use parity and stream robustness#2971
Bring Anthropic usechat backend to OpenAI-level tool-use parity and stream robustness#2971
Conversation
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Deploying waveterm with
|
| Latest commit: |
d629e4a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://bc2a2902.waveterm.pages.dev |
| Branch Preview URL: | https://copilot-update-anthropic-bac.waveterm.pages.dev |
Code Review SummaryStatus: No Critical Issues Found | Recommendation: Merge with observations OverviewThis PR updates the Anthropic backend to support native web search, improves tool use data tracking, and adds better client disconnect handling. The changes are well-structured and include comprehensive test coverage. ObservationsCode Quality Improvements
Design Decisions Worth Noting
Files Reviewed (5 files)
The changes follow the project's coding standards and include appropriate test coverage. The new functionality is well-integrated with existing code patterns. |
This updates
pkg/aiusechat/anthropicfrom partial implementation to full backend parity for core tool-use orchestration and stream behavior. The main gaps were unimplemented tool lifecycle methods, missing persisted tool-use UI state, and weaker disconnect/error handling versus the OpenAI backend.Tool-use lifecycle parity (critical path)
UpdateToolUseDataRemoveToolUseCallGetFunctionCallInputByToolCallIdpkg/aiusechat/usechat-backend.goto call Anthropic implementations instead of stubs.nilresponses are not wrapped into[]GenAIMessage{nil}.Persisted tool-use state in Anthropic native messages
ToolUseDatastorage on Anthropictool_useblocks.Clean().UI conversion parity for reloaded history
ConvertToUIMessage()to emitdata-tooluseparts when tool-use metadata exists, in addition totool-{name}parts.Streaming UX parity for tool argument deltas
aiutil.SendToolProgress(...)calls during:input_json_delta(incremental updates)content_block_stopfortool_use(final update)Disconnect/stream robustness
sse.Err()checks in event handling and decode-error path.Correctness + hygiene alignment
AreModelsCompatible(...)(instead of strict string equality).httpClient.Dofailures).log.Printfcalls withlogutil.DevPrintf.Targeted coverage additions
data-tooluseUI conversion behavior✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.