Skip to content

fix(runtime):修复热切换问题#440

Merged
phantom5099 merged 4 commits into1024XEngineer:mainfrom
phantom5099:main
Apr 24, 2026
Merged

fix(runtime):修复热切换问题#440
phantom5099 merged 4 commits into1024XEngineer:mainfrom
phantom5099:main

Conversation

@phantom5099
Copy link
Copy Markdown
Collaborator

问题

切换供应商时发现切换失效,实际上还是使用旧供应商

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

@phantom5099 is attempting to deploy a commit to the pionxe's projects Team on Vercel.

A member of the Team first needs to authorize it.

@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.

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.

完成四轮审查(代码质量/性能/安全/文档一致性)并去重后,保留 1 条需要处理的问题。

Comment thread internal/runtime/runtime.go Outdated
if ctx != nil && ctx.Err() != nil {
return s.configManager.Get(), nil
}
return s.configManager.Load(context.Background())
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

configManager.Load 被强制用 context.Background() 调用,会丢失上层 Run/Compact 的取消与超时语义。结果是:当配置文件 I/O 或解析卡住时,运行任务即使已取消也可能继续阻塞在这里。建议改为透传 ctx(必要时仅在 ctx == nil 时回退到 context.Background()),保证运行链路可及时响应取消。

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

❌ Patch coverage is 64.70588% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/runtime/run.go 33.33% 2 Missing and 2 partials ⚠️
internal/runtime/compact.go 33.33% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@phantom5099
Copy link
Copy Markdown
Collaborator Author

/code 修复review的问题,并且提高测试覆盖率

@fennoai
Copy link
Copy Markdown

fennoai Bot commented Apr 24, 2026

完成情况

已按你的要求修复 review 问题并补充覆盖率,代码已推送到当前 PR 分支 phantom5099/main

变更摘要

  • 修复 loadConfigSnapshot 上下文语义:
    • ctx == nil 时回退 context.Background()
    • ctx 已取消时返回缓存配置(保持既有错误优先级行为)
    • 其他场景改为 configManager.Load(ctx),不再强制 context.Background()
  • 新增测试覆盖 loadConfigSnapshot 关键分支:
    • nil ctx 回退路径
    • canceled ctx 缓存配置路径
    • nil configManager 错误路径

测试结果

  • go test ./internal/runtime -coverprofile=/tmp/runtime.cover.out 通过
  • go test ./... 通过

提交信息

  • 48cdb87 fix(runtime): 修复配置热切换上下文透传并补齐覆盖

View job run

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: phantom5099 <245659304+phantom5099@users.noreply.github.com>
@phantom5099 phantom5099 merged commit 3fc9a82 into 1024XEngineer:main Apr 24, 2026
1 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.

2 participants