Skip to content

Commit c97a9b3

Browse files
committed
docs: recommend native protocols + translation issue reporting guide
- README (EN + zh-CN mirror): Protocol fidelity note under API Reference — native endpoints preferred, cross-protocol is best-effort (messages inbound only), rule out backend flakiness then file an issue with minimal repro. - architecture.md section 5: user-facing guidance mirroring READMEs. - troubleshooting.md: new cross-protocol FAQ (exclude flakiness: retry, /health/details, native-endpoint repro, DEBUG capture) plus redacted issue checklist. - CONTRIBUTING.md: bug reports require flakiness exclusion and, for translation bugs, endpoint + direction + minimal JSON + native repro.
1 parent 32aed6f commit c97a9b3

5 files changed

Lines changed: 44 additions & 2 deletions

File tree

‎CONTRIBUTING.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ Please be respectful and professional. We follow the [Contributor Covenant](http
1111
### Reporting Bugs
1212

1313
1. Check if the issue already exists
14-
2. Create a detailed issue with:
14+
2. Rule out backend flakiness first: retry the request and check backend status (`GET /health/details`)
15+
3. Create a detailed issue with:
1516
- Clear title and description
1617
- Steps to reproduce
1718
- Environment details
18-
- Relevant logs
19+
- Relevant logs (redact `API_KEY` and other secrets)
20+
- For suspected protocol-translation bugs: the endpoint plus the translation direction (e.g. messages→chat), a minimal request JSON, expected vs actual response, and whether the native-protocol endpoint reproduces it
1921

2022
### Suggesting Features
2123

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ OPENCODE_PROXY_AUTO_CLEANUP_CONVERSATIONS=true
322322
| `POST` | `/v1beta/interactions` | Gemini-compatible thin layer (text + `google_search` grounding, `previous_interaction_id`, `store`, SSE without `[DONE]`) |
323323
| `POST` | `/v1/interactions` | Alias of `/v1beta/interactions` |
324324

325+
### Protocol fidelity
326+
327+
Use the endpoint native to your client (OpenAI SDKs → `/v1/chat/completions` or `/v1/responses`, Anthropic SDKs → `/v1/messages`, Gemini SDKs → `/v1beta/interactions`). Cross-protocol conversion is best-effort and only wired where documented (currently `POST /v1/messages` inbound): non-native paths may drop or zero-fill tool deltas, thinking signatures, token usage, and truncation signals (see [Architecture](./docs/architecture.md#5-nn-translator-registry-srcconverters)). If output looks wrong, first reproduce on the native endpoint and rule out backend flakiness (retry, check `/health/details`); if it persists, file an issue with a minimal repro (see [Troubleshooting](./docs/troubleshooting.md)).
328+
325329
### Model name formats
326330

327331
- Direct: `opencode/big-pickle`

‎README.zh-CN.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,10 @@ OPENCODE_PROXY_AUTO_CLEANUP_CONVERSATIONS=true
323323
| `POST` | `/v1beta/interactions` | Gemini 兼容薄层(文本 + `google_search` 联网、`previous_interaction_id`、`store`、SSE 无 `[DONE]`) |
324324
| `POST` | `/v1/interactions` | `/v1beta/interactions` 的别名 |
325325

326+
### 协议保真度
327+
328+
请使用与客户端原生对应的端点(OpenAI SDK → `/v1/chat/completions` 或 `/v1/responses`,Anthropic SDK → `/v1/messages`,Gemini SDK → `/v1beta/interactions`)。跨协议转换是 best-effort,且仅在已接线处生效(目前为 `POST /v1/messages` 入站):非原生路径可能丢失或零填充工具增量、thinking 签名、token 用量与截断信号(见 [Architecture](./docs/architecture.md#5-nn-translator-registry-srcconverters))。若输出异常,请先在原生端点复现并排除后端波动(重试、检查 `/health/details`);确认存在后再附最小复现提 issue(见 [故障排查](./docs/troubleshooting.md))。
329+
326330
### 模型名称格式
327331

328332
- 直接使用: `opencode/big-pickle`

‎docs/architecture.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,15 @@ Wiring status (live, not tests-only):
158158
- TokenCount stays unregistered — use `isTokenCountRegistered(registry)`
159159
(live registry query).
160160

161+
User-facing guidance (also stated in both READMEs and
162+
`docs/troubleshooting.md`): clients should use their native protocol
163+
endpoint. Only `POST /v1/messages` inbound goes through the registry
164+
today; every other cross-protocol path is best-effort and may degrade
165+
(TEXT-CORE: dropped tool/thinking deltas, zero-filled usage, lost
166+
truncation signals). Suspected translation bugs must be reproduced on the
167+
native endpoint first — ruling out backend flakiness — and reported with
168+
a minimal repro.
169+
161170
## 6. Roadmap (accepted, not yet implemented)
162171

163172
- Extract shared `preflight(ctx, body)` (resolve model → tool context →

‎docs/troubleshooting.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,29 @@ curl -H "Authorization: Bearer YOUR_API_KEY" ...
118118

119119
---
120120

121+
### 9️⃣ 跨协议转换结果异常
122+
123+
| 项目 | 说明 |
124+
|:-----|:-----|
125+
| **症状** | 非原生协议客户端收到缺字段、空工具调用、`usage` 为 0、截断信号丢失 |
126+
| **说明** | 网关建议各客户端使用原生协议端点(OpenAI SDK → `/v1/chat/completions` 或 `/v1/responses`,Anthropic SDK → `/v1/messages`,Gemini SDK → `/v1beta/interactions`)。跨协议转换是 best-effort,目前仅 `POST /v1/messages` 入站走转换矩阵,其余路径可能降级(纯文本 + 零填充用量),属已知限制而非后端故障 |
127+
128+
提 issue 前请先排除偶发因素:
129+
130+
```bash
131+
# 1. 重试一次,并检查后端状态(排除波动/限流)
132+
curl -H "Authorization: Bearer YOUR_API_KEY" http://127.0.0.1:10000/health/details
133+
134+
# 2. 用原生协议端点复现同一请求(确认是转换问题,而非模型/后端问题)
135+
136+
# 3. 开调试日志抓最小复现
137+
OPENCODE_PROXY_DEBUG=true
138+
```
139+
140+
提 issue 时请附(并删掉 `API_KEY` 等密钥):端点 + 协议方向(如 messages→chat)、最小请求 JSON、期望 vs 实际响应、模型 ID、原生端点是否同样复现。
141+
142+
---
143+
121144
## 🔍 调试模式
122145

123146
开启调试日志:

0 commit comments

Comments
 (0)