[codex] feat(serve): add capability registry protocol versions#4191
Conversation
Introduce a serve capability registry and advertise protocolVersions from /capabilities while preserving the existing v1 envelope and Stage 1 feature aliases. Update SDK wire types, docs, and focused tests for old-daemon compatibility. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
📋 Review SummaryThis PR introduces a capability registry pattern for the 🔍 General Feedback
🎯 Specific Feedback🟡 High
🟢 Medium
🔵 Low
✅ Highlights
|
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
…y OPEN [PR#4191](QwenLM/qwen-code#4191) `feat(serve): capability registry + protocol versions` 2026-05-16 02:08 OPEN by doudouOUC ([codex] 前缀, +170/-39, 10 files): - 新文件 packages/cli/src/serve/capabilities.ts (+52 LOC): - SERVE_PROTOCOL_VERSION = 'v1' 常量 - SERVE_CAPABILITY_REGISTRY typed dict (9 features, 每个 { since: 'v1' } descriptor, 留 deprecated/requires 扩展位) - getServeFeatures() + getServeProtocolVersions() accessor functions - /capabilities 响应加 protocolVersions: { current, supported } (optional) - 旧 STAGE1_FEATURES 保留为 @deprecated alias - SDK 加 DaemonProtocolVersions type - 测试验证 backward compat (accepts old v1 envelopes without protocolVersions) - 关闭 chiga0 PR#3889 finding 5 FIXME (registry instead of hard-coded array) 7 项 Engineering Principles 全部满足: - Independently mergeable ✓ (无外部依赖) - Backward compatible ✓ (optional field + @deprecated alias + SDK test) - Default off ✓ (N/A, default capability response 改善) - qwen serve Stage 1 unbroken ✓ (envelope 仍含 9 features) - Gradual migration ✓ (旧 const 仍 export) - Reversible ✓ (单 PR 可回滚) - Tests-first ✓ (2 registry tests + 1 SDK backward compat test, 84+43 passing) 文档同步: - §06 §三·一 Wave 1 row + PR 2 row 标 🔧 OPEN with PR#4191 link + 详细规格 - §01 §五 Stage 演进表加 Wave 1 已启动 callout - README §四 Status 行加 Wave 1 启动状态 时间线: Issue #4175 (2026-05-15 11:41) → my reply (01:30) → doudouOUC 6 body edits + 3 questions (01:45) → my reply (02:??) → PR#4191 OPEN (02:08) — 24h 内 plan → 第一个实施 PR。
Multi-round review: roadmap/design/compatibilityI reviewed this beyond code quality, against #4175 Wave 1 PR2, #3803, and the daemon design docs. SummaryThis PR is broadly aligned with the current Mode B roadmap. It implements #4175 Wave 1 PR2: capability registry + I do not see an immediate break change to existing Stage 1 FindingsP1 —
|
wenshao
left a comment
There was a problem hiding this comment.
No issues found. Downgraded from Approve to Comment: CI still running. — DeepSeek/deepseek-v4-pro via Qwen Code /review
Address PR review feedback by preserving historical capability versions, separating registered and advertised feature helpers, testing protocol version metadata directly, and keeping runtime exports out of the serve types module. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
|
@wenshao I addressed the unresolved review threads in follow-up commit |
wenshao
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅ — gpt-5.5 via Qwen Code /review
Local E2E Verification ReportVerified locally against PR head Setup
A. Focused unit tests
The SDK suite includes the explicit backward-compat case B. Live
|
| # | Assertion | Result |
|---|---|---|
| 1 | .v == 1 |
✅ |
| 2 | .protocolVersions.current == "v1" |
✅ |
| 3 | .protocolVersions.supported == ["v1"] |
✅ |
| 4 | .mode == "http-bridge" |
✅ |
| 5 | .features is the exact 9-item Stage-1 list, in the documented order |
✅ |
| 6 | .modelServices == [] |
✅ |
| 7 | .workspaceCwd is absolute and matches the bound workspace |
✅ |
GET /capabilities?deep=1 and ?deep=true both return identical envelopes — protocolVersions is unconditionally part of the v1 envelope regardless of the deep flag.
Daemon shut down cleanly on SIGINT (received SIGINT, draining...); no errors during request handling.
C. Backward-compat spot check (STAGE1_FEATURES / Stage1Feature)
grep -rn 'STAGE1_FEATURES\|Stage1Feature' packages/ --include='*.ts':
| File | Notes |
|---|---|
packages/cli/src/serve/types.ts |
@deprecated aliases now pointing at SERVE_FEATURES / ServeFeature |
packages/cli/src/serve/index.ts |
Public re-exports preserved |
packages/cli/src/serve/server.test.ts |
Test-local EXPECTED_STAGE1_FEATURES (independent constant) |
No dangling import sites; build + tests green confirm the deprecation aliases keep the public API surface intact.
Claim → evidence mapping
| Claim | Evidence | Verdict |
|---|---|---|
/capabilities returns optional protocolVersions: { current: "v1", supported: ["v1"] } alongside v: 1 |
Live HTTP response above | ✅ |
| Stage-1 features sourced from registry; same 9-item list in same order | Live HTTP response — order matches exactly | ✅ |
Schema stays v: 1; old envelopes without protocolVersions still accepted |
DaemonClient backward-compat test passes | ✅ |
STAGE1_FEATURES / Stage1Feature retained as deprecated re-exports |
types.ts aliases + green build/tests |
✅ |
Verdict
SAFE TO MERGE ✅ — All four PR claims hold against a real daemon and the focused unit suites. Schema is fully additive, deprecated aliases preserve the public surface, and the deep-mode endpoint is consistent. No blocking caveats.
Verification done on macOS (darwin/arm64), Node ≥22, loopback only.
There was a problem hiding this comment.
Pull request overview
This PR adds protocol version metadata to qwen serve capability discovery and introduces a serve capability registry while keeping SDK compatibility with older v1 daemons.
Changes:
- Adds
protocolVersions: { current, supported }to/capabilities. - Introduces registry/helper APIs for registered vs advertised serve features.
- Updates SDK types/tests and developer docs for the additive optional field.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
packages/cli/src/serve/capabilities.ts |
Adds serve protocol version constants, capability registry, and helper functions. |
packages/cli/src/serve/server.ts |
Emits protocol version metadata and advertised features in capabilities responses. |
packages/cli/src/serve/types.ts |
Extends the capabilities envelope and preserves deprecated Stage 1 aliases. |
packages/cli/src/serve/index.ts |
Re-exports new capability registry APIs and types. |
packages/cli/src/serve/server.test.ts |
Covers registry helpers, fresh-copy behavior, and capabilities response shape. |
packages/sdk-typescript/src/daemon/types.ts |
Adds optional SDK protocol version typing for capabilities. |
packages/sdk-typescript/src/daemon/index.ts |
Re-exports the new daemon protocol version type. |
packages/sdk-typescript/src/index.ts |
Exposes the new SDK protocol version type from the package root. |
packages/sdk-typescript/test/unit/DaemonClient.test.ts |
Verifies new envelopes and old-daemon compatibility. |
docs/developers/qwen-serve-protocol.md |
Documents the new protocolVersions capability field. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wenshao
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅ — DeepSeek/deepseek-v4-pro via Qwen Code /review
wenshao
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅ — DeepSeek/deepseek-v4-pro via Qwen Code /review
Summary
qwen servenow advertises its supported serve protocol version alongside the existing capability envelope, and its feature list is backed by a small registry with separate registered-vs-advertised feature helpers.Wave Checklist (#4175)
/capabilities.vstays1;protocolVersionsis additive and optional for SDK consumers.STAGE1_FEATURES/Stage1Featureremain as deprecated compatibility aliases.protocolVersionsand the registry helpers would restore the previous static feature-list behavior.sincemetadata, and fresh-copy helpers.Protocol Shape Note
This PR follows #4175 as the implementation source of truth for the field shape:
Older design docs may still mention
protocol_versions; those should be synced separately if needed so PR3/PR4 build on the same camelCase serve envelope.Validation
protocolVersions.current = "v1"andprotocolVersions.supported = ["v1"].86 passedfor daemon server tests and43 passedfor SDK daemon client tests.Scope / Risk
1, and the previous Stage 1 feature exports remain available as compatibility aliases.Testing Matrix
Testing matrix notes:
Linked Issues / Bugs