Skip to content

修复 max_turn_exceeded 中断提示与错误透传#696

Merged
phantom5099 merged 2 commits into
1024XEngineer:mainfrom
Yumiue:codex/gateway-plan-approval-rpc
May 25, 2026
Merged

修复 max_turn_exceeded 中断提示与错误透传#696
phantom5099 merged 2 commits into
1024XEngineer:mainfrom
Yumiue:codex/gateway-plan-approval-rpc

Conversation

@Yumiue
Copy link
Copy Markdown
Collaborator

@Yumiue Yumiue commented May 24, 2026

Summary

  • 将 Runtime max-turn 受控停止映射为 Gateway 稳定错误码 max_turn_exceeded
  • 让异步 gateway.run 失败事件透传 stop_reason=max_turn_exceeded
  • Web 端补齐 run_error 处理,显示明确的最大轮数提示并收敛生成状态
  • 更新 Gateway 错误字典文档

Test

  • go test ./internal/gateway ./internal/runtime
  • go test ./internal/gateway/...
  • go test ./internal/cli -run TestGatewayRuntimePortBridgeRuntimeMethods
  • cd web && npm test -- eventBridge

Notes

  • go test ./internal/cli 整包仍受本地 Windows 环境限制影响,失败点与本次改动无关。

close #695

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

❌ Patch coverage is 72.09302% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/cli/gateway_runtime_bridge.go 0.00% 5 Missing and 1 partial ⚠️
internal/gateway/runtime_errors.go 75.00% 4 Missing ⚠️
internal/gateway/bootstrap.go 88.23% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

@fennoai fennoai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. I found one session/run isolation issue in the web event bridge.

Comment thread web/src/utils/eventBridge.ts Outdated
const CRITICAL_EVENTS = new Set<string>([EventType.Error, EventType.RunError]);
const SESSION_AGNOSTIC_EVENTS = new Set<string>([
EventType.Error,
EventType.RunError,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RunError is run-scoped, but adding it to SESSION_AGNOSTIC_EVENTS lets failures from a stale/different session bypass the session guard. The handler below then calls resetGeneratingState() and finalizeRunningToolCalls("error") globally, so if the user has switched sessions or started another run, an old run_error can stop/corrupt the current UI state. Consider only allowing mismatched RunError through when its run_id matches currentRunId, or otherwise keep the session guard and route the error to the owning session/run.

@phantom5099 phantom5099 merged commit a838645 into 1024XEngineer:main May 25, 2026
2 of 3 checks passed
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.

实现 max_turn_exceeded 受控终止透传与前端提示

2 participants