Skip to content

fix(acp): improve vendor compatibility for session/update parsing#434

Open
chenhg5 wants to merge 1 commit intomainfrom
fix/acp-vendor-compat-issue-432
Open

fix(acp): improve vendor compatibility for session/update parsing#434
chenhg5 wants to merge 1 commit intomainfrom
fix/acp-vendor-compat-issue-432

Conversation

@chenhg5
Copy link
Copy Markdown
Owner

@chenhg5 chenhg5 commented Apr 3, 2026

Summary

  • Added debug logging to capture raw session/update JSON for troubleshooting vendor compatibility issues
  • Enhanced mapAgentMessageChunk() to support multiple JSON formats:
    • Standard ACP: {"content": {"type": "text", "text": "..."}}
    • Alternative: {"content": {"text": "..."}} (type omitted)
    • Alternative: {"text": "..."} (top-level text field)
    • Alternative: {"content": "..."} (content as string)
  • Improved mapSessionUpdateFallback() to extract text from common vendor extensions (message, message_chunk, response, text)
  • Added comprehensive tests for all alternative formats

Root Cause

Issue #432 reported "(empty response)" when using OpenClaw/OpenCode with cc-connect. The ACP agent was only parsing the standard content.text format. If a vendor sends text in a different JSON structure, the mapping function returned nil, resulting in no EventText events and eventually "(empty response)" in the UI.

Test plan

  • Build passes: go build ./...
  • Tests pass: go test ./...
  • Manual test: use OpenClaw/OpenCode with Feishu and verify responses are displayed correctly

Fixes #432

🤖 Generated with Claude Code

Add support for alternative JSON formats in ACP session/update messages
to handle different vendor implementations (OpenClaw, OpenCode, etc.).

Changes:
- Add debug logging to capture raw session/update JSON for troubleshooting
- Support multiple text field formats in mapAgentMessageChunk:
  - Standard ACP: content.text with type field
  - Alternative: content.text without type
  - Alternative: top-level text field
  - Alternative: content as string
- Enhance fallback text extraction for unknown sessionUpdate types
- Add tests for all alternative formats

Fixes #432

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chenhg5 chenhg5 force-pushed the fix/acp-vendor-compat-issue-432 branch from c3a32f0 to 20f0444 Compare April 3, 2026 13:10
@chenhg5
Copy link
Copy Markdown
Owner Author

chenhg5 commented Apr 3, 2026

LGTM! Clean fix for vendor compatibility.

✅ Correctness: Multiple JSON format fallbacks correctly handle various vendor implementations

  • Standard ACP format
  • content.text without type
  • Top-level text field
  • Content as string

✅ Tests: Comprehensive test coverage for all alternative formats

✅ Debug logging: Added slog.Debug statements for troubleshooting

✅ CI: All checks pass

✅ Documentation: Added OpenClaw pairing requirements to config.example.toml

Fixes #432 - OpenClaw/OpenCode empty response issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 飞书通过cc-connect访问openclaw,出现空消息错误。

2 participants