Skip to content

[codex] dedupe parallel MCP circuit-breaker failures (ZER-676) - #38

Closed
ZeroPointSix wants to merge 5 commits into
mainfrom
codex/zer-676-circuit-breaker-counting
Closed

[codex] dedupe parallel MCP circuit-breaker failures (ZER-676)#38
ZeroPointSix wants to merge 5 commits into
mainfrom
codex/zer-676-circuit-breaker-counting

Conversation

@ZeroPointSix

@ZeroPointSix ZeroPointSix commented Aug 12, 2026

Copy link
Copy Markdown
Owner

概要

修复 ZER-676 中 MCP 连续失败熔断的两类误计数:

  • 同一健康状态下发出的并行请求共享失败纪元,只有首个传输失败会推进连续失败计数。
  • 任意 wire-level 响应都视为传输成功;响应类型错误仍返回调用错误,但不再污染 transport breaker。
  • 成功响应会重置失败计数并使较早并行请求的迟到失败票据失效。
  • openab-agent 版本从 0.1.0 更新为 0.1.1

根因

旧实现按完成回调逐次调用 record_failure。同一时刻发出的多个请求在共享传输故障后会分别加一,单次并发故障波可能直接达到阈值。连接建立路径虽用互斥锁串行 dial,但并行调用者等待锁之前没有共享失败票据,因此也会重复计数。

此外,tools/calltools/listping 收到不符合预期的结果变体时,没有统一按“wire response 证明 transport 存活”处理,与 ADR 5.9 的 transport-only 计数模型不一致。

验证

GitHub Actions 全部通过:

  • cargo fmt --check
  • cargo clippy -- -D warnings
  • cargo test:246 passed,0 failed,11 ignored
  • cargo test -- --ignored:11 passed,0 failed
  • release 二进制构建
  • ACP initialize 冒烟测试

回归测试覆盖:同一纪元的三个并行失败只计一次;新纪元的顺序重试仍能在三次后触发熔断;成功后旧失败票据不能重新污染计数或触发客户端断连。

Review Contract

Goal

保证 MCP 熔断器只统计独立的连续 transport failure:同一失败纪元中的并行失败只计一次;协议级或工具级错误允许调用方修正后立即重试,不触发 transport breaker。

Non-goals

不修改失败阈值、60 秒冷却、half-open probe 规则、OAuth challenge 分类、请求超时或连接并发上限。

Accepted Residual Risks

失败纪元使用进程内 u64 且不跨进程持久化;这与现有进程内 breaker 生命周期一致。极端的 u64 回绕仅在理论上存在。

Acceptance Criteria

  1. 三个共享同一纪元的并行 transport failure 只增加一次连续失败计数。
  2. 后续独立重试使用新纪元,并继续按每次失败加一,达到阈值后正常 Open。
  3. 任意成功响应重置计数,并让旧纪元的迟到失败失效;旧失败不得断开已恢复健康的客户端。
  4. CallToolResult.isError、JSON-RPC error 与意外的 wire response variant 不计为 transport failure。
  5. 现有 cooldown、half-open probe、per-server isolation 测试保持通过。
  6. GitHub Actions 的格式、Clippy、单元测试和构建门禁全部通过。

Follow-ups

无。本次变更限定在 ZER-676 的失败分类与并行去重,不扩展 breaker 配置面。

@linear-code

linear-code Bot commented Aug 12, 2026

Copy link
Copy Markdown

ZER-676

@ZeroPointSix
ZeroPointSix marked this pull request as ready for review August 12, 2026 15:01
ZeroPointSix added a commit that referenced this pull request Aug 12, 2026
Integrate ZER-676 MCP circuit-breaker failure counting changes for isolated development validation.

Copy link
Copy Markdown
Owner Author

Daytona image smoke test

Validated PR head 270e2b64437d016108460a0cc4627972bf1b8a6c using the image built by workflow run 31610945889.

  • Image: ghcr.io/zeropointsix/openab-plus:qa-zer676-pr38-native
  • Immutable commit tag: 270e2b6-native
  • Digest: sha256:aaed7032aa369910299c7f2d8407c607f4459fc1b90a01c53f32103ea3bac330
  • Platform: linux/amd64
  • Environment: Daytona daytona-small (1 CPU / 1 GiB / 3 GiB), rootless OCI pull/unpack

Smoke results:

  • GHCR pull and rootless unpack: pass
  • openab --version: openab 0.9.10
  • openab-agent --help: pass
  • ACP initialize: exit code 0; response contains agentInfo.name = openab-agent, version 0.1.1, protocol version 1

This verifies the exact PR image is publishable, pullable, correctly packaged, and starts the ACP protocol successfully. The stale-concurrency behavior itself remains covered by the PR's Rust tests.

ZeroPointSix added a commit that referenced this pull request Aug 13, 2026
Resolve the diverged #36 and #37 integration trees by retaining the current #39 tree, which contains the complete #30-#35 integration plus #38. The second parent preserves the exact #36/#41 head for ancestry and auditability without reintroducing its incomplete duplicate workbench implementation.
@ZeroPointSix

Copy link
Copy Markdown
Owner Author

Closing because ZER-676 belongs to the MetaMCP implementation repository, not openab-plus. PR #40 only affected the session dev branch; main was never affected, and the session branch is being reverted with preserved history.

ZeroPointSix pushed a commit that referenced this pull request Aug 13, 2026
This reverts commit 3d1a465, reversing
changes made to dd8f906.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant