emrg: start_daemon 超时附加 emrgd.log 尾部真实原因(R124) - #404
Closed
argszero wants to merge 1 commit into
Closed
Conversation
argszero
commented
Aug 5, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle 20260805-1618. 自查确认:① 改动最小(_tail_daemon_log + start_daemon 超时行附加);② 兼容现有测试 match='failed to start';③ 日志读取 best-effort(缺失/OSError/编码容错);④ 469 passed + import OK。直接解决 rant 15:54 关联项的调试痛点(config.toml 错误只显示超时)。
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
rant 2026-08-05T15:54:28 关联项:Windows 上 config.toml 解析错误(如
vision = trues)导致 daemon 启动失败时,CLI 吞掉真实报错,只显示failed to start within timeout。stderr 被 DEVNULL 丢弃,真实原因唯一幸存处是 ~/.emrg/emrgd.log(RotatingFileHandler)。改动
emrg/client/daemon_manager.py:_tail_daemon_log(log_path=None, max_lines=20):best-effort 读取 emrgd.log 尾部(utf-8 + errors=replace,OSError 兜底)start_daemon()超时时:RuntimeError("emrgd failed to start within timeout: <日志尾部>")—— 用户立即看到真实错误而非干巴巴的超时tests/test_daemon_manager.py新增 3 测试:vision = trues解析失败示例)no emrgd.log验证
uv run pytest tests/469 passed(原 466 + 3 新增)emrg --help通过test_raises_on_timeout(match=failed to start)保持兼容预期效果
用户配置错误(config.toml 语法、API key 缺失等)导致 daemon 启动失败时,CLI 直接显示真实日志尾部,不再需要手动翻 ~/.emrg/emrgd.log。