Add OpenClaw User-Agent header to all outbound HTTP requests#51570
Add OpenClaw User-Agent header to all outbound HTTP requests#51570SidU wants to merge 2 commits intoopenclaw:mainfrom
Conversation
Adds "OpenClaw/<version>" User-Agent header to every outbound HTTP request the Teams plugin makes to Microsoft services: - Graph API calls (fetchGraphJson, graph-upload, attachments/graph) - Bot Framework SDK connector client (via CloudAdapter subclass that injects the header into both inbound webhook replies and proactive messages via continueConversation) - File consent uploads The version is read from the plugin runtime (PluginRuntime.version). https://claude.ai/code/session_019xsguY8tjCjHwwvUu8zxjj
Greptile SummaryThis PR adds Two items warrant attention before merging:
Confidence Score: 4/5
|
- Add User-Agent header to SharePoint fetchImpl callback (was the only remaining outbound Graph call without it) - Guard CloudAdapter User-Agent injection so caller-supplied headers are not clobbered by propagation.override() Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Both items fixed in 7ba1f97:
|
Summary
buildUserAgent()function that constructsOpenClaw/<version>headers from the MSTeams runtimegraph.ts,graph-upload.ts,attachments/graph.ts)file-consent.ts)CloudAdaptersubclass to inject User-Agent into allConnectorClientinstances (both inbound webhook replies and proactive messages)Closes #51568
Change Type
Scope
Linked Issue/PR
User-visible / Behavior Changes
None. User-Agent headers are transparent to end users; they only appear in HTTP request metadata visible to Microsoft services and network logs.
Security Impact
NoNoNo(same calls, just with additional header)NoNoRepro + Verification
Environment
Steps
npm test -- user-agent.test.ts graph.user-agent.test.tsOpenClaw/<version>graph.user-agent.test.ts)Expected
buildUserAgent()returnsOpenClaw/2026.3.19(or current runtime version)User-Agent: OpenClaw/<version>headerConnectorClientinstances created byCloudAdapterinclude the User-Agent headerActual
OpenClaw/unknownwhen runtime is not initializedEvidence
user-agent.test.tswith 3 test cases covering normal operation, version reflection, and error handlinggraph.user-agent.test.tswith 2 test cases covering default User-Agent injection and caller override behaviorHuman Verification
Verified scenarios:
OpenClaw/<version>ConnectorClientcreation for both inbound and proactive messagesunknownversionEdge cases checked:
unknown)createConnectorClientandcreateConnectorClientWithIdentityWhat you did NOT verify:
Compatibility / Migration
Yes(purely additive; no breaking changes)Nohttps://claude.ai/code/session_019xsguY8tjCjHwwvUu8zxjj